View Full Version : Grabbing RGB8, getting frames as RGB32?

May 15, 2008, 09:42:38

I've set up a Grabber, a FrameHandlerSink and a MemBufferCollection. I select the device using the Grabber::showDevicePage(), I now select RGB8 as the color format though this dialog.

When I 'ask' the grabber it says the color format is RGB8, but when I ask the frame I receive it says it's RGB32. Why is this? I use the DShowLib::getColorformatFromSubtype(videoFormatIte m.getColorformat()) for 'asking' the grabber about what color format is set. (the response is RGB8) I use pBuffer->getColorformat() on the incoming frame (pBuffer - coming from the GrabberListener::frameReady()) to find out what colorformat the frame got. (the response is RB32)

The info on RGB8 says that "Every pixel is represented by one byte". http://www.imagingcontrol.com/support/documentation/class/PixelformatRGB8.htm

Have I overlooked something, or am I doing something wrong?

I would greatly appreciate your help on this matter.

-Janne Beate

Stefan Geissler
May 15, 2008, 10:43:08

The video format of the camera will be converted in the pixel format of the sink (memory buffer). You can setup the color format of the sink by setting the colorformat to eY800:

DShowLib::FrameHandlerSink::tFHSPtr m_pSink;
m_pSink = DShowLib::FrameHandlerSink::create( DShowLib::eY800, 5 )
m_pSink->setSnapMode( true );
m_Grabber.setSinkType( m_pSink );

With this code you will create the memory buffers with Y800, 1 byte per pixel, grayscale.

Please refer to:
Create a framehandler sink:

Color formats:

June 2, 2008, 13:39:18
Hi, I've tried what you suggested now, but I didn't have much luck.

If I understand this correct there is no need to create a MemBufferCollection manually and add it to the FrameHandleSink because it will make one automatically by calling the FrameHandleSink::create(...), is that correct?

I thought I'd use the Grabber::showDevicePage(), but I can't choose other than UYVY, RGB8, RGB24 and RGB32 with this, is there a way I can add Y800 to this list? Or will I have to make my own device setting dialog?

Thanks again,
Janne Beate

Stefan Geissler
June 2, 2008, 13:52:52

Please do not mix up the video format with the pixel format in the sink. The video format of the camera (UYVY, RGB8, RGB24 and RGB32) will (if possible) be converted into the pixel format of the sink (Y800). Thus you must create the sink and pass it to the grabber object.

The display of the live video is not affected by the color format of the sink.

Do you only want to display the live video or do you want to perform some image processing?

June 3, 2008, 09:47:31
Aha! That explains some problems I've had.

What I wanna do is:
1. Grab the video, either as UYVY, RGB8, RGB24 or RGB32
2. Store X frames in a MemBufferCollection, either as 8, 24 or 32bit
3. Copy these frames over to a different buffer.
4. Save the frames, from step 3, to file.

I'm not using IC to do step 3 and 4.