tags:

views:

62

answers:

4

I run a site with lots of small images (www.iconfinder.com) and would like to develop a feature that can compare and recognize images. A user should be able to upload an image (icon) and then the site will respond with information about the image if it's in the database.

What is the approach to finding similar (or the same image). I know I can compare md5 of the two images, but I also want be able to find matches if the are scaled.

+1  A: 

I asked a similar question here before: http://stackoverflow.com/questions/336067/detecting-if-two-images-are-visually-identical

Bemmu
Ok, I didn't see find it before posting. Thank you for the link.
Martin LeBlanc
+3  A: 

There probably aren't a lot of languages LESS suited to this task than PHP. You should really look for an image comparison library with a C compatible API and figure out how to glue that into your PHP application.

Carl Smotricz
+100 if I could. PHP is a bad choice for doing this directly.
Matt Ellen
Thank you! But interestingly enough, DBQ's answer shows someone was crazy enough to implement this. Wisdom of crowds and all that.
Carl Smotricz
A: 

Identical images can be checked with an md5sum, but detecting if somebody uploads a scaled image, which displays the same thing as the other is very hard. This requires digital image processing.

An approach is to scale down all images to a certain width (say 100px). Then check a few coordinates for the color. If another image matches a big part (say 80%), it might be the same image.

But if the image is lighter... this won't work.

GroteBozeWolf
+3  A: 

This is a good start if you are interested in looking at doing it in PHP: http://www.intelliot.com/blog/2008/03/sorted-directory-listing-image-resizing-comparison-and-similarity-in-php/

DBQ
Ok, thank you for that link.
Martin LeBlanc