I have troubles solving camera equation in matlab. I am given two points and two camera matrices and my task is to find lambda , and U . I created a function as follows and now I am trying to find a way to solve this. Can anyone please help me with that? Thanks
function U = minimal_triangulation(Ps, us)
% Takes in two camera matrices -> Ps and two image points -> us
% Outputs a triangulateion of a 3D point.
%The image points are a 2 × 2 array whereas the camera matrices
% is a cell list with one camera matrix in each cell.
% we have two equations , with two unknown variables as :
% lambda*u1 = P1*U , lambda*u2 = P2*U and we search for lambda, U
u1 = [us(1,1); us(2,1) ; 1]
u2 = [us(1,2); us(2,2) ; 1]
syms l1 l2 l3 U1 U2 U3
lambda = [l1 l2 l3]
U = [U1;U2;U3;1];
P1 = Ps{1}
P2 = Ps{2}
eq1 = lambda*u1==P1*U ;
eq2 = lambda*u2==P2*U ;
sol = solve([eq1, eq2], [l1, l2, l3, U1, U2, U3]);
U = [sol.U1 ; sol.U3 ; sol.U3 ; 1]
end