Loading...
Given two camera projection matrices P1 (3x4) and P2 (3x4), and corresponding 2D points x1=[u1,v1] and x2=[u2,v2] in each image, triangulate the 3D point X=[X,Y,Z] using the Direct Linear Transform (DLT) method.
Algorithm (DLT Triangulation):
For each 2D point x=[u,v] and its projection matrix P, we have: x×(P⋅X)=0
This gives us a system of linear equations. From each view, we extract two independent equations:
ui⋅Pi3T−Pi1T=0 vi⋅Pi3T−Pi2T=0
where PijT is the j-th row of Pi.
Build the 4×4 matrix A:
A=u1P13T−P11Tv1P13T−P12Tu2P23T−P21Tv2P23T−P22T
Solve via SVD of A: the solution is the last column of V (last row of VT), converted from homogeneous coordinates.
Round each coordinate to 4 decimal places.
P1 = [[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0]]
P2 = [[1, 0, 0, -1],
[0, 1, 0, 0],
[0, 0, 1, 0]]
x1 = [0.5, 0.5]
x2 = [0.0, 0.5][1.0, 1.0, 2.0]