Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

estimateFisheyeParameters

Calibrate fisheye camera

Syntax

[fisheyeParams,imagesUsed,estimationErrors] = estimateFisheyeParameters(imagePoints,worldPoints,imageSize)
[___] = estimateFisheyeParameters(___,Name,Value)

Description

example

[fisheyeParams,imagesUsed,estimationErrors] = estimateFisheyeParameters(imagePoints,worldPoints,imageSize) returns a fisheyeParameters object containing estimates for the intrinsic and extrinsic parameters of a fisheye camera. The function also returns the images you used to estimate the fisheye parameters and the standard estimation errors for the single camera calibration.

[___] = estimateFisheyeParameters(___,Name,Value) configures the fisheyeParams object properties specified by one or more Name,Value pair arguments, using the previous syntax. Unspecified properties have their default values.

Examples

collapse all

Use calibration images to detect a checkerboard calibration pattern. Then calibrate the camera using corneres extracted from the pattern and visualize the results.

Gather a set of calibration images.

images = imageDatastore(fullfile(toolboxdir('vision'),'visiondata',...
        'calibration','gopro'));
imageFileNames = images.Files;

Detect the calibration pattern from the images.

[imagePoints,boardSize] = detectCheckerboardPoints(imageFileNames);

Generate world coordinates for the corners of the checkerboard squares.

squareSize = 29; % millimeters
worldPoints = generateCheckerboardPoints(boardSize,squareSize);

Estimate the fisheye camera calibration parameters based on the image and world points.

I = readimage(images,1);
imageSize = [size(I,1) size(I,2)];
params = estimateFisheyeParameters(imagePoints,worldPoints,imageSize);

Visualize the calibration accuracy.

figure
showReprojectionErrors(params);

Visualize the camera extrinsics.

figure
showExtrinsics(params);
drawnow

Plot the detected and reprojected points.

figure
imshow(I);
hold on
plot(imagePoints(:,1,1),imagePoints(:,2,1),'go');
plot(params.ReprojectedPoints(:,1,1),params.ReprojectedPoints(:,2,1),'r+');
legend('Detected Points','Reprojected Points');
hold off

Input Arguments

collapse all

Key points of calibration pattern, specified as an M-by-2-by-numImages array of [x,y] intrinsic image coordinates. The number of images, numImages, must be greater than 2. The number of keypoint coordinates in each pattern, M, must be greater than 3.

Data Types: single | double

Key points of calibration pattern in world coordinates, specified as an M-by-2 matrix of M [x,y] world coordinates. Because the pattern must be planar, the z-coordinates are zero.

Data Types: single | double

Image size, specified as an [mrows ncols] vector.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'WorldUnits','mm' sets the world point units to millimeters.

collapse all

Estimate the axes alignment, specified as the comma-separated pair consisting of 'EstimateAlignment' and false or true. Set to true if the optical axis of the fisheye lens is not perpendicular to the image plane.

World point units, specified as the comma-separated pair consisting of 'WorldUnits' and a character vector representing units. This argument is used simply to store the unit type and does not affect any calculations. Any character vector is valid.

Output Arguments

collapse all

Fisheye camera parameters, returned as a fisheyeParameters object.

Images used to the estimate camera parameters, returned as a P-by-1 logical array. P corresponds to the number of images. A logical true value indicates the index of an image used to estimate the camera parameters.

Standard errors of estimated parameters, returned as a fisheyeCalibrationErrors object.

References

[1] Scaramuzza, D., A. Martinelli, and R. Siegwart. "A Toolbox for Easy Calibrating Omindirectional Cameras." Proceedings to IEEE International Conference on Intelligent Robots and Systems (IROS 2006). Beijing, China, October 7–15, 2006.

[2] Urban, S., J. Leitloff, and S. Hinz. "Improved Wide-Angle, Fisheye and Omnidirecitonal Camera Calibration." ISPRS Journal of Photogrammetry and Remove Sensing. Vol. 108, 2015, pp.72–79.

Introduced in R2017b