Page 1 of 1

Magick++ reading Blob YUV 4:2:2 into an Image

Posted: 2007-04-01T19:44:51-07:00
by frsswdn
Hi,

I am trying to read a Blob in YUV 4:2:2 format into an Image instance as follows:

image.read(blob, geo, "YUV4:2:2");

(function signature: const Blob &blob_, const Geometry &size, const string &magick_)

I get though the following error:

----------------------
terminate called after throwing an instance of 'Magick::WarningOption'
what(): ImageMagick: Unrecognized image format (YUV4:2:2)
---------------------

Trying to use "YUV" instead of "YUV4:2:2" results in a (different) error. However, trying

Image image(blob, geo, "YUV4:2:2");

works great. Trying to specify the magick_ argument with the Image::magick function yields an error as well.

How should I specify the magick_ argument for the Image::read function? Is it on purpose that the constructor and the read functions behave differently on the same magick_ string?

Version: ImageMagick 6.3.2 03/04/07 Q16
OS: GNU/Linux, FC 6.

Thanks,
Firas.

Re: Magick++ reading Blob YUV 4:2:2 into an Image

Posted: 2007-04-02T07:29:28-07:00
by magick
ImageMagick uses the sampling factor to determine the type of YUV image. By default it is 4:2:2. Your problem may be that you need to set the image depth. The Q16 version of ImageMagick expects images to be 16 bits per pixel. An alternative is to build/use the Q8 version of ImageMagick.

Re: Magick++ reading Blob YUV 4:2:2 into an Image

Posted: 2007-04-04T16:30:11-07:00
by frsswdn
Hi,

I have tried to specify the depth of the image and I tried a couple of other potential workarounds, but I still cannot solve the issue:

Specifying the depth parameter (i.e. calling something like: ' image.read(blob, geo, 8, "YUV" ') results in the following exception/error:

--------------
terminate called after throwing an instance of 'Magick::ErrorCorruptImage'
what(): ImageMagick: Unexpected end-of-file `': No such file or directory
------------

Does this mean that there is a problem in the blob's format? I self-construct the blob out of three YUV channels by successively copying them into a continues array, then update the blob with the data array using:

blob.updateNoCopy(data, static_cast<size_t>(size) );

I guess I am missing something?

Thanks for the help,
Firas.

Re: Magick++ reading Blob YUV 4:2:2 into an Image

Posted: 2007-04-04T17:49:05-07:00
by magick
Post a URL where we can download a small working example that illustrates this problem and a sample image. We need to reproduce the problem before we can offer a proper fix.

Re: Magick++ reading Blob YUV 4:2:2 into an Image

Posted: 2007-04-05T06:38:13-07:00
by frsswdn
Hi,

well, while preparing a working example, I managed to convert the YUV to RGB24 using a third party method (ffmpeg's img_convert). Now reading the RGB24 into an Image through a Blob works smoothly.

I can still provide the YUV example if relevant.

Thanks for asking for an example,
Firas.