You have one camera, a way to slide it exactly sideways, and a depth map to build. Shooting the scene twice — once from each end of the slide — replaces a two-camera stereo head, and the processing pipeline barely changes: intrinsics come from one checkerboard session, extrinsics from a fresh fit for every pair. This guide is for engineers prototyping 3D measurement, bin inspection or robot guidance without committing to a stereo rig. You will calibrate the lens once, fit each pair with the intrinsics frozen, choose the slide distance from the numbers that drive depth error, and recognise the jobs where two stills are the wrong tool and an integrated 3D sensor is the right one.
Does a stereo pair from one moved camera work?
Yes — the stereo geometry only needs two views of the same static scene from two positions, and it cannot tell two simultaneous sensors from one camera shot twice; the baseline is simply the distance between the two capture positions.
Depth from stereo needs three things: two perspective centres separated by a baseline, the same intrinsics in both views, and scene points visible in both images. It is silent on whether those views arrived at the same instant. Two exposures from one camera slid sideways meet all three, which is why this is how photogrammetry has always worked: one calibrated camera, many stations, every pair solved for its own pose.
The shortcut has a cost. A hardware head keeps its extrinsics for life, so you calibrate once; a moved camera changes pose every time, so every pair is its own small calibration problem. And the scene must hold still between exposures — a fan-blown label or a vibrating conveyor destroys the pair before any software runs.
Slide, don't swing: translate the camera parallel to the sensor plane, keep the distance to the part constant, and lock focus and iris mechanically before the first exposure. A webcam that refocuses between shots changes the principal distance and silently invalidates the intrinsics mid-job.
Which functions calibrate a single camera used this way?
Run the single-camera routine calibrateCamera once on 15-20 checkerboard images to fix focal length and distortion, then call stereoCalibrate separately for every captured pair with CALIB_FIX_INTRINSIC, so each pair returns its own rotation R and translation T rather than reusing one extrinsic set.
Split the job the way the library splits it. calibrateCamera estimates the intrinsics — focal length in pixels, principal point, distortion coefficients — and those parameters hold for every later pair as long as focus, iris and lens stay untouched. stereoCalibrate then solves only the pose between the two exposures: feed it the object points, the corner sets from both images and the intrinsics with CALIB_FIX_INTRINSIC set, and it returns R, the rotation between the two stations, and T, the translation — your baseline.
Run it once per pair. Extrinsics describe the relative position of two captures, not of two bolted-together cameras, so a new move means a new T. Never copy a previous pair's translation into a new job: depth follows Z = f_px·B/d, so a baseline assumed 100 mm on a true 95 mm move inflates every depth by 5%.
Keep one intrinsics set across all pairs — that is the point of the fixed-intrinsics flag — and recalibrate only when focus, zoom or the lens itself changes. Treat 0.5 pixels of reprojection RMS as the working bar; if a fit comes back worse, the usual culprits are covered in why stereoCalibrate RMS comes back too high. The per-pair step is exactly the extrinsics-only stereo calibration with fixed intrinsics case, and the single-camera session itself is laid out in calibrating one camera when there is no stereo pair.
How far should you move the camera between shots?
Slide sideways by one tenth to one fifth of the working distance: at Z = 500 mm, a 50-100 mm move keeps disparity comfortably above matching noise while leaving about three quarters of the scene visible in both shots.
d is the disparity in pixels, f_px the focal length in pixels, B the baseline and Z the depth to the part; B and Z share units, so the recommended move scales with working distance.
The fraction rule is self-adjusting. Move the camera Z/10 and the disparity lands at one tenth of the focal length in pixels — 432 px for a 4324 px focal length — whether the part sits at 300 mm or 3 m. Move Z/5 and the disparity doubles, roughly halving the depth error at the cost of overlap.
Overlap is the limit on the long side. A point is matchable only where both images see it: with a 4000-pixel-wide image and 865 px of disparity, the common field is about 78% of the frame. Keep disparity below roughly half the image width and matching stays comfortable. Keep the move straight and level — a rail or a machined edge beats a free hand.
What are the steps for one pair, start to finish?
Eight steps cover it: lock focus, calibrate intrinsics once, shoot the static scene twice with a measured sideways move, detect checkerboard corners in both images, fit R and T per pair with fixed intrinsics, rectify, match disparities, then convert to metric depth.
- Lock the lens. Tape the focus and iris rings, fix the exposure, and keep that state for the whole job.
-
Calibrate intrinsics once. Shoot 15-20 views of a flat, matte checkerboard — corners filling every region of the frame, board tilted up to about 45° — run
calibrateCamera, and accept the session at 0.5 px RMS or better. - Enter the square size in millimetres. Metric depth falls out of this number: a 0.2 mm error on a 20 mm square is a 1% scale error, worth 5 mm of depth at 500 mm, so measure with calipers.
- Stage the scene. Nothing moves between exposures. If the part is textureless, tape a small checkerboard beside it so the pose fit has correspondences and the depth stays metric.
- Shoot the pair. First exposure, slide B = Z/5 (100 mm at a 500 mm working distance) along the rail, second exposure. Do not touch focus.
- Detect corners. Find the checkerboard corners in both images and refine them to sub-pixel positions.
-
Fit the pose. Run
stereoCalibratewithCALIB_FIX_INTRINSIC, the two corner sets, the object points and the intrinsics from step 2. Multiply T by the square size for millimetres. If the horizontal component comes back with the wrong sign, the image order is flipped — see when a negative baseline means your cameras are flipped. - Rectify, match, convert. Build the undistort-and-rectify maps from the calibration, apply them to both images, run a block-matching or semi-global-matching disparity pass on the rectified pair, then compute Z = f_px·B/d per pixel. Probe a feature of known geometry before trusting the map.
How accurate is depth from two stills?
Depth error from matching noise follows ΔZ = Z²·Δd / (f_px·B): a 12 MP camera with an 8 mm lens and a 100 mm baseline lands near 0.17 mm at 500 mm for 0.3 pixels of matching error, and near 0.7 mm at 1 m.
Work it through with a real sensor. The LS-CMR-0166 resolves 4000 × 3000 pixels on a 1/1.7" sensor. A 1/1.7" sensor is about 7.4 mm wide, so the pixel pitch is 7.4 / 4000 = 1.85 µm, and an 8 mm lens gives a focal length of 8 / 0.00185 = 4324 px.
Slide 100 mm at a 500 mm working distance and the numbers fall out like this:
- Disparity: d = 4324 × 0.1 / 0.5 = 865 px, about 22% of the image width, leaving a 78% common field.
- Matching-noise floor at 0.3 px: ΔZ = 0.5² × 0.3 / (4324 × 0.1) = 0.075 / 432.4 ≈ 0.00017 m = 0.17 mm.
- Same rig at 1 m: d = 432 px and ΔZ = 1² × 0.3 / 432.4 ≈ 0.00069 m = 0.7 mm — four times worse at twice the distance, the Z² term at work.
- Sensor format
- 1/1.7"
- Interface
- USB3
- Resolution
- 12 MP
- Shutter
- Rolling
These are matching-noise floors, and they assume a matte, textured surface, sub-pixel corners and the 0.5 px intrinsics bar. Scale errors ride on top: the whole map stretches in proportion to any error in the checkerboard square size or the fitted baseline, which is why the calipers matter in step 3.
Which camera and lens suit this workflow?
Because every frame is a still, shutter type drops out of the decision; pick mono for cleaner checkerboard corners, a C-mount lens with locked focus and manual iris, and as many pixels as the job allows, since depth error falls in proportion to the focal length in pixels.
Rolling shutter is harmless when nothing moves during either exposure, so choose by pixels and lens, not by scan mode. Resolution earns its keep twice: more pixels raise f_px for the same field and give the matcher more texture to lock onto. Mono sensors produce crisper checkerboard corners than colour, though colour works. Interface hardly matters at two frames per job — pick USB3 or GigE to suit the host.
The lens needs mechanical focus and iris, low distortion for gentle rectification resampling, and a focal length that puts the field where you want it: at 500 mm, an 8 mm lens on a 1/1.7" sensor covers about 460 mm wide, while the same lens on a 1" sensor covers about 800 mm. If you start from the field of view and working distance instead, size the focal length here:
- Sensor format
- 1"
- Lens mount
- C-mount
- Interface
- USB3
- Resolution
- 16-25 MP
The MV-CS200-10UM pairs a 20 MP mono IMX183 sensor — 1" format, C-mount, USB3.0 — with the same slide, and at the same field of view a 20 MP sensor carries more pixels across than a 12 MP one, pushing the depth-noise floor down further. Browse the rest of the area scan cameras or the camera finder and match sensor format to your field.
When is a two-shot rig the wrong tool?
Two stills fit static parts, prototypes and offline measurement; a moving scene, a conveyor or a per-cycle production check needs an integrated 3D sensor that builds its own baseline in one exposure.
Any motion between the exposures corrupts the pair before software runs, and a two-exposure cycle will never sit inside a takt time. The moment the job becomes production metrology or in-line guidance, move the geometry into the sensor:
- Type
- Laser profiler
A 3D laser profile sensor from the DP4000 series sweeps a profile across the part and builds height in one pass — the natural fit for seams, adhesive beads and flatness on the line. For pallet and parcel volume over an area, structured light does the same job with its own projected pattern:
- Type
- Stereo / structured light
A projected structured-light camera projects the texture it needs, so it also solves the featureless-part problem the two-shot method struggles with. The 3D sensors category holds the full range, and choosing 2D versus 3D for conveyor pick and place walks the system-level decision. If you pick an integrated stereo depth camera rather than a profiler, budget for its own behaviour: this guide to depth jitter and IMU drift on stereo depth cameras lists the symptoms and the checks.
What checks do you run before trusting the numbers?
Accept a session only when three gates pass: single-camera reprojection RMS of 0.5 pixels or less, per-pair stereo RMS of about 1 pixel or less, and matched features landing on the same row in both rectified images within about 1 pixel.
- Calibration inputs — 15-20 board views, squares measured with calipers, sub-pixel corners, intrinsics RMS at or below 0.5 px. A session above that bar biases every later pair.
- Per pair — the two frames identical in every static region, a fresh R and T fitted, and the fitted baseline within a few percent of the tape-measured slide distance. A persistent gap points at square-size error or a moved focus ring.
- Rectification — the same physical feature sits on the same row in both rectified images, within about 1 px; larger offsets mean a bad pose fit and a smeared disparity map.
- Disparity and depth — a known feature's disparity within a few percent of f_px·B/Z, few speckles in flat areas, and a probe of a part with known height landing inside tolerance; pin the translation against a known distance as in calibrating with a known distance to fix the Z translation.
To build the camera side of the rig, start at the camera configurator; the 3D topic page collects the rest of the calibration and depth guides, and developing 3D inspection without hardware: the record-once workflow shows how to replay captured pairs while the pipeline comes together.
Questions
Can a webcam or a phone camera produce usable stereo pairs?
Yes, for bench work and algorithm development. Lock the focus — a phone refocuses constantly, so shoot in a mode that fixes focal length — and keep the lighting steady. For repeatable measurement, an industrial camera with a manual iris and taped focus rings removes the autofocus problem entirely, and its calibration holds across many sessions rather than one.
Does the checkerboard have to sit inside every scene pair?
For the per-pair pose fit with fixed intrinsics, the routine needs point correspondences, and a board supplies them reliably. Without a board you can match natural features and decompose the essential matrix, but the result then carries an unknown scale unless you measure the physical slide distance. A small board beside the part is the simple way to keep depth metric.
How do I read the baseline out of the calibration result?
Take the length of the translation vector T, which comes out in board-square units when your object points are entered in squares, and multiply by the square size in millimetres. Compare with your tape-measured slide distance: agreement within a few percent is normal, and a persistent gap points at square-size error rather than the solver.
What can I do when the part itself has no texture?
Disparity matching needs edges or a pattern to lock onto. Stick a removable random-dot sheet beside or behind the region of interest, project a dot pattern with a separate projector, or move to a structured-light camera that supplies its own pattern. A featureless white surface otherwise produces holes in the disparity map that no tuning closes.
Can this workflow run on a moving conveyor?
No — the scene must be identical in both exposures, and a conveyor part is not. For moving parts use a 3D laser profile sensor or a line-scan 2.5D system, which captures height in a single pass and needs no second station. Two-shot stereo belongs to static parts, fixtures and offline measurement.



