0

I have 2 gray-level images and want to measure the similarity between two images using subtraction and opencv. I tried to subtract the images and count black pixels but some values may be under 0 so I guess they will be displayed as 0 and that means this way is not so accurate. I need a way to find the percentage using subtraction.

GAM
  • 57
  • 1
  • 4
  • 1
    Does this answer your question? [Simple and fast method to compare images for similarity](https://stackoverflow.com/questions/4196453/simple-and-fast-method-to-compare-images-for-similarity) – Cris Luengo Apr 07 '20 at 20:53
  • I don't think using a color based similarity check will work. – muyustan Apr 07 '20 at 20:53
  • 1
    Not sure what sort of differences you are expecting to detect, but there's nothing stopping you from converting to float (or signed integer) to be able to detect/record negative numbers. – Mark Setchell Apr 07 '20 at 21:14
  • What, specifically, is your question? Please see [ask], [help/on-topic]. – AMC Apr 07 '20 at 21:29
  • 1
    Convert you images to float. The subtract. Then take the absolute value. See https://www.pyimagesearch.com/2017/06/19/image-difference-with-opencv-and-python/. Have you considered using SSIM? See https://www.pyimagesearch.com/2014/09/15/python-compare-two-images/ – fmw42 Apr 07 '20 at 22:13

1 Answers1

0

There are many ways to measure similarity or differences in images. The request you are asking is specifically for L1 Differences.

For a quick and simple solution just take the absolute value.

gnodab
  • 850
  • 6
  • 15