Loading...
Searching...
No Matches
Aruco markers, module functionality was moved to objdetect module

Classes

struct  cv::aruco::EstimateParameters
 Pose estimation parameters. More...
 

Enumerations

enum  cv::aruco::PatternPositionType {
  cv::aruco::ARUCO_CCW_CENTER ,
  cv::aruco::ARUCO_CW_TOP_LEFT_CORNER
}
 rvec/tvec define the right handed coordinate system of the marker. More...
 

Functions

double cv::aruco::calibrateCameraAruco (InputArrayOfArrays corners, InputArray ids, InputArray counter, const Ptr< Board > &board, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, OutputArray stdDeviationsIntrinsics, OutputArray stdDeviationsExtrinsics, OutputArray perViewErrors, int flags=0, const TermCriteria &criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON))
 Calibrate a camera using aruco markers.
 
double cv::aruco::calibrateCameraAruco (InputArrayOfArrays corners, InputArray ids, InputArray counter, const Ptr< Board > &board, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs=noArray(), OutputArrayOfArrays tvecs=noArray(), int flags=0, const TermCriteria &criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON))
 It's the same function as calibrateCameraAruco but without calibration error estimation.
 
double cv::aruco::calibrateCameraCharuco (InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, const Ptr< CharucoBoard > &board, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, OutputArray stdDeviationsIntrinsics, OutputArray stdDeviationsExtrinsics, OutputArray perViewErrors, int flags=0, const TermCriteria &criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON))
 Calibrate a camera using Charuco corners.
 
double cv::aruco::calibrateCameraCharuco (InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, const Ptr< CharucoBoard > &board, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs=noArray(), OutputArrayOfArrays tvecs=noArray(), int flags=0, const TermCriteria &criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON))
 It's the same function as calibrateCameraCharuco but without calibration error estimation.
 
void cv::aruco::detectCharucoDiamond (InputArray image, InputArrayOfArrays markerCorners, InputArray markerIds, float squareMarkerLengthRate, OutputArrayOfArrays diamondCorners, OutputArray diamondIds, InputArray cameraMatrix=noArray(), InputArray distCoeffs=noArray(), Ptr< Dictionary > dictionary=makePtr< Dictionary >(getPredefinedDictionary(PredefinedDictionaryType::DICT_4X4_50)))
 Detect ChArUco Diamond markers.
 
void cv::aruco::detectMarkers (InputArray image, const Ptr< Dictionary > &dictionary, OutputArrayOfArrays corners, OutputArray ids, const Ptr< DetectorParameters > &parameters=makePtr< DetectorParameters >(), OutputArrayOfArrays rejectedImgPoints=noArray())
 detect markers
 
void cv::aruco::drawCharucoDiamond (const Ptr< Dictionary > &dictionary, Vec4i ids, int squareLength, int markerLength, OutputArray img, int marginSize=0, int borderBits=1)
 Draw a ChArUco Diamond marker.
 
void cv::aruco::drawPlanarBoard (const Ptr< Board > &board, Size outSize, OutputArray img, int marginSize, int borderBits)
 draw planar board
 
int cv::aruco::estimatePoseBoard (InputArrayOfArrays corners, InputArray ids, const Ptr< Board > &board, InputArray cameraMatrix, InputArray distCoeffs, InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess=false)
 
bool cv::aruco::estimatePoseCharucoBoard (InputArray charucoCorners, InputArray charucoIds, const Ptr< CharucoBoard > &board, InputArray cameraMatrix, InputArray distCoeffs, InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess=false)
 Pose estimation for a ChArUco board given some of their corners.
 
void cv::aruco::estimatePoseSingleMarkers (InputArrayOfArrays corners, float markerLength, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvecs, OutputArray tvecs, OutputArray objPoints=noArray(), const Ptr< EstimateParameters > &estimateParameters=makePtr< EstimateParameters >())
 
void cv::aruco::getBoardObjectAndImagePoints (const Ptr< Board > &board, InputArrayOfArrays detectedCorners, InputArray detectedIds, OutputArray objPoints, OutputArray imgPoints)
 get board object and image points
 
