ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

synchronizing two point grey USB cameras for Stereo using OpenCV?

asked 2013-04-16 11:17:46 -0500

Gaviria R gravatar image

updated 2014-01-28 17:16:12 -0500

ngrennan gravatar image


I have two Firefly MV USB cameras from PoinGrey which are working with the Camera1394 node, Im able to view the images and create an package containing c++ code which uses the cv_bridge node to integrate the stream from both cameras and perform a simple color inversion process on the frames of the images on OpenCV , thanks to this handy tutorial on the web at

Now I would like to get up and running with synchronizing the two cameras (externally) and hopefully calculate the disparity. Currently I synchronize the cameras by enabling a strobe signal (output) and a trigger (input) on the two cameras by setting registers manually using Coriander . However this seems quite inefficient as I have to do it every time the cameras are turned on and is susceptible to errors on my behalf.

So the questions I ask are:

  1. What is the best way for me to get and set registers dynamically on the Firefly MV (IIDC 1.3 Compliant) camera? Should I use libdc1394 if so could someone please give me an example or a quick guide?
  2. Once the cameras are synchronized I will need to poll the cameras so that one camera waits for the completion of the other cameras frame capture process. Does ROS provide a solution for this? If not how can I program the cameras to do this?

Apologies if the question is very trivial, but im only just starting with OpenCV and ROS. I would greatly appreciate some help.

UPDATE: Ok, Since my software skills are not up to scratch yet I have not yet been able to set the camera regiasters through the 1394 library in order to poll the cameras to wait for a each other to complete their . However I am sure its possible but I just dont know how to.

Anyways to synchronise the cameras I made an external hardware trigger using a 555 timer circuuit which was able to synchronize my images to a 0.015s delay, by enabling a trigger at a specified frequency.

edit retag flag offensive close merge delete


What was the max frame rate you got from your PGR camera ? Using the external 555 timer sync.

zcream gravatar image zcream  ( 2014-03-26 01:13:39 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-04-16 14:59:54 -0500

joq gravatar image

updated 2013-04-17 08:04:56 -0500

  1. The camera1394 driver just supports the IIDC specification. It does not provide that kind of device-dependent processing. Check with Point Grey. They may provide information on how to write a separate program to enable the hardware synchronization.

  2. There is a brief camera1394 tutorial with examples of how to combine two cameras into a stereo pair.

edit flag offensive delete link more


I did as in the tutorial and it works, thanks! But my issue is that since the images are synchronised using a Master-Slave set up the Master should wait until the slave completes the capture process triggered by the master until a new capture process can start. Do you know how this can do this?

Gaviria R gravatar image Gaviria R  ( 2013-04-16 23:56:13 -0500 )edit

Camera1394 does not support that. Each driver node runs independently. The stereo image pipeline puts the images together using the approximate time synchronization parameter.

joq gravatar image joq  ( 2013-04-17 08:01:02 -0500 )edit

joq thanks for the reply I appreciate the help. I managed to get a workaround in order to get the images synchronised without having to worry about the Polling issue. I will update my post soon.

Gaviria R gravatar image Gaviria R  ( 2013-04-21 07:52:44 -0500 )edit

answered 2015-04-25 15:59:59 -0500

Kozuch gravatar image

If your Firefly MV cameras have no image buffer (and the current specs say so) I think you are never going to achieve a good (say 1ms-level or better) sync if you have them both on the same USB bus and most likely even on separate buses. For a precise sync you need cameras with frame buffer memory - Point Grey has 16 or 32 MB on many of its models.

You say you have a 15 ms (0.015s) sync which almost certainly mean the cameras are read in series. You are never going to achieve a sync better that what the duration of first camera readout will be. You may push this delay time down by choosing a lower resolution (via pixel binning etc.) and thus get higher FPS and faster image readout but that probably will never be around 1ms. Your delay is 15 ms which would point to about 60 FPS.

So long story short - go and get buffered cameras for much better stereo sync.

edit flag offensive delete link more


To update my answer: I asked PG about image buffer on Firefly MV and they confirmed is has one (but probably only for a single image). Also, some of PG technical notes mention a "FIFO buffer" on FFMV cameras. This implies you should be able to sync cameras - you just need to externally trigger them.

Kozuch gravatar image Kozuch  ( 2016-01-12 10:17:00 -0500 )edit

Question Tools



Asked: 2013-04-16 11:17:46 -0500

Seen: 6,523 times

Last updated: Apr 25 '15