imageFileNames = {'C:\ece564\CV2016-02-08\2016-02-08_19-14-16.JPG',...
'C:\ece564\CV2016-02-08\2016-02-08_19-14-40.JPG',...
'C:\ece564\CV2016-02-08\2016-02-08_19-15-14.JPG',...
'C:\ece564\CV2016-02-08\2016-02-08_19-15-28.JPG',...
};
[imagePoints, boardSize, imagesUsed] = detectCheckerboardPoints(imageFileNames);
imageFileNames = imageFileNames(imagesUsed);
squareSize = 3;
worldPoints = generateCheckerboardPoints(boardSize, squareSize);
[cameraParams, imagesUsed, estimationErrors] = estimateCameraParameters(imagePoints, worldPoints, ...
'EstimateSkew', false, 'EstimateTangentialDistortion', false, ...
'NumRadialDistortionCoefficients', 2, 'WorldUnits', 'in');
h1=figure; showReprojectionErrors(cameraParams, 'BarGraph');
h2=figure; showExtrinsics(cameraParams, 'CameraCentric');
displayErrors(estimationErrors, cameraParams);
originalImage = imread(imageFileNames{1});
undistortedImage = undistortImage(originalImage, cameraParams);
Warning: The checkerboard must be asymmetric: one side should be
even, and the other should be odd. Otherwise, the orientation of
the board may be detected incorrectly.
Standard Errors of Estimated Camera Parameters
----------------------------------------------
Intrinsics
----------
Focal length (pixels): [ 6552.5298 +/- 15.1651 6555.8076 +/- 15.0562 ]
Principal point (pixels):[ 2452.9481 +/- 11.1140 1350.7598 +/- 10.3378 ]
Radial distortion: [ -0.0078 +/- 0.0191 0.0313 +/- 0.2283 ]
Extrinsics
----------
Rotation vectors:
[ 0.2743 +/- 0.0018 -0.5467 +/- 0.0019 -0.0934 +/- 0.0004 ]
[ 1.0157 +/- 0.0023 0.5886 +/- 0.0017 1.5666 +/- 0.0008 ]
[ -1.2763 +/- 0.0017 -0.0491 +/- 0.0017 -0.0618 +/- 0.0010 ]
[ 0.0427 +/- 0.0024 -0.0885 +/- 0.0024 1.5634 +/- 0.0002 ]
Translation vectors (in):
[ -21.3521 +/- 0.1667 -11.7276 +/- 0.1531 97.5894 +/- 0.2639 ]
[ 19.5118 +/- 0.1433 -6.1625 +/- 0.1349 85.9157 +/- 0.2412 ]
[ -13.5013 +/- 0.1820 9.8203 +/- 0.1688 107.6352 +/- 0.2462 ]
[ 7.2284 +/- 0.1746 -11.2818 +/- 0.1638 102.9208 +/- 0.2450 ]