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


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


expand all

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

Pinhole Camera

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

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

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
extr2poseConvert extrinsics to camera pose
pose2extrConvert camera pose to extrinsics
estrelposeCalculate relative rotation and translation between camera poses
rotmat2vec3dConvert 3-D rotation matrix to rotation vector
rotvec2mat3dConvert 3-D rotation vector to rotation matrix
cameraIntrinsicsToOpenCVConvert camera intrinsic parameters from MATLAB to OpenCV
cameraIntrinsicsFromOpenCVConvert camera intrinsic parameters from OpenCV to MATLAB
stereoParametersToOpenCVConvert stereo camera parameters from MATLAB to OpenCV
stereoParametersFromOpenCVConvert stereo camera parameters from OpenCV to MATLAB