int cv::aruco::interpolateCornersCharuco (InputArrayOfArrays markerCorners, InputArray markerIds, InputArray image, const Ptr< CharucoBoard > &board, OutputArray charucoCorners, OutputArray charucoIds, InputArray cameraMatrix=noArray(), InputArray distCoeffs=noArray(), int minMarkers=2)
 Interpolate position of ChArUco board corners.
 
void cv::aruco::refineDetectedMarkers (InputArray image, const Ptr< Board > &board, InputOutputArrayOfArrays detectedCorners, InputOutputArray detectedIds, InputOutputArrayOfArrays rejectedCorners, InputArray cameraMatrix=noArray(), InputArray distCoeffs=noArray(), float minRepDistance=10.f, float errorCorrectionRate=3.f, bool checkAllOrders=true, OutputArray recoveredIdxs=noArray(), const Ptr< DetectorParameters > &parameters=makePtr< DetectorParameters >())
 refine detected markers
 
bool cv::aruco::testCharucoCornersCollinear (const Ptr< CharucoBoard > &board, InputArray charucoIds)
 

Detailed Description

ArUco Marker Detection, module functionality was moved to objdetect module

See also
ArucoDetector, CharucoDetector, Board, GridBoard, CharucoBoard

Enumeration Type Documentation

◆ PatternPositionType

#include <opencv2/aruco/aruco_calib.hpp>

rvec/tvec define the right handed coordinate system of the marker.

PatternPositionType defines center this system and axes direction. Axis X (red color) - first coordinate, axis Y (green color) - second coordinate, axis Z (blue color) - third coordinate.

See also
estimatePoseSingleMarkers(), check tutorial_aruco_detection in aruco contrib
Enumerator
ARUCO_CCW_CENTER 

The marker coordinate system is centered on the middle of the marker.

The coordinates of the four corners (CCW order) of the marker in its own coordinate system are: (-markerLength/2, markerLength/2, 0), (markerLength/2, markerLength/2, 0), (markerLength/2, -markerLength/2, 0), (-markerLength/2, -markerLength/2, 0).

These pattern points define this coordinate system:

ARUCO_CW_TOP_LEFT_CORNER 

The marker coordinate system is centered on the top-left corner of the marker.

The coordinates of the four corners (CW order) of the marker in its own coordinate system are: (0, 0, 0), (markerLength, 0, 0), (markerLength, markerLength, 0), (0, markerLength, 0).

These pattern points define this coordinate system:

These pattern dots are convenient to use with a chessboard/ChArUco board.

Function Documentation

◆ calibrateCameraAruco() [1/2]

double cv::aruco::calibrateCameraAruco ( InputArrayOfArrays  corners,
InputArray  ids,
InputArray  counter,
const Ptr< Board > &  board,
Size  imageSize,
InputOutputArray  cameraMatrix,
InputOutputArray  distCoeffs,
OutputArrayOfArrays  rvecs,
OutputArrayOfArrays  tvecs,
OutputArray  stdDeviationsIntrinsics,
OutputArray  stdDeviationsExtrinsics,
OutputArray  perViewErrors,
int  flags = 0,
const TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON) 
)

#include <opencv2/aruco/aruco_calib.hpp>

Calibrate a camera using aruco markers.

