readArucoMarker
Syntax
Description
[
detects ArUco markers of only the specified families,
id
,loc
] = readArucoMarker(I
,markerFamily
)markerFamily
.
[
returns the poses of the markers with respect to the specified camera intrinsic parameters,
id
,loc
,pose
] = readArucoMarker(___,intrinsics
,markerSize
)intrinsics
, and size of the markers, markerSize
,
in addition to any combination of input arguments from previous syntaxes.
[___,
returns the recognized ArUco marker families, detectedFamily
,rejections
] = readArucoMarker(___)detectedFamily
, and the
xy-locations of rejected ArUco marker candidates,
rejections
, in addition to any combination of arguments from previous
syntaxes.
[___] = readArucoMarker(___,
specifies options using one or more name-value arguments. For example,
Name=Value
)WindowSizeStep=12
sets the number of pixels by which to increment the
window size during adaptive thresholding to 12
.
Examples
Input Arguments
Output Arguments
Tips
This function does not account for lens distortion during pose estimation. To estimate poses, the input image must be undistorted. To estimate poses with a camera that has been calibrated using the Scaramuzza model, you can use the virtual pinhole model returned by the
undistortFisheyeImage
function.Consider the number of markers your application requires, marker length, and Hamming distance when choosing a marker family. The minimum Hamming distance between markers in the same family determines how capable the function is of detecting them and correcting errors. Smaller marker families, in terms of the number of markers in the family, and marker families with more bits have a larger minimum Hamming distance, but the additional bits to extract can make marker detection more difficult. For example, if your application only requires 10 markers, you can use a family of 10 markers for increased error robustness over a family of 1000 markers. In summary:
The fewer bits used to encode the ID in the ArUco marker, the greater the distance from the camera that you can detect the marker. The marker family name specifies the number of bits (for example,
DICT_4X4_50
has a marker size of 4-by-4, totaling 16 bits).Refer to the full list of ArUco family markers, specified in the
markerFamily
argument description.
Use one or more of these debugging tips:
Include a white border (also called a quiet zone) around ArUco markers for proper identification and decoding.
The function does not detect markers if the images have been flipped vertically or horizontally.
The function does not detect markers if their square shape has been altered as a result of lens distortion. You can undistort images to improve marker detection.
If the function does not detect a marker image, and does not return it as a rejected marker candidate, you might need to modify the adaptive thresholding steps. You can do this by adjusting the
WindowSizeRange
andWindowSizeStep
values.If the function does not detect a marker image, but returns it as a rejected candidate, verify or adjust the
markerFamily
andNumBorderBits
values. Also, verify that the image has not been flipped vertically or horizontally.If a detected or rejected marker incorrectly encompasses any surrounding black borders, adjust the
MarkerSizeRange
value.If the function returns an incorrect marker ID, or if it detects the same marker using two different marker families, increase the
ResolutionPerBit
value.
Algorithms
When the detection process starts, the function binarizes the input image using adaptive thresholding at different neighborhood window sizes. The function extracts marker rejections on each of the binarized images.
The marker detection algorithm uses these steps:
Perform adaptive thresholding to binarize the image.
Extract and filter contours to detect square-shaped marker candidates.
Remove perspective distortion and extract marker bits to analyze the inner codification of the marker bits.
Perform error correction to identify valid markers.
Optionally, perform subpixel refinement of corner positions.
Extended Capabilities
Version History
Introduced in R2024a