Main Content

Camera Calibration

Calibrate single or stereo cameras and estimate camera intrinsics, extrinsics, and distortion parameters using pinhole and fisheye camera models

Camera calibration is the process of estimating camera parameters by using images that contain a calibration pattern. The parameters include camera intrinsics, distortion coefficients, and camera extrinsics. Use these camera parameters to remove lens distortion effects from an image, measure planar objects, reconstruct 3-D scenes from multiple cameras, and perform other computer vision applications.

Use the Camera Calibrator app and functions to estimate single camera intrinsics, extrinsics, and lens distortion parameters.

Use the Stereo Camera Calibrator app and functions to estimate the parameters and relative positions and orientations of both cameras in a stereo camera pair. You can then use the camera to recover depth from images. It also calculates the position and orientation of the second camera relative to the first camera.

Calibration patterns

Apps

Camera CalibratorEstimate geometric parameters of a single camera
Stereo Camera CalibratorEstimate geometric parameters of a stereo camera

Functions

expand all

detectCheckerboardPointsDetect checkerboard pattern in image
generateCheckerboardPointsGenerate checkerboard corner locations
detectCircleGridPointsDetect circle grid pattern in images (Since R2021b)
generateCircleGridPointsGenerate circle grid point locations (Since R2021b)
vision.calibration.PatternDetectorInterface for defining custom planar pattern detectors (Since R2021b)

Pinhole Camera

estimateCameraParametersCalibrate a single or stereo camera
estimateCameraProjectionEstimate camera projection matrix from world-to-image point correspondences (Since R2022b)

Fisheye Camera

estimateFisheyeParametersCalibrate fisheye camera

Stereo Camera

estimateStereoBaselineEstimate baseline of stereo camera

Single Camera

cameraParametersObject for storing camera parameters
cameraIntrinsicsObject for storing intrinsic camera parameters
cameraProjectionCamera projection matrix (Since R2022b)

Fisheye Camera

fisheyeIntrinsicsObject for storing intrinsic fisheye camera parameters
fisheyeParametersObject for storing fisheye camera parameters

Stereo Camera

stereoParametersObject for storing stereo camera system parameters

Error Metrics

cameraCalibrationErrorsObject for storing standard errors of estimated camera parameters
stereoCalibrationErrorsObject for storing standard errors of estimated stereo parameters
extrinsicsEstimationErrorsObject for storing standard errors of estimated camera extrinsics and distortion coefficients
intrinsicsEstimationErrorsObject for storing standard errors of estimated camera intrinsics and distortion coefficients
fisheyeCalibrationErrorsObject for storing standard errors of estimated fisheye camera parameters
fisheyeIntrinsicsEstimationErrorsObject for storing standard errors of estimated fisheye camera intrinsics

Pinhole Camera

undistortImageCorrect image for lens distortion
undistortPointsCorrect point coordinates for lens distortion

Fisheye Camera

undistortFisheyeImageCorrect fisheye image for lens distortion
undistortFisheyePointsCorrect point coordinates for fisheye lens distortion
pcshowPlot 3-D point cloud
plotCameraPlot a camera in 3-D coordinates
showExtrinsicsVisualize extrinsic camera parameters
showReprojectionErrorsVisualize calibration errors
stereoAnaglyphCreate red-cyan anaglyph from stereo pair of images
estimateExtrinsicsCalculate location of calibrated camera (Since R2022b)
extr2poseConvert extrinsics to camera pose (Since R2022b)
pose2extrConvert camera pose to extrinsics (Since R2022b)
estrelposeCalculate relative rotation and translation between camera poses (Since R2022b)
rotmat2vec3dConvert 3-D rotation matrix to rotation vector (Since R2022b)
rotvec2mat3dConvert 3-D rotation vector to rotation matrix (Since R2022b)
cameraIntrinsicsToOpenCVConvert camera intrinsic parameters from MATLAB to OpenCV (Since R2021b)
cameraIntrinsicsFromOpenCVConvert camera intrinsic parameters from OpenCV to MATLAB (Since R2021b)
stereoParametersToOpenCVConvert stereo camera parameters from MATLAB to OpenCV (Since R2021b)
stereoParametersFromOpenCVConvert stereo camera parameters from OpenCV to MATLAB (Since R2021b)

Topics