# Depth from two calibrated views

Run `python generate.py` with matplotlib to reproduce 573 geometry rows, eight boundary cases, metadata, validation and two original figures in PNG/SVG/PDF. The calculations describe ideal rectified parallel pinhole cameras, not measured camera performance.

The assigned focal length is 800 pixels. Baselines are 0.05, 0.10 and 0.20 metres, and axial depths span 1–20 metres in 0.1 metre steps. With correct correspondence and matched principal points, disparity d=f*B/Z. Inversion Z=f*B/d gives depth along the optical axis, not Euclidean distance to a point. Calibration, image rectification and correspondence are treated as exact.

Two different uncertainty concepts are deliberately separate. A hypothetical disparity standard uncertainty sigma_d=0.5 pixels gives conditional first-order sigma_Z=f*B*sigma_d/d². This is a local derivative-based approximation, not a confidence interval. Its small-error premise weakens at the farthest depth and smallest baseline, where sigma_d/d=0.25; the figure explicitly calls out that limit. No Gaussian distribution or exact stochastic depth moments are claimed.

Separately, an assigned deterministic bound of ±0.5 pixels gives the exact positive-depth interval [fB/(d+0.5),fB/(d−0.5)] when d>0.5. For positive disparity at or below 0.5 pixels, the positive-depth upper bound is unbounded and represented by null with an explicit flag. A zero baseline or zero measured disparity gives no finite nominal estimate. Negative or nonfinite parameters are rejected. Do not label this deterministic interval 95% or derive it from the standard uncertainty.

Reference example: B=0.1 m and Z=2 m give d=40 pixels. The local standard uncertainty is 0.025 m, whereas the separate bounded interval is [1.975308642, 2.025316456] m. Zero assigned standard uncertainty gives zero conditional propagated uncertainty only under the ideal assumptions; it does not establish perfect real-camera accuracy.

Checks independently finite-difference the depth inverse (maximum relative disagreement 1.11e-10), reconstruct every input depth, invert both finite interval endpoints back to their disparity limits, exercise unbounded/zero cases and reject six invalid inputs. Boundary CSV blanks mean unavailable/unbounded as identified by its flags, not numeric zero.

The model excludes texture ambiguity, matching outliers, occlusion, reflections, motion, distortion and calibration drift. A larger baseline reduces this ideal conditional sensitivity but may impair overlap and matching. No display, visual-comfort, head-tracking or live-tissue capability follows from these curves. Such topics require distinct explanations and evidence.

Geometry context: [OpenCV stereo depth documentation](https://docs.opencv.org/4.13.0/dd/d53/tutorial_py_depthmap.html), verified in the chapter coverage/source review. It supports disparity geometry and matching caveats; no numerical camera performance is borrowed here.
