Matlab - 相机方程求解器

时间:2018-02-21 13:19:51

标签: matlab camera equation-solving

我在matlab中解决相机方程式时遇到了麻烦。我有两个点和两个相机矩阵,我的任务是找到lambda和U.我创建了一个函数如下,现在我正试图找到解决这个问题的方法。任何人都可以帮助我吗? 谢谢

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

0 个答案:

没有答案