image comparison with imagemagick

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
spectre
Posts: 6
Joined: 2011-07-14T03:31:45-07:00
Authentication code: 8675308

image comparison with imagemagick

Post by spectre »

Dear imagemagick users,

I'm deciding if it is more suitable and easy to use image-magick or to use opencv for the following purpose:

I need to do the following task(step by step):

0)put an object under the webcam
1)press a key on my pc and grab an image of the object from the webcam
2)compare the grabbed image with the reference image on the hard-drive(splitting the grabbed image and the sample image into 10 sections)
3)highlight the major differences between the two images(comparing the 10 sections of the reference image with the grabbed 10 sections)
4)generate the histogram text file of the 10 sections of the grabbed image
5)generate the histogram text file of the 10 sections of the reference image
6*)check the difference of the histograms text file to check if there is a "great" difference(example: check section1 grabbed with section1 ref.)

*For this point I think that I can write a small c program as I need only to compare numeric data

Can I do it with imagemagick ? Do I need opencv ?(it seems more simple to use imagemagick for me)

regards

Spectre

p.s. I'm a newbie
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: image comparison with imagemagick

Post by fmw42 »

IM will give you any number of statistics on the difference between two equal sized images (or subsections). See the compare function at:
http://www.imagemagick.org/script/compare.php
http://www.imagemagick.org/Usage/compare/
http://www.imagemagick.org/Usage/compare/#statistics

Syntax:

compare -metric rmse image1 image2 null:

If you want histograms. See http://www.imagemagick.org/Usage/files/#histogram
Post Reply