Parameters
cornersvector of detected marker corners in all frames. The corners should have the same format returned by detectMarkers (see detectMarkers).
idslist of identifiers for each marker in corners
counternumber of markers in each frame so that corners and ids can be split
boardMarker Board layout
imageSizeSize of the image used only to initialize the intrinsic camera matrix.
cameraMatrixOutput 3x3 floating-point camera matrix \(A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\) . If CV_CALIB_USE_INTRINSIC_GUESS and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be initialized before calling the function.
distCoeffsOutput 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
rvecsOutput vector of rotation vectors (see Rodrigues ) estimated for each board view (e.g. std::vector<cv::Mat>>). That is, each k-th rotation vector together with the corresponding k-th translation vector (see the next output parameter description) brings the board pattern from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the board pattern in the k-th pattern view (k=0.. M -1).
tvecsOutput vector of translation vectors estimated for each pattern view.
stdDeviationsIntrinsicsOutput vector of standard deviations estimated for intrinsic parameters. Order of deviations values: \((f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3, s_4, \tau_x, \tau_y)\) If one of parameters is not estimated, it's deviation is equals to zero.
stdDeviationsExtrinsicsOutput vector of standard deviations estimated for extrinsic parameters. Order of deviations values: \((R_1, T_1, \dotsc , R_M, T_M)\) where M is number of pattern views, \(R_i, T_i\) are concatenated 1x3 vectors.
perViewErrorsOutput vector of average re-projection errors estimated for each pattern view.
flagsflags Different flags for the calibration process (see calibrateCamera for details).
criteriaTermination criteria for the iterative optimization algorithm.

This function calibrates a camera using an Aruco Board. The function receives a list of detected markers from several views of the Board. The process is similar to the chessboard calibration in calibrateCamera(). The function returns the final re-projection error.

◆ calibrateCameraAruco() [2/2]

double cv::aruco::calibrateCameraAruco ( InputArrayOfArrays  corners,
InputArray  ids,
InputArray  counter,
const Ptr< Board > &  board,
Size  imageSize,
InputOutputArray  cameraMatrix,
InputOutputArray  distCoeffs,
OutputArrayOfArrays  rvecs = noArray(),
OutputArrayOfArrays  tvecs = noArray(),
int  flags = 0,
const TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON) 
)

#include <opencv2/aruco/aruco_calib.hpp>

It's the same function as calibrateCameraAruco but without calibration error estimation.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ calibrateCameraCharuco() [1/2]

double cv::aruco::calibrateCameraCharuco ( InputArrayOfArrays  charucoCorners,
InputArrayOfArrays  charucoIds,
const Ptr< CharucoBoard > &  board,
Size  imageSize,
InputOutputArray  cameraMatrix,
InputOutputArray  distCoeffs,
OutputArrayOfArrays  rvecs,
OutputArrayOfArrays  tvecs,
OutputArray  stdDeviationsIntrinsics,
OutputArray  stdDeviationsExtrinsics,
OutputArray  perViewErrors,
int  flags = 0,
const TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON) 
)

#include <opencv2/aruco/aruco_calib.hpp>

Calibrate a camera using Charuco corners.

Parameters
charucoCornersvector of detected charuco corners per frame
charucoIdslist of identifiers for each corner in charucoCorners per frame
boardMarker Board layout
imageSizeinput image size
cameraMatrixOutput 3x3 floating-point camera matrix \(A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\) . If CV_CALIB_USE_INTRINSIC_GUESS and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be initialized before calling the function.
distCoeffsOutput 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
rvecsOutput vector of rotation vectors (see Rodrigues ) estimated for each board view (e.g. std::vector<cv::Mat>>). That is, each k-th rotation vector together with the corresponding k-th translation vector (see the next output parameter description) brings the board pattern from the model coordinate space (in which object points are specified) to the world coordinate space, that is, a real position of the board pattern in the k-th pattern view (k=0.. M -1).
tvecsOutput vector of translation vectors estimated for each pattern view.
stdDeviationsIntrinsicsOutput vector of standard deviations estimated for intrinsic parameters. Order of deviations values: \((f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3, s_4, \tau_x, \tau_y)\) If one of parameters is not estimated, it's deviation is equals to zero.
stdDeviationsExtrinsicsOutput vector of standard deviations estimated for extrinsic parameters. Order of deviations values: \((R_1, T_1, \dotsc , R_M, T_M)\) where M is number of pattern views, \(R_i, T_i\) are concatenated 1x3 vectors.
perViewErrorsOutput vector of average re-projection errors estimated for each pattern view.
flagsflags Different flags for the calibration process (see calibrateCamera for details).
criteriaTermination criteria for the iterative optimization algorithm.

This function calibrates a camera using a set of corners of a Charuco Board. The function receives a list of detected corners and its identifiers from several views of the Board. The function returns the final re-projection error.

