Is there possible to compare two images with different resolutions?
I mean here some algorithmic/programming approach. For instance, now I calculate hash code from image's byte array and compare these hash code values. That is work great but fail in case of different resolutions, i.e. images are identical by eye but different in it byte content.
For example see my image attaches:
one of it has 72 ppi but another 96 ppi. I would like to have TRUE value while comparing on equality but now I get FALSE. Help please to find correct solution here.
Two very simple perceptual hashing methods you might give a try before venturing into more complicated territory are based on the Discrete Cosine Transform and the local vs glocal mean of an image:
Convert image to grayscale
1.1 (EDIT) Make your image zero mean
And a variant on this theme would be
Also, have a look at phash.
For synthetic images with a few distinct colours I would start with histogram matching.
Basically add up the number of pixels of each colour in each image and divide by the total number of pixels. Then you have a simple float vector as a fingerprint. You can ignore white if you want images with more or less border to count as a match
It's not going to detect the same image with the slices re-arranged, or the text moved down a line but i don't think that is the concern in this case
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With