Page 1 of 1

Problem with MagickAverageImages

Posted: 2011-06-06T02:54:33-07:00
by edsonlp1
Hello!

I'm trying to make an average of a set of images with the function MagickAverageImages, but i'm doing something wrong..

Code: Select all

MagickWand *mw = NULL;
	MagickWand *imagen =NULL;
	MagickWand *combi =NULL;
	MagickBooleanType status;

	MagickWandGenesis();

        mw = NewMagickWand();
	imagen =NewMagickWand();
	combi =NewMagickWand();

	/* Read the input image */
	MagickReadImage(mw,"C:\\data\\10_3_61_154\\000\\004\\M00001.jpg");
	MagickReadImage(imagen,"C:\\data\\10_3_61_154\\000\\004\\M00001.jpg");


	status= MagickAddImage (mw, imagen);
	combi = MagickAverageImages(mw);
		
	/* write it */
	MagickWriteImage(combi,"D:\\c++\\imagemagick\\Debug\\combinacion.jpg");

	/* Tidy up */
	if(mw) mw = DestroyMagickWand(mw);
	if(imagen) imagen = DestroyMagickWand(imagen);
	if(combi) combi = DestroyMagickWand(combi);

	MagickWandTerminus();
}
        
What i'm doing wrong? Thanks a lot!

Re: Problem with MagickAverageImages

Posted: 2011-06-06T05:25:46-07:00
by magick
You need to check for exceptions. See http://www.imagemagick.org/script/magick-wand.php and look for ThrowWandException().