◆ calibrateCameraCharuco() [2/2]

double cv::aruco::calibrateCameraCharuco ( InputArrayOfArrays  charucoCorners,
InputArrayOfArrays  charucoIds,
const Ptr< CharucoBoard > &  board,
Size  imageSize,
InputOutputArray  cameraMatrix,
InputOutputArray  distCoeffs,
OutputArrayOfArrays  rvecs = noArray(),
OutputArrayOfArrays  tvecs = noArray(),
int  flags = 0,
const TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON) 
)

#include <opencv2/aruco/aruco_calib.hpp>

It's the same function as calibrateCameraCharuco but without calibration error estimation.

◆ detectCharucoDiamond()

void cv::aruco::detectCharucoDiamond ( InputArray  image,
InputArrayOfArrays  markerCorners,
InputArray  markerIds,
float  squareMarkerLengthRate,
OutputArrayOfArrays  diamondCorners,
OutputArray  diamondIds,
InputArray  cameraMatrix = noArray(),
InputArray  distCoeffs = noArray(),
Ptr< Dictionary dictionary = makePtrDictionary >(getPredefinedDictionary(PredefinedDictionaryType::DICT_4X4_50)) 
)

#include <opencv2/aruco/charuco.hpp>

Detect ChArUco Diamond markers.

Parameters
imageinput image necessary for corner subpixel.
markerCornerslist of detected marker corners from detectMarkers function.
markerIdslist of marker ids in markerCorners.
squareMarkerLengthRaterate between square and marker length: squareMarkerLengthRate = squareLength/markerLength. The real units are not necessary.
diamondCornersoutput 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::vector<cv::Point2f> > ).
diamondIdsids 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.
cameraMatrixOptional camera calibration matrix.
distCoeffsOptional camera distortion coefficients.
dictionarydictionary of markers indicating the type of markers.

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.

Deprecated:
Use CharucoDetector::detectDiamonds

◆ detectMarkers()

void cv::aruco::detectMarkers ( InputArray  image,
const Ptr< Dictionary > &  dictionary,
OutputArrayOfArrays  corners,
OutputArray  ids,
const Ptr< DetectorParameters > &  parameters = makePtrDetectorParameters >(),
OutputArrayOfArrays  rejectedImgPoints = noArray() 
)

#include <opencv2/aruco.hpp>

detect markers

Deprecated:
Use class ArucoDetector::detectMarkers

◆ drawCharucoDiamond()

void cv::aruco::drawCharucoDiamond ( const Ptr< Dictionary > &  dictionary,
Vec4i  ids,
int  squareLength,
int  markerLength,
OutputArray  img,
int  marginSize = 0,
int  borderBits = 1 
)

#include <opencv2/aruco/charuco.hpp>

Draw a ChArUco Diamond marker.

Parameters
dictionarydictionary of markers indicating the type of markers.
idslist of 4 ids for each ArUco marker in the ChArUco marker.
squareLengthsize of the chessboard squares in pixels.
markerLengthsize of the markers in pixels.
imgoutput image with the marker. The size of this image will be 3*squareLength + 2*marginSize,.
marginSizeminimum margins (in pixels) of the marker in the output image
borderBitswidth of the marker borders.

This function return the image of a ChArUco marker, ready to be printed.

◆ drawPlanarBoard()

void cv::aruco::drawPlanarBoard ( const Ptr< Board > &  board,
Size  outSize,
OutputArray  img,
int  marginSize,
int  borderBits 
)

#include <opencv2/aruco.hpp>

draw planar board

Deprecated:
Use Board::generateImage

◆ estimatePoseBoard()

int cv::aruco::estimatePoseBoard ( InputArrayOfArrays  corners,
InputArray  ids,
const Ptr< Board > &  board,
InputArray  cameraMatrix,
InputArray  distCoeffs,
InputOutputArray  rvec,
InputOutputArray  tvec,
bool  useExtrinsicGuess = false 
)

◆ estimatePoseCharucoBoard()

