Subimage search fails

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
_kiser_
Posts: 1
Joined: 2019-01-08T15:31:26-07:00
Authentication code: 1152

Subimage search fails

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Subimage search fails

Post 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
snibgo's IM pages: im.snibgo.com
Post Reply