PHP中文网2017-04-17 11:40:05
Simple steps:
Reference link: Principle of similar image search - Ruan Yifeng | Color distribution method and content feature method
ringa_lee2017-04-17 11:40:05
Similarity is a very vague thing. . . If you just want to implement a simple version, I found a very interesting algorithm on stackoverflow:
Then find the average similarity of each point of the two pictures (the similarity can be calculated by using the difference, the square of the difference, or multiplying it by a weight based on the position. Get some data and run it to select the one with the best effect).
Interestingly, this algorithm can even support pre-computing a batch of images and then querying similar ones from the database:
To look up a possible match in a database, store the pixel colors as inpidual columns in the database, index a bunch of them (but not all, unless you use a very small image), and do a query that uses a range for each pixel value, ie. every image where the pixel in the small image is between -5 and +5 of the image you want to look up.