PDA

View Full Version : FrameTypeInfo info return buffer size 0



WK Ho
January 8, 2008, 07:16:18
Hi there

I have try to access the pixels set up the capture as below:
mm_Grabber.setHWND(m_hWnd);
mm_Grabber.setWindowPosition(5, 70 );
//creat the sink to store the image data
pSink = FrameHandlerSink::create( eRGB24,5 );
// enable snap mode (formerly tFrameGrabberMode::eSNAP).
pSink->setSnapMode( true );
// Apply the sink to the grabber.
mm_Grabber.setSinkType( pSink );

// Retrieve the output type and dimension of the handler sink.
FrameTypeInfo info;
pSink->getOutputFrameType( info ); //??<--- exam. info. find buffersize=0
//-----------------------------
//-----------------------------

// Snap an Image to the memory buffer
mm_Grabber.startLive(); // Start the grabber.
if(mm_Grabber.snapImages( 5 ) )
{
// Save the image to a bitmap file.
pSink->getLastAcqMemBuffer()->save( "image.bmp" );

}
else
{
AfxMessageBox( "Snap Image Error" );
}

int x=mm_Grabber.getFrameCount();
int framectr=pSink->getFrameCount() ; //-also both frame count value=0

//while these:
int xx,yy;
yy=mm_Grabber.getAcqSizeMaxY();
xx=mm_Grabber.getAcqSizeMaxX();

//gives correctly 640x480

Could you pls help on why with the
FrameTypeInfo info;
pSink->getOutputFrameType( info );

the struct info.buffersize =0???

Regards
WK

WK Ho
January 8, 2008, 07:38:14
Hi
It seems I need to do :
// Prepare the live mode, to get the output size if the sink.
if( !mm_Grabber.prepareLive( false ) )
{
AfxMessageBox( "CANNOT renderring eRGB24" );

// return -1;
}

In order to get the correct
FrameTypeInfo info;

However, my second problem of not getting any frame in still there, that is:
int x=mm_Grabber.getFrameCount();
int framectr=pSink->getFrameCount() ;

both return a value of 0 even I have executed snapImages(5) right after the live.

Pls help.

WK Ho
January 8, 2008, 10:15:20
Hi there

I find the problem it is that
snapImages() has been deprecated in Grabber class. ANd getSinkTypePtr(); must be used first to get the correct pointer.

It would be nice if the various prerequistics of certain important methods be listed in your doc. as it seems version 3.0 this is a major update and some of your enclosed examples are still using deprecated methods.

WK

Stefan Geissler
January 8, 2008, 11:35:46
Hi,

The size of the buffer is known after the filter graph has been prepared. Before doing so, we do not know which frame filters are in use, thus we can not know the size.

It is correct, that the deprecated methods are used, because they work in their context. This is to be compatible to older versions of source as far as possible.