PVCAM
3.9.x
Programmable Virtual Camera Access Method library
|
This example application demonstrates how to run the camera in continuous circular buffer mode. The camera is triggered by external hardware signal.
This sample is almost identical to the Live Image Callbacks example and therefore only the code parts that are different are shown below.
In order to initiate an acquisition with an external trigger source, the acquisition first needs to be configured accordingly and started. The configuration is done by setting the exp_mode
argument in the pl_exp_setup_seq or pl_exp_setup_cont functions. For legacy cameras, the argument should be set to STROBED_MODE, for modern cameras the value of EXT_TRIG_EDGE_RISING is usually selected. For all available triggering modes please refer to Exposure Modes chapter.
Instead of pl_exp_get_latest_frame the pl_exp_get_latest_frame_ex alternative function is used. The 'ex' function additionally returns a FRAME_INFO structure containing frame number and timestamps. This is the same FRAME_INFO that is passed to the callback handler. If any of the two functions are called from inside the callback function, PVCAM guarantees that the FRAME_INFO returned by these functions is identical to the FRAME_INFO passed into the callback. However, in case of this example, the pl_exp_get_latest_frame_ex is called from within the main thread. Especially with fast frame rates, it may happen that a new frame arrives before the context is switched from the PVCAM callback thread to the main thread and the FRAME_INFO structure passed into the callback routine does not correspond to the FRAME_INFO structure received through the pl_exp_get_latest_frame_ex function. This example prints a message if it happens. When working with fast frame rates, Teledyne Photometrics recommends to use callback acquisition and to call the pl_exp_get_latest_frame_ex from inside the callback routine and either process the frames inside the callback or defer processing to another thread. PVCAM queues the callback notifications up to the size of the circular buffer before it starts dropping frames. Note that the eofFrameInfo
in the CameraContext structure contains the FRAME_INFO reported by the callback function.