Page 1 of 1

Taking a Image from OpenCV to a MagickWand

Posted: 2013-04-22T05:55:58-07:00
by marxwright
Hello there,

I'm currently using OpenCV to capture some live images from a webcam and I need to save out one of the images to use with one of your MagickWands.

I've tried several different suggestions on the internet but hoped someone here could shed some light on the subject.

I've tried this which gives me just a blank image

Code: Select all

IplImage FreshImage(saveImage);

MagickWand* wand(NewMagickWand());
MagickReadImage(wand, "C:/Users/mharrison/Desktop/QRBlocks/14Pix131QRNoBorder.jpg");

MagickImportImagePixels(wand, 0, 0, FreshImage.width, FreshImage.height, "BGR", CharPixel, FreshImage.imageData
);

I could list a few more but I'd rather ask he you guys would achieve this.

Thanks for any help you can provide.

Re: Taking a Image from OpenCV to a MagickWand

Posted: 2013-04-22T06:20:11-07:00
by marxwright
After spending ages on this I get the answer 30 minutes after I post on the forum.

Answer is as followings:

Code: Select all

	 ExceptionInfo info;
         GetExceptionInfo(&info);

	 Image* myImage = ConstituteImage(FreshImage.width, FreshImage.height, "RGB", CharPixel, FreshImage.imageData, &info);

	 MagickWand *wand = NewMagickWandFromImage(myImage);