How does reverse image searching work?

660 views

How does reverse image searching work?

In: Other

4 Answers

Anonymous 0 Comments

A “perceptual image hash” of your sample image is calculated. Depending on the scheme, this is a number between 8 and a few hundred bytes in length. It contains information about the image in a condensed form. Two images that are similar would have similar, but probably not identical, hashes.

In simplest terms, they compare the hash of your image against the hashes of every image in their database. Other images whose hashes differ only by a few bits are very likely to look similar.

There are algorithms to find matches much faster than brute force.

A super simple “perceptual image hash” is to convert the image to gray-scale, then scale the image WAY down to an 8×9 pixel image of 256 grayscale levels. Then scan each row. If the pixel to the right is brighter than the one before, write a ‘1’. If the next pixel is the same or darker, write a ‘0’, scan the entire row and then the other rows.

This will result in an 8 byte ‘hash’ of the image. Other images that that look similar might have fairly similar patterns of brighter/dimmer pixels when scaled down so tiny.

If you XOR your image hash against the other image hash, the only bits left will be the differences. If the number of difference bits are few, the images are probably similar. Two totally unrelated images would tend to differ by about 32 bits. But images that differed by 6 bits probably look similar,.

There are FAR better perceptual hashes than the one I described.

You are viewing 1 out of 4 answers, click here to view all answers.