Note

This Python sample has a corresponding C++ sample.

Sync Sample

The sample metavision_sync.py shows how to use Python API for synchronizing two event-based cameras.

The source code of this sample can be found in <install-prefix>/share/metavision/sdk/core/python_samples/metavision_sync when installing Metavision SDK from installer or packages. For other deployment methods, check the page Path of Samples.

Prerequisites

As explained in the camera synchronization page, you need to connect the two event-based cameras using a synchronization cable. Specifically, the Sync Out signal of the master camera needs to be connected to the Sync In interface of the slave camera. One of the camera will be the master camera, while the other will be the slave camera.

See also

See the Timing Interface section for more information about Prophesee’s cameras Sync In and Sync Out interfaces.

You will need to start the slave camera first, followed by the master camera. You can connect both cameras to the same PC or to two different PCs.

Note

When connecting the two cameras on the same PC, make sure to specify the serial number of the camera you want to use (SERIAL_NUMBER in the commands below). You can retrieve it using Metavision Platform Info Application (the Serial Number it the Serial from the output, e.g. 00ca0009).

Expected Output

The sample visualizes CD events on the screen. Note that the slave camera will not visualize any events until the master camera is started.

Expected Output from Metavision Sync Sample

How to start

To start the sample, first run the slave camera:

Linux

python3 metavision_sync.py -s SERIAL_NUMBER -m slave

Windows

python metavision_sync.py -s SERIAL_NUMBER -m slave

Then start the master camera:

Linux

python3 metavision_sync.py -s SERIAL_NUMBER -m master

Windows

python metavision_sync.py -s SERIAL_NUMBER -m master

Warning

When starting the second camera (the master), you may get an error message similar to [HAL][ERROR] Camera is busy (r=-6). This error message can be safely ignored. It is only an symptom of the sample trying to connect to all the connected cameras to retrieve their serial number, and randomly trying the slave first which is already connected (i.e. “busy”).

To check for additional options:

Linux

metavision_sync.py -h

Windows

metavision_sync.py -h

Note

You cannot run this sample from a pre-recorded RAW file, as the synchronization only works with live camera. RAW files recorded with synchronized cameras will have synchronized timestamps, but can be played separately using any available RAW player.

Code Notes

The code of this sample is similar to the one of the Metavision Simple Viewer. The synchronization part was added using the two functions metavision_hal.I_DeviceControl.set_mode_master and metavision_hal.I_DeviceControl.set_mode_slave.