Basic picture similarity analysis

I want to compare two images and get a % value as to how similar they are. The source of the images are videos.

Example: 1080p raw video

  1. encoded with x264 in 1080p
  2. encoded with VP9 in 240p

I know how to extract images from the videos, I just mention it, so you know one image will be high quality (1080p) and the image I compare it to will be low qulity, potentially with block artefacts (240p).

I attached two images so you know what I am dealing with.

I just want very basic full image comparison (and maybe a few parameters and algorithms to play with) that spits out a % value at the end.

I would prefer code examples in Java but I guess the API is similar between Python and Java, so I could work it out.

Example images:

image

I should note, that the images I want to compare are identical, except the different size and compression. They are NOT from different time stamps in the video.

Maybe in some pictures there is a little logo added to a corner of one of the pictures for the comparison, but that’s it.

It’s like I take a high-res picture and scale it down and use high JPEG compression to save it again and then compare the two pictures.

please, put your images here, not on an external site.

then, “similarity” is a very broad term. what exactly are you looking for ?
what is the purpose of your program ?

I wanted to insert the images in the text but I wasn’t allowed as newbie.

I want to find duplicates of the same video (or image). I am already comparing by resolution, duration and much more but not by actual visual comparison.

I don’t want to identify any objects in the image or do something fancy. I just want a % value that tells me how similar two images are.

yea, just make 2 posts …

sounds like something from img_hash

1 Like

so… PSNR is a common metric, and so is SSIM.

a percentage is too simple and too ambiguous.

1 Like

Can you direct me to code samples both for img_hash and PSNR/SSIM?