Page 1 of 1

Need Help using MagickCompareImages *****SOLVED****

Posted: 2007-07-23T02:58:29-07:00
by Strichcode
Hallo,

For the last 3 Days i'am trying to work with MagickWand and C.
I was able to read in a BMP Image and to get some Information about it.

Now i need to write a function that compares 2 BMP Images.
I need to know if the 2 Images, are (nearly) the same.

And the Command Line on my Linux i was using the command "compare" like this:

1) compare -metric PSNR /tmp/bmp/preload/2.bmp /tmp/bmp/preload/1.bmp devel.bmp
--> here i get a new image and a return value of 5.3595, which means the images are different

2) compare -metric PSNR /tmp/bmp/preload/2.bmp /tmp/bmp/preload/2.bmp devel.bmp
--> here i get a new image and the return value is "inf", which means the images are the same

Now i need this compare function in my C-function.


I have tryed this:
----------------------------------------
MagickWand *magick_wand_1;
MagickWand *magick_wand_2;
MagickWand *compare_wand;
double differenz;

MagickWandGenesis();
magick_wand_1=NewMagickWand();
status_1=MagickReadImage(magick_wand_1,"path/to/image1");
if (status_1 == MagickFalse)
ThrowWandException(magick_wand_1);

MagickWandGenesis();
magick_wand_2=NewMagickWand();
status_2=MagickReadImage(magick_wand_2,"path/to/image/3");
if (status_2 == MagickFalse)
ThrowWandException(magick_wand_2);

compare_wand = NewMagickWand();
compare_wand=MagickCompareImages(magick_wand_1,magick_wand_2, MeanSquaredErrorMetric, &differenz);
DestroyMagickWand(compare_wand);

DestroyMagickWand(magick_wand_1);
DestroyMagickWand(magick_wand_2);
MagickWandTerminus();

------------------------------------------

The Problem is that i did not get any return Values.
I need a value on which i can decide if the Images are identic.


I hope somebody can help me

best regards
Strichcode


------------------------------------------

Sorry that i was a littlebit stupid,
i just forget a printf of the variable differenz