Main Content

multiCameraParameters

Store multi-camera system parameters

Since R2025a

Description

The multiCameraParameters object stores the intrinsic and extrinsic parameters of a multi-camera system estimated during multi-camera calibration.

Creation

Create a multiCameraParameters object using the estimateMultiCameraParameters function.

Properties

expand all

Extrinsic Parameters

This property is read-only.

Pose of each camera relative to the origin camera ReferenceCameraIndex, specified as a numCameras-element vector of rigidtform3d objects. numCameras represents the number of cameras.

This property is read-only.

Index of the origin camera, specified as an integer. This camera defines the reference coordinate system, and all other camera poses are defined relative to this reference camera. The pose of the reference camera is represented as rigidtform3d(eye(4)).

Number of cameras in the system, specified as an integer.

Intrinsic Parameters

This property is read-only.

Intrinsic parameters for all cameras in the multi-camera system, specified as a numCameras-element cell array containing cameraIntrinsics objects, fisheyeIntrinsics objects, or a combination of both. numCameras is the number of cameras.

Accuracy of Estimated Parameters

This property is read-only.

Average Euclidean distance between reprojected points and detected points over all image pairs, specified as a scalar in pixels.

Data Types: double

This property is read-only.

Average reprojection error for each camera, specified a numCameras-element vector. numCameras is the number of cameras.

This property is read-only.

Average reprojection error of each image in pixels, specified as an numViews-by-numCameras vector.

This property is read-only.

Average reprojection error of each view in pixels, specified as an numViews-by-1 vector

This property is read-only.

World points reprojected onto calibration images, specified as a numKeyPoints-by-2-by-numViews-by-numCameras-by-patternCount matrix.

Settings Used to Estimate Multi-Camera Parameters

This property is read-only.

Number of unique calibration patterns captured in the calibration images, specified as a scalar.

This property is read-only.

Poses of calibration patterns relative to the reference pattern, specified as a P-element vector of rigidtform3d objects, where P represents the number of calibration patterns. The reference pattern is the first element of the PatternPoses vector, stored as PatternPoses(1). Subsequent elements represent the poses of other patterns relative to this reference pattern. The reference pattern's pose is given by rigidtform3d(eye(4)).

This property is read-only.

Number of pattern views to estimate camera poses, specified as an integer.

This property is read-only.

Covisibility of cameras based on the calibration images, specified as a numCameras-by-numCameras logical matrix. numCameras is the number of cameras.

This property is read-only.

World coordinates of pattern keypoints in the calibration pattern, specified as a numKeyPoints-by-2 matrix. numKeyPoints is the number of keypoints in the pattern.

This property is read-only.

Units of world points, specified as a character vector or string scalar. This value describes the unit of measure.

Examples

collapse all

Estimate the relative position and orientation of six cameras with overlapping fields of view by using calibration images that contain a single ChArUco board.

Download the calibration images.

calibImagesURL = "https://www.mathworks.com/supportfiles/vision/data/overlapping-cameras-charuco.zip";
calibImagesDir = fullfile(pwd,"overlapping-cameras-charuco");
calibImagesZip = fullfile(pwd,"overlapping-cameras-charuco.zip");
if ~exist(calibImagesZip,"file")
    disp("Downloading calibration images (52 MB)...")
    websave(calibImagesZip,calibImagesURL);
end
Downloading calibration images (52 MB)...
if ~exist(calibImagesDir,"dir")
    unzip(calibImagesZip,pwd)
end

Specify calibration image filenames for each camera.

numCameras = 6;
camDirPrefix = "Cam00";
imageFiles = cell(1,numCameras);
for i = 1:numCameras
    camDir = fullfile(calibImagesDir,camDirPrefix+i);
    imds = imageDatastore(camDir);
    imageFiles{i} = imds.Files;
end
imageFiles = [imageFiles{:}];

Define the ChArUco board properties. Specify checker size and marker size in centimeters.

markerFamily = "DICT_6X6_1000";
patternDims = [5 5];
markerSize = 6.8;   % in cm
checkerSize = 9.15; % in cm
numKeyPoints = prod(patternDims - 1);
minMarkerId = 144;

Detect the key points of the ChArUco board in the calibration images.

imagePoints = detectPatternPoints(imageFiles,"charuco-board",patternDims, ...
    markerFamily,checkerSize,markerSize,MinMarkerID=minMarkerId);
[==================================================] 100%
Elapsed time: 00:00:09
Estimated time remaining: 00:00:00

Generate the world points for the pattern.

worldPoints = patternWorldPoints("charuco-board",patternDims,checkerSize);

Load the intrinsic parameters of the six cameras. These parameters have been estimated using the Using the Single Camera Calibrator App.

ld = load("sixCameraIntrinsics.mat");

Perform multi-camera calibration.

params = estimateMultiCameraParameters(imagePoints,worldPoints,ld.intrinsics,WorldUnits="cm");

Visualize the calibration accuracy.

figure(Position=[100,100,1000,400])
showReprojectionErrors(params)

Figure contains 3 axes objects. Axes object 1 with title Mean Reprojection Error per Image, xlabel View, ylabel Camera contains an object of type patch. Axes object 2 with title Mean Reprojection Error per View, xlabel View, ylabel Mean Error in Pixels contains 2 objects of type bar, line. This object represents Overall Mean Error: 0.28 pixels. Axes object 3 with title Mean Reprojection Error per Camera, xlabel Camera, ylabel Mean Error in Pixels contains 2 objects of type bar, line.

Visualize the camera extrinsic parameters.

figure
showExtrinsics(params)
view(2)

Figure contains an axes object. The axes object with title Extrinsic Parameters Visualization, xlabel X (cm), ylabel Z (cm) contains 56 objects of type patch, text, line.

Version History

Introduced in R2025a

expand all