![]() |
PVCAM
3.9.x
Programmable Virtual Camera Access Method library
|
This sample application demonstrates how to acquire a finite number of images. This example is similar to the single image acquisition example - the only difference is in the pl_exp_setup_seq function parameters where we request multiple images. The READOUT_COMPLETE flag is reported only once, after the whole sequence finishes. For this reason, if the application wants to track the acquisition progress, it has to calculate the current frame number based on the number of bytes received (using the pl_exp_check_status) or by periodically reading PARAM_BOF_EOF_COUNT - as shown in this example.
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.
To check the progress of the sequence acquisition we need to monitor the EOF counter. PVCAM has three parameters to control and manipulate BOF and EOF counters: PARAM_BOF_EOF_ENABLE, PARAM_BOF_EOF_CLR and PARAM_BOF_EOF_COUNT. All three parameters are needed in this example, therefore we make sure the parameters are available.
Next, enable BOF/EOF counters:
Clear the BOF/EOF counters. This should be done before every acquisition, but never during the acquisition.
Prepare the acquisition - the framesToAcquire
specifies the number of frames to acquire in this sequence. The exposureBytes
then holds the size of the whole buffer for all the images in the sequence. See Buffer Size and Frame Count Limitations section for possible limitations.
We can calculate the size of each frame that is needed later:
Now allocate the buffer memory to the size reported by pl_exp_setup_seq function.
Start the acquisition. Since the pl_exp_start_seq was configured to use the internal camera trigger, the acquisition is started immediately. In hardware triggering modes the camera would wait for an external trigger signal.
Monitor the acquisition progress with pl_exp_check_status and PARAM_BOF_EOF_COUNT.
If no error occurred or the user did not abort the acquisition, then everything completed successfully. For the last frame, we should do the same call as in the while loop above, because EOF counter was incremented only after the READOUT_COMPLETE status was reported and the loop exited.
Now we can finally walk through the buffer and process all frames:
When acquiring sequences, call pl_exp_finish_seq before accessing the frame buffer.
For completeness, we do a cleanup. Please, refer to the Closing Camera and Uninitializing PVCAM section.