Stereo Camera Setup with Blackfly S Mono USB3 Vision Cameras

The Cameras

2Blackfly S Mono 3.2 MP USB3 Vision Camera
16 pins, 1m GPIO Cable, Hirose HR10 Circular Connector
2USB 3, 1m, Type-A to Micro-B Cable

The most important component of the setup is the cameras, so I picked the cameras I wanted first, then built up the rest of the rig around them. I decided to go with two Flir Blackfly S Mono USB3 vision cameras; I went with these cameras because they offer a good overall balance between image quality, resolution, price, and they use Flir’s Spinnaker SDK. They were also the newest cameras released by Flir at the time and it always feels good to be on the cutting edge.

These cameras use a primary/secondary setup for synchronized capture. One camera (in my case, the left camera) is set as the “primary”. This camera will acquire the image and uses a “trigger” to send a signal to the other camera to acquire an image at the same time.

There are two types of triggers:

  1. Software trigger – Basically, the program handles the synchronization by sending a signal to the secondary camera via USB; a direct physical connection between both cameras is not required.
  2. Hardware trigger – This requires a direct physical connection between both cameras via GPIO cable (The Blackfly S specifically needs a 6-pin GPIO cable). The primary camera sends a strobe directly to the secondary camera via GPIO at the beginning of the image acquisition, which triggers the secondary camera to acquire an image.

The hardware trigger provides better synchronized capture, so that’s the route I went with. The documentation for synchronized capture for the BlackFly S states the following GPIO connection is required:

After a trip to RadioShack and some soldering (the resistor uses Brown, Black, Orange, Gold color code…):

This will allow for synchronized capture via hardware trigger, although both cameras will still need to be set up via the Spinnaker API (I’ll go over this in the next article).

The Optics/Lighting

212mm Focal Length, HP Series Fixed Focal Length Lens
1AmScope 6 Watt LED Dual Gooseneck Lights Illuminator

The next component to consider is the optics. The first step is determining the required focal length of the lens. The pertinent equation (from here) is:

f = \frac{h*WD}{FOV}


  • f = focal length in mm
  • h = horizontal sensor size in mm
  • WD = working distance in mm
  • FOV = horizontal field of view in mm

There are a few constraints that I need to be satisfied:

  • FOV ~= 100 mm
  • WD ~= 200 mm

In addition, the sensor for the Black Fly S is a Sony IMX252 which has a “sensor type” of 1/1.8″ which has a width of 7.18 mm and a height of 5.32 mm; hence:

  • h = 7.18 mm


f = \frac{7.18*200}{100} \approx 14.36 mm

However, the lens I was looking at came in either 12 mm or 16 mm focal lengths. 12 mm results in a slightly larger FOV which I’m ok with, so I went with the 12 mm lens. Furthermore, the lens itself actually has adjustable focus, so that gives additional wiggle room.

The next thing to consider is the depth of field. Since stereo cameras will need to acquire images with depth information, the lens should have a large depth of field (i.e. objects with a varying range of distances should be in focus at the same time). Smaller apertures result in a larger depth of field. This lens actually has an adjustable aperture; the aperture is typically adjustable in increments called “f-stops”, with larger “f-numbers” corresponding to smaller apertures. I’ve gone ahead and set this lens to a large f-number, although it’s important to realize that smaller apertures mean less light will hit the sensor. So, to compensate you will either need to increase the exposure (not ideal, since any movement during acquisition will be acquired during the exposure window, and may result in a blurry image), increase the gain (again, not ideal, as it increases noise), or increase the lighting (most ideal, but requires a light source).

It’s also important to check the maximum sensor format supported (this lens has a max of 1.1″) and the mount type (this lens is a C-Mount). Both of these requirements are met by this lens and the Blackfly S.

The “Rig”

260mm Rotary Stage
1250mm Travel Metric Long Travel Rack
2One Knob Stage
2M16 x 1.0 Male to M6 x 1.0 Male
2M6 x 1.0 Female and ΒΌ-20 Male
226.9mm by 17.9mm, 1/4"-20 Tripod Adapter
1M4x0.7 x 16 SHCS, 50/Pack

The most important requirement for the rig is it must be sturdy; if it isn’t, then there might be relative movement between the cameras which would ruin the calibration. In my case, I’d also like the relative camera positions to be adjustable.

The rack and pinion allows the baseline to be adjusted while the rotary stages allow the relative angles to be adjusted to modify the working distance. Most everything on this list is machined metal with relatively high tolerances, so rig is very sturdy, yet adjustable.

The Assembled Stereo Camera Setup

After carefully assembling everything, the overall setup looks like:

The next step is to configure the cameras for synchronized capture via the Spinnaker API. This is discussed in the next article.

Leave a Reply

Your email address will not be published. Required fields are marked *