Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just a behaviour note... #68

Closed
marcolino opened this issue Nov 10, 2015 · 4 comments
Closed

Just a behaviour note... #68

marcolino opened this issue Nov 10, 2015 · 4 comments

Comments

@marcolino
Copy link
Contributor

It's not an issue, just a note.

I'm testing hash() function.

I find signatures it generates are quite effective to calculate the distance among two images.

However I notice that the hashes (perceptual hashes) are not as 'sensible' as I'd expect to: sometimes
making a small change to an image does not change the hash (and then the distance) at all (0 bits changed), while sometimes a similar change makes a 2% difference...

I suppose this behaviour can be expected knowing the internals of perceptual hashes algorithm, but it's not always aligned with humanly preceived distance...

@oliver-moran
Copy link
Collaborator

Yes. I think that raises a question about how sensitive you expect it to be.

I also think it's a question of the right tool for the job:

When I was testing it, I used a cut-off of 15%, so 2% would be considered a match. And they are, if you are testing for similarity.

On the other hand, if you are testing for difference then the image.diff() method is probably the better tool.

@marcolino
Copy link
Contributor Author

I meant an additional 2%, I was verifiyng how many additional changes to an image would cause the threshold (I currently use 12%) to be overcome...

On the other hand, I don't completely understand the distinction you make between similarity and difference... Ultimately, they are just two different algorithms (one from 'pHash' and one from 'PixelMatch') to measure the same entity... Or am I wrong?

@oliver-moran
Copy link
Collaborator

They are two different algorithms though.

If pHash and PixelMatch were people, pHash would scrunch up its eyes and say that a cat looks like a dog. PixelMatch, on the other hand, would carefully detail all the things about a cat that a different to a dog within a given threshold.

Both are right. pHash is good at finding similarity. PixelMatch is good at finding difference.

@marcolino
Copy link
Contributor Author

I see... Your metaphor was great! :-) Now I clearly understand what you meant...
Now I'm even more convinced I'll use pHash (Jimp.hash()) to find similarities on my images...
Thanks a lot, Oliver!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants