PDA

View Full Version : software Triggering



dpat12
May 6, 2009, 09:03:49
does your USB camera free running camera can be software triggered to capture on demand frame using snapimages settings .

I want to capture from two USB cameras once i get encoder input i will send snamimages to both the grabber objects what will be the frame delay between two cameras

Stefan Geissler
May 6, 2009, 17:24:20
Hello,

First of all, the cameras have no software single snapshot mode.

If you use snapImages, then each call to snapImage will return, after a complete frame has been delivered. In worst case, this is twice the time of the frame rate.
You can use FrameHandlerSink::snapImagesAsync() function.

http://www.imagingcontrol.com/en_US/support/documentation/class/meth_descFrameHandlerSink_snapImagesAsync.htm

The function call will return immediately. A call to FrameHandlerSink::getLastAcqMemBuffer() will return the last snapped frame. Please keep in mind, that you should wait some milliseconds, at least the frame rate time, e.g. 30ms at 30 fps, before the frame is filled after you called snapImagesAsync().

I assume using this method the frame difference between both cameras should not be more than two frames. I must admit I did not check this on my own.

dpat12
May 6, 2009, 18:15:37
that is the point i am inspecting web running at a speed of 100mtr/minutes with the two camera i need to snap image of the same FOV in both camera at same time i can not afford to miss single frame in that case do you suggest to go for external trigger able camera ??

your trigger camera can start acquisition of new frame once it receive trigger i.e. it does not run in free running mode ??

Stefan Geissler
May 7, 2009, 17:37:08
Yes, you are right. If the cameras run triggered, the synchronization is given. The camera will start new exposure 4.8Ás after the trigger pulse occured. It does not run in free mode then.

dpat12
May 10, 2009, 06:54:08
when enternal trigger mode is set and snamimage is called it will wait for the new image to arrive and then call to snapimage will return will the new on demand exposed frame .

Have i understood it right !

Stefan Geissler
May 11, 2009, 09:32:30
Hi,

using snapImage together with an external trigger is no good idea, because snapImage will wait blocking your computer. It is a better idea to use the GrabberListener::frameReady(). (See callback sample for an implementation). The GrabberListener::frameReady() is called automatically, if a new frame is provided by the camera, that means a trigger pulse was fired. In order to use the GrabberListener::frameReady() you may write following code:


Grabber grabber1;grabber2;
CListener Listener1,Listener2;
smart_ptr<FrameHandlerSink> pSink1 = FrameHandlerSink::create( DShowLib::eRGB24, 3);
smart_ptr<FrameHandlerSink> pSink2 = FrameHandlerSink::create( DShowLib::eRGB24, 3);


pSink1->setSnapMode( false );
pSink2->setSnapMode( false );

// Apply the sink to the grabber.
grabber1.setSinkType( pSink1 );
grabber2.setSinkType( pSink2 );

grabber1.addListener( &Listener1, GrabberListener::eFRAMEREADY);
grabber2.addListener( &Listener2 GrabberListener::eFRAMEREADY);

grabber1.setExternalTrigger(true);
grabber2.setExternalTrigger(true);

grabber1.startLive();
grabber2.startLive();


where "CListener" is a GrabberListener inherited class.

dpat12
May 19, 2009, 07:08:57
with frameready how to synchronise between two grabber object . that once i receive frames from both the grabber frameready event another parallel thread should be notified so that i can take action in frameready i can use Setevent kind of user thread synch. mechanizam to synchronize betwween two frameready callback

Stefan Geissler
May 19, 2009, 17:39:47
The simple way is to set a flag in the frameReady() method to true, if a frame has receive and check this flag(s) from your main program.