Taking a Image from OpenCV to a MagickWand

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
marxwright
Posts: 2
Joined: 2013-04-22T05:46:54-07:00
Authentication code: 6789

Taking a Image from OpenCV to a MagickWand

Post 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.
marxwright
Posts: 2
Joined: 2013-04-22T05:46:54-07:00
Authentication code: 6789

Re: Taking a Image from OpenCV to a MagickWand

Post 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);
Post Reply