Google "Similar image search": You can use an image to search all images on the internet that resemble it.
To open the Google Image search page:
Click Use to upload a Angelababy original image:
When you click Search, Google will find a similar image, with the higher the image similarity. Such as:
What is the principle of this technology? How does a computer know that two pictures are similar?
According to Dr. Neal Krawetz's explanation, the key technology for similar image search is called "Perceptual hashing Algorithm" (Perceptualhash algorithm), which generates a "fingerprint" (fingerprint) string for each image. Then compare the fingerprints of the different pictures. The closer the result is, the more similar the picture is.
The following is one of the simplest Java implementations:
Preprocessing: Reading pictures
The first step is to reduce the size.
Reduce the image to 8x8 's size, a total of 64 pixels. The role of this step is to remove the details of the picture, only the structure, shading and other basic information, discard the different sizes, proportions of the picture differences.
The second step is to simplify the color.
Converts the zoomed-in image to a level 64 grayscale. That is, all pixels have a total of 64 colors.
The third step is to calculate the average.
Calculates a grayscale average of all 64 pixels.
Fourth step, compare the grayscale of the pixel.
The grayscale of each pixel is compared to the average. Greater than or equal to the average, recorded as 1, less than the average, recorded as 0.
Fifth step, calculate the hash value.
By combining the results of the previous step, you make up a 64-bit integer, which is the fingerprint of the image. The order of the combinations is not important, just make sure all the pictures are in the same order.
After getting the fingerprint, you can compare different pictures and see how many of the 64 bits are not the same. In theory, this equates to the calculation of "Hamming distance" (hammingdistance). If the data bits are not more than 5, the two images are similar, and if they are greater than 10, they are two different pictures.
You can put a few pictures together, and also calculate their Hamming distance comparison, you can see whether the two pictures are similar.
The advantages of this algorithm are simple and fast, not affected by the size of the picture, the disadvantage is that the contents of the picture can not be changed. If you add a few words to the picture, it will not be recognized. So, it's best to use thumbnails to find out the original image.
In practical applications, more powerful phash algorithms and sift algorithms are often used to identify the deformation of images. As long as the degree of deformation does not exceed 25%, they can match the original image. Although these algorithms are more complex, the principle is the same as the simple algorithm above, that is, to first convert the image into a hash string, and then compare.
Most of the above content directly from the Nanyi site copy, want to see the original children's shoes can go to the top link click to see.
Copyright NOTICE: This article for Bo Master http://www.zuiniusn.com original article, without Bo Master permission not reproduced.
Java fingerprint recognition + Google image recognition technology