View Full Version : snap and modify images

June 3, 2008, 12:42:36
I use the callback-sample to test my modifikation of an image.
Later I must find an blob in the picture from an ir-transmiter.
My backgroundfilter works.
But how can I easily modiy the callback-sample to snap images for an indefinite time ?
Here I add my filter :

void CListener::frameReady( Grabber& caller, smart_ptr<MemBuffer> pBuffer, DWORD currFrame)
std::cout << "Buffer " << currFrame << " processed in CListener::frameReady()." << std::endl;
//saveImage( pBuffer, currFrame+100 );

pBuffer = bgFilter.filterBackground(pBuffer); // here my filter

saveImage( pBuffer, currFrame ); // Do the buffer processing.

//::Sleep(250); // Simulate a time expensive processing.

Stefan Geissler
June 3, 2008, 14:01:46

the trick is to set the snapMode:

smart_ptr<FrameHandlerSink> pSink = FrameHandlerSink::create( acceptedTypes, NUM_BUFFERS );

// enable snap mode to false. This means for each incoming image the CListner::frameReady is called automatically
pSink->setSnapMode( false);

// Apply the sink to the grabber.
grabber.setSinkType( pSink );

grabber.startLive(); // Start the grabber.

Now you do not need to call "snapImages" and more, because the CListener::frameReady() is called automatically by the grabber object until the live video is stopped.