cv2.aruco

None

Attributes

cv2.aruco.CORNER_REFINE_APRILTAG: int
cv2.aruco.CORNER_REFINE_CONTOUR: int
cv2.aruco.CORNER_REFINE_NONE: int
cv2.aruco.CORNER_REFINE_SUBPIX: int
cv2.aruco.DICT_4X4_100: int
cv2.aruco.DICT_4X4_1000: int
cv2.aruco.DICT_4X4_250: int
cv2.aruco.DICT_4X4_50: int
cv2.aruco.DICT_5X5_100: int
cv2.aruco.DICT_5X5_1000: int
cv2.aruco.DICT_5X5_250: int
cv2.aruco.DICT_5X5_50: int
cv2.aruco.DICT_6X6_100: int
cv2.aruco.DICT_6X6_1000: int
cv2.aruco.DICT_6X6_250: int
cv2.aruco.DICT_6X6_50: int
cv2.aruco.DICT_7X7_100: int
cv2.aruco.DICT_7X7_1000: int
cv2.aruco.DICT_7X7_250: int
cv2.aruco.DICT_7X7_50: int
cv2.aruco.DICT_APRILTAG_16H5: int
cv2.aruco.DICT_APRILTAG_16h5: int
cv2.aruco.DICT_APRILTAG_25H9: int
cv2.aruco.DICT_APRILTAG_25h9: int
cv2.aruco.DICT_APRILTAG_36H10: int
cv2.aruco.DICT_APRILTAG_36H11: int
cv2.aruco.DICT_APRILTAG_36h10: int
cv2.aruco.DICT_APRILTAG_36h11: int
cv2.aruco.DICT_ARUCO_MIP_36H12: int
cv2.aruco.DICT_ARUCO_MIP_36h12: int
cv2.aruco.DICT_ARUCO_ORIGINAL: int

Classes

class cv2.aruco.ArucoDetector
detectMarkers(image[, corners[, ids[, rejectedImgPoints]]]) corners, ids, rejectedImgPoints

Basic marker detection * * @param image input image * @param corners vector of detected marker corners. For each marker, its four corners * are provided, (e.g std::vector<std::vectorcv::Point2f > ). For N detected markers, * the dimensions of this array is Nx4. The order of the corners is clockwise. * @param ids vector of identifiers of the detected markers. The identifier is of type int * (e.g. std::vector). For N detected markers, the size of ids is also N. * The identifiers have the same order than the markers in the imgPoints array. * @param rejectedImgPoints contains the imgPoints of those squares whose inner code has not a * correct codification. Useful for debugging purposes. * * Performs marker detection in the input image. Only markers included in the specific dictionary * are searched. For each detected marker, it returns the 2D position of its corner in the image * and its corresponding identifier. * Note that this function does not perform pose estimation. * @note The function does not correct lens distortion or takes it into account. It’s recommended to undistort * input image with corresponding camera model, if camera parameters are known * @sa undistort, estimatePoseSingleMarkers, estimatePoseBoard

Parameters:
  • self

  • image (cv2.typing.MatLike) –

  • corners (_typing.Sequence[cv2.typing.MatLike] | None) –

  • ids (cv2.typing.MatLike | None) –

  • rejectedImgPoints (_typing.Sequence[cv2.typing.MatLike] | None) –

Return type:

tuple[_typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike, _typing.Sequence[cv2.typing.MatLike]]

detectMarkers(image[, corners[, ids[, rejectedImgPoints]]]) corners, ids, rejectedImgPoints

Basic marker detection * * @param image input image * @param corners vector of detected marker corners. For each marker, its four corners * are provided, (e.g std::vector<std::vectorcv::Point2f > ). For N detected markers, * the dimensions of this array is Nx4. The order of the corners is clockwise. * @param ids vector of identifiers of the detected markers. The identifier is of type int * (e.g. std::vector). For N detected markers, the size of ids is also N. * The identifiers have the same order than the markers in the imgPoints array. * @param rejectedImgPoints contains the imgPoints of those squares whose inner code has not a * correct codification. Useful for debugging purposes. * * Performs marker detection in the input image. Only markers included in the specific dictionary * are searched. For each detected marker, it returns the 2D position of its corner in the image * and its corresponding identifier. * Note that this function does not perform pose estimation. * @note The function does not correct lens distortion or takes it into account. It’s recommended to undistort * input image with corresponding camera model, if camera parameters are known * @sa undistort, estimatePoseSingleMarkers, estimatePoseBoard

