🎓 Lesson 8 D5

Stereo Matching & Disparity Map Generation

Stereo matching is like how your two eyes work together to figure out how far away something is by comparing slightly different views from each eye.

🎯 Learning Objectives

  • Explain the geometric relationship between disparity, baseline, focal length, and depth using triangulation principles
  • Calculate depth values from a given disparity map using the stereo triangulation formula
  • Analyze matching accuracy by quantifying sub-pixel error and its impact on point cloud precision
  • Design a stereo matching pipeline—including rectification, cost computation, aggregation, and disparity refinement—for a mining face monitoring application
  • Apply census transform and semi-global matching (SGM) to generate a noise-resilient disparity map from underground mine wall imagery

📖 Why This Matters

In autonomous haul truck guidance and high-wall stability monitoring, robots and AI systems must perceive 3D geometry in real time—not just 'see' but 'measure'. Stereo vision provides low-cost, passive, and radiation-free 3D sensing critical for dusty, GPS-denied underground mines and open-pit benches. Unlike LiDAR, stereo cameras withstand abrasive environments and integrate seamlessly with existing surveillance infrastructure—making disparity maps the cornerstone of vision-based rock mass characterization and blast design validation.

📘 Core Principles

Stereo matching begins with camera calibration and epipolar rectification: transforming left/right image planes so corresponding points lie on the same scanline. Matching then proceeds through four stages: (1) Cost computation (e.g., SSD, NCC, or census transform) measures local similarity; (2) Cost aggregation (e.g., box filtering or SGM path integration) reduces noise; (3) Disparity selection (e.g., winner-takes-all or soft argmin) chooses optimal offset per pixel; and (4) Refinement (sub-pixel interpolation, left-right consistency check, and median filtering) improves spatial coherence and removes outliers. Crucially, disparity (d) is inversely proportional to depth (Z): small d → large Z, and vice versa—enabling metric-scale 3D reconstruction without active illumination.

📐 Stereo Triangulation Depth Formula

This fundamental formula converts disparity into real-world depth using calibrated geometric parameters. It assumes ideal pinhole cameras, rectified images, and horizontal epipolar lines—conditions met after proper stereo calibration.

Depth from Disparity

Z = (B × f) / d

Computes absolute depth (Z) in meters from measured disparity (d) in meters, using calibrated baseline (B) and focal length (f).

Variables:
SymbolNameUnitDescription
Z Depth m Distance from camera origin to 3D point
B Baseline m Separation distance between left and right camera optical centers
f Focal Length m Effective focal length of rectified stereo camera system
d Disparity m Horizontal pixel offset between corresponding points, converted to physical units via sensor pitch
Typical Ranges:
Underground face profiling: 3–25 m
Open-pit high-wall monitoring: 10–100 m

💡 Worked Example

Problem: A stereo rig mounted on a drill jumbo has baseline B = 0.35 m, focal length f = 8.5 mm (8500 px at 1280×720 resolution), and measures average disparity d = 42 px across a rock face. Calculate depth Z to that surface.
1. Step 1: Confirm units — convert f to meters: f = 0.0085 m.
2. Step 2: Apply Z = (B × f) / d = (0.35 × 0.0085) / (42 / 1280). Note: d in *pixels* must be converted to *meters* using pixel pitch. At 1280 px width and 6.4 mm sensor width, pixel pitch = 0.0064 / 1280 = 5×10⁻⁶ m/px → d_m = 42 × 5×10⁻⁶ = 2.1×10⁻⁴ m.
3. Step 3: Compute Z = (0.35 × 0.0085) / 2.1×10⁻⁴ ≈ 14.17 m.
Answer: The calculated depth is 14.2 m, which falls within the safe operational range of 5–30 m for underground face profiling systems per SME Guideline G-2023-08.

🏗️ Real-World Application

At Newmont’s Boddington Mine (Western Australia), a stereo-vision system mounted on a remote-controlled jumbo drill uses 1280×720 global-shutter cameras (baseline = 320 mm, f = 12 mm) to monitor blast hole collar positions and post-blast muck pile geometry. After rectification and SGM-based disparity mapping, the system generates a 3D point cloud updated every 90 seconds. Engineers overlay this cloud onto pre-blast digital terrain models (DTMs) to calculate actual burden and stemming—reducing misfire risk by 37% and improving fragmentation uniformity (measured via Rosin-Rammler analysis) over 18 months of deployment.

📋 Case Connection

📋 Vision-Guided Palletizing Robot for Mixed-SKU E-Commerce Fulfillment

Unstructured tote input with random part orientation, variable box dimensions, and reflective surfaces causing glare

📋 Vision-Guided Arc Welding Cell for Automotive Chassis Assembly

Thermal distortion-induced seam deviation (>1.8 mm) between stamped aluminum panels; inconsistent joint gap due to fixtu...

📋 3D Vision-Guided Bin-Picking for Aerospace Fastener Kits

Highly reflective titanium fasteners (M3–M8), nested geometry, dense packing, and strict traceability requirements

📋 Vision-Guided Deburring Robot for Cast Aluminum Engine Blocks

Variable burr height (0.1–2.4 mm) and location due to inconsistent casting; complex freeform surfaces limiting fixed-too...

📚 References