Page 1 of 1
compare -subimage-search very slow since 6.6.6-0
Posted: 2011-09-21T05:39:12-07:00
by Hobbes
I am not really sure if it is a bug or a sideeffect of a new feature, so please be lenient with me if this is the wrong board.
With IM 6.6.5-3-q16-windows, the search for a subimage of 43x23 pixels in a 700x480 pixel image takes about 3-4 seconds on my pc. With IM
6.6.6-0-Q16-windows and IM 6.7.2-7-q16-windows the same job takes about 68 seconds. Of course, the pc, the images and the commandline
parameters are the same in all cases:
compare -metric AE -subimage-search part.png image.png null
I already looked into the change history from 6.6.5-3 to 6.6.6-0, but I did not find a hint on a change introducing
a new feature or a bugfix for this topic.
Crosscheck with another machine was also done with the same results.
Re: compare -subimage-search very slow since 6.6.6-0
Posted: 2011-09-21T09:32:24-07:00
by fmw42
Hobbes wrote:I am not really sure if it is a bug or a sideeffect of a new feature, so please be lenient with me if this is the wrong board.
With IM 6.6.5-3-q16-windows, the search for a subimage of 43x23 pixels in a 700x480 pixel image takes about 3-4 seconds on my pc. With IM
6.6.6-0-Q16-windows and IM 6.7.2-7-q16-windows the same job takes about 68 seconds. Of course, the pc, the images and the commandline
parameters are the same in all cases:
compare -metric AE -subimage-search part.png image.png null
I already looked into the change history from 6.6.5-3 to 6.6.6-0, but I did not find a hint on a change introducing
a new feature or a bugfix for this topic.
Crosscheck with another machine was also done with the same results.
I don't think subimage search feature of compare has ever been 3-4 sec for those sizes. The only way it could have been 3-4 seconds if you were comparing two equal sized images.
Also your syntax is incorrect. The larger image must be first and null must have : after it as null:
However, it does seem excessively slow:
time compare -metric AE -subimage-search logo: logo_center50x50.png null:
where the small image was 50x50 center of the logo: image
and quit it after 16 minutes!
Using IM 6.7.2.7 Q16 Mac OSX Tiger on old PowerPC G4 Mac Mini 512 Mbytes memory.
Whereas, when I ran this test at
viewtopic.php?f=1&t=14613&p=51076&hilit ... ric#p51076 it did finish after 45 seconds. The large image was 256x256 and the small image was 23x14
time compare -metric rmse -subimage-search mandril3.png mandril3_156_22.png null:
0 (0) @ 156,22
real 0m45.051s
user 0m39.868s
sys 0m0.672s
I imagine the time goes way up as the size of the subimage gets bigger.
Re: compare -subimage-search very slow since 6.6.6-0
Posted: 2011-09-22T01:02:43-07:00
by Hobbes
fmw42 wrote:
Also your syntax is incorrect. The larger image must be first and null must have : after it as null:
Sorry, of course you are right. I changed the filenames in the posting to make them "self explaining", and mixed up the order. I tried with the colon after null, but it has no effect on the result:
compare -metric AE -subimage-search image.png part.png null:
Version: ImageMagick 6.6.5-3 2010-10-22 Q16
595 @ 362,310
Command took 0:0:2.31
Version: ImageMagick 6.6.6-0 2010-11-21 Q16
595 @ 362,310
Command took 0:1:5.83
Version: ImageMagick 6.7.2-7 2011-09-16 Q16
595 @ 362,310
Command took 0:1:13.14
My main point is that version 6.6.6-0 is more than 30 times slower than version 6.6.5-3.
Re: compare -subimage-search very slow since 6.6.6-0
Posted: 2011-09-22T09:28:26-07:00
by fmw42
This is something the IM developers will have to check for you.
But you might identify your system and memory capacity.
Re: compare -subimage-search very slow since 6.6.6-0
Posted: 2011-09-22T09:31:27-07:00
by magick
We'll investigate but it may be a few days before we get to this problem.
Re: compare -subimage-search very slow since 6.6.6-0
Posted: 2015-08-06T20:46:35-07:00
by McGuive7
Any update on this one. I'm experiencing similarly long compare times, and I was hoping to set up an automated tool to compare larger screenshots of staging/live websites to check for differences. At these speeds, this task wouldn't be feasible (generating and comparing screenshots for numerous ages in a site) - do you have any advice and/or information on possible ways to optimize for this task (in addition to the original question, of increased delays). Thanks!
Re: compare -subimage-search very slow since 6.6.6-0
Posted: 2015-08-07T11:36:11-07:00
by snibgo
Sub-image searches with IM are accurate but expensive because every pixel in the sub-image must be compared to every possible location in the large image. Speed can be massively improved by reducing the number of comparisons by resizing and/or cropping. See my page "Searching an image".