How to do perspective correction in Matlab from known Intrinsic and Extrinsic parameters?

后端 未结 2 1504
鱼传尺愫
鱼传尺愫 2020-12-13 07:28

I\'m using Matlab for camera calibration using Jean- Yves Bouget\'s Camera Calibration Toolbox. I have all the camera parameters from the calibration procedure. When I use a

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 08:11

    Approach 1: In the Camera Calibration Toolbox you should notice that there is an H matrix for each image of your checkerboard in your workspace. I am not familiar with the computer vision toolbox yet but perhaps this is the matrix you need for your function. It seems that H is computed like so:

    KK = [fc(1) fc(1)*alpha_c cc(1);0 fc(2) cc(2); 0 0 1];
    H = KK * [R(:,1) R(:,2) Tc]; % where R is your extrinsic rotation matrix and Tc the translation matrix
    H = H / H(3,3);
    

    Approach 2: If the computer vision toolbox function doesn't work out for you then to find the prospective projection of an image I have used the interp2 function like so:

    [X, Y] = meshgrid(0:size(I,2)-1, 0:size(I,1)-1);
    im_coord = [X(:), Y(:), ones(prod(size(I_1)))]';
    % Insert projection here for X and Y to XI and YI
    ZI = interp2(X,Y,Z,XI,YI);
    

    I have used prospective projections on a project a while ago and I believe that you need to use homogeneous coordinates. I think I found this wikipedia article quite helpful.

提交回复
热议问题