Unit 28 · Semester 2 · geometry
Camera and multiview geometry
Mission: Recover a marker’s depth from two views, then find when that estimate fails.
The interactive version of this unit needs JavaScript. Below are its steps as text.
Steps
1. One view leaves a ray
Press Show one view. Follow the orange marker to its position in the left image.
Why it matters: A camera collapses a 3D scene onto an image. Other points on the same viewing ray produce the same pixel, so one image location alone does not determine depth.
2. Find the same marker twice
Press Match the marker. Compare the orange marker in the left and right image panels.
Why it matters: Both observations must belong to the same physical point. This association is called correspondence. Matching another marker can produce a convincing but incorrect intersection.
3. Give the two views a measured separation
Press Reveal separation. Read the camera centers and the blue baseline arrow.
Why it matters: The distance between camera centers is the baseline. In this aligned rig, a point shifts horizontally between views. That pixel difference is disparity; here it is 60 px.
4. Intersect the two viewing directions
Press Recover depth. Compare the recovered marker with its known synthetic location.
Why it matters: Combining the directions from two known camera poses is triangulation. For this aligned setup, depth is focal length × baseline ÷ disparity. The calibrated focal length in pixels sets the image scale. Ground truth is used to assess the answer, never supplied to the reconstruction.
5. Recover more than depth
Press Recover three points. Read X, Y and Z for all three markers in the adjacent results.
Why it matters: Use X right, Y down and Z forward in metres. The camera’s image center and focal length convert directions in pixels to those coordinates. A consistent convention makes the result interpretable.
6. Move the pixels, keep the scene fixed
Press Add pixel noise. Compare the seed-1 observations and reconstructed positions with the noiseless case.
Why it matters: Pixel uncertainty changes the direction of each inferred ray. Vertical disagreement is a diagnostic for this aligned model; the reconstruction uses their mean vertical coordinate. This simplified estimator does not solve arbitrary rotated-camera geometry.
7. Plot depth error against pixel noise
Press Run noise sweep. Read both the graph axes and the valid/invalid counts.
Why it matters: Root mean squared depth error summarizes squared depth differences, then takes a square root. It uses valid cases only. A smaller conditional error can hide rejected cases, so every point includes the invalid count.
8. Keep the whole experiment
Press Inspect sweep records. Inspect all five summary rows and the first seed’s raw observations.
Why it matters: A reproducible experiment records poses, intrinsics, point coordinates, noise, sampling and all outcomes. The plotted worked example is generated software data. Your own run and interpretation belong in the separate blank notebook.
9. Try a much smaller baseline
Press Shrink baseline. Compare the orange small-baseline curve with the blue 0.2 m reference.
Why it matters: A small baseline produces a small disparity. The same pixel error is a larger fraction of that difference. Near zero disparity, the division becomes sensitive; finite samples need not improve monotonically.
10. Remove the baseline completely
Press Set zero baseline. Read the invalid count rather than treating the empty plot as zero error.
Why it matters: Two identical viewpoints do not provide independent depth directions. Random pixel differences do not create a physical baseline. This is a degenerate configuration: depth is not constrained by the two views.
11. Tell the reconstruction the wrong translation
Press Double assumed baseline. Keep the actual cameras at 0.2 m while the reconstruction assumes 0.4 m.
Why it matters: A camera center and a world-to-camera translation are related but different. The right center is +0.2 m along X; its translation is −0.2 m. An incorrect scale in this transform can preserve image reprojection while giving the wrong metric depth.
12. Check direction before trusting a number
Press Reverse assumed direction. Inspect the failure reason, then use Play to restore and compare the cases yourself.
Why it matters: Check the coordinate convention, correspondence and camera transform before interpreting a depth. General moving or rotated cameras require the correct transforms and calibration or rectification. This lesson deliberately models only parallel aligned cameras.
Go deeper
Coordinates and the restricted model
X points right, Y down and Z forward. Camera centers and point coordinates use m. Both camera rotations are identity. The right center C=(B,0,0) gives world-to-camera translation t=−C. Images are 640 × 480 px with f=600 px and principal point (320,240) px. We assume known calibration, known correspondence, no distortion, no rolling shutter and a static scene. Real rotated or moving cameras require correct transforms and rectification or a more general triangulator.
uL = f X/Z + cx; vL = f Y/Z + cy uR = f (X−B)/Z + cx; vR = f Y/Z + cy d = uL−uR; Z = f Bassumed/d X = (uL−cx) Z/f; Y = ((vL+vR)/2−cy) Z/f dZ/dd = −f B/d²; approximate depth sensitivity grows as disparity shrinks.
What the experiment does and does not establish
Noise is independent Gaussian perturbation of each of four image coordinates. Park–Miller uses multiplier 16807 and modulus 2147483647; each normal draw uses two fresh uniforms in Box–Muller, without caching. Every seed generates all three markers, in order uL,vL,uR,vR, even for zero noise. The same seed repeats those perturbations at every level and baseline. Every sweep retains 60 cases per level. Invalid: zero actual/assumed baseline, out-of-frame observation, disparity ≤0.000001 px, or nonpositive reconstructed depth. All-invalid RMSE is unavailable. A finite sample’s error need not be monotonic; a tiny-baseline result may have large tails. Vertical residual is vL−vR in px. Reprojection RMSE uses both 2D image errors per point and may remain small under wrong metric scale.
Known 3D truth only generates images and assesses errors. The image estimator receives pixels and assumed geometry. Real correspondence, calibration, distortion, occlusion, timing and camera motion can fail in ways this simple model does not simulate. This is a self-study resource, not accredited study or validation of learner work.