bool cv::aruco::estimatePoseCharucoBoard ( InputArray  charucoCorners,
InputArray  charucoIds,
const Ptr< CharucoBoard > &  board,
InputArray  cameraMatrix,
InputArray  distCoeffs,
InputOutputArray  rvec,
InputOutputArray  tvec,
bool  useExtrinsicGuess = false 
)

#include <opencv2/aruco.hpp>

Pose estimation for a ChArUco board given some of their corners.

Parameters
charucoCornersvector of detected charuco corners
charucoIdslist of identifiers for each corner in charucoCorners
boardlayout of ChArUco board.
cameraMatrixinput 3x3 floating-point camera matrix \(A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\)
distCoeffsvector 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
rvecOutput vector (e.g. cv::Mat) corresponding to the rotation vector of the board (see cv::Rodrigues).
tvecOutput vector (e.g. cv::Mat) corresponding to the translation vector of the board.
useExtrinsicGuessdefines whether initial guess for rvec and tvec will be used or not.

This function estimates a Charuco board pose from some detected corners. The function checks if the input corners are enough and valid to perform pose estimation. If pose estimation is valid, returns true, else returns false.

See also
use cv::drawFrameAxes to get world coordinate system axis for object points

◆ estimatePoseSingleMarkers()

void cv::aruco::estimatePoseSingleMarkers ( InputArrayOfArrays  corners,
float  markerLength,
InputArray  cameraMatrix,
InputArray  distCoeffs,
OutputArray  rvecs,
OutputArray  tvecs,
OutputArray  objPoints = noArray(),
const Ptr< EstimateParameters > &  estimateParameters = makePtrEstimateParameters >() 
)

◆ getBoardObjectAndImagePoints()

void cv::aruco::getBoardObjectAndImagePoints ( const Ptr< Board > &  board,
InputArrayOfArrays  detectedCorners,
InputArray  detectedIds,
OutputArray  objPoints,
OutputArray  imgPoints 
)

#include <opencv2/aruco.hpp>

get board object and image points

Deprecated:
Use Board::matchImagePoints

◆ interpolateCornersCharuco()

int cv::aruco::interpolateCornersCharuco ( InputArrayOfArrays  markerCorners,
InputArray  markerIds,
InputArray  image,
const Ptr< CharucoBoard > &  board,
OutputArray  charucoCorners,
OutputArray  charucoIds,
InputArray  cameraMatrix = noArray(),
InputArray  distCoeffs = noArray(),
int  minMarkers = 2 
)

#include <opencv2/aruco/charuco.hpp>

Interpolate position of ChArUco board corners.

Parameters
markerCornersvector of already detected markers corners. For each marker, its four corners are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
markerIdslist of identifiers for each marker in corners
imageinput image necesary for corner refinement. Note that markers are not detected and should be sent in corners and ids parameters.
boardlayout of ChArUco board.
charucoCornersinterpolated chessboard corners
charucoIdsinterpolated chessboard corners identifiers
cameraMatrixoptional 3x3 floating-point camera matrix \(A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\)
distCoeffsoptional 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
minMarkersnumber of adjacent markers that must be detected to return a charuco corner

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 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. The function returns the number of interpolated corners.

Deprecated:
Use CharucoDetector::detectBoard

◆ refineDetectedMarkers()

void cv::aruco::refineDetectedMarkers ( InputArray  image,
const Ptr< Board > &  board,
InputOutputArrayOfArrays  detectedCorners,
InputOutputArray  detectedIds,
InputOutputArrayOfArrays  rejectedCorners,
InputArray  cameraMatrix = noArray(),
InputArray  distCoeffs = noArray(),
float  minRepDistance = 10.f,
float  errorCorrectionRate = 3.f,
bool  checkAllOrders = true,
OutputArray  recoveredIdxs = noArray(),
const Ptr< DetectorParameters > &  parameters = makePtrDetectorParameters >() 
)

#include <opencv2/aruco.hpp>

refine detected markers

Deprecated:
Use class ArucoDetector::refineDetectedMarkers

◆ testCharucoCornersCollinear()

bool cv::aruco::testCharucoCornersCollinear ( const Ptr< CharucoBoard > &  board,
InputArray  charucoIds 
)