FG Camera Library  1.5.0.0 (2023-09-08)
VisionSensor PV

The VisionSensor PV is a compact programmable Linux camera. Unlike the VisionCam, it does not provide a "Real Time Communication Controller" (RTCC). Sensor trigger and the integrated LED are controlled by this libraray, while the digital I/Os are controlled by the VisionBox Interface Library.

There are two generations:

  • VisionSensor PV1 / PV2: single-core ARM Cortex-A9 (armhf architecture).
  • VisionSensor PV3: quad-core ARM Cortex-A57 (arm64 architecture).

Also take a look at the Sensors page for more information.

Using hardware trigger mode

The function FG_set_trigger_mode() is used to enable sensor trigger by digital input.

Example:

// Enable hardware trigger

The debounce setting for the digital inputs will also be applied for the trigger signal. See VIB::DigitalInput::ConfigureDebounceTime() for adjustment of the debouncing time.

VisionSensor PV / PV2

The VisionSensor PV / PV2 uses a fixed connection from digital input IN0 to the sensor in hardware triggered mode. Therefore, no additional initialization code is necessary. The rising edge will be used.

VisionSensor PV3

The VisionSensor PV3 provides the Special feature TriggerLine to control the trigger input and the edge sensitivity. The trigger input can be IN0, IN1 or both. The sensitivity can be rising edge, falling edge or both edges. Input IN0 with rising edge is used by default.

Example:

// Select input IN1, rising edge as sensor trigger:
FG_set_special_option("TriggerLine", 1);

A trigger divider can also be used to decrease the frequency of the trigger events, see Special feature TriggerDivider.

Example:

// Divide incoming trigger signal by 10:
FG_set_special_option("TriggerDivider", 10);

In Line scan mode, the input IN1 is available as a frame trigger signal by using the Special feature FrameTriggerMode value 2 or 3.

Controlling the integrated LED and exposure signal output

The operating mode of the integrated LED unit and the exposure output signal can be controlled by a physical mode switch or by software:

  • If the integrated LED is enabled, the LED turns on during the integration period of the sensor. The image brightness can only be changed by adjusting the integration time with FG_set_shutter_time().
  • The exposure signal of the sensor can be copied to a digital OUT wire. This allows synchronization of an external lighting unit. The output signal can be selected with the special feature StrobeOutput.

The position of the physical switch is used for mode selection unless it's overwritten by software. For software mode control, use the special feature StrobeMode. The value for this parameter is equal to the switch position for modes 0...2:

Switch position Software control
(StrobeMode)
Integrated LED Digital output OUT<i>
0 0 Enabled Controlled by VIB::DigitalOutput
1 1 Off Sensor exposure signal
2 2 Off Controlled by VIB::DigitalOutput
- 3 Enabled Sensor exposure signal
- -1 Controlled by switch

The mode switch is not present on most devices, the default setting after initialization is then 2.

Example:

// Enable the integrated LED and exposure signal on digital output:
FG_set_special_option("StrobeMode", 3);
// Select output OUT1 for the exposure signal:
FG_set_special_option("StrobeOutput", 1);
Note
The maximum LED strobe time gets automatically limited to a duty cycle of 25% for protection of the hardware. For example: when using a frame rate of 60 fps, the LED strobe time will be dynamically limited to 4.17 ms if the exposure time setting is longer. The external strobe signal on digital outputs will not be limited.

LED current (VisionSensor PV3)

The LED current can be adjusted for the following hardware:

  • Multi-channel LED illumination unit
  • Adjustable ring light

The LED current is controlled by the following special feature:

Property name Description Version requirements
FPGA Library
LedCurrent LED current in percent for adjustable LED units:
range: x...100 (the minimum value depends on the LED hardware)
Default value for multi-channel LED illumination unit: 100
Default value for adjustable ring light: 28 (similar to non-adjustable version)
≥ 1.0.0.70 (for adjustable ring light only) ≥ 1.4.0.0

Sequencer (VisionSensor PV3)

A sequencer can be used to apply different settings to subsequent sensor frames:

  • Trigger mode: enable or disable sensor trigger
  • Control flash parameters for the multi-channel LED illumination unit

The sequencer is configured using special features as follows:

  • Configure the number of sequencer steps with SequencerStepCount
  • For each sequencer step:
    • Select the step with SequencerStep
    • Configure the selected step parameters

The sequencer is controlled by the following special features:

