View Full Version : A pointer that points to the original live video data without snapImages ?

February 11, 2013, 12:09:03

My context is to get image data from the live video and showed it in an interface (made by fltk and opencv).

For now, the only way I know is to use snapImages function to snap a frame to the memory buffer and return the pointer to the image data in the memory buffer.

unsigned char* GetOutputBuffer(void)
Error err = pHandlerSink->snapImages( 1, 2000 ); //smart_ptr<FrameHandlerSink> pHandlerSink;
pActiveBuf = pHandlerSink->getLastAcqMemBuffer(); //MemBufferCollection::tMemBufferPtr pActiveBuf;
return (unsigned char*)pActiveBuf->getPtr();

My question is: is it possible to get the pointer directly to the original live frame data (where snapImages get the image), without calling snapImages all the time? I support that the adress for the original data is alway the same?

Thanks in advance for your help.


Stefan Geissler
February 11, 2013, 12:37:00
Hello Shuji,

Yes, what you want, can be done.

Usually, it is done by a callback. Using IC Imaging Control, you implement a GrabberListener inherited class. This class has the frameReady() method, which is called automatically each time a new frame is provided. Also you must call "Grabber::setSnapMode(false);" so each incoming image is saved automatically with out snapImages and GabberListener::frameReady is called.

You may have a look in the "Callback" sample, it implements a Grabberlistener.

The Membuffer parameter of frameReady contains the curret image. There you can access the image data pointer.

However, this approach is different from yours, since now the grabber controls the call to update your screen. In your current version it seems your application calls the GetOutputBuffer() (which is no longer needed.)

February 11, 2013, 13:52:03
Thank you Stefan for your support !
I just modify setSnapMode(true) to setSnapMode(false) in my program (similar to Pixelformat example) and I get live video as I need. I just call snapImages for the first time, then give the pointer my application, then my application continue to get new image from the same adress without calling snapImages.
I will try the callback method later if I have problem with actual one.
Thank you and have a good day!

Stefan Geissler
February 11, 2013, 14:35:47

well, you can proceed so, if you want, then you have control, when you want to update your images on screen.