⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getf15pt2d.m

📁 This is a computer vision project implemented in matlab to remove radial distortion from the image
💻 M
字号:
function F = getF15pt2D(x,xp)

    a = hatall(x);
    b = hatall(xp);

    [img1pts,T1] = normalize_transform(a);
    [img2pts,T2] = normalize_transform(b);
    
    %%
%     img1pts = hatall([img1pts';ones(1,size(img1pts))]');
%     img2pts = hatall([img2pts';ones(1,size(img2pts),1)]');
    
%     img1pts = [img1pts ones(size(img1pts,1),1)];
%     img2pts = [img2pts ones(size(img2pts,1),1)];
    A = prepareA(img1pts,img2pts);
    size(img1pts)
    size(img2pts)
    size(A)
    [U,D,V] = svd(A);
    f = V(:,end);
    F = reshape( f,4,4)';

    % enforce the singularity constraint
    [U,D,V] = svd(F);
    D(4,4) = 0;             % force to zero to satisfy Frobenius norm'
    D = D / D(1,1);         % scale 
    F = U * D * V';
    e = norm( A * reshape(F',16,1 ))^2; %algebraic error

    %denormalize
    F = T2' * F * T1;
end


function A = prepareA(x,xp) % x is 1by4
  A = [];
  for i=1:size(xp,1)
      At = [xp(i,1)*x(i,1) xp(i,1)*x(i,2) xp(i,1)*x(i,3) xp(i,1)*x(i,4) xp(i,2)*x(i,1) xp(i,2)*x(i,2) xp(i,2)*x(i,3) xp(i,2)*x(i,4) xp(i,3)*x(i,1) xp(i,3)*x(i,2) xp(i,3)*x(i,3) xp(i,3)*x(i,4) xp(i,4)*x(i,1) xp(i,4)*x(i,2) xp(i,4)*x(i,3) xp(i,4)*x(i,4)];
      %At = [xp(i,1)*x(i,1) xp(i,1)*x(i,2) xp(i,1)*x(i,3) xp(i,2)*x(i,1) xp(i,2)*x(i,2) xp(i,2)*x(i,3) xp(i,3)*x(i,1) xp(i,3)*x(i,2) xp(i,3)*x(i,3)];
      A = [A;At];
  end
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -