PVCAM
3.9.x
Programmable Virtual Camera Access Method library
|
This sample demonstrates acquisition of multiple "snaps" using callback notification approach. Each acquisition is started by the host with an 'emulated' software trigger (using the pl_exp_start_seq function repeatedly, without re-configuring the acquisition).
The code snippet below initializes PVCAM and opens 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.
This code example uses the recommended callbacks acquisition (see Polling versus Callbacks). A part of the code omitted here defines a static callback function and registers the function with PVCAM. This approach is used in other code samples as well. The relevant code part is described in Frame Callback Handler section.
Prepare the acquisition. The pl_exp_setup_seq function returns the size of the frame buffer required for the entire sequence. Since we are only requesting a single frame, the size of one frame will be reported. For more details please refer to Acquisition Configuration. section.
Allocate a buffer of the size reported by the pl_exp_setup_seq function.
Acquire 5 images in a loop:
Start the acquisition - the command below is used as the software trigger. In hardware trigger modes this function call will put camera into a waiting state - the camera will wait for an external signal to start the acquisition:
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 the user aborts the acquisition with ctrl+c shortcut, the main while
loop is interrupted and the acquisition is aborted.
When acquiring single frames with callback notifications, call the pl_exp_finish_seq function after each frame before new acquisition is started.
Although the sequence acquisition with single frame goes automatically to idle state, the main while
loop can also be interrupted by the user. For this reason we always call pl_exp_abort. For more details, please, refer to the Closing Camera and Uninitializing PVCAM section.