资源简介
双目矫正及视差图的计算 立体匹配主要是通过找出每对图像间的对应关系,根据三角测量原理,得到视差图;在获得了视差信息后,根据投影模型很容易地可以得到原始图像的深度信息和三维信息。
代码片段和文件信息
function [ARt]=art(Pfsign)
%ART Factorize camera matrix into intrinsic and extrinsic matrices
%
% [ARt] = art(Pfsign) factorize the projection matrix P
% as P=A*[R;t] and enforce the sign of the focal lenght to be fsign.
% By default fsign=1.
% Author: A. Fusiello 1999
%
% fsign tells the position of the image plane wrt the focal plane. If it is
% negative the image plane is behind the focal plane.
% by default assume POSITIVE focal lenght
if nargin == 1
fsign = 1;
end
s = P(1:34);
Q = inv(P(1:3 1:3));
[UB] = qr(Q);
% fix the sign of B(33). This can possibly change the sign of the resulting matrix
% which is defined up to a scale factor however.
sig = sign(B(33));
B=B*sig;
s=s*sig;
% if the sign of the focal lenght is not the required one
% change it and change the rotation accordingly.
if fsign*B(11) < 0
E= [-1 0 0
0 1 0
0 0 1];
B = E*B;
U = U*E;
end
if fsign*B(22) < 0
E= [1 0 0
0 -1 0
0 0 1];
B = E*B;
U = U*E;
end
% if U is not a rotation fix the sign. This can possibly change the sign
% of the resulting matrix which is defined up to a scale factor however.
if det(U)< 0
U = -U;
s= - s;
end
% sanity check
if (norm(Q-U*B)>1e-10) & (norm(Q+U*B)>1e-10)
error(‘Something wrong with the QR factorization.‘); end
R = U‘;
t = B*s;
A = inv(B);
A = A ./A(33);
% sanity check
if det(R) < 0 error(‘R is not a rotation matrix‘); end
if A(33) < 0 error(‘Wrong sign of A(33)‘); end
% this guarantee that the result *is* a factorization of the given P up to a scale factor
W = A*[Rt];
if (rank([P(:) W(:)]) ~= 1 )
error(‘Something wrong with the ART factorization.‘); end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-05-16 09:17 RectifKitE-Stereo\
文件 6148 2016-05-15 21:14 RectifKitE-Stereo\.DS_Store
目录 0 2016-05-16 23:43 __MACOSX\
目录 0 2016-05-16 23:43 __MACOSX\RectifKitE-Stereo\
文件 120 2016-05-15 21:14 __MACOSX\RectifKitE-Stereo\._.DS_Store
文件 1825 2009-04-17 01:21 RectifKitE-Stereo\art.m
文件 222 2009-04-17 01:21 __MACOSX\RectifKitE-Stereo\._art.m
目录 0 2016-05-15 21:13 RectifKitE-Stereo\data\
文件 6148 2009-04-17 01:21 RectifKitE-Stereo\data\.DS_Store
目录 0 2016-05-16 23:43 __MACOSX\RectifKitE-Stereo\data\
文件 222 2009-04-17 01:21 __MACOSX\RectifKitE-Stereo\data\._.DS_Store
文件 432 2009-04-17 01:21 RectifKitE-Stereo\data\Sport_cam.mat
文件 222 2009-04-17 01:21 __MACOSX\RectifKitE-Stereo\data\._Sport_cam.mat
文件 28 2009-04-17 01:21 RectifKitE-Stereo\data\Sport_points
文件 222 2009-04-17 01:21 __MACOSX\RectifKitE-Stereo\data\._Sport_points
文件 222 2016-05-15 21:13 __MACOSX\RectifKitE-Stereo\._data
文件 489 2009-04-17 01:21 RectifKitE-Stereo\Disclaimer.txt
文件 222 2009-04-17 01:21 __MACOSX\RectifKitE-Stereo\._Disclaimer.txt
文件 761 2009-04-17 01:21 RectifKitE-Stereo\fund.m
文件 222 2009-04-17 01:21 __MACOSX\RectifKitE-Stereo\._fund.m
目录 0 2016-05-15 21:13 RectifKitE-Stereo\images\
文件 6148 2009-04-17 01:21 RectifKitE-Stereo\images\.DS_Store
目录 0 2016-05-16 23:43 __MACOSX\RectifKitE-Stereo\images\
文件 222 2009-04-17 01:21 __MACOSX\RectifKitE-Stereo\images\._.DS_Store
文件 326905 2009-04-17 01:21 RectifKitE-Stereo\images\Sport0.png
文件 117515 2009-04-17 01:21 __MACOSX\RectifKitE-Stereo\images\._Sport0.png
文件 314828 2009-04-17 01:21 RectifKitE-Stereo\images\Sport1.png
文件 117063 2009-04-17 01:21 __MACOSX\RectifKitE-Stereo\images\._Sport1.png
文件 222 2016-05-15 21:13 __MACOSX\RectifKitE-Stereo\._images
目录 0 2009-04-17 01:21 RectifKitE-Stereo\imagesE\
文件 222 2009-04-17 01:21 __MACOSX\RectifKitE-Stereo\._imagesE
............此处省略22个文件信息
评论
共有 条评论