The vidl2 library is still relatively new. That is why there is
little documentation and usage examples. It will be moving to VXL
core in the not-so-distant future and I'm putting together a vidl2
chapter for the VXL book which should be ready around the same time.
It sounds like you have the right idea. Your call to
vidl2_convert_to_view should convert that frame into an RGB
vil_image_view. The third argument for color space is required to
force the image into RGB. You don't need to manually convert YUV to
RGB since the convert function should be doing that.
There must be a bug somewhere. I'll need more information to help
track this down. The bug could be before, during, or after the
vidl2_convert_to_view call. We need to find out where it is. Which
vidl2_istream are you using? Can you test your code with an image
list istream? Can you step through the vidl2_convert_to_view function
to make sure it is calling the correct conversion routine? Can you
check the output vil_image_view data to see exactly what it contains?
Does it have 3 planes? Is that data in the red and green planes set
to all zeros?
On Sep 30, 2008, at 2:55 PM, Crístian Viana wrote:
> 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,
> 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 Deives dos Santos Viana [aka CD1]
> Google Talk: cristiandeives@...
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in
> the world
> Vxl-users mailing list