Page 1 of 1

Subimage search fails

Posted: 2019-01-08T15:58:13-07:00
by _kiser_
small.png is a subimage of big.png

Code: Select all

wget https://i.ibb.co/sCkgfsQ/big.png
wget https://i.ibb.co/XSDw7My/small.png
/usr/local/bin/compare -subimage-search -metric AE -similarity-threshold 1.0 big.png small.png null:
compare: images too dissimilar `/tmp/big.png' @ error/compare.c/CompareImageCommand/1170.
As you see compare throws error 'images too dissimilar' even though small.png is a subimage of big.png. Images are very simple and can be easily zoomed and compared manually in gimp for instance.
Images are very small in size 5x5 and 10x8 pixels. The same command works ok and finds subimages for many other similar images.

compare tool is the latest available on Jan 8.

Code: Select all

/usr/local/bin/compare -version
Version: ImageMagick 6.9.10-24 Q16 x86_64 2019-01-08 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC OpenMP 
Delegates (built-in): fontconfig freetype jng jpeg pangocairo png x zlib

Re: Subimage search fails

Posted: 2019-01-08T16:10:59-07:00
by snibgo
See http://www.imagemagick.org/script/comma ... -threshold . You set the similarity threshold to 1.0, so images are not considered equal unless they are as different as they could possibly be.

More sensible settings are:

Code: Select all

-similarity-threshold 0 -dissimilarity-threshold 1