pub fn triangulate_points(
pts_a: &[(f32, f32)],
pts_b: &[(f32, f32)],
baseline: f32,
focal: f32,
) -> Vec<(f32, f32, f32)>Expand description
Triangulate 3D points from two camera views. Triangulate 3-D points from corresponding 2-D observations in a rectified stereo pair.
Uses the disparity d = pts_a.x - pts_b.x together with the known
baseline (distance between cameras) and shared focal length to recover
depth:
Z = baseline * focal / disparity
X = (u - cx) * Z / focal (cx assumed 0 here)
Y = (v - cy) * Z / focal (cy assumed 0 here)Points with zero or negative disparity are placed at the origin (0, 0, 0).