PIXELBANKv9.1.0
Menu

Multi-View Triangulation Error

Compute the total reprojection error for a 3D point observed in multiple camera views.

In Structure from Motion (SfM), we triangulate 3D points from multiple 2D observations. The quality of a triangulated point is measured by its reprojection error - how well it projects back to the observed 2D locations.

For each view ii, the reprojection error is: ei=βˆ£βˆ£Ο€(Ki,Ri,ti,X)βˆ’pi∣∣2e_i = ||\pi(K_i, R_i, t_i, X) - p_i||^2

where Ο€\pi projects the 3D point XX to 2D, and pip_i is the observed 2D point.

Total error is the sum across all views: Etotal=βˆ‘iei=βˆ‘i((uiβˆ’u^i)2+(viβˆ’v^i)2)E_{total} = \sum_i e_i = \sum_i ((u_i - \hat{u}_i)^2 + (v_i - \hat{v}_i)^2)

Lower error indicates better triangulation.

Example:

Input:
triangulation_error([0, 0, 10], [([[1000,0,320],[0,1000,240],[0,0,1]], [[1,0,0],[0,1,0],[0,0,1]], [0,0,0], [320, 240])])
Output:
0.0
Reasoning:

Point at (0,0,10) with identity pose:

  1. Transform to camera: X_cam = IΓ—[0,0,10] + [0,0,0] = [0,0,10]
  2. Project: u = (1000Γ—0 + 320Γ—10)/10 = 320 v = (1000Γ—0 + 240Γ—10)/10 = 240
  3. Error: (320-320)Β² + (240-240)Β² = 0 Perfect reprojection means the 3D point is correct.

Constraints:

  • point_3d: [X, Y, Z] in world coordinates
  • observations: list of (K, R, t, pixel) tuples for each view
  • Return total squared reprojection error rounded to 4 decimal places
solution.py

Test Results

0/0
Run code to see test results.