by palish · 17y ago · 0 comments
For each image in the index, break it up into 4x4 tiles, then store a hash code for each tile. Then repeat the process, but offset the boundary of each tile by 1px along the X axis. Repeat 2 more times. Then, for each offset along the X axis, offset down along the Y axis. So you store 16 hashes per 4x4 pixel area.
Now, when someone searches for an image, repeat that hashing algorithm for the source image. The results page then returns any image that contains a 4x4 tile that is also contained in the source image, ranked by the number of tiles within the image that is common between the source and result image.
The end result is that you can see how the features within an image are used in other images -- so if someone takes the red stapler from Office Space ( http://www.yunasville.com/img/102005/milton.jpg ) and puts it into a different image, and you search for that red stapler, the results page will still return the photoshopped image, because it'll match the 4x4 tiles on the stapler in both images.
I've explained this in a convoluted way, but hopefully I've communicated the essence of the idea.
On one hand, there will be more results to filter through, and it's more computationally expensive. But that's fine, the image results are still ranked effectively. On the other hand, it's more computationally expensive.
First, looking at the examples, it doesn't seem to be restricted to exact images, not by a long shot.
Second, your approach is hopelessly naive. ;) Consider: rescaling, re-encoding using a lossy image format, color adjustments, and so on.
Good news though, I bet your approach is way, way, _less_ computationally expensive than whatever it is they are doing ;)
(My guess would be something like SIFT or SURF, probably minus (some) rotation invariance to speed things up, combined with a whole bunch of hackery to make the feature database search suitably fast while still acceptably accurate. Worth your time to google + read up as those algorithms can achieve positive red stapler identification fairly robustly, but you'll be in for rather a lot of math.)