Parameters:
  • self

  • image (cv2.UMat) –

  • corners (_typing.Sequence[cv2.UMat] | None) –

  • ids (cv2.UMat | None) –

  • rejectedImgPoints (_typing.Sequence[cv2.UMat] | None) –

Return type:

tuple[_typing.Sequence[cv2.UMat], cv2.UMat, _typing.Sequence[cv2.UMat]]

refineDetectedMarkers(image, board, detectedCorners, detectedIds, rejectedCorners[, cameraMatrix[, distCoeffs[, recoveredIdxs]]]) detectedCorners, detectedIds, rejectedCorners, recoveredIdxs

Refine not detected markers based on the already detected and the board layout * * @param image input image * @param board layout of markers in the board. * @param detectedCorners vector of already detected marker corners. * @param detectedIds vector of already detected marker identifiers. * @param rejectedCorners vector of rejected candidates during the marker detection process. * @param cameraMatrix optional input 3x3 floating-point camera matrix * \(A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\) * @param distCoeffs optional vector of distortion coefficients * \((k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\) of 4, 5, 8 or 12 elements * @param recoveredIdxs Optional array to returns the indexes of the recovered candidates in the * original rejectedCorners array. * * This function tries to find markers that were not detected in the basic detecMarkers function. * First, based on the current detected marker and the board layout, the function interpolates * the position of the missing markers. Then it tries to find correspondence between the reprojected * markers and the rejected candidates based on the minRepDistance and errorCorrectionRate parameters. * If camera parameters and distortion coefficients are provided, missing markers are reprojected * using projectPoint function. If not, missing marker projections are interpolated using global * homography, and all the marker corners in the board must have the same Z coordinate.

Parameters:
  • self

  • image (cv2.typing.MatLike) –

  • board (Board) –

  • detectedCorners (_typing.Sequence[cv2.typing.MatLike]) –

  • detectedIds (cv2.typing.MatLike) –

  • rejectedCorners (_typing.Sequence[cv2.typing.MatLike]) –

  • cameraMatrix (cv2.typing.MatLike | None) –

  • distCoeffs (cv2.typing.MatLike | None) –

  • recoveredIdxs (cv2.typing.MatLike | None) –

Return type:

tuple[_typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike, _typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike]

refineDetectedMarkers(image, board, detectedCorners, detectedIds, rejectedCorners[, cameraMatrix[, distCoeffs[, recoveredIdxs]]]) detectedCorners, detectedIds, rejectedCorners, recoveredIdxs

Refine not detected markers based on the already detected and the board layout * * @param image input image * @param board layout of markers in the board. * @param detectedCorners vector of already detected marker corners. * @param detectedIds vector of already detected marker identifiers. * @param rejectedCorners vector of rejected candidates during the marker detection process. * @param cameraMatrix optional input 3x3 floating-point camera matrix * \(A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\) * @param distCoeffs optional vector of distortion coefficients * \((k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\) of 4, 5, 8 or 12 elements * @param recoveredIdxs Optional array to returns the indexes of the recovered candidates in the * original rejectedCorners array. * * This function tries to find markers that were not detected in the basic detecMarkers function. * First, based on the current detected marker and the board layout, the function interpolates * the position of the missing markers. Then it tries to find correspondence between the reprojected * markers and the rejected candidates based on the minRepDistance and errorCorrectionRate parameters. * If camera parameters and distortion coefficients are provided, missing markers are reprojected * using projectPoint function. If not, missing marker projections are interpolated using global * homography, and all the marker corners in the board must have the same Z coordinate.

Parameters:
Return type:

tuple[_typing.Sequence[cv2.UMat], cv2.UMat, _typing.Sequence[cv2.UMat], cv2.UMat]

__init__(self, dictionary: Dictionary = ..., detectorParams: DetectorParameters = ..., refineParams: RefineParameters = ...)
Parameters:
Return type:

None

getDictionary() retval
Parameters:

self

Return type:

Dictionary

setDictionary(dictionary) None
Parameters:
Return type:

None

getDetectorParameters() retval
Parameters:

self

Return type:

DetectorParameters

setDetectorParameters(detectorParameters) None
Parameters:
Return type:

None

getRefineParameters() retval
Parameters:

self

Return type:

RefineParameters

setRefineParameters(refineParameters) None
Parameters:
Return type:

None

write(fs, name) None

simplified API for language bindings

Parameters:
Return type:

None

read(fn) None

Reads algorithm parameters from a file storage

Parameters:
Return type:

None

class cv2.aruco.Board
__init__(self, objPoints: _typing.Sequence[cv2.typing.MatLike], dictionary: Dictionary, ids: cv2.typing.MatLike)
Parameters:
  • self

  • objPoints (_typing.Sequence[cv2.typing.MatLike]) –

  • dictionary (Dictionary) –

  • ids (cv2.typing.MatLike) –

Return type:

None

__init__(self, objPoints: _typing.Sequence[cv2.UMat], dictionary: Dictionary, ids: cv2.UMat)
Parameters:
Return type:

None

matchImagePoints(detectedCorners, detectedIds[, objPoints[, imgPoints]]) objPoints, imgPoints

Given a board configuration and a set of detected markers, returns the corresponding * image points and object points, can be used in solvePnP() * * @param detectedCorners List of detected marker corners of the board. * For cv::Board and cv::GridBoard the method expects std::vector<std::vector> or std::vector with Aruco marker corners. * For cv::CharucoBoard the method expects std::vector or Mat with ChAruco corners (chess board corners matched with Aruco markers). * * @param detectedIds List of identifiers for each marker or charuco corner. * For any Board class the method expects std::vector or Mat. * * @param objPoints Vector of marker points in the board coordinate space. * For any Board class the method expects std::vectorcv::Point3f objectPoints or cv::Mat * * @param imgPoints Vector of marker points in the image coordinate space. * For any Board class the method expects std::vectorcv::Point2f objectPoints or cv::Mat * * @sa solvePnP

Parameters:
  • self

  • detectedCorners (_typing.Sequence[cv2.typing.MatLike]) –

  • detectedIds (cv2.typing.MatLike) –

  • objPoints (cv2.typing.MatLike | None) –

  • imgPoints (cv2.typing.MatLike | None) –

Return type:

tuple[cv2.typing.MatLike, cv2.typing.MatLike]

matchImagePoints(detectedCorners, detectedIds[, objPoints[, imgPoints]]) objPoints, imgPoints

Given a board configuration and a set of detected markers, returns the corresponding * image points and object points, can be used in solvePnP() * * @param detectedCorners List of detected marker corners of the board. * For cv::Board and cv::GridBoard the method expects std::vector<std::vector> or std::vector with Aruco marker corners. * For cv::CharucoBoard the method expects std::vector or Mat with ChAruco corners (chess board corners matched with Aruco markers). * * @param detectedIds List of identifiers for each marker or charuco corner. * For any Board class the method expects std::vector or Mat. * * @param objPoints Vector of marker points in the board coordinate space. * For any Board class the method expects std::vectorcv::Point3f objectPoints or cv::Mat * * @param imgPoints Vector of marker points in the image coordinate space. * For any Board class the method expects std::vectorcv::Point2f objectPoints or cv::Mat * * @sa solvePnP

Parameters:
Return type:

tuple[cv2.UMat, cv2.UMat]

generateImage(outSize[, img[, marginSize[, borderBits]]]) img

Draw a planar board * * @param outSize size of the output image in pixels. * @param img output image with the board. The size of this image will be outSize * and the board will be on the center, keeping the board proportions. * @param marginSize minimum margins (in pixels) of the board in the output image * @param borderBits width of the marker borders. * * This function return the image of the board, ready to be printed.

Parameters:
  • self

  • outSize (cv2.typing.Size) –

  • img (cv2.typing.MatLike | None) –

  • marginSize (int) –

  • borderBits (int) –

Return type:

cv2.typing.MatLike

generateImage(outSize[, img[, marginSize[, borderBits]]]) img

Draw a planar board * * @param outSize size of the output image in pixels. * @param img output image with the board. The size of this image will be outSize * and the board will be on the center, keeping the board proportions. * @param marginSize minimum margins (in pixels) of the board in the output image * @param borderBits width of the marker borders. * * This function return the image of the board, ready to be printed.

Parameters:
  • self

  • outSize (cv2.typing.Size) –

  • img (cv2.UMat | None) –

  • marginSize (int) –

  • borderBits (int) –

Return type:

cv2.UMat

getDictionary() retval

return the Dictionary of markers employed for this board

Parameters:

self

Return type:

Dictionary

getObjPoints() retval

return array of object points of all the marker corners in the board. * * Each marker include its 4 corners in this order: * - objPoints[i][0] - left-top point of i-th marker * - objPoints[i][1] - right-top point of i-th marker * - objPoints[i][2] - right-bottom point of i-th marker * - objPoints[i][3] - left-bottom point of i-th marker * * Markers are placed in a certain order - row by row, left to right in every row. For M markers, the size is Mx4.

Parameters:

self

Return type:

_typing.Sequence[_typing.Sequence[cv2.typing.Point3f]]

getIds() retval

vector of the identifiers of the markers in the board (should be the same size as objPoints) * @return vector of the identifiers of the markers

Parameters:

self

Return type:

_typing.Sequence[int]

getRightBottomCorner() retval

get coordinate of the bottom right corner of the board, is set when calling the function create()

Parameters:

self

Return type:

cv2.typing.Point3f

class cv2.aruco.CharucoBoard
__init__(self, size: cv2.typing.Size, squareLength: float, markerLength: float, dictionary: Dictionary, ids: cv2.typing.MatLike | None = ...)
Parameters:
  • self

  • size (cv2.typing.Size) –

  • squareLength (float) –

  • markerLength (float) –

  • dictionary (Dictionary) –

  • ids (cv2.typing.MatLike | None) –

Return type:

None

__init__(self, size: cv2.typing.Size, squareLength: float, markerLength: float, dictionary: Dictionary, ids: cv2.UMat | None = ...)
Parameters:
  • self

  • size (cv2.typing.Size) –

  • squareLength (float) –

  • markerLength (float) –

  • dictionary (Dictionary) –

  • ids (cv2.UMat | None) –

Return type:

None

checkCharucoCornersCollinear(charucoIds) retval

check whether the ChArUco markers are collinear * * @param charucoIds list of identifiers for each corner in charucoCorners per frame. * @return bool value, 1 (true) if detected corners form a line, 0 (false) if they do not. * solvePnP, calibration functions will fail if the corners are collinear (true). * * The number of ids in charucoIDs should be <= the number of chessboard corners in the board. * This functions checks whether the charuco corners are on a straight line (returns true, if so), or not (false). * Axis parallel, as well as diagonal and other straight lines detected. Degenerate cases: * for number of charucoIDs <= 2,the function returns true.

Parameters:
  • self

  • charucoIds (cv2.typing.MatLike) –

Return type:

bool

checkCharucoCornersCollinear(charucoIds) retval

check whether the ChArUco markers are collinear * * @param charucoIds list of identifiers for each corner in charucoCorners per frame. * @return bool value, 1 (true) if detected corners form a line, 0 (false) if they do not. * solvePnP, calibration functions will fail if the corners are collinear (true). * * The number of ids in charucoIDs should be <= the number of chessboard corners in the board. * This functions checks whether the charuco corners are on a straight line (returns true, if so), or not (false). * Axis parallel, as well as diagonal and other straight lines detected. Degenerate cases: * for number of charucoIDs <= 2,the function returns true.

Parameters:
Return type:

bool

setLegacyPattern(legacyPattern) None

set legacy chessboard pattern. * * Legacy setting creates chessboard patterns starting with a white box in the upper left corner * if there is an even row count of chessboard boxes, otherwise it starts with a black box. * This setting ensures compatibility to patterns created with OpenCV versions prior OpenCV 4.6.0. * See https://github.com/opencv/opencv/issues/23152. * * Default value: false.

Parameters:
  • self

  • legacyPattern (bool) –

Return type:

None

getLegacyPattern() retval
Parameters:

self

Return type:

bool

getChessboardSize() retval
Parameters:

self

Return type:

cv2.typing.Size

getSquareLength() retval
Parameters:

self

Return type:

float

getMarkerLength() retval
Parameters:

self

Return type:

float

getChessboardCorners() retval

get CharucoBoard::chessboardCorners

Parameters:

self

Return type:

_typing.Sequence[cv2.typing.Point3f]

class cv2.aruco.CharucoDetector
detectBoard(image[, charucoCorners[, charucoIds[, markerCorners[, markerIds]]]]) charucoCorners, charucoIds, markerCorners, markerIds
  • @brief detect aruco markers and interpolate position of ChArUco board corners

    • @param image input image necesary for corner refinement. Note that markers are not detected and

    • should be sent in corners and ids parameters.

    • @param charucoCorners interpolated chessboard corners.

    • @param charucoIds interpolated chessboard corners identifiers.

    • @param markerCorners vector of already detected markers corners. For each marker, its four

    • corners are provided, (e.g std::vector<std::vectorcv::Point2f > ). For N detected markers, the

    • dimensions of this array should be Nx4. The order of the corners should be clockwise.

    • If markerCorners and markerCorners are empty, the function detect aruco markers and ids.

    • @param markerIds list of identifiers for each marker in corners.

    • If markerCorners and markerCorners are empty, the function detect aruco markers and ids.

    • This function receives the detected markers and returns the 2D position of the chessboard corners

    • from a ChArUco board using the detected Aruco markers.

    • If markerCorners and markerCorners are empty, the detectMarkers() will run and detect aruco markers and ids.

    • If camera parameters are provided, the process is based in an approximated pose estimation, else it is based on local homography.

    • Only visible corners are returned. For each corner, its corresponding identifier is also returned in charucoIds.

    • @sa findChessboardCorners

Parameters:
  • self

  • image (cv2.typing.MatLike) –

  • charucoCorners (cv2.typing.MatLike | None) –

  • charucoIds (cv2.typing.MatLike | None) –

  • markerCorners (_typing.Sequence[cv2.typing.MatLike] | None) –

  • markerIds (cv2.typing.MatLike | None) –

Return type:

tuple[cv2.typing.MatLike, cv2.typing.MatLike, _typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike]

detectBoard(image[, charucoCorners[, charucoIds[, markerCorners[, markerIds]]]]) charucoCorners, charucoIds, markerCorners, markerIds
  • @brief detect aruco markers and interpolate position of ChArUco board corners

    • @param image input image necesary for corner refinement. Note that markers are not detected and

    • should be sent in corners and ids parameters.

    • @param charucoCorners interpolated chessboard corners.

    • @param charucoIds interpolated chessboard corners identifiers.

    • @param markerCorners vector of already detected markers corners. For each marker, its four

    • corners are provided, (e.g std::vector<std::vectorcv::Point2f > ). For N detected markers, the

    • dimensions of this array should be Nx4. The order of the corners should be clockwise.

    • If markerCorners and markerCorners are empty, the function detect aruco markers and ids.

    • @param markerIds list of identifiers for each marker in corners.

    • If markerCorners and markerCorners are empty, the function detect aruco markers and ids.

    • This function receives the detected markers and returns the 2D position of the chessboard corners

    • from a ChArUco board using the detected Aruco markers.

    • If markerCorners and markerCorners are empty, the detectMarkers() will run and detect aruco markers and ids.

    • If camera parameters are provided, the process is based in an approximated pose estimation, else it is based on local homography.

    • Only visible corners are returned. For each corner, its corresponding identifier is also returned in charucoIds.

    • @sa findChessboardCorners

Parameters:
Return type:

tuple[cv2.UMat, cv2.UMat, _typing.Sequence[cv2.UMat], cv2.UMat]

detectDiamonds(image[, diamondCorners[, diamondIds[, markerCorners[, markerIds]]]]) diamondCorners, diamondIds, markerCorners, markerIds
  • @brief Detect ChArUco Diamond markers *

    • @param image input image necessary for corner subpixel.

    • @param diamondCorners output list of detected diamond corners (4 corners per diamond). The order

    • is the same than in marker corners: top left, top right, bottom right and bottom left. Similar

    • format than the corners returned by detectMarkers (e.g std::vector<std::vectorcv::Point2f > ).

    • @param diamondIds ids of the diamonds in diamondCorners. The id of each diamond is in fact of

    • type Vec4i, so each diamond has 4 ids, which are the ids of the aruco markers composing the

    • diamond.

    • @param markerCorners list of detected marker corners from detectMarkers function.

    • If markerCorners and markerCorners are empty, the function detect aruco markers and ids.

    • @param markerIds list of marker ids in markerCorners.

    • If markerCorners and markerCorners are empty, the function detect aruco markers and ids.

    • This function detects Diamond markers from the previous detected ArUco markers. The diamonds

    • are returned in the diamondCorners and diamondIds parameters. If camera calibration parameters

    • are provided, the diamond search is based on reprojection. If not, diamond search is based on

    • homography. Homography is faster than reprojection, but less accurate.

Parameters:
  • self

  • image (cv2.typing.MatLike) –

  • diamondCorners (_typing.Sequence[cv2.typing.MatLike] | None) –

  • diamondIds (cv2.typing.MatLike | None) –

  • markerCorners (_typing.Sequence[cv2.typing.MatLike] | None) –

  • markerIds (cv2.typing.MatLike | None) –

Return type:

tuple[_typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike, _typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike]

detectDiamonds(image[, diamondCorners[, diamondIds[, markerCorners[, markerIds]]]]) diamondCorners, diamondIds, markerCorners, markerIds
  • @brief Detect ChArUco Diamond markers *

    • @param image input image necessary for corner subpixel.

    • @param diamondCorners output list of detected diamond corners (4 corners per diamond). The order

    • is the same than in marker corners: top left, top right, bottom right and bottom left. Similar

    • format than the corners returned by detectMarkers (e.g std::vector<std::vectorcv::Point2f > ).

    • @param diamondIds ids of the diamonds in diamondCorners. The id of each diamond is in fact of

    • type Vec4i, so each diamond has 4 ids, which are the ids of the aruco markers composing the

    • diamond.

    • @param markerCorners list of detected marker corners from detectMarkers function.

    • If markerCorners and markerCorners are empty, the function detect aruco markers and ids.

    • @param markerIds list of marker ids in markerCorners.

    • If markerCorners and markerCorners are empty, the function detect aruco markers and ids.

    • This function detects Diamond markers from the previous detected ArUco markers. The diamonds

    • are returned in the diamondCorners and diamondIds parameters. If camera calibration parameters

    • are provided, the diamond search is based on reprojection. If not, diamond search is based on

    • homography. Homography is faster than reprojection, but less accurate.

Parameters:
  • self

  • image (cv2.UMat) –

  • diamondCorners (_typing.Sequence[cv2.UMat] | None) –

  • diamondIds (cv2.UMat | None) –

  • markerCorners (_typing.Sequence[cv2.UMat] | None) –

  • markerIds (cv2.UMat | None) –

Return type:

tuple[_typing.Sequence[cv2.UMat], cv2.UMat, _typing.Sequence[cv2.UMat], cv2.UMat]

__init__(self, board: CharucoBoard, charucoParams: CharucoParameters = ..., detectorParams: DetectorParameters = ..., refineParams: RefineParameters = ...)
Parameters:
Return type:

None

getBoard() retval
Parameters:

self

Return type:

CharucoBoard

setBoard(board) None
Parameters:
Return type:

None

getCharucoParameters() retval
Parameters:

self

Return type:

CharucoParameters

setCharucoParameters(charucoParameters) None
Parameters:
Return type:

None

getDetectorParameters() retval
Parameters:

self

Return type:

DetectorParameters

setDetectorParameters(detectorParameters) None
Parameters:
Return type:

None

getRefineParameters() retval
Parameters:

self

Return type:

RefineParameters

setRefineParameters(refineParameters) None
Parameters:
Return type:

None

class cv2.aruco.CharucoParameters
__init__(self)
Parameters:

self

Return type:

None

cameraMatrix: cv2.typing.MatLike
distCoeffs: cv2.typing.MatLike
minMarkers: int
tryRefineMarkers: bool
class cv2.aruco.DetectorParameters
__init__(self)
Parameters:

self

Return type:

None

readDetectorParameters(fn) retval

Read a new set of DetectorParameters from FileNode (use FileStorage.root()).

Parameters:
Return type:

bool

writeDetectorParameters(fs[, name]) retval

Write a set of DetectorParameters to FileStorage

Parameters:
Return type:

bool

adaptiveThreshWinSizeMin: int
adaptiveThreshWinSizeMax: int
adaptiveThreshWinSizeStep: int
adaptiveThreshConstant: float
minMarkerPerimeterRate: float
maxMarkerPerimeterRate: float
polygonalApproxAccuracyRate: float
minCornerDistanceRate: float
minDistanceToBorder: int
minMarkerDistanceRate: float
minGroupDistance: float
cornerRefinementMethod: int
cornerRefinementWinSize: int
relativeCornerRefinmentWinSize: float
cornerRefinementMaxIterations: int
cornerRefinementMinAccuracy: float
markerBorderBits: int
perspectiveRemovePixelPerCell: int
perspectiveRemoveIgnoredMarginPerCell: float
maxErroneousBitsInBorderRate: float
minOtsuStdDev: float
errorCorrectionRate: float
aprilTagQuadDecimate: float
aprilTagQuadSigma: float
aprilTagMinClusterPixels: int
aprilTagMaxNmaxima: int
aprilTagCriticalRad: float
aprilTagMaxLineFitMse: float
aprilTagMinWhiteBlackDiff: int
aprilTagDeglitch: int
detectInvertedMarker: bool
useAruco3Detection: bool
minSideLengthCanonicalImg: int
minMarkerLengthRatioOriginalImg: float
class cv2.aruco.Dictionary
__init__(self)
Parameters:

self

Return type:

None

__init__(self, bytesList: cv2.typing.MatLike, _markerSize: int, maxcorr: int = ...)
Parameters:
  • self

  • bytesList (cv2.typing.MatLike) –

  • _markerSize (int) –

  • maxcorr (int) –

Return type:

None

getDistanceToId(bits, id[, allRotations]) retval

Returns Hamming distance of the input bits to the specific id. * * If allRotations flag is set, the four posible marker rotations are considered

Parameters:
  • self

  • bits (cv2.typing.MatLike) –

  • id (int) –

  • allRotations (bool) –

Return type:

int

getDistanceToId(bits, id[, allRotations]) retval

Returns Hamming distance of the input bits to the specific id. * * If allRotations flag is set, the four posible marker rotations are considered

Parameters:
Return type:

int

generateImageMarker(id, sidePixels[, _img[, borderBits]]) _img

Generate a canonical marker image

Parameters:
  • self

  • id (int) –

  • sidePixels (int) –

  • _img (cv2.typing.MatLike | None) –

  • borderBits (int) –

Return type:

cv2.typing.MatLike

generateImageMarker(id, sidePixels[, _img[, borderBits]]) _img

Generate a canonical marker image

Parameters:
  • self

  • id (int) –

  • sidePixels (int) –

  • _img (cv2.UMat | None) –

  • borderBits (int) –

Return type:

cv2.UMat

readDictionary(fn) retval

Read a new dictionary from FileNode. * * Dictionary example in YAML format:\n * nmarkers: 35\n * markersize: 6\n * maxCorrectionBits: 5\n * marker_0: “101011111011111001001001101100000000”\n * …\n * marker_34: “011111010000111011111110110101100101”

Parameters:
Return type:

bool

writeDictionary(fs[, name]) None

Write a dictionary to FileStorage, format is the same as in readDictionary().

Parameters:
Return type:

None

identify(onlyBits, maxCorrectionRate) retval, idx, rotation

Given a matrix of bits. Returns whether if marker is identified or not. * * Returns reference to the marker id in the dictionary (if any) and its rotation.

Parameters:
  • self

  • onlyBits (cv2.typing.MatLike) –

  • maxCorrectionRate (float) –

Return type:

tuple[bool, int, int]

static getByteListFromBits(bits) retval

Transform matrix of bits to list of bytes with 4 marker rotations

Parameters:

bits (cv2.typing.MatLike) –

Return type:

cv2.typing.MatLike

static getBitsFromByteList(byteList, markerSize) retval

Transform list of bytes to matrix of bits

Parameters:
  • byteList (cv2.typing.MatLike) –

  • markerSize (int) –

Return type:

cv2.typing.MatLike

bytesList: cv2.typing.MatLike
markerSize: int
maxCorrectionBits: int
class cv2.aruco.GridBoard
__init__(self, size: cv2.typing.Size, markerLength: float, markerSeparation: float, dictionary: Dictionary, ids: cv2.typing.MatLike | None = ...)
Parameters:
  • self

  • size (cv2.typing.Size) –

  • markerLength (float) –

  • markerSeparation (float) –

  • dictionary (Dictionary) –

  • ids (cv2.typing.MatLike | None) –

Return type:

None

__init__(self, size: cv2.typing.Size, markerLength: float, markerSeparation: float, dictionary: Dictionary, ids: cv2.UMat | None = ...)
Parameters:
  • self

  • size (cv2.typing.Size) –

  • markerLength (float) –

  • markerSeparation (float) –

  • dictionary (Dictionary) –

  • ids (cv2.UMat | None) –

Return type:

None

getGridSize() retval
Parameters:

self

Return type:

cv2.typing.Size

getMarkerLength() retval
Parameters:

self

Return type:

float

getMarkerSeparation() retval
Parameters:

self

Return type:

float

class cv2.aruco.RefineParameters
__init__(self, minRepDistance: float = ..., errorCorrectionRate: float = ..., checkAllOrders: bool = ...)
Parameters:
  • self

  • minRepDistance (float) –

  • errorCorrectionRate (float) –

  • checkAllOrders (bool) –

Return type:

None

readRefineParameters(fn) retval

Read a new set of RefineParameters from FileNode (use FileStorage.root()).

Parameters:
Return type:

bool

writeRefineParameters(fs[, name]) retval

Write a set of RefineParameters to FileStorage

Parameters:
Return type:

bool

minRepDistance: float
errorCorrectionRate: float
checkAllOrders: bool

Functions

cv2.aruco.Dictionary_getBitsFromByteList(byteList, markerSize) retval

Transform list of bytes to matrix of bits

Return type:

object

cv2.aruco.Dictionary_getByteListFromBits(bits) retval

Transform matrix of bits to list of bytes with 4 marker rotations

Return type:

object

cv2.aruco.drawDetectedCornersCharuco(image, charucoCorners[, charucoIds[, cornerColor]]) image
  • @brief Draws a set of Charuco corners

  • @param image input/output image. It must have 1 or 3 channels. The number of channels is not

  • altered.

  • @param charucoCorners vector of detected charuco corners

  • @param charucoIds list of identifiers for each corner in charucoCorners

  • @param cornerColor color of the square surrounding each corner

  • This function draws a set of detected Charuco corners. If identifiers vector is provided, it also

  • draws the id of each corner.

Parameters:
  • image (cv2.typing.MatLike) –

  • charucoCorners (cv2.typing.MatLike) –

  • charucoIds (cv2.typing.MatLike | None) –

  • cornerColor (cv2.typing.Scalar) –

Return type:

cv2.typing.MatLike

cv2.aruco.drawDetectedDiamonds(image, diamondCorners[, diamondIds[, borderColor]]) image
  • @brief Draw a set of detected ChArUco Diamond markers

  • @param image input/output image. It must have 1 or 3 channels. The number of channels is not

  • altered.

  • @param diamondCorners positions of diamond corners in the same format returned by

  • detectCharucoDiamond(). (e.g std::vector<std::vectorcv::Point2f > ). For N detected markers,

  • the dimensions of this array should be Nx4. The order of the corners should be clockwise.

  • @param diamondIds vector of identifiers for diamonds in diamondCorners, in the same format

  • returned by detectCharucoDiamond() (e.g. std::vector).

  • Optional, if not provided, ids are not painted.

  • @param borderColor color of marker borders. Rest of colors (text color and first corner color)

  • are calculated based on this one.

  • Given an array of detected diamonds, this functions draws them in the image. The marker borders

  • are painted and the markers identifiers if provided.

  • Useful for debugging purposes.

Parameters:
  • image (cv2.typing.MatLike) –

  • diamondCorners (_typing.Sequence[cv2.typing.MatLike]) –

  • diamondIds (cv2.typing.MatLike | None) –

  • borderColor (cv2.typing.Scalar) –

Return type:

cv2.typing.MatLike

cv2.aruco.drawDetectedMarkers(image, corners[, ids[, borderColor]]) image

Draw detected markers in image *

  • @param image input/output image. It must have 1 or 3 channels. The number of channels is not altered.

  • @param corners positions of marker corners on input image.

  • (e.g std::vector<std::vectorcv::Point2f > ). For N detected markers, the dimensions of

  • this array should be Nx4. The order of the corners should be clockwise.

  • @param ids vector of identifiers for markers in markersCorners .

  • Optional, if not provided, ids are not painted.

  • @param borderColor color of marker borders. Rest of colors (text color and first corner color)

  • are calculated based on this one to improve visualization.

  • Given an array of detected marker corners and its corresponding ids, this functions draws

  • the markers in the image. The marker borders are painted and the markers identifiers if provided.

  • Useful for debugging purposes.

Parameters:
  • image (cv2.typing.MatLike) –

  • corners (_typing.Sequence[cv2.typing.MatLike]) –

  • ids (cv2.typing.MatLike | None) –

  • borderColor (cv2.typing.Scalar) –

Return type:

cv2.typing.MatLike

cv2.aruco.extendDictionary(nMarkers, markerSize[, baseDictionary[, randomSeed]]) retval

Extend base dictionary by new nMarkers *

  • @param nMarkers number of markers in the dictionary

  • @param markerSize number of bits per dimension of each markers

  • @param baseDictionary Include the markers in this dictionary at the beginning (optional)

  • @param randomSeed a user supplied seed for theRNG()

  • This function creates a new dictionary composed by nMarkers markers and each markers composed

  • by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly

  • included and the rest are generated based on them. If the size of baseDictionary is higher

  • than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.

Parameters:
Return type:

Dictionary

cv2.aruco.generateImageMarker(dictionary, id, sidePixels[, img[, borderBits]]) img

Generate a canonical marker image *

  • @param dictionary dictionary of markers indicating the type of markers

  • @param id identifier of the marker that will be returned. It has to be a valid id in the specified dictionary.

  • @param sidePixels size of the image in pixels

  • @param img output image with the marker

  • @param borderBits width of the marker border.

  • This function returns a marker image in its canonical form (i.e. ready to be printed)

Parameters:
  • dictionary (Dictionary) –

  • id (int) –

  • sidePixels (int) –

  • img (cv2.typing.MatLike | None) –

  • borderBits (int) –

Return type:

cv2.typing.MatLike

cv2.aruco.getPredefinedDictionary(dict) retval

Returns one of the predefined dictionaries referenced by DICT_*.

Parameters:

dict (int) –

Return type:

Dictionary