![]() |
PVCAM
3.9.x
Programmable Virtual Camera Access Method library
|
This sample application demonstrates how to run continuous acquisition in circular buffer mode and with SMART Streaming feature enabled.
Initialize PVCAM and open the first available camera. Please refer to the actual code sample in the SDK installation directory for more details about the common helper functions used in this documentation.
Check whether SMART Streaming feature has been detected during the camera initialization.
To use callbacks we need to create a callback function and register it with PVCAM. PVCAM will then call this function every time a frame arrives. This approach is used in most samples, thus a generic code block is shared across the code examples. For more information please refer to Frame Callback Handler section.
The following code snippet uploads the desired set of exposures to the camera. Please, see the UploadSmartStreamingExposures for details.
Prepare the continuous acquisition with circular buffer mode. The pl_exp_setup_cont function returns the size of one frame in bytes (unlike the size of entire buffer as with the pl_exp_setup_seq function). Please, see more details in Acquisition Configuration section.
Now allocate the buffer memory. The application is in control of the circular buffer and should allocate memory of appropriate size.
Start the continuous acquisition. By passing the entire size of the buffer to pl_exp_start_cont, PVCAM can calculate the capacity of the circular buffer.
Loop to acquire 16 frames. Since SMART Streaming array holds 8 different exposure times, these will be applied in a circular manner, thus after the first 8 exposures are completed, the next 8 exposures will start again with the initial exposure time of 10ms.
Here we need to wait for a frame readout notification signaled by eofEvent
in CameraContext which is raised in the callback handler we registered. If the frame does not arrive within 5 seconds or if user aborts the acquisition with ctrl+c keyboard shortcut, the main while
loop is interrupted and the acquisition is aborted.
Next, use the address of the latest frame in the circular buffer stored in the callback handler:
Once we have acquired the desired number of frames, the acquisition should be stopped with pl_exp_abort. For more information about closing cameras and uninitializing PVCAM, please, refer to the Closing Camera and Uninitializing PVCAM section.