Reputation: 689
I am Trying to compare two images which looks similar , but When I do pixel to pixel comparison ,they won't be similar . Here the Problem is the Image is compressed in different Ratios .
To give more Example , If we take the Facebook Profile picture and the Twitter Profile Picture and Compare Pixel by pixel , we will see images are NOT Same . But by look and feel, we will see Image are same (Image Width and Height are same)
I have tried one of the Library called ImageHashing
which is available in Python , when I use Average hashing , even when I Have dark Line on image it will show as same , where Phash will have same problem as Pixel to pixel compare .
The Other way which, I thought was Template matching
(OpenCV) , But I am not so convinced for Image Comparison
Is there any way can compare two similar images which are compressed or Sampled differently and get proper result ?
Upvotes: 0
Views: 1915
Reputation: 46
You might consider the combined Mean Squared Error (MSE) and Structural Similarity Index (SSIM) processes taught in this tutorial:
https://www.pyimagesearch.com/2014/09/15/python-compare-two-images/
An MSE of 0 indicates a perfect match; A SIMM index of 1.00 indicates a perfect match. It's kind of arbitrary, but an MSE under 1000 and a SIMM Index above 0.5 would indicate a strong similarity despite differences in compression and angle.
Upvotes: 2