autoPub2

Contents

close all
clear

load board1


imageFileNames = board.FullPathNames;
imagePoints = board.BoardPoints;
boardSize = board.BoardSize;
squareSize = board.SquareSize;
worldPoints = board.WorldPoints;
ImageSize = board.ImageSize;

explore image

filename = '2012_0524_1.JPG';
[impts, bsize, used] = detectCheckerboardPoints(filename);
bsize
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. 
bsize =
     9     9

show results

I = imread(filename);
scl = 0.6;
imshow(imresize(I,scl));
hold on
plot(scl*(impts(:,1)-0.5)+0.5,scl*(impts(:,2)-0.5)+0.5,'bo','MarkerSize',7,'LineWidth',2);
hold off
Warning: Image is too big to fit on screen; displaying at 67% 
% Calibrate the camera
[cameraParams, imagesUsed, estimationErrors] = estimateCameraParameters(imagePoints, worldPoints, ...
    'EstimateSkew', false, 'EstimateTangentialDistortion', false, ...
    'NumRadialDistortionCoefficients', 2, 'WorldUnits', 'inches', ...
    'InitialIntrinsicMatrix', [], 'InitialRadialDistortion', [], ...
    'ImageSize', ImageSize);
% Display parameter estimation errors
displayErrors(estimationErrors, cameraParams);
			Standard Errors of Estimated Camera Parameters
			----------------------------------------------

Intrinsics
----------
Focal length (pixels):   [ 2524.6825 +/- 4.3166     2518.1892 +/- 4.4630  ]
Principal point (pixels):[ 1017.3758 +/- 3.7191      843.3565 +/- 4.8709  ]
Radial distortion:       [   -0.1903 +/- 0.0098        0.5643 +/- 0.0699  ]

Extrinsics
----------
Rotation vectors:
                         [   -0.8013 +/- 0.0024       -0.2965 +/- 0.0018       -0.6899 +/- 0.0006  ]
                         [    0.6803 +/- 0.0019       -0.6779 +/- 0.0019       -0.2725 +/- 0.0008  ]
                         [    1.2195 +/- 0.0023        0.0899 +/- 0.0021        1.6908 +/- 0.0009  ]

Translation vectors (inches):
                         [  -13.4723 +/- 0.1108        3.9026 +/- 0.1451       75.4292 +/- 0.1327  ]
                         [  -14.9313 +/- 0.0919      -13.5842 +/- 0.1207       61.2792 +/- 0.1374  ]
                         [   16.7684 +/- 0.0879      -12.4416 +/- 0.1169       59.5286 +/- 0.1415  ]
% View reprojection errors
figure; showReprojectionErrors(cameraParams);
% Visualize pattern locations
figure; showExtrinsics(cameraParams, 'CameraCentric');
% For example, you can use the calibration data to remove effects of lens distortion.
% undistortedImage = undistortImage(originalImage, cameraParams);

% See additional examples of how to use the calibration data.  At the prompt type:
% showdemo('MeasuringPlanarObjectsExample')
% showdemo('StructureFromMotionExample')