Synchronous Free Run (blaze)#
Using the Feature#
Why Use Synchronous Free Run#
If you want use multiple blaze cameras to capture the same scene, you have to stagger the exposures on the individual cameras so that their light sources don't interfere with each other. Similar to ambient light, the light sources of the individual cameras also cause a reduction in image quality.
Using PTP, you can let a group of cameras capture images in synchronous free run but with the exposures starting consecutively in precisely time-aligned intervals and in chronological order. That way, the light of one camera doesn’t interfere with the other cameras’ measurements.
How It Works#
There are two ways to configure synchronous free run. To help you decide which option is best for you, you have to understand the general operating principle of the blaze camera when it comes to image acquisition.
When acquiring images, each frame is composed of eight subframes (4 subframes if Fast Mode is enabled). Each subframe can be viewed as a separate exposure because after exposing each subframe the illumination is switched off and the sensor is reset.
Frame Exposure Phases#
During an exposure, the following phases take place:
- Startup: This happens once when a frame is triggered.
- Reset: The sensor is reset. This happens before each subframe is acquired.
- Exposure: The shutter opens and the sensor is exposed. This happens for each subframe.
- Readout: The data collected during the subframe is read out of the sensor.
The following figure shows the different phases of a frame exposure (only subframes 1, 2, and 8 are shown).
Configuring Synchronous Free Run#
When setting up cameras for synchronous free run, the cameras' acquisitions are aligned by specifying different acquisition start times for the cameras.
There are two ways to use synchronous free run:
If you want to operate two blaze cameras simultaneously, choose the interleaved mode. In this mode, the second camera emits light while the first camera performs the sensor readout.
If you want to operate more than two cameras simultaneously, the interleaved mode is not an option since the readout time of the first camera isn't long enough for two or more cameras to perform their exposure cycle during the sensor readout time. Instead, you have to use the consecutive mode, where the cameras acquire frames consecutively one after another.
Configuring the Cameras#
The blaze SDK contains the SynchronousFreeRun C++ sample, which demonstrates how to set up several cameras for synchronous free run and how to capture image data and identify frames that belong together chronologically. Part of that sample are several helper functions and classes that you can integrate into your application by adding the PtpHelper.h and PtpHelper.cpp files to your project.
This section describes a sample implementation for configuring the cameras for synchronous free run using pseudo code. The procedure can be used for configuring the interleaved and the consecutive mode.
t_start,n: Duration of the frame startup time of the nth camera.
t_reset,n: Duration of the nth camera's reset time (reset takes place at the beginning of each subframe).
t_exp,n: Duration of the nth camera's exposure time for a single subframe.
t_read,n: Duration of the nth camera's readout time for a single subframe.
t_frame,n: Total time required for the nth camera to acquire all subframes of a frame.
The actual values can be retrieved from the camera. The following table lists the parameter names that you have to read out:
| || |
| || |
| || |
| || |
| || |
The following variables are used as well:
t_0: Current PTP timestamp [ns].
f_max: Maximum possible frame rate [Hz].
t_acq,n: Acquisition start time for the nth camera [ns].
t_safety: Additional amount of time that the acquisition should be delayed by in order to compensate for jitter [us]. Recommended value: 400 µs.
n: Number of cameras.
All the camera parameters listed above return values in microseconds (µs).
The amount of time by which the individual acquisition start times have to be staggered depends on the exposure times and whether interleaved or consecutive synchronous free run mode is used. In consecutive mode, the offsets between the acquisition start times also depend on whether the Fast Mode parameter is enabled.
The acquisition start times should be set to some point in the future to ensure that no camera starts acquisition before your application has configured all cameras and set up a grab loop. You should factor in about 400 ms for configuring one camera. This approach ensures that all frames that belong together chronologically have the same frame number.
To configure the cameras (sample implementation):
- On each camera, enable PTP by setting the
- Wait until the master clock selection has been performed and the clocks are sufficiently synchronized.
For details, see Precision Time Protocol (blaze).
On each camera, configure the desired
When setting up the cameras for interleaved synchronous free run mode, you have to set the same exposure time and operating mode on both cameras.
Calculate the maximum possible frame rate
f_maxas described below.
On each camera, specify a fixed frame rate by setting the
true. Specify the desired frame rate by setting the
AcquisitionFrameRateparameter to a value equal to or less than
You have to specify the same frame rate on all cameras.
Retrieve the current timestamp
t_0from one of the cameras by first executing the
TimestampLatchcommand and then reading out the
t_acq,1 = t_0 + n * 400 * 1e6
For i = 1 to n
- Set the
SyncFreeRunTimerStartTimeLowparameter of camera
t_acq,i & 0xffffffff.
- Set the
SyncFreeRunTimerStartTimeHighparameter of camera
t_acq,i >> 32.
- Execute the
SyncFreeRunTimerUpdatecommand of camera i.
- Enable synchronous free run on camera i by setting the
iis less than
n == 2, i.e., interleaved mode:
t_acq,i+1 = t_acq,i + 1000 * (t_safety + t_exp,i)
n > 2, i.e., consecutive mode:
t_acq,i+1 = t_acq,i + 1000 * (t_safety + t_frame,i - t_read,i - t_start,i+1 - t_reset,i+1)
- Set the
Prepare the application's grab loop.
- On each camera, issue the
- Grab images from each camera.
Determining the Maximum Frame Rate#
When using consecutive synchronous free run, the maximum frame rate per camera is limited by the number of cameras and the frame duration of each camera.
When using two cameras in interleaved synchronous free run, both cameras can be operated with the maximum possible frame rate.
In the following,
f_max,n denotes the maximum allowed value for the nth camera's
AcquisitionFrameRate parameter. To read out
f_max,i for camera
i using the APIs of the blaze SDK the following code snippets can be used:
auto max = camera.GetParameter<GenApi::CFloatPtr>("AcquisitionFrameRate")->GetMax();
var max = (double) camera.GetParameterMaximum("AcquisitionFrameRate");
The maximum frame rate
f_max in interleaved mode is determined by the lower value out of
The maximum frame rate
f_max in consecutive mode can be calculated with the following steps:
f_minmax = min(f_max,1 , ... ,f_max,n)
t_total = 0
for i = 1 to n
t_total = t_total + t_frame,i - t_start,i - t_reset,i - t_read,i
t_total = t_total + t_start,1 + t_reset,1
f = 1e6 / t_total
f_max = min(f, f_minmax)