Triangulating a 3d point by 2 camera matrices

917 Views Asked by At

can you give me a hint how to solve this issue?

Two cameras are placed with a 1m gap in x-direction next to each other (with focal length 1). The rotation matrices Ri and coordinates of the camera centers Ti are given as

1 = 2 = [1 0 0,
           0 1 0,
           0 0 1]



1 = [ 0 0 0 ], 2 = [ 1 0 0 ]

We get two measurements 1 = (3/4, 1/2) and 2 = (−1/2, 1/2) from the two cameras. Triangulate the 3D point using these two measurements.

Thank you for your time! : )

2

There are 2 best solutions below

0
On

I have tried a solution according to this pdf (http://www.cs.cmu.edu/~16385/s17/Slides/11.4_Triangulation.pdf)

But i always get a zero-solution vector

syms x y z w
% w = 1
vec = [x y z w]';
R = [1,0,0;0,1,0;0,0,1];
tt_1 = [0,0,0]';
tt_2 = [0,0,1]';
x_1 = [3/4, 1/2, 1];
x_2 = [-1/2, 1/2, 1];
K = [1,0,0;0,1,0;0,0,1];
t_1 = -R*tt_1;
t_2 = -R*tt_2;

P_1 = K*[R, t_1];
P_2 = K*[R, t_2];

part_1 = cross(x_1', P_1*vec);
part_2 = cross(x_2', P_2*vec);
left_vec = [part_1(1:2), part_2(1:2)]';

left_vec_alt = [x_1(2)*P_1(3,:) - P_1(2,:); P_1(1,:) - x_1(1)*P_1(3,:);  x_2(2)*P_2(3,:) - P_2(2,:); P_2(1,:) - x_2(1)*P_2(3,:)]';
equ = left_vec_alt*vec == 0;
equ_temp = left_vec(1:4)' == 0
w=1;
y=0.5;
vec_sol = solve(equ)
vec_sol_2 = solve(equ_temp)
vec_sol_temp = [vec_sol.x vec_sol.y vec_sol.z vec_sol.w]
vec_sol_temp_2 = [vec_sol_2.x vec_sol_2.y vec_sol_2.z vec_sol_2.w]
0
On

The right answer would be, but it would be nice to understand, what is wrong in the answer above

p_1 = [3/4, 1/2, 1];
p_2 = [-1/2, 1/2, 1];

Z = ( 1 * 1 ) / ( p_1(1) - p_2(1) );
X =  p_1(1)*Z/1;
Y =  p_1(2)*Z/1;

x_3d = [X, Y, Z]

%solution ==    0.6000    0.4000    0.8000