Page 1 of 1
Using compare with subimage cannot return proper result
Posted: 2016-05-18T09:42:25-07:00
by yuexin
Hello
I am new to ImageMagick, so right now I simply apply "compare.exe -subimage-search" to compare two images, most of times it returns the proper result, but sometimes it will return the offset even these two images are totally different. It seems the compare program detected several matched pixels, may I know how to get the overall score of the matched pixels? Is it possible in ImageMagick?
Thanks in advance.
Yuexin
Re: Using compare with subimage cannot return proper result
Posted: 2016-05-18T10:35:32-07:00
by snibgo
"compare -subimage-search" finds the
best match for the small image within the large image. This may not be a perfect match, or even a good one.
For example, searching for a 10x10 red image within "rose:":
Code: Select all
f:\web\im>%IM%convert -size 10x10 xc:red r.png
f:\web\im>%IM%compare -subimage-search -metric RMSE rose: r.png NULL:
12260.4 (0.187082) @ 32,9
The best match is at (32,9). But the RMSE score is 0.187, which isn't very good. (0.0 means a perfect match.) As a rule of thumb, for ordinary photos, I find that when an RMSE score is greater than 0.01 I can readily see the difference between the images.
Re: Using compare with subimage cannot return proper result
Posted: 2016-05-18T22:33:12-07:00
by yuexin
I tried to the following command
"compare.exe -subimage-search -dissimilarity-threshold 0.15 -metric RMSE tmp\click1463634949831.png 1463635754111.png result-%d.jpg"
the result is "8815.7 (0.134519) @ 11,1" for instance.
It seems the result is better than without the RMSE parameter, but what I worried now is the execution velocity is definitely faster than without one, so does it indicate the compare tried to use RMSE as the identification flag to filter result and didn't try to detect the subimage?
Re: Using compare with subimage cannot return proper result
Posted: 2016-05-19T00:31:44-07:00
by snibgo
I don't know what the default "-metric" setting is. You can use any metric you like. See
http://www.imagemagick.org/script/comma ... php#metric