PDA

View Full Version : how can i get a BY8 color format image data using a MemBufferCollection?



bblxd
November 7, 2010, 09:32:40
I want to use MemBufferCollection to get an image data buffer ptr. But I get an exception error when I

call grabber1.startlive(). How can i set it, or is there another way to get the image data ptr.
BTW, The video formart I set is "BY8 (1024x768)".

The main code is as below:
FrameTypeInfo frameType(eBY8,1024,768,1024*768);
m_pSink1=FrameHandlerSink::create(frameType,1);
m_pSink1->setSnapMode(ture);

Grabber grabber1.setSinkType(m_pSink1);

BYTE* pBuf1[1];
pBuf1[0]=new BYTE[1024*768];

SIZE dim;
dim.cx=1024;
dim.cy=768;
pCollection1=MemBufferCollection::create(frameType ,1,pBuf1);
m_pSink1->setMemBufferCollection(pCollection1);

Stefan Geissler
November 8, 2010, 14:08:09
Hello,

using BY8 in a sink is senseless. The BY8 format is an invention to let DirectShow insert a DebayerTransform filter automatically. Thus all DirectShow application can use the BY8 format and convert it to RGB.

Since you need a colored format in the sink, I suggest to use eRGB32 or eRGB32. If you need grayscale 8 bit, you should use eY800. If you want to see the CCD raw data, the video format must be set to Y800 and the sink to eY800 too.