Main Content

generateCharucoBoard

Generate ChArUco board image

Since R2024b

Description

I = generateCharucoBoard(imageSize,patternDims,markerFamily,checkerSize,markerSize) returns a grayscale ChArUco board image.

example

I = generateCharucoBoard(___,Name=Value) specifies options using one or more name-value arguments in addition to the previous syntax. For example, MinMarkerID=3 sets the lowest marker ID in the board to 3.

Examples

collapse all

Specify properties to generate the ChArUco board. Image, checker, and marker size are in pixels.

patternDims = [7 10];
family = "DICT_4X4_1000";
imageSize = [900 1200];
checkerSize = 100;
markerSize = 75;

Generate the ChArUco board based on specified properties.

I = generateCharucoBoard(imageSize,patternDims,family,checkerSize,markerSize);

Display the generated ChArUco board image.

imshow(I)

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

Write the ChArUco board image to a file.

imwrite(I,"ChArUco_7X10_4X4_100_75.png")

Next Steps: Print the ChArUco board image file. Use the printed board for capturing calibration images with the camera you intend to calibrate.

Input Arguments

collapse all

ChArUco board size in pixels, specified as a 2-element vector of the form [height,width].

Pattern dimensions, specified as a two-element vector that represents the number of checker boxes in the dim1 and dim2 dimensions of the ChArUco board image, respectively. For more details on ChArUco board patterns, see Calibration Patterns.

ArUco marker family name used in CharUco board, specified as a character vector, string scalar, vector of strings, or cell array of character vectors. Each element must be one of the valid ArUco marker families listed in the table. Select a marker family suitable for your application based on the total number of markers needed, the marker length, and the Hamming distance between the marker code words. The minimum Hamming distance between markers in the same family, determine the ability to detect them and correct errors. Marker families with less number of markers can be more robust against errors than a family with a large number of markers, which can increase marker detection difficulty due to a greater number of bits to extract. These general rules apply:

  • The less number of bits to detect, the longer the range in distance a marker can be detected.

  • For correct identification and decoding, ArUco markers require a white border, also known as the quiet zone.

FamilyMarker Size (bits)Number of Markers in FamilyMinimum Hamming Distance Between Markers (bits)
"DICT_ARUCO_ORIGINAL"5-by-510243
"DICT_4X4_50"4-by-4504
"DICT_4X4_100"1003
"DICT_4X4_250"2502
"DICT_4X4_1000"10002
"DICT_5X5_50"5-by-5508
"DICT_5X5_100"1007
"DICT_5X5_250"2506
"DICT_5X5_1000"10005
"DICT_6X6_50"6-by-65013
"DICT_6X6_100"10012
"DICT_6X6_250"25011
"DICT_6X6_1000"10009
"DICT_7X7_50"7-by-75019
"DICT_7X7_100"25018
"DICT_7X7_250"25017
"DICT_7X7_1000"100014

Data Types: char | string | cell

ChArUco board checker box side length, specified as a scalar in world units, such as millimeters or inches. The checkerSize and markerSize must be specified in the same world units and checkerSize must be a larger value than markerSize.

ArUco marker side length, specified as a scalar in world units, such as millimeters or inches. The checkerSize and markerSize must be specified in the same world units and checkerSize must be a larger value than markerSize.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: generateCharucoBoard(____,MinMarkerID=3)sets the lowest marker ID in the board to 3.

Number of white pixels to pad margin of output image, specified as a scalar.

Lowest value marker ID in the pattern, specified as a non-negative integer. The markers in the pattern must correspond to sequential IDs, each incremented by 1.

Color of the checker box located in the top-left corner of ChArUco board, specified as "black" or "white". The top-left corner value represents the origin of the board. This value must not be set to "white" when the board contains an odd number of boxes in the x dimension, specified in patternDims(1).

Output Arguments

collapse all

ChArUco image, returned as a grayscale image.

Data Types: uint8

Version History

Introduced in R2024b