Main Content

patternWorldPoints

Generate world point locations of a camera calibration pattern

Since R2024b

Description

worldPoints = patternWorldPoints("checkerboard",patternDims,squareSize) generates keypoints for a checkerboard camera calibration pattern with dimensions specified by patternDims and squareSize.

example

worldPoints = patternWorldPoints("circle-grid-symmetric",patternDims,centerDistance) generates keypoints for a symmetric circle grid camera calibration pattern with dimensions specified by patternDims and centerDistance.

worldPoints = patternWorldPoints("circle-grid-asymmetric",patternDims,centerDistance) generates keypoints for an asymmetric circle grid camera calibration pattern with dimensions specified by patternDims and centerDistance.

worldPoints = patternWorldPoints("charuco-board",patternDims,checkerSize) generates keypoints for a ChArUco board camera calibration pattern with dimensions specified by patternDims and checkerSize.

worldPoints = patternWorldPoints("aprilgrid",patternDims,tagSize,tagSpacing) generates keypoints for an AprilGrid camera calibration pattern with dimensions specified by patternDims, tagSize, and tagSpacing.

worldPoints = patternWorldPoints(patternName,___) generates keypoints for the calibration pattern specified by patternName.

Examples

collapse all

Generate the checkerboard and obtain world coordinates.

squareSize = 10;
boardSize = [8, 10];
I = checkerboard(squareSize,boardSize(1)/2,boardSize(2)/2);
worldPoints = patternWorldPoints("checkerboard",boardSize,squareSize);

Offset the points by placing the first point at the lower-right corner of the first square.

imshow(insertMarker(I,worldPoints + squareSize));

Figure contains an axes object. The hidden axes object contains an object of type image.

To generate the world point locations of keypoints in an AprilGrid, define the grid pattern dimensions (number of AprilTags along width and height), the size of each AprilTag, and the spacing between consecutive AprilTags. The tag size and spacing is specified in millimeters.

patternDims = [6,6];
tagSize = 25;
tagSpacing = 10;
worldPoints = patternWorldPoints("aprilgrid",patternDims,tagSize,tagSpacing);

Specify the center-to-center distance in millimeters (mm) between adjacent circles in the asymmetric circle grid pattern.

patternDims = [4,11];
centerDistance = 9;
worldPoints = patternWorldPoints("circle-grid-asymmetric",patternDims,centerDistance);

Define the dimensions of the ChArUco board pattern and the size of each checker square to generate the world point locations of its keypoints. The checker square size is in millimeters.

patternDims = [7,10];
checkerSize = 27;
worldPoints = patternWorldPoints("charuco-board",patternDims,checkerSize);

Specify the center-to-center distance in millimeters (mm) between adjacent circles for the symmetric circle grid pattern.

patternDims = [8,11];
centerDistance = 19;
worldPoints = patternWorldPoints("circle-grid-symmetric",patternDims,centerDistance);

Input Arguments

collapse all

Pattern dimensions, specified as a two-element vector. The first and second element represent the number of checker boxes or circles in the x- and y- dimensions, respectively. For a ChArUco board pattern, ensure that the board is oriented with the origin located at the top-left corner.

The pattern boards have these origin locations:

  • Checkerboard — Lower-right corner of the top-left square of the board.

  • Symmetric and asymmetric circle grids — Center of the top-left circle.

  • ChArUco marker — Lower-right ChArUco corner, which corresponds to the minimum ArUco marker ID.

  • AprilGrid pattern — Bottom-left corner, which corresponds to the minimum ID AprilTag.

For more details on calibration patterns, see Calibration Patterns.

Side length of the square, specified as a scalar in world units such as millimeters or inches.

Center-to-center distance between two circles, specified in world units such as millimeters or inches.

Side length of a ChArUco checker board square, specified in world units such as millimeters or inches.

Size of the AprilTag, specified as a scalar in world units, such as millimeters or inches.

Space between two consecutive AprilTags.

Camera calibration pattern name, specified as one of these options:

  • "checkerboard"

  • "circle-grid-symmetric"

  • "circle-grid-asymmetric"

  • "charuco-board"

  • "aprilgrid"

Output Arguments

collapse all

Keypoint locations, returned as an M-by-2 matrix in world coordinates. The matrix contains M points with coordinates in the form [x y]. The number of points the function returns is calculated based on the type of pattern:

  • Checkerboard and ChArUco board — (patternDims(1)-1)*(patternDims(2)-1)

  • Symmetric and asymmetric circle grid — patternDims(1)*patternDims(2)

  • AprilGrid pattern — patternDims(1)*patternDims(2)*4

Version History

Introduced in R2024b