Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Comparing images to find similar images in a databaseby wollmers (Scribe) |
on Dec 05, 2014 at 19:22 UTC ( [id://1109374]=note: print w/replies, xml ) | Need Help?? |
As I understand the author merlin defines a match as follows:
IMHO the above set of matches is a subset of all matches where
Depending on the randomness the matches will be roughly doubled, i.e. with $FUZZ=5, and a vector with 48 elements each an 8-bit integer, the number of possible different sums of the vector values is 48*255+1=12_241. The original method gives 48*5=240 as maximal allowed sum of the absolute differences. Thus the set of all possible sums is reduced by a factor of 12_241/240=51. When we use an interval of +/- 5, then 48*5*2=480, and the reduction is only 25. This means 1_000 images found out of a total of 25_000 images. But if we calculate the sum of the vector, we can store it as an integer field in the database and use SQL comparisons. The query result could still be refined using the original method, or something better like e.g. cosine similarity, which should be fast enough for ~1_000 vectors.
In Section
Seekers of Perl Wisdom
|
|