Hi!

I'm reading some videos using vidl2 and I need to display the frames in my application. For that, I need to convert the image to the RGB color space, because that's how QImage works (that's the class I'm using to display the frames, it's from the Qt framework).

I obtain a vidl2_frame_sptr from the vidl2_istream, and I convert the frame to a vil_image_view with the following code:

vil_image_view<vxl_byte> original_image;
bool frame_converted = vidl2_convert_to_view(*frame, original_image, VIDL2_PIXEL_COLOR_RGB);

And then, I take every pixel of "original_image", using the () operator, and I copy each one of it to my QImage object. But when I display the image, it appears all blueish! It's like there's only one color channel, and that channel is interpreted as blue. The image can still be recognized (it's not plain blue #0000FF), but those are not the colors I want!

After some vcl_cout's in my code, I found out that my vidl2_istream's color space is YUV 420P, and not RGB, as I need. So I have to convert the pixels to RGB. I found the functions in the file vidl2_color.h, but they receive three parameters, the "y", "u" and "v" parts of the YUV pixel. But I have only one number representing it (the template of the vil_image_view is vxl_byte). And because of that, I don't know how to convert the image to RGB. The third parameter of vidl2_convert_to_view above (VIDL2_PIXEL_COLOR_RGB) doesn't seem to be useful to me, there's no difference if I use that parameter or if I omit it.

Any help will be appreciated.

* It's hard to find documentation or sample code on the Internet about vidl2. When I google for "vidl2_color_convert_yuv2rgb", for example, I only find the source code of it (in like 5 ocurrences). No use of those functions out there... :(

See ya,
Crístian

--
Crístian Deives dos Santos Viana [aka CD1]
Google Talk: cristiandeives@gmail.com