getf8pt.m
来自「图像 里面常用到的矩阵运算」· M 代码 · 共 27 行
M
27 行
function F = getF8pt( a, b )
% F = getF8pt( a, b )
% retrieve F from the first 8 points of a and b
[img1pts,T1] = normalize( a(1:8,:) );
[img2pts,T2] = normalize( b(1:8,:) );
x = img1pts(:,1);
y = img1pts(:,2);
xp = img2pts(:,1);
yp = img2pts(:,2);
A = [ xp.*x xp.*y xp yp.*x yp.*y yp x y ones(8,1)];
[U,D,V] = svd(A,0);
f = V(:,end);
F = reshape( f,[3 3])';
% enforce the singularity constraint
[U,D,V] = svd(F);
D(3,3) = 0; % force to zero to satisfy Frobenius norm'
D = D / D(1,1); % scale
F = U * D * V';
e = norm( A * reshape(F',9,1 ))^2; %algebraic error
%denormalize
F = T2' * F * T1;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?