Aruco
Objective-C
@interface Aruco : NSObject
Swift
class Aruco : NSObject
The Aruco module
Member classes: DetectorParameters, Board, GridBoard, Dictionary, CharucoBoard
Member enums: CornerRefineMethod, PREDEFINED_DICTIONARY_NAME
-
Generates a new customizable marker dictionary
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.
Declaration
Objective-C
+ (nonnull Dictionary *)custom_dictionary_from:(int)nMarkers markerSize:(int)markerSize baseDictionary: (nonnull Dictionary *)baseDictionary randomSeed:(int)randomSeed;Swift
class func generateCustomDictionary(nMarkers: Int32, markerSize: Int32, baseDictionary: Dictionary, randomSeed: Int32) -> DictionaryParameters
nMarkersnumber of markers in the dictionary
markerSizenumber of bits per dimension of each markers
baseDictionaryInclude the markers in this dictionary at the beginning (optional)
randomSeeda user supplied seed for theRNG()
-
Generates a new customizable marker dictionary
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.
Declaration
Objective-C
+ (nonnull Dictionary *)custom_dictionary_from:(int)nMarkers markerSize:(int)markerSize baseDictionary: (nonnull Dictionary *)baseDictionary;Swift
class func generateCustomDictionary(nMarkers: Int32, markerSize: Int32, baseDictionary: Dictionary) -> DictionaryParameters
nMarkersnumber of markers in the dictionary
markerSizenumber of bits per dimension of each markers
baseDictionaryInclude the markers in this dictionary at the beginning (optional)
-
See
generateCustomDictionaryDeclaration
Objective-C
+ (nonnull Dictionary *)custom_dictionary:(int)nMarkers markerSize:(int)markerSize randomSeed:(int)randomSeed;Swift
class func generateCustomDictionary(nMarkers: Int32, markerSize: Int32, randomSeed: Int32) -> Dictionary -
See
generateCustomDictionaryDeclaration
Objective-C
+ (nonnull Dictionary *)custom_dictionary:(int)nMarkers markerSize:(int)markerSize;Swift
class func generateCustomDictionary(nMarkers: Int32, markerSize: Int32) -> Dictionary -
Returns one of the predefined dictionaries referenced by DICT_*.
Declaration
Objective-C
+ (nonnull Dictionary *)getPredefinedDictionary:(int)dict;Swift
class func getPredefinedDictionary(dict: Int32) -> Dictionary -
Pose estimation for a ChArUco board given some of their corners
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.
Declaration
Objective-C
+ (BOOL)estimatePoseCharucoBoard:(nonnull Mat *)charucoCorners charucoIds:(nonnull Mat *)charucoIds board:(nonnull CharucoBoard *)board cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvec:(nonnull Mat *)rvec tvec:(nonnull Mat *)tvec useExtrinsicGuess:(BOOL)useExtrinsicGuess;Parameters
charucoCornersvector of detected charuco corners
charucoIdslist of identifiers for each corner in charucoCorners
boardlayout of ChArUco board.
cameraMatrixinput 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecOutput 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 \b rvec and \b tvec will be used or not.
-
Pose estimation for a ChArUco board given some of their corners
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.
Declaration
Parameters
charucoCornersvector of detected charuco corners
charucoIdslist of identifiers for each corner in charucoCorners
boardlayout of ChArUco board.
cameraMatrixinput 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecOutput 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.
-
test whether the ChArUco markers are collinear
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.
Declaration
Objective-C
+ (BOOL)testCharucoCornersCollinear:(nonnull CharucoBoard *)_board _charucoIds:(nonnull Mat *)_charucoIds;Swift
class func testCharucoCornersCollinear(_board: CharucoBoard, _charucoIds: Mat) -> BoolParameters
_boardlayout of ChArUco board.
_charucoIdslist of identifiers for each corner in charucoCorners per frame.
Return Value
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).
-
+calibrateCameraArucoExtended:ids: counter: board: imageSize: cameraMatrix: distCoeffs: rvecs: tvecs: stdDeviationsIntrinsics: stdDeviationsExtrinsics: perViewErrors: flags: criteria: Calibrate a camera using aruco markers
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.
Declaration
Objective-C
+ (double)calibrateCameraArucoExtended:(nonnull NSArray<Mat *> *)corners ids:(nonnull Mat *)ids counter:(nonnull Mat *)counter board:(nonnull Board *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs tvecs:(nonnull NSMutableArray<Mat *> *)tvecs stdDeviationsIntrinsics:(nonnull Mat *)stdDeviationsIntrinsics stdDeviationsExtrinsics:(nonnull Mat *)stdDeviationsExtrinsics perViewErrors:(nonnull Mat *)perViewErrors flags:(int)flags criteria:(nonnull TermCriteria *)criteria;Swift
class func calibrateCameraAruco(corners: [Mat], ids: Mat, counter: Mat, board: Board, imageSize: Size2i, cameraMatrix: Mat, distCoeffs: Mat, rvecs: NSMutableArray, tvecs: NSMutableArray, stdDeviationsIntrinsics: Mat, stdDeviationsExtrinsics: Mat, perViewErrors: Mat, flags: Int32, criteria: TermCriteria) -> DoubleParameters
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
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecsOutput vector of rotation vectors (see Rodrigues ) estimated for each board view (e.g. std::vectorcv::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_iare 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.
-
+calibrateCameraArucoExtended:ids: counter: board: imageSize: cameraMatrix: distCoeffs: rvecs: tvecs: stdDeviationsIntrinsics: stdDeviationsExtrinsics: perViewErrors: flags: Calibrate a camera using aruco markers
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.
Declaration
Objective-C
+ (double)calibrateCameraArucoExtended:(nonnull NSArray<Mat *> *)corners ids:(nonnull Mat *)ids counter:(nonnull Mat *)counter board:(nonnull Board *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs tvecs:(nonnull NSMutableArray<Mat *> *)tvecs stdDeviationsIntrinsics:(nonnull Mat *)stdDeviationsIntrinsics stdDeviationsExtrinsics:(nonnull Mat *)stdDeviationsExtrinsics perViewErrors:(nonnull Mat *)perViewErrors flags:(int)flags;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
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecsOutput vector of rotation vectors (see Rodrigues ) estimated for each board view (e.g. std::vectorcv::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_iare 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).
-
+calibrateCameraArucoExtended:ids: counter: board: imageSize: cameraMatrix: distCoeffs: rvecs: tvecs: stdDeviationsIntrinsics: stdDeviationsExtrinsics: perViewErrors: Calibrate a camera using aruco markers
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.
Declaration
Objective-C
+ (double)calibrateCameraArucoExtended:(nonnull NSArray<Mat *> *)corners ids:(nonnull Mat *)ids counter:(nonnull Mat *)counter board:(nonnull Board *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs tvecs:(nonnull NSMutableArray<Mat *> *)tvecs stdDeviationsIntrinsics:(nonnull Mat *)stdDeviationsIntrinsics stdDeviationsExtrinsics:(nonnull Mat *)stdDeviationsExtrinsics perViewErrors:(nonnull Mat *)perViewErrors;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
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecsOutput vector of rotation vectors (see Rodrigues ) estimated for each board view (e.g. std::vectorcv::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_iare concatenated 1x3 vectors.perViewErrorsOutput vector of average re-projection errors estimated for each pattern view.
-
+calibrateCameraAruco:ids: counter: board: imageSize: cameraMatrix: distCoeffs: rvecs: tvecs: flags: criteria: It’s the same function as #calibrateCameraAruco but without calibration error estimation.
Declaration
Objective-C
+ (double)calibrateCameraAruco:(nonnull NSArray<Mat *> *)corners ids:(nonnull Mat *)ids counter:(nonnull Mat *)counter board:(nonnull Board *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs tvecs:(nonnull NSMutableArray<Mat *> *)tvecs flags:(int)flags criteria:(nonnull TermCriteria *)criteria; -
It’s the same function as #calibrateCameraAruco but without calibration error estimation.
Declaration
Objective-C
+ (double)calibrateCameraAruco:(nonnull NSArray<Mat *> *)corners ids:(nonnull Mat *)ids counter:(nonnull Mat *)counter board:(nonnull Board *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs tvecs:(nonnull NSMutableArray<Mat *> *)tvecs flags:(int)flags; -
It’s the same function as #calibrateCameraAruco but without calibration error estimation.
Declaration
Objective-C
+ (double)calibrateCameraAruco:(nonnull NSArray<Mat *> *)corners ids:(nonnull Mat *)ids counter:(nonnull Mat *)counter board:(nonnull Board *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs tvecs:(nonnull NSMutableArray<Mat *> *)tvecs; -
It’s the same function as #calibrateCameraAruco but without calibration error estimation.
Declaration
Objective-C
+ (double)calibrateCameraAruco:(nonnull NSArray<Mat *> *)corners ids:(nonnull Mat *)ids counter:(nonnull Mat *)counter board:(nonnull Board *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs; -
It’s the same function as #calibrateCameraAruco but without calibration error estimation.
-
+calibrateCameraCharucoExtended:charucoIds: board: imageSize: cameraMatrix: distCoeffs: rvecs: tvecs: stdDeviationsIntrinsics: stdDeviationsExtrinsics: perViewErrors: flags: criteria: Calibrate a camera using Charuco corners
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.
Declaration
Objective-C
+ (double)calibrateCameraCharucoExtended: (nonnull NSArray<Mat *> *)charucoCorners charucoIds:(nonnull NSArray<Mat *> *)charucoIds board:(nonnull CharucoBoard *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs tvecs:(nonnull NSMutableArray<Mat *> *)tvecs stdDeviationsIntrinsics:(nonnull Mat *)stdDeviationsIntrinsics stdDeviationsExtrinsics:(nonnull Mat *)stdDeviationsExtrinsics perViewErrors:(nonnull Mat *)perViewErrors flags:(int)flags criteria:(nonnull TermCriteria *)criteria;Swift
class func calibrateCameraCharuco(charucoCorners: [Mat], charucoIds: [Mat], board: CharucoBoard, imageSize: Size2i, cameraMatrix: Mat, distCoeffs: Mat, rvecs: NSMutableArray, tvecs: NSMutableArray, stdDeviationsIntrinsics: Mat, stdDeviationsExtrinsics: Mat, perViewErrors: Mat, flags: Int32, criteria: TermCriteria) -> DoubleParameters
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
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecsOutput vector of rotation vectors (see Rodrigues ) estimated for each board view (e.g. std::vectorcv::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_iare 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.
-
+calibrateCameraCharucoExtended:charucoIds: board: imageSize: cameraMatrix: distCoeffs: rvecs: tvecs: stdDeviationsIntrinsics: stdDeviationsExtrinsics: perViewErrors: flags: Calibrate a camera using Charuco corners
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.
Declaration
Objective-C
+ (double)calibrateCameraCharucoExtended: (nonnull NSArray<Mat *> *)charucoCorners charucoIds:(nonnull NSArray<Mat *> *)charucoIds board:(nonnull CharucoBoard *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs tvecs:(nonnull NSMutableArray<Mat *> *)tvecs stdDeviationsIntrinsics:(nonnull Mat *)stdDeviationsIntrinsics stdDeviationsExtrinsics:(nonnull Mat *)stdDeviationsExtrinsics perViewErrors:(nonnull Mat *)perViewErrors flags:(int)flags;Swift
class func calibrateCameraCharuco(charucoCorners: [Mat], charucoIds: [Mat], board: CharucoBoard, imageSize: Size2i, cameraMatrix: Mat, distCoeffs: Mat, rvecs: NSMutableArray, tvecs: NSMutableArray, stdDeviationsIntrinsics: Mat, stdDeviationsExtrinsics: Mat, perViewErrors: Mat, flags: Int32) -> DoubleParameters
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
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecsOutput vector of rotation vectors (see Rodrigues ) estimated for each board view (e.g. std::vectorcv::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_iare 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).
-
+calibrateCameraCharucoExtended:charucoIds: board: imageSize: cameraMatrix: distCoeffs: rvecs: tvecs: stdDeviationsIntrinsics: stdDeviationsExtrinsics: perViewErrors: Calibrate a camera using Charuco corners
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.
Declaration
Objective-C
+ (double)calibrateCameraCharucoExtended: (nonnull NSArray<Mat *> *)charucoCorners charucoIds:(nonnull NSArray<Mat *> *)charucoIds board:(nonnull CharucoBoard *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs tvecs:(nonnull NSMutableArray<Mat *> *)tvecs stdDeviationsIntrinsics:(nonnull Mat *)stdDeviationsIntrinsics stdDeviationsExtrinsics:(nonnull Mat *)stdDeviationsExtrinsics perViewErrors:(nonnull Mat *)perViewErrors;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
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecsOutput vector of rotation vectors (see Rodrigues ) estimated for each board view (e.g. std::vectorcv::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_iare concatenated 1x3 vectors.perViewErrorsOutput vector of average re-projection errors estimated for each pattern view.
-
+calibrateCameraCharuco:charucoIds: board: imageSize: cameraMatrix: distCoeffs: rvecs: tvecs: flags: criteria: It’s the same function as #calibrateCameraCharuco but without calibration error estimation.
Declaration
Objective-C
+ (double)calibrateCameraCharuco:(nonnull NSArray<Mat *> *)charucoCorners charucoIds:(nonnull NSArray<Mat *> *)charucoIds board:(nonnull CharucoBoard *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs tvecs:(nonnull NSMutableArray<Mat *> *)tvecs flags:(int)flags criteria:(nonnull TermCriteria *)criteria;Swift
class func calibrateCameraCharuco(charucoCorners: [Mat], charucoIds: [Mat], board: CharucoBoard, imageSize: Size2i, cameraMatrix: Mat, distCoeffs: Mat, rvecs: NSMutableArray, tvecs: NSMutableArray, flags: Int32, criteria: TermCriteria) -> Double -
It’s the same function as #calibrateCameraCharuco but without calibration error estimation.
Declaration
Objective-C
+ (double)calibrateCameraCharuco:(nonnull NSArray<Mat *> *)charucoCorners charucoIds:(nonnull NSArray<Mat *> *)charucoIds board:(nonnull CharucoBoard *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs tvecs:(nonnull NSMutableArray<Mat *> *)tvecs flags:(int)flags; -
It’s the same function as #calibrateCameraCharuco but without calibration error estimation.
Declaration
Objective-C
+ (double)calibrateCameraCharuco:(nonnull NSArray<Mat *> *)charucoCorners charucoIds:(nonnull NSArray<Mat *> *)charucoIds board:(nonnull CharucoBoard *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs tvecs:(nonnull NSMutableArray<Mat *> *)tvecs; -
It’s the same function as #calibrateCameraCharuco but without calibration error estimation.
Declaration
Objective-C
+ (double)calibrateCameraCharuco:(nonnull NSArray<Mat *> *)charucoCorners charucoIds:(nonnull NSArray<Mat *> *)charucoIds board:(nonnull CharucoBoard *)board imageSize:(nonnull Size2i *)imageSize cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs rvecs:(nonnull NSMutableArray<Mat *> *)rvecs; -
It’s the same function as #calibrateCameraCharuco but without calibration error estimation.
-
Pose estimation for a board of markers
This function receives the detected markers and returns the pose of a marker board composed by those markers. A Board of marker has a single world coordinate system which is defined by the board layout. The returned transformation is the one that transforms points from the board coordinate system to the camera coordinate system. Input markers that are not included in the board layout are ignored. The function returns the number of markers from the input employed for the board pose estimation. Note that returning a 0 means the pose has not been estimated.
Declaration
Parameters
cornersvector of already detected markers corners. For each marker, its four corners are provided, (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
idslist of identifiers for each marker in corners
boardlayout of markers in the board. The layout is composed by the marker identifiers and the positions of each marker corner in the board reference system.
cameraMatrixinput 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecOutput vector (e.g. cv::Mat) corresponding to the rotation vector of the board (see cv::Rodrigues). Used as initial guess if not empty.
tvecOutput vector (e.g. cv::Mat) corresponding to the translation vector of the board.
useExtrinsicGuessdefines whether initial guess for \b rvec and \b tvec will be used or not. Used as initial guess if not empty.
-
Pose estimation for a board of markers
This function receives the detected markers and returns the pose of a marker board composed by those markers. A Board of marker has a single world coordinate system which is defined by the board layout. The returned transformation is the one that transforms points from the board coordinate system to the camera coordinate system. Input markers that are not included in the board layout are ignored. The function returns the number of markers from the input employed for the board pose estimation. Note that returning a 0 means the pose has not been estimated.
Declaration
Parameters
cornersvector of already detected markers corners. For each marker, its four corners are provided, (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
idslist of identifiers for each marker in corners
boardlayout of markers in the board. The layout is composed by the marker identifiers and the positions of each marker corner in the board reference system.
cameraMatrixinput 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecOutput vector (e.g. cv::Mat) corresponding to the rotation vector of the board (see cv::Rodrigues). Used as initial guess if not empty.
tvecOutput vector (e.g. cv::Mat) corresponding to the translation vector of the board. Used as initial guess if not empty.
-
+interpolateCornersCharuco:markerIds: image: board: charucoCorners: charucoIds: cameraMatrix: distCoeffs: minMarkers: Interpolate position of ChArUco board corners
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.
Declaration
Objective-C
+ (int)interpolateCornersCharuco:(nonnull NSArray<Mat *> *)markerCorners markerIds:(nonnull Mat *)markerIds image:(nonnull Mat *)image board:(nonnull CharucoBoard *)board charucoCorners:(nonnull Mat *)charucoCorners charucoIds:(nonnull Mat *)charucoIds cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs minMarkers:(int)minMarkers;Parameters
markerCornersvector of already detected markers corners. For each marker, its four corners are provided, (e.g std::vectorstd::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
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsminMarkersnumber of adjacent markers that must be detected to return a charuco corner
-
Interpolate position of ChArUco board corners
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.
Declaration
Objective-C
+ (int)interpolateCornersCharuco:(nonnull NSArray<Mat *> *)markerCorners markerIds:(nonnull Mat *)markerIds image:(nonnull Mat *)image board:(nonnull CharucoBoard *)board charucoCorners:(nonnull Mat *)charucoCorners charucoIds:(nonnull Mat *)charucoIds cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs;Parameters
markerCornersvector of already detected markers corners. For each marker, its four corners are provided, (e.g std::vectorstd::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
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 -
Interpolate position of ChArUco board corners
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.
Declaration
Objective-C
+ (int)interpolateCornersCharuco:(nonnull NSArray<Mat *> *)markerCorners markerIds:(nonnull Mat *)markerIds image:(nonnull Mat *)image board:(nonnull CharucoBoard *)board charucoCorners:(nonnull Mat *)charucoCorners charucoIds:(nonnull Mat *)charucoIds cameraMatrix:(nonnull Mat *)cameraMatrix;Parameters
markerCornersvector of already detected markers corners. For each marker, its four corners are provided, (e.g std::vectorstd::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
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}(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 -
Interpolate position of ChArUco board corners
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.
Declaration
Parameters
markerCornersvector of already detected markers corners. For each marker, its four corners are provided, (e.g std::vectorstd::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
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}(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 -
+detectCharucoDiamond:markerCorners: markerIds: squareMarkerLengthRate: diamondCorners: diamondIds: cameraMatrix: distCoeffs: Detect ChArUco Diamond 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 can slightly reduce the detection rate.
Declaration
Objective-C
+ (void)detectCharucoDiamond:(nonnull Mat *)image markerCorners:(nonnull NSArray<Mat *> *)markerCorners markerIds:(nonnull Mat *)markerIds squareMarkerLengthRate:(float)squareMarkerLengthRate diamondCorners:(nonnull NSMutableArray<Mat *> *)diamondCorners diamondIds:(nonnull Mat *)diamondIds cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs;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::vectorstd::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.
-
+detectCharucoDiamond:markerCorners: markerIds: squareMarkerLengthRate: diamondCorners: diamondIds: cameraMatrix: Detect ChArUco Diamond 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 can slightly reduce the detection rate.
Declaration
Objective-C
+ (void)detectCharucoDiamond:(nonnull Mat *)image markerCorners:(nonnull NSArray<Mat *> *)markerCorners markerIds:(nonnull Mat *)markerIds squareMarkerLengthRate:(float)squareMarkerLengthRate diamondCorners:(nonnull NSMutableArray<Mat *> *)diamondCorners diamondIds:(nonnull Mat *)diamondIds cameraMatrix:(nonnull Mat *)cameraMatrix;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::vectorstd::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.
-
Detect ChArUco Diamond 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 can slightly reduce the detection rate.
Declaration
Objective-C
+ (void)detectCharucoDiamond:(nonnull Mat *)image markerCorners:(nonnull NSArray<Mat *> *)markerCorners markerIds:(nonnull Mat *)markerIds squareMarkerLengthRate:(float)squareMarkerLengthRate diamondCorners:(nonnull NSMutableArray<Mat *> *)diamondCorners diamondIds:(nonnull Mat *)diamondIds;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::vectorstd::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.
-
Basic marker detection
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.
Declaration
Objective-C
+ (void)detectMarkers:(nonnull Mat *)image dictionary:(nonnull Dictionary *)dictionary corners:(nonnull NSMutableArray<Mat *> *)corners ids:(nonnull Mat *)ids parameters:(nonnull DetectorParameters *)parameters rejectedImgPoints:(nonnull NSMutableArray<Mat *> *)rejectedImgPoints cameraMatrix:(nonnull Mat *)cameraMatrix distCoeff:(nonnull Mat *)distCoeff;Swift
class func detectMarkers(image: Mat, dictionary: Dictionary, corners: NSMutableArray, ids: Mat, parameters: DetectorParameters, rejectedImgPoints: NSMutableArray, cameraMatrix: Mat, distCoeff: Mat)Parameters
imageinput image
dictionaryindicates the type of markers that will be searched
cornersvector of detected marker corners. For each marker, its four corners are provided, (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.
idsvector 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. parametersmarker detection parameters
rejectedImgPointscontains the imgPoints of those squares whose inner code has not a correct codification. Useful for debugging purposes.
cameraMatrixoptional input 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}distCoeffoptional 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 -
Basic marker detection
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.
Declaration
Objective-C
+ (void)detectMarkers:(nonnull Mat *)image dictionary:(nonnull Dictionary *)dictionary corners:(nonnull NSMutableArray<Mat *> *)corners ids:(nonnull Mat *)ids parameters:(nonnull DetectorParameters *)parameters rejectedImgPoints:(nonnull NSMutableArray<Mat *> *)rejectedImgPoints cameraMatrix:(nonnull Mat *)cameraMatrix;Swift
class func detectMarkers(image: Mat, dictionary: Dictionary, corners: NSMutableArray, ids: Mat, parameters: DetectorParameters, rejectedImgPoints: NSMutableArray, cameraMatrix: Mat)Parameters
imageinput image
dictionaryindicates the type of markers that will be searched
cornersvector of detected marker corners. For each marker, its four corners are provided, (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.
idsvector 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. parametersmarker detection parameters
rejectedImgPointscontains the imgPoints of those squares whose inner code has not a correct codification. Useful for debugging purposes.
cameraMatrixoptional input 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}(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 -
Basic marker detection
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.
Declaration
Objective-C
+ (void)detectMarkers:(nonnull Mat *)image dictionary:(nonnull Dictionary *)dictionary corners:(nonnull NSMutableArray<Mat *> *)corners ids:(nonnull Mat *)ids parameters:(nonnull DetectorParameters *)parameters rejectedImgPoints:(nonnull NSMutableArray<Mat *> *)rejectedImgPoints;Swift
class func detectMarkers(image: Mat, dictionary: Dictionary, corners: NSMutableArray, ids: Mat, parameters: DetectorParameters, rejectedImgPoints: NSMutableArray)Parameters
imageinput image
dictionaryindicates the type of markers that will be searched
cornersvector of detected marker corners. For each marker, its four corners are provided, (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.
idsvector 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. parametersmarker detection parameters
rejectedImgPointscontains the imgPoints of those squares whose inner code has not a correct codification. Useful for debugging purposes.
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}(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 -
Basic marker detection
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.
Declaration
Objective-C
+ (void)detectMarkers:(nonnull Mat *)image dictionary:(nonnull Dictionary *)dictionary corners:(nonnull NSMutableArray<Mat *> *)corners ids:(nonnull Mat *)ids parameters:(nonnull DetectorParameters *)parameters;Swift
class func detectMarkers(image: Mat, dictionary: Dictionary, corners: NSMutableArray, ids: Mat, parameters: DetectorParameters)Parameters
imageinput image
dictionaryindicates the type of markers that will be searched
cornersvector of detected marker corners. For each marker, its four corners are provided, (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.
idsvector 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. parametersmarker detection parameters correct codification. Useful for debugging purposes.
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}(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 -
Basic marker detection
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.
Declaration
Objective-C
+ (void)detectMarkers:(nonnull Mat *)image dictionary:(nonnull Dictionary *)dictionary corners:(nonnull NSMutableArray<Mat *> *)corners ids:(nonnull Mat *)ids;Swift
class func detectMarkers(image: Mat, dictionary: Dictionary, corners: NSMutableArray, ids: Mat)Parameters
imageinput image
dictionaryindicates the type of markers that will be searched
cornersvector of detected marker corners. For each marker, its four corners are provided, (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.
idsvector 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. correct codification. Useful for debugging purposes. \newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}(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 -
Deprecated
Draw coordinate system axis from pose estimation
Given the pose estimation of a marker or board, this function draws the axis of the world coordinate system, i.e. the system centered on the marker/board. Useful for debugging purposes.
@deprecated use cv::drawFrameAxes
Declaration
Parameters
imageinput/output image. It must have 1 or 3 channels. The number of channels is not altered.
cameraMatrixinput 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecrotation vector of the coordinate system that will be drawn. (- see: Rodrigues).
tvectranslation vector of the coordinate system that will be drawn.
lengthlength of the painted axis in the same unit than tvec (usually in meters)
-
Draws a set of Charuco corners
This function draws a set of detected Charuco corners. If identifiers vector is provided, it also draws the id of each corner.
Declaration
Parameters
imageinput/output image. It must have 1 or 3 channels. The number of channels is not altered.
charucoCornersvector of detected charuco corners
charucoIdslist of identifiers for each corner in charucoCorners
cornerColorcolor of the square surrounding each corner
-
Draws a set of Charuco corners
This function draws a set of detected Charuco corners. If identifiers vector is provided, it also draws the id of each corner.
Declaration
Parameters
imageinput/output image. It must have 1 or 3 channels. The number of channels is not altered.
charucoCornersvector of detected charuco corners
charucoIdslist of identifiers for each corner in charucoCorners
-
Draws a set of Charuco corners
This function draws a set of detected Charuco corners. If identifiers vector is provided, it also draws the id of each corner.
Declaration
Parameters
imageinput/output image. It must have 1 or 3 channels. The number of channels is not altered.
charucoCornersvector of detected charuco corners
-
Draw a set of detected ChArUco Diamond markers
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.
Declaration
Parameters
imageinput/output image. It must have 1 or 3 channels. The number of channels is not altered.
diamondCornerspositions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
diamondIdsvector 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. borderColorcolor of marker borders. Rest of colors (text color and first corner color) are calculated based on this one.
-
Draw a set of detected ChArUco Diamond markers
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.
Declaration
Parameters
imageinput/output image. It must have 1 or 3 channels. The number of channels is not altered.
diamondCornerspositions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
diamondIdsvector 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. are calculated based on this one. -
Draw a set of detected ChArUco Diamond markers
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.
Declaration
Parameters
imageinput/output image. It must have 1 or 3 channels. The number of channels is not altered.
diamondCornerspositions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise. returned by detectCharucoDiamond() (e.g. std::vector
). Optional, if not provided, ids are not painted. are calculated based on this one. -
Draw detected markers in image
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.
Declaration
Parameters
imageinput/output image. It must have 1 or 3 channels. The number of channels is not altered.
cornerspositions of marker corners on input image. (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
idsvector of identifiers for markers in markersCorners . Optional, if not provided, ids are not painted.
borderColorcolor of marker borders. Rest of colors (text color and first corner color) are calculated based on this one to improve visualization.
-
Draw detected markers in image
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.
Declaration
Parameters
imageinput/output image. It must have 1 or 3 channels. The number of channels is not altered.
cornerspositions of marker corners on input image. (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
idsvector of identifiers for markers in markersCorners . Optional, if not provided, ids are not painted. are calculated based on this one to improve visualization.
-
Draw detected markers in image
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.
Declaration
Parameters
imageinput/output image. It must have 1 or 3 channels. The number of channels is not altered.
cornerspositions of marker corners on input image. (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise. Optional, if not provided, ids are not painted. are calculated based on this one to improve visualization.
-
Draw a canonical marker image
This function returns a marker image in its canonical form (i.e. ready to be printed)
Declaration
Objective-C
+ (void)drawMarker:(nonnull Dictionary *)dictionary id:(int)id sidePixels:(int)sidePixels img:(nonnull Mat *)img borderBits:(int)borderBits;Swift
class func drawMarker(dictionary: Dictionary, id: Int32, sidePixels: Int32, img: Mat, borderBits: Int32)Parameters
dictionarydictionary of markers indicating the type of markers
ididentifier of the marker that will be returned. It has to be a valid id in the specified dictionary.
sidePixelssize of the image in pixels
imgoutput image with the marker
borderBitswidth of the marker border.
-
Draw a canonical marker image
This function returns a marker image in its canonical form (i.e. ready to be printed)
Declaration
Objective-C
+ (void)drawMarker:(nonnull Dictionary *)dictionary id:(int)id sidePixels:(int)sidePixels img:(nonnull Mat *)img;Swift
class func drawMarker(dictionary: Dictionary, id: Int32, sidePixels: Int32, img: Mat)Parameters
dictionarydictionary of markers indicating the type of markers
ididentifier of the marker that will be returned. It has to be a valid id in the specified dictionary.
sidePixelssize of the image in pixels
imgoutput image with the marker
-
Draw a planar board
See
_drawPlanarBoardImplThis function return the image of a planar board, ready to be printed. It assumes the Board layout specified is planar by ignoring the z coordinates of the object points.
Declaration
Parameters
boardlayout of the board that will be drawn. The board should be planar, z coordinate is ignored
outSizesize of the output image in pixels.
imgoutput image with the board. The size of this image will be outSize and the board will be on the center, keeping the board proportions.
marginSizeminimum margins (in pixels) of the board in the output image
borderBitswidth of the marker borders.
-
Draw a planar board
See
_drawPlanarBoardImplThis function return the image of a planar board, ready to be printed. It assumes the Board layout specified is planar by ignoring the z coordinates of the object points.
Declaration
Parameters
boardlayout of the board that will be drawn. The board should be planar, z coordinate is ignored
outSizesize of the output image in pixels.
imgoutput image with the board. The size of this image will be outSize and the board will be on the center, keeping the board proportions.
marginSizeminimum margins (in pixels) of the board in the output image
-
Draw a planar board
See
_drawPlanarBoardImplThis function return the image of a planar board, ready to be printed. It assumes the Board layout specified is planar by ignoring the z coordinates of the object points.
Declaration
Parameters
boardlayout of the board that will be drawn. The board should be planar, z coordinate is ignored
outSizesize of the output image in pixels.
imgoutput image with the board. The size of this image will be outSize and the board will be on the center, keeping the board proportions.
-
Pose estimation for single markers
This function receives the detected markers and returns their pose estimation respect to the camera individually. So for each marker, one rotation and translation vector is returned. The returned transformation is the one that transforms points from each marker coordinate system to the camera coordinate system. The marker corrdinate system is centered on the middle of the marker, with the Z axis perpendicular to the marker plane. The coordinates of the four corners 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)
Declaration
Parameters
cornersvector of already detected markers corners. For each marker, its four corners are provided, (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
markerLengththe length of the markers’ side. The returning translation vectors will be in the same unit. Normally, unit is meters.
cameraMatrixinput 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecsarray of output rotation vectors (- see: Rodrigues) (e.g. std::vectorcv::Vec3d). Each element in rvecs corresponds to the specific marker in imgPoints.
tvecsarray of output translation vectors (e.g. std::vectorcv::Vec3d). Each element in tvecs corresponds to the specific marker in imgPoints.
_objPointsarray of object points of all the marker corners
-
Pose estimation for single markers
This function receives the detected markers and returns their pose estimation respect to the camera individually. So for each marker, one rotation and translation vector is returned. The returned transformation is the one that transforms points from each marker coordinate system to the camera coordinate system. The marker corrdinate system is centered on the middle of the marker, with the Z axis perpendicular to the marker plane. The coordinates of the four corners 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)
Declaration
Parameters
cornersvector of already detected markers corners. For each marker, its four corners are provided, (e.g std::vectorstd::vector<cv::Point2f > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
markerLengththe length of the markers’ side. The returning translation vectors will be in the same unit. Normally, unit is meters.
cameraMatrixinput 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsrvecsarray of output rotation vectors (- see: Rodrigues) (e.g. std::vectorcv::Vec3d). Each element in rvecs corresponds to the specific marker in imgPoints.
tvecsarray of output translation vectors (e.g. std::vectorcv::Vec3d). Each element in tvecs corresponds to the specific marker in imgPoints.
-
Given a board configuration and a set of detected markers, returns the corresponding image points and object points to call solvePnP
Declaration
Parameters
boardMarker board layout.
detectedCornersList of detected marker corners of the board.
detectedIdsList of identifiers for each marker.
objPointsVector of vectors of board marker points in the board coordinate space.
imgPointsVector of vectors of the projections of board marker corner points.
-
+refineDetectedMarkers:board: detectedCorners: detectedIds: rejectedCorners: cameraMatrix: distCoeffs: minRepDistance: errorCorrectionRate: checkAllOrders: recoveredIdxs: parameters: Refind not detected markers based on the already detected and the board layout
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.
Declaration
Objective-C
+ (void)refineDetectedMarkers:(nonnull Mat *)image board:(nonnull Board *)board detectedCorners:(nonnull NSMutableArray<Mat *> *)detectedCorners detectedIds:(nonnull Mat *)detectedIds rejectedCorners:(nonnull NSMutableArray<Mat *> *)rejectedCorners cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs minRepDistance:(float)minRepDistance errorCorrectionRate:(float)errorCorrectionRate checkAllOrders:(BOOL)checkAllOrders recoveredIdxs:(nonnull Mat *)recoveredIdxs parameters:(nonnull DetectorParameters *)parameters;Swift
class func refineDetectedMarkers(image: Mat, board: Board, detectedCorners: NSMutableArray, detectedIds: Mat, rejectedCorners: NSMutableArray, cameraMatrix: Mat, distCoeffs: Mat, minRepDistance: Float, errorCorrectionRate: Float, checkAllOrders: Bool, recoveredIdxs: Mat, parameters: DetectorParameters)Parameters
imageinput image
boardlayout of markers in the board.
detectedCornersvector of already detected marker corners.
detectedIdsvector of already detected marker identifiers.
rejectedCornersvector of rejected candidates during the marker detection process.
cameraMatrixoptional input 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsminRepDistanceminimum distance between the corners of the rejected candidate and the reprojected marker in order to consider it as a correspondence.
errorCorrectionRaterate of allowed erroneous bits respect to the error correction capability of the used dictionary. -1 ignores the error correction step.
checkAllOrdersConsider the four posible corner orders in the rejectedCorners array. If it set to false, only the provided corner order is considered (default true).
recoveredIdxsOptional array to returns the indexes of the recovered candidates in the original rejectedCorners array.
parametersmarker detection parameters
-
+refineDetectedMarkers:board: detectedCorners: detectedIds: rejectedCorners: cameraMatrix: distCoeffs: minRepDistance: errorCorrectionRate: checkAllOrders: recoveredIdxs: Refind not detected markers based on the already detected and the board layout
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.
Declaration
Objective-C
+ (void)refineDetectedMarkers:(nonnull Mat *)image board:(nonnull Board *)board detectedCorners:(nonnull NSMutableArray<Mat *> *)detectedCorners detectedIds:(nonnull Mat *)detectedIds rejectedCorners:(nonnull NSMutableArray<Mat *> *)rejectedCorners cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs minRepDistance:(float)minRepDistance errorCorrectionRate:(float)errorCorrectionRate checkAllOrders:(BOOL)checkAllOrders recoveredIdxs:(nonnull Mat *)recoveredIdxs;Parameters
imageinput image
boardlayout of markers in the board.
detectedCornersvector of already detected marker corners.
detectedIdsvector of already detected marker identifiers.
rejectedCornersvector of rejected candidates during the marker detection process.
cameraMatrixoptional input 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsminRepDistanceminimum distance between the corners of the rejected candidate and the reprojected marker in order to consider it as a correspondence.
errorCorrectionRaterate of allowed erroneous bits respect to the error correction capability of the used dictionary. -1 ignores the error correction step.
checkAllOrdersConsider the four posible corner orders in the rejectedCorners array. If it set to false, only the provided corner order is considered (default true).
recoveredIdxsOptional array to returns the indexes of the recovered candidates in the original rejectedCorners array.
-
+refineDetectedMarkers:board: detectedCorners: detectedIds: rejectedCorners: cameraMatrix: distCoeffs: minRepDistance: errorCorrectionRate: checkAllOrders: Refind not detected markers based on the already detected and the board layout
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.
Declaration
Objective-C
+ (void)refineDetectedMarkers:(nonnull Mat *)image board:(nonnull Board *)board detectedCorners:(nonnull NSMutableArray<Mat *> *)detectedCorners detectedIds:(nonnull Mat *)detectedIds rejectedCorners:(nonnull NSMutableArray<Mat *> *)rejectedCorners cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs minRepDistance:(float)minRepDistance errorCorrectionRate:(float)errorCorrectionRate checkAllOrders:(BOOL)checkAllOrders;Parameters
imageinput image
boardlayout of markers in the board.
detectedCornersvector of already detected marker corners.
detectedIdsvector of already detected marker identifiers.
rejectedCornersvector of rejected candidates during the marker detection process.
cameraMatrixoptional input 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsminRepDistanceminimum distance between the corners of the rejected candidate and the reprojected marker in order to consider it as a correspondence.
errorCorrectionRaterate of allowed erroneous bits respect to the error correction capability of the used dictionary. -1 ignores the error correction step.
checkAllOrdersConsider the four posible corner orders in the rejectedCorners array. If it set to false, only the provided corner order is considered (default true). original rejectedCorners array.
-
+refineDetectedMarkers:board: detectedCorners: detectedIds: rejectedCorners: cameraMatrix: distCoeffs: minRepDistance: errorCorrectionRate: Refind not detected markers based on the already detected and the board layout
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.
Declaration
Objective-C
+ (void)refineDetectedMarkers:(nonnull Mat *)image board:(nonnull Board *)board detectedCorners:(nonnull NSMutableArray<Mat *> *)detectedCorners detectedIds:(nonnull Mat *)detectedIds rejectedCorners:(nonnull NSMutableArray<Mat *> *)rejectedCorners cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs minRepDistance:(float)minRepDistance errorCorrectionRate:(float)errorCorrectionRate;Parameters
imageinput image
boardlayout of markers in the board.
detectedCornersvector of already detected marker corners.
detectedIdsvector of already detected marker identifiers.
rejectedCornersvector of rejected candidates during the marker detection process.
cameraMatrixoptional input 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsminRepDistanceminimum distance between the corners of the rejected candidate and the reprojected marker in order to consider it as a correspondence.
errorCorrectionRaterate of allowed erroneous bits respect to the error correction capability of the used dictionary. -1 ignores the error correction step. If it set to false, only the provided corner order is considered (default true). original rejectedCorners array.
-
+refineDetectedMarkers:board: detectedCorners: detectedIds: rejectedCorners: cameraMatrix: distCoeffs: minRepDistance: Refind not detected markers based on the already detected and the board layout
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.
Declaration
Objective-C
+ (void)refineDetectedMarkers:(nonnull Mat *)image board:(nonnull Board *)board detectedCorners:(nonnull NSMutableArray<Mat *> *)detectedCorners detectedIds:(nonnull Mat *)detectedIds rejectedCorners:(nonnull NSMutableArray<Mat *> *)rejectedCorners cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs minRepDistance:(float)minRepDistance;Parameters
imageinput image
boardlayout of markers in the board.
detectedCornersvector of already detected marker corners.
detectedIdsvector of already detected marker identifiers.
rejectedCornersvector of rejected candidates during the marker detection process.
cameraMatrixoptional input 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 elementsminRepDistanceminimum distance between the corners of the rejected candidate and the reprojected marker in order to consider it as a correspondence. capability of the used dictionary. -1 ignores the error correction step. If it set to false, only the provided corner order is considered (default true). original rejectedCorners array.
-
Refind not detected markers based on the already detected and the board layout
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.
Declaration
Objective-C
+ (void)refineDetectedMarkers:(nonnull Mat *)image board:(nonnull Board *)board detectedCorners:(nonnull NSMutableArray<Mat *> *)detectedCorners detectedIds:(nonnull Mat *)detectedIds rejectedCorners:(nonnull NSMutableArray<Mat *> *)rejectedCorners cameraMatrix:(nonnull Mat *)cameraMatrix distCoeffs:(nonnull Mat *)distCoeffs;Parameters
imageinput image
boardlayout of markers in the board.
detectedCornersvector of already detected marker corners.
detectedIdsvector of already detected marker identifiers.
rejectedCornersvector of rejected candidates during the marker detection process.
cameraMatrixoptional input 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } 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 reprojected marker in order to consider it as a correspondence. capability of the used dictionary. -1 ignores the error correction step. If it set to false, only the provided corner order is considered (default true). original rejectedCorners array. -
Refind not detected markers based on the already detected and the board layout
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.
Declaration
Objective-C
+ (void)refineDetectedMarkers:(nonnull Mat *)image board:(nonnull Board *)board detectedCorners:(nonnull NSMutableArray<Mat *> *)detectedCorners detectedIds:(nonnull Mat *)detectedIds rejectedCorners:(nonnull NSMutableArray<Mat *> *)rejectedCorners cameraMatrix:(nonnull Mat *)cameraMatrix;Parameters
imageinput image
boardlayout of markers in the board.
detectedCornersvector of already detected marker corners.
detectedIdsvector of already detected marker identifiers.
rejectedCornersvector of rejected candidates during the marker detection process.
cameraMatrixoptional input 3x3 floating-point camera matrix
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}(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 reprojected marker in order to consider it as a correspondence. capability of the used dictionary. -1 ignores the error correction step. If it set to false, only the provided corner order is considered (default true). original rejectedCorners array. -
Refind not detected markers based on the already detected and the board layout
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.
Declaration
Parameters
imageinput image
boardlayout of markers in the board.
detectedCornersvector of already detected marker corners.
detectedIdsvector of already detected marker identifiers.
rejectedCornersvector of rejected candidates during the marker detection process.
\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\ #4 & #5 & #6\\ #7 & #8 & #9 \end{bmatrix} } A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}(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 reprojected marker in order to consider it as a correspondence. capability of the used dictionary. -1 ignores the error correction step. If it set to false, only the provided corner order is considered (default true). original rejectedCorners array.
View on GitHub
Aruco Class Reference