Page 1 of 1

image comparison with imagemagick

Posted: 2011-07-14T05:33:01-07:00
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

Re: image comparison with imagemagick

Posted: 2011-07-14T10:06:31-07:00
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