Issues with computing extrinsic matrices after camera calibration

5 views (last 30 days)
I am using the camera calibrator app on matlab 2014a. I used the attached images for calibration. Then I want to compute the extrinsic parameters for other images. I wrote the following code according to the documentation in matlab.
function [rotationmatrix,translationvector] = extrinsic(imagefile,cameraParameters)
imOrig=imread(imagefile);
im = undistortImage(imOrig, cameraParameters);
[imagePoints, boardSize] = detectCheckerboardPoints(im);
squareSize = 2.43; % in millimeters
worldPoints = generateCheckerboardPoints(boardSize, squareSize);
[rotationmatrix, translationvector] = extrinsics(imagePoints, worldPoints, cameraParameters);
end
To verify that my code works, I have tested it with the first image I used for calibration. I have obtained the extrinsic rotation and translation matrices using this code and the calibration parameters. Then I compared them to the matrices that I have directly from calibration. They shoudl be equal. Actually, they are very similar but not identical (averaging 1 mm difference for each matrix coordinate). Do you know why?

Accepted Answer

Dima Lisin
Dima Lisin on 1 May 2014
During calibration, all camera parameters, including the translations and rotations of all checkerboards are estimated jointly using a numeric optimization algorithm. In other words, you are trying to fit all the parameters to minimize the reprojection error. On the other hand, when you call extrinsics() you are computing only the rotation and translation for the single checkerboard, and you are computing it in closed form using the parameters that you have just estimated. This is why the results are not exactly the same.

More Answers (0)

Categories

Find more on MATLAB Support Package for USB Webcams in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!