Jump to content

Is there any way to measure similarity between two images?


Recommended Posts

Load the compressed image as new layer above the original  (Layers Menu -> Import from File) and change it's blending mode to XOR (Layers Menu -> Layer Properties -> Blend Mode)

 

If the two images are identical then you will see a black canvas. If they are not then any differences will appear as strange colors on a black background.

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

Load the compressed image as new layer above the original  (Layers Menu -> Import from File) and change it's blending mode to XOR (Layers Menu -> Layer Properties -> Blend Mode)

 

If the two images are identical then you will see a black canvas. If they are not then any differences will appear as strange colors on a black background.

I knew the xor trick, but is there any way to calculate a number out of it? (Like SSIM)

Edited by yut951121
Link to comment
Share on other sites

You could select the black (i.e. common pixels) then invert the selection to reach a count of dissimilar pixels.

Link to comment
Share on other sites

you can merge the layers  use this code lab code - it will give you difference percentage

0 would be identical , 100 would be completely different

 

Menu : Colors -> Difference

 

#region UICode

bool Amount1 = false; // [0,1] Slider 1 Description
#endregion
 
 
 
void Render(Surface dst, Surface src, Rectangle rect)
{
    if (!Amount1)
    {
        Amount1=true;
        int totalcount = src.Width * src.Height * 1020;
        int PixelSum = 0;
        ColorBgra CP;
        for (int y = 0; y < src.Height; y++)
        {
            for (int x =0; x < src.Width; x++)
            {
                CP = src[x,y];
                PixelSum  += CP.A;
                PixelSum  += CP.R;
                PixelSum  += CP.G;
                PixelSum  += CP.B;
 
            }
        }
        double result = (double)PixelSum / (double)totalcount;
        System.Windows.Forms.MessageBox.Show((100 * result).ToString()); 
    }
}

 

Difference.zip

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...