MATRIX VISION - mvBlueCOUGAR-X/-XD Technical Documentation
Creating synchronized acquisitions using timers

Basics

Getting images from several cameras exactly at the same time is a major task in

  • 3D image acquisitions
    (the images must be acquired at the same time using two cameras) or
  • acquisitions of larger objects
    (if more than one camera is required to span over the complete image, like in the textile and printing industry).

To solve this task MATRIX VISION devices offer timers that can be used to generate pulse at regular intervals. This pulse can be connected to a digital output. The digital output can be connected digital to the digital input of one or more cameras to use it as a trigger.

Connecting the hardware

Note
We recommend to use the cable "KS-BCX-HR12" to connect an external power supply (at pin 2 and 10) and the I/Os.

One camera is used as master (M), which generates the trigger signal. The other ones receive the trigger signal and act as slaves (S).

On the master camera

  1. Connect power supply GND to "pin 1" and "pin 7".
  2. Connect power supply +12 V to "pin 2" and "pin 10 (power supply for the outputs)".
  3. Connect DigOut0 of master ("pin 6") to DigIn0 of master ("pin 4").

On each slave camera

  1. Connect power supply GND to "pin 1" and "pin 7".
  2. Connect power supply +12 V to "pin 2" and "pin 10 (power supply for the outputs)".

Between the cameras

  1. Connect DigOut0 of master ("pin 6") to DigIn0 of slave ("pin 4").
Note
If more than one slave is used, connect the same "pin 6" of master to all "pin 4" of the slaves.
If each camera has its own power supply, then connect all grounds (GND) together.

For the master camera, there are 2 possibilities how it is triggered:

  1. The master camera triggers itself logically (so called "Master - Slave", see Figure 1), or
  2. the master camera uses the external trigger signal, which was created by itself, via digital input (so called "Slave - Slave", see Figure 2).
Figure 1: Master - Slave connecting
Figure 2: Slave - Slave connecting
Note
With "Master - Slave" and according to the delay of the opto-isolated inputs of the slave cameras, you have to adapted the property "Trigger delay" of the master camera to synchronize the cameras exactly.

Programming the acquisition

You will need two timers and you have to set a trigger.

Start timer

Two timers are used for the "start timer". Timer1 defines the interval between two triggers. Timer2 generates the trigger pulse at the end of Timer1.

The following sample shows a trigger

  • which is generated every second and
  • the pulse width is 10 ms:
#include <mvIMPACT_CPP/mvIMPACT_acquire.h>
#include <mvIMPACT_CPP/mvIMPACT_acquire_GenICam.h>

... 

// Master: Set timers to trig image: Start after queue is filled
    GenICam::CounterAndTimerControl catcMaster(pDev);
    catcMaster.timerSelector.writeS( "Timer1" );
    catcMaster.timerDelay.write( 0. );
    catcMaster.timerDuration.write( 1000000. );
    catcMaster.timerTriggerSource.writeS( "Timer1End" );

    catcMaster.timerSelector.writeS( "Timer2" );
    catcMaster.timerDelay.write( 0. );
    catcMaster.timerDuration.write( 10000. );
    catcMaster.timerTriggerSource.writeS( "Timer1End" );
See also
Counter And Timer Control
Note
Make sure the Timer1 interval must be larger than the processing time. Otherwise, the images are lost.

The timers are defined, now you have to do following steps:

  1. Set the digital output, e.g. "Line 0",
  2. connect the digital output with the inputs of the slave cameras (and master camera if using "Slave - Slave"), and finally
  3. set the trigger source to the digital input, e.g. "Line4".

Set digital I/O

In this step, the signal has to be connected to the digital output, e.g. "Line0":

// Set Digital I/O
    GenICam::DigitalIOControl io(pDev);
    io.lineSelector.writeS( "Line0" );
    io.lineSource.writeS( "Timer2Active" );
See also
Digital I/O Control

This signal has to be connected with the digital inputs of the slave cameras as shown in Figure 1 and 2.

Set trigger

"If you want to use Master - Slave":

// Set Trigger of Master camera
    GenICam::AcquisitionControl ac(pDev);
    ac.triggerSelector.writeS( "FrameStart" );
    ac.triggerMode.writeS( "On" );
    ac.triggerSource.writeS( "Timer1Start" );
// or ac.triggerSource.writeS( "Timer1End" );
// Set Trigger of Slave camera 
    GenICam::AcquisitionControl ac(pDev);
    ac.triggerSelector.writeS( "FrameStart" );
    ac.triggerMode.writeS( "On" );
    ac.triggerSource.writeS( "Line4" );
    ac.triggerActivation.writeS( "RisingEdge" ); 

"If you want to use Slave - Slave":

// Set Trigger of Master and Slave camera 
    GenICam::AcquisitionControl ac(pDev);
    ac.triggerSelector.writeS( "FrameStart" );
    ac.triggerMode.writeS( "On" );
    ac.triggerSource.writeS( "Line4" );
    ac.triggerActivation.writeS( "RisingEdge" ); 
See also
Acquisition Control

Now, the two timers will work like the following figure illustrates, which means

  • Timer1 is the trigger event and
  • Timer2 the trigger pulse width:
Figure 3: Timers

By the way, this is a simple "pulse width modulation (PWM)" example.

Setting the synchronized acquisition using wxPropView

The following figures show, how you can set the timers and trigger using the GUI tool wxPropView

  1. Setting of Timer1 (blue box) on the master camera:

    Figure 4: wxPropView - Setting of Timer1 on the master camera

  2. Setting of Timer2 (purple box) on the master camera:

    Figure 5: wxPropView - Setting of Timer2 on the master camera

  3. Setting the trigger slave camera(s)
    - The red box in Figure 4 is showing "Slave - Slave", which means that both master and slave camera are connected via digital input.
    - The red box in Figure 6 is showing "Master - Slave"), which means that the master is triggered internally and the slave camera is set as shown in Figure 4.
  4. Assigning timer to DigOut (orange box in Figure 4).
Figure 6: Trigger setting of the master camera using "Master - Slave"