Special features for the sequencer
Property name Description Version requirements
FPGA Library
SequencerStepCount Number of active Sequencer steps
range: 1...4 (default: 1)
≥ 1.0.0.70 ≥ 1.4.0.0
SequencerStep Selected Sequencer step index for using the following special options:
SequencerTriggerMode, SequencerFlashTime, SequencerFlashEnable
range: 0...(SequencerStepCount - 1) (default: 0)
SequencerTriggerMode Trigger mode for the selected Sequencer step. This setting is ignored in free run mode:
0: disable sensor trigger for this step, acquire image when the sensor is ready
1: enable sensor trigger for this step (default)
SequencerFlashEnable LED illumination unit: a bit field for selecting active LED channels for the selected Sequencer step.
range: 0x0...0xf (default: 0x3 - channel 0+1 for step 0, else 0x0)
SequencerFlashTime LED illumination unit: strobe duration for the selected Sequencer step in micro-seconds.
range: 1...16384 (default: 100)

Correlation between acquired images and the used sequencer step can be done in two ways:

  • By using remainder of the frame number FG_IMAGE::image_number divided by the number of sequencer steps. The frame number will also be incremented if frames are lost when the acquisition queue is empty.
  • Accumulate multiple sensor scans into one image by using FG_set_scan_param() and setting the parameter image_scan_count equal to the number of sequencer steps. The resulting image will contain the sensor images for all steps after another in memory.
Note
The number of sequencer steps should be configured before starting image acquisition with FG_append_image() to ensure the correlation.

Sequencer trigger mode setting

The trigger mode can be used to enable or disable the sensor trigger for each sequencer step.

The trigger is activated by default for all steps, so the sensor will wait for a trigger signal (hardware or software trigger). If the trigger mode is disabled for a sequencer step, the sensor will start acquisition as soon as the previous sensor exposure and readout has completed.

Example:

The following example configures the sequencer to capture three frames for each trigger event:

// number of sequencer steps: 3
FG_set_special_option("SequencerStepCount", 3);
// disable trigger for steps 1 and 2 (trigger for step 0 stays active)
FG_set_special_option("SequencerStep", 1);
FG_set_special_option("SequencerTriggerMode", 0);
FG_set_special_option("SequencerStep", 2);
FG_set_special_option("SequencerTriggerMode", 0);

In free-run mode, the sequencer trigger mode setting affects the acquisition as follows:

  • If the trigger is active for a step, the sensor will be triggered according to the FrameRate / ScanPeriod setting.
  • If the trigger is disabled for a step, the sensor will be triggered as soon as possible.

Sequencer LED illumination unit settings

The following LED parameters can be changed for each sequencer step when using the multi-channel LED illumination unit:

  • SequencerFlashTime: controls the LED flash duration
  • SequencerFlashEnable: a bit field controlling the active LED channels
Note
  • The LED current (option LedCurrent) is the same for all LED channels and for all sequencer steps.
  • The actual LED current may be limited to less than 100 percent if multiple LED channels are used simultaneously in any sequencer step. Read the current value back to get the actual value.
  • The maximum allowed duty cycle is calculated by the library for each LED channel to protect against hardware damage.

Example:

// number of sequencer steps: 3
FG_set_special_option("SequencerStepCount", 3);
// configure step 0
FG_set_special_option("SequencerStep", 0);
FG_set_special_option("SequencerFlashEnable", 0x3); // enable LED channel 0 and 1
FG_set_special_option("SequencerFlashTime", 400); // 400 micro-seconds
// configure step 1
FG_set_special_option("SequencerStep", 1);
FG_set_special_option("SequencerFlashEnable", 0x4); // enable LED channel 2
FG_set_special_option("SequencerFlashTime", 1000); // 1000 micro-seconds
// configure step 2
FG_set_special_option("SequencerStep", 2);
FG_set_special_option("SequencerFlashEnable", 0x8); // enable LED channel 3
FG_set_special_option("SequencerFlashTime", 200); // 200 micro-seconds
FG_TRIGGER_MODE_HARDWARE
@ FG_TRIGGER_MODE_HARDWARE
Hardware triggered mode.
Definition: FG_CameraInterface.h:142
FG_set_special_option
UINT32 DLL_FG_API FG_set_special_option(const char *option, INT64 arg)
Configures a special camera property.
Definition: FG_CameraInterface.cpp:893
FG_set_trigger_mode
UINT32 DLL_FG_API FG_set_trigger_mode(enum eFG_TRIGGER_MODE trigger_mode)
Sets the trigger mode.
Definition: FG_CameraInterface.cpp:770