Processing time concern

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
cambob
Posts: 11
Joined: 2013-01-12T11:32:05-07:00
Authentication code: 6789

Processing time concern

Post by cambob »

convert other.jpg -crop 100x100+100+100 crop.jpg

This command takes 90 seconds to complete, master.jpg is 640x480 24 bit, is the 24 bit the problem? if so how do i reduce?
compare -metric RMSE master.jpg crop.png -subimage-search null:
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Processing time concern

Post by snibgo »

Subimage searches take a long time. IM needs to examine every position the subimage might be on the full image, then do a pixel-by-pixel comparison.

You can massively increase performance by:

(1) cropping a smaller area for the subimage;

(2) cropping master.jpg, and searching within that.
snibgo's IM pages: im.snibgo.com
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Processing time concern

Post by snibgo »

Or (3) resizing both master.jpg and other.jpg.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Processing time concern

Post by fmw42 »

In one of my scripts, I was able to speed it up by reducing both image sizes doing a search and then doing it again at full resolution bu limiting the search to a subsection of the original image in the neighborhood of the first match.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Processing time concern

Post by anthony »

Take a look at the very raw bare bones "overlap" script (for merging computer generated images which has small overlaps).
It takes smaller crops of one images to find them on the first (typically larger) image. It has room for improvement in finding good sub-sections to crop for the search, and these have been noted in comments in the script.

http://www.imagemagick.org/Usage/scripts/overlap

See example in the discussion...
viewtopic.php?f=1&t=22526
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply