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

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.

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

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

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

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

Settings Used to Estimate Multi-Camera Parameters

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

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

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.

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
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);

Create a function handle for detectCharucoBoardPoints that specifies the non-zero minimum marker ID of the board.

minMarkerId = 144;
funcHandle = @(image) detectCharucoBoardPoints(image,patternDims, ...
    markerFamily,checkerSize,markerSize,MinMarkerID=minMarkerId);

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

imagePoints = detectPatternPoints(imageFiles,funcHandle,numKeyPoints);
[==================================================] 100%
Elapsed time: 00:00:04
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.37 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