11// This file is part of OpenCV project.
22// It is subject to the license terms in the LICENSE file found in the top-level directory
33// of this distribution and at http://opencv.org/license.html
4- #ifndef __OPENCV_ARUCO_HPP__
5- #define __OPENCV_ARUCO_HPP__
4+ #ifndef OPENCV_ARUCO_HPP
5+ #define OPENCV_ARUCO_HPP
66
7- #include " opencv2/aruco_detector.hpp"
8- #include " opencv2/aruco/aruco_calib_pose .hpp"
7+ #include " opencv2/objdetect/ aruco_detector.hpp"
8+ #include " opencv2/aruco/aruco_calib .hpp"
99
1010namespace cv {
1111namespace aruco {
1212
1313
1414/* *
15- @deprecated Use class ArucoDetector
15+ @deprecated Use class ArucoDetector::detectMarkers
1616*/
1717CV_EXPORTS_W void detectMarkers (InputArray image, const Ptr<Dictionary> &dictionary, OutputArrayOfArrays corners,
1818 OutputArray ids, const Ptr<DetectorParameters> ¶meters = DetectorParameters::create(),
1919 OutputArrayOfArrays rejectedImgPoints = noArray());
2020
2121/* *
22- @deprecated Use class ArucoDetector
22+ @deprecated Use class ArucoDetector::refineDetectedMarkers
2323*/
2424CV_EXPORTS_W void refineDetectedMarkers (InputArray image,const Ptr<Board> &board,
2525 InputOutputArrayOfArrays detectedCorners,
@@ -29,6 +29,124 @@ CV_EXPORTS_W void refineDetectedMarkers(InputArray image,const Ptr<Board> &boar
2929 bool checkAllOrders = true, OutputArray recoveredIdxs = noArray(),
3030 const Ptr<DetectorParameters> ¶meters = DetectorParameters::create());
3131
32+ /* *
33+ @deprecated Use Board::draw
34+ */
35+ CV_EXPORTS_W void drawPlanarBoard (const Ptr<Board> &board, Size outSize, OutputArray img, int marginSize,
36+ int borderBits);
37+
38+ /* *
39+ @deprecated Use Board::matchImagePoints
40+ */
41+ CV_EXPORTS_W void getBoardObjectAndImagePoints (const Ptr<Board> &board, InputArrayOfArrays detectedCorners,
42+ InputArray detectedIds, OutputArray objPoints, OutputArray imgPoints);
43+
44+
45+ /* *
46+ * @brief Pose estimation for a board of markers
47+ *
48+ * @param corners vector of already detected markers corners. For each marker, its four corners
49+ * are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the
50+ * dimensions of this array should be Nx4. The order of the corners should be clockwise.
51+ * @param ids list of identifiers for each marker in corners
52+ * @param board layout of markers in the board. The layout is composed by the marker identifiers
53+ * and the positions of each marker corner in the board reference system.
54+ * @param cameraMatrix input 3x3 floating-point camera matrix
55+ * \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
56+ * @param distCoeffs vector of distortion coefficients
57+ * \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
58+ * @param rvec Output vector (e.g. cv::Mat) corresponding to the rotation vector of the board
59+ * (see cv::Rodrigues). Used as initial guess if not empty.
60+ * @param tvec Output vector (e.g. cv::Mat) corresponding to the translation vector of the board.
61+ * @param useExtrinsicGuess defines whether initial guess for \b rvec and \b tvec will be used or not.
62+ * Used as initial guess if not empty.
63+ *
64+ * This function receives the detected markers and returns the pose of a marker board composed
65+ * by those markers.
66+ * A Board of marker has a single world coordinate system which is defined by the board layout.
67+ * The returned transformation is the one that transforms points from the board coordinate system
68+ * to the camera coordinate system.
69+ * Input markers that are not included in the board layout are ignored.
70+ * The function returns the number of markers from the input employed for the board pose estimation.
71+ * Note that returning a 0 means the pose has not been estimated.
72+ * @sa use cv::drawFrameAxes to get world coordinate system axis for object points
73+ */
74+ CV_EXPORTS_W int estimatePoseBoard (InputArrayOfArrays corners, InputArray ids, const Ptr<Board> &board,
75+ InputArray cameraMatrix, InputArray distCoeffs, InputOutputArray rvec,
76+ InputOutputArray tvec, bool useExtrinsicGuess = false );
77+
78+ /* *
79+ * @brief Pose estimation for a ChArUco board given some of their corners
80+ * @param charucoCorners vector of detected charuco corners
81+ * @param charucoIds list of identifiers for each corner in charucoCorners
82+ * @param board layout of ChArUco board.
83+ * @param cameraMatrix input 3x3 floating-point camera matrix
84+ * \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
85+ * @param distCoeffs vector of distortion coefficients
86+ * \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
87+ * @param rvec Output vector (e.g. cv::Mat) corresponding to the rotation vector of the board
88+ * (see cv::Rodrigues).
89+ * @param tvec Output vector (e.g. cv::Mat) corresponding to the translation vector of the board.
90+ * @param useExtrinsicGuess defines whether initial guess for \b rvec and \b tvec will be used or not.
91+ *
92+ * This function estimates a Charuco board pose from some detected corners.
93+ * The function checks if the input corners are enough and valid to perform pose estimation.
94+ * If pose estimation is valid, returns true, else returns false.
95+ * @sa use cv::drawFrameAxes to get world coordinate system axis for object points
96+ */
97+ CV_EXPORTS_W bool estimatePoseCharucoBoard (InputArray charucoCorners, InputArray charucoIds,
98+ const Ptr<CharucoBoard> &board, InputArray cameraMatrix,
99+ InputArray distCoeffs, InputOutputArray rvec,
100+ InputOutputArray tvec, bool useExtrinsicGuess = false );
101+
102+ /* *
103+ * @brief Pose estimation for single markers
104+ *
105+ * @param corners vector of already detected markers corners. For each marker, its four corners
106+ * are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers,
107+ * the dimensions of this array should be Nx4. The order of the corners should be clockwise.
108+ * @sa detectMarkers
109+ * @param markerLength the length of the markers' side. The returning translation vectors will
110+ * be in the same unit. Normally, unit is meters.
111+ * @param cameraMatrix input 3x3 floating-point camera matrix
112+ * \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
113+ * @param distCoeffs vector of distortion coefficients
114+ * \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
115+ * @param rvecs array of output rotation vectors (@sa Rodrigues) (e.g. std::vector<cv::Vec3d>).
116+ * Each element in rvecs corresponds to the specific marker in imgPoints.
117+ * @param tvecs array of output translation vectors (e.g. std::vector<cv::Vec3d>).
118+ * Each element in tvecs corresponds to the specific marker in imgPoints.
119+ * @param objPoints array of object points of all the marker corners
120+ * @param estimateParameters set the origin of coordinate system and the coordinates of the four corners of the marker
121+ * (default estimateParameters.pattern = PatternPositionType::ARUCO_CCW_CENTER, estimateParameters.useExtrinsicGuess = false,
122+ * estimateParameters.solvePnPMethod = SOLVEPNP_ITERATIVE).
123+ *
124+ * This function receives the detected markers and returns their pose estimation respect to
125+ * the camera individually. So for each marker, one rotation and translation vector is returned.
126+ * The returned transformation is the one that transforms points from each marker coordinate system
127+ * to the camera coordinate system.
128+ * The marker coordinate system is centered on the middle (by default) or on the top-left corner of the marker,
129+ * with the Z axis perpendicular to the marker plane.
130+ * estimateParameters defines the coordinates of the four corners of the marker in its own coordinate system (by default) are:
131+ * (-markerLength/2, markerLength/2, 0), (markerLength/2, markerLength/2, 0),
132+ * (markerLength/2, -markerLength/2, 0), (-markerLength/2, -markerLength/2, 0)
133+ * @sa use cv::drawFrameAxes to get world coordinate system axis for object points
134+ * @sa @ref tutorial_aruco_detection
135+ * @sa EstimateParameters
136+ * @sa PatternPositionType
137+ */
138+ CV_EXPORTS_W void estimatePoseSingleMarkers (InputArrayOfArrays corners, float markerLength,
139+ InputArray cameraMatrix, InputArray distCoeffs,
140+ OutputArray rvecs, OutputArray tvecs, OutputArray objPoints = noArray(),
141+ const Ptr<EstimateParameters>& estimateParameters = EstimateParameters::create());
142+
143+
144+ /* *
145+ @deprecated Use CharucoBoard::testCharucoCornersCollinear
146+ */
147+ CV_EXPORTS_W bool testCharucoCornersCollinear (const Ptr<CharucoBoard> &board, InputArray charucoIds);
148+
149+
32150}
33151}
34152
0 commit comments