Page 1 of 1

Support for YUV420P?

Posted: 2011-08-29T22:33:09-07:00
by jonoomph
Greetings! I was wondering if ImageMagick++ has an easy way to convert RGB pixels into YUV420P (planar) values? I need to set the pixel data on a SDL_Overlay, which requires me to convert my Magick::Image pixel data into the YUV420P format. Can ImageMagick++ help me with this conversion? Or should I write my own conversion code?

I did find the Magick::ColorYUV class, but it doesn't seem to support the 4:2:0 planar format... unless I am misunderstanding how it works. Any thoughts would be much appreciated.

Thanks!
-Jonathan

Re: Support for YUV420P?

Posted: 2011-08-30T05:51:06-07:00
by magick
Try
  • im.interlaceType(PlaneInterlace);

Re: Support for YUV420P?

Posted: 2011-08-30T12:19:25-07:00
by jonoomph
Thanks for the reply. So, if I call the interlaceType(PlaneInterlace) method, I assume it will tell the Image to store the Y,U, and V in separate planes? I am no expert on YUV420P, but it looks like I'm supposed to have more Y values, and less U & V values. Every pixel would have a corresponding Y value... and the U and V values would represent a 2x2 pixel block. So, there are 1/4 less U and V values.

So, once I invoke that method, what would be the best approach to access these YUV values? Would I still use the Magick::ColorYUV class?

Thanks again for your help!
-Jonathan