Skip to content
DeepForgeby svx
All problems
HardComputer Visioncv-373

Bundle Adjustment Residual

Problem

Compute the bundle adjustment residual over several observations.

For each 3D point apply the rotation matrix rot and translation t to get camera coordinates, project to normalized image coordinates, and sum the squared distance to the observed 2D point. Return the total squared residual rounded to 4 decimal places.

Hint

Rotate first, translate second, then divide by the camera-space depth.

Test cases

case 1
in: [[[1,0,0],[0,1,0],[0,0,1]],[0,0,0],[[1,2,4]],[[0.25,0.5]]]
expected: 0
case 2
in: [[[1,0,0],[0,1,0],[0,0,1]],[0,0,0],[[1,2,4],[0,0,2]],[[0.25,0.5],[0.5,0.5]]]
expected: 0.5
case 3
in: [[[1,0,0],[0,1,0],[0,0,1]],[1,0,0],[[0,0,2]],[[0.5,0]]]
expected: 0
case 4
in: [[[0,-1,0],[1,0,0],[0,0,1]],[0,0,0],[[1,0,1]],[[0,1]]]
expected: 0
Starter codePython
def bundle_residual(rot, t, points, observations):
    # Your code here
    pass

4 test cases · run your code against them in the editor