TH /TannoHubYOSHINOBU TANNO日本語 ↗
Data Analysis & Computer Vision

Stereo camera depth: calibration, disparity, and the factor of 16

Read a stereo camera project through calibration, rectification, disparity scaling, and depth units, with clarifications to the 2013 slides.

← All technical notes

Original material: 2013-05 · Article edited:

Adapted from Yoshinobu Tanno’s published slides with AI assistance. Historical implementation details are distinguished from added explanations.

Read the original slides: ステレオカメラ作成の道

A stereo camera needs more than two simultaneous images. Separate mounting, calibration, rectification, disparity, and reprojection to find where an incorrect depth value originates.

The original project

The 2013 project used two C920 cameras, C#, OpenCVSharp 2.4.5, OpenCV 2.4.5, and Visual Studio 2012. Its slides cover checkerboard capture, image correction, block matching, and depth conversion. These are historical versions, not current installation recommendations. Original slides, 4–10.

Check each stage

  1. Fix the cameras so their relative pose remains stable after calibration.
  2. Capture checkerboard pairs at varied positions and angles.
  3. Calibrate using image corners and separately defined board coordinates.
  4. Rectify and check that corresponding points align horizontally.
  5. Calculate disparity, reject invalid values, and reproject.

Clarify the terminology

Corner detection provides image coordinates, not the board's world coordinates. Keep camera intrinsics, lens distortion coefficients, and the relative camera rotation and translation distinct. OpenCV calibration reference.

The factor-of-16 trap

The signed 16-bit disparity produced by StereoBM can contain values scaled by 16. Convert that format to floating point and divide by 16 before calling reprojectImageTo3D. Do not interpret the original slide's brief scaling comment as a universal instruction to multiply depth. OpenCV reprojection specification.

For a simplified rectified stereo model, Z = f × B / d. With f=700 pixels, B=0.10 m, and d=35 pixels, the example depth is 2.0 m. This is a dimensional check, not a measured project result. Use the calibration's Q matrix for the actual reprojection.

When depth looks wrong

Check rectification, calibration units, duplicate scaling, and invalid matches in textureless or occluded regions. Increasing the number of distortion coefficients is not a universal accuracy fix. Current hardware accuracy has not been revalidated.

Related reading and work

For collaborative research, technical validation, or learning-material development, discuss a project.