1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-16 22:35:51 +08:00

fix docs/API

This commit is contained in:
AleksandrPanov
2022-07-04 10:32:20 +03:00
parent 774faf3a67
commit 64804f06b3
5 changed files with 51 additions and 51 deletions

View File

@@ -12,8 +12,7 @@ namespace aruco {
//! @addtogroup aruco //! @addtogroup aruco
//! @{ //! @{
/** @brief /** @brief rvec/tvec define the right handed coordinate system of the marker.
* rvec/tvec define the right handed coordinate system of the marker.
* PatternPos defines center this system and axes direction. * PatternPos defines center this system and axes direction.
* Axis X (red color) - first coordinate, axis Y (green color) - second coordinate, * Axis X (red color) - first coordinate, axis Y (green color) - second coordinate,
* axis Z (blue color) - third coordinate. * axis Z (blue color) - third coordinate.
@@ -28,7 +27,7 @@ enum PatternPos {
* These pattern points define this coordinate system: * These pattern points define this coordinate system:
* ![Image with axes drawn](images/singlemarkersaxes.jpg) * ![Image with axes drawn](images/singlemarkersaxes.jpg)
*/ */
CCW_center, CCW_CENTER,
/** @brief The marker coordinate system is centered on the top-left corner of the marker. /** @brief The marker coordinate system is centered on the top-left corner of the marker.
* The coordinates of the four corners (CW order) of the marker in its own coordinate system are: * The coordinates of the four corners (CW order) of the marker in its own coordinate system are:
* (0, 0, 0), (markerLength, 0, 0), * (0, 0, 0), (markerLength, 0, 0),
@@ -39,12 +38,11 @@ enum PatternPos {
* *
* These pattern dots are convenient to use with a chessboard/ChArUco board. * These pattern dots are convenient to use with a chessboard/ChArUco board.
*/ */
CW_top_left_corner CW_TOP_LEFT_CORNER
}; };
/** @brief /** @brief Pose estimation parameters
* Pose estimation parameters * @param pattern Defines center this system and axes direction (default PatternPos::CCW_CENTER).
* @param pattern Defines center this system and axes direction (default PatternPos::CCW_center).
* @param useExtrinsicGuess Parameter used for SOLVEPNP_ITERATIVE. If true (1), the function uses the provided * @param useExtrinsicGuess Parameter used for SOLVEPNP_ITERATIVE. If true (1), the function uses the provided
* rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further * rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further
* optimizes them (default false). * optimizes them (default false).
@@ -56,7 +54,7 @@ struct CV_EXPORTS_W EstimateParameters {
CV_PROP_RW bool useExtrinsicGuess; CV_PROP_RW bool useExtrinsicGuess;
CV_PROP_RW SolvePnPMethod solvePnPMethod; CV_PROP_RW SolvePnPMethod solvePnPMethod;
EstimateParameters(): pattern(CCW_center), useExtrinsicGuess(false), EstimateParameters(): pattern(CCW_CENTER), useExtrinsicGuess(false),
solvePnPMethod(SOLVEPNP_ITERATIVE) {} solvePnPMethod(SOLVEPNP_ITERATIVE) {}
CV_WRAP static Ptr<EstimateParameters> create() { CV_WRAP static Ptr<EstimateParameters> create() {
@@ -82,9 +80,9 @@ struct CV_EXPORTS_W EstimateParameters {
* Each element in rvecs corresponds to the specific marker in imgPoints. * Each element in rvecs corresponds to the specific marker in imgPoints.
* @param tvecs array of output translation vectors (e.g. std::vector<cv::Vec3d>). * @param tvecs array of output translation vectors (e.g. std::vector<cv::Vec3d>).
* Each element in tvecs corresponds to the specific marker in imgPoints. * Each element in tvecs corresponds to the specific marker in imgPoints.
* @param _objPoints array of object points of all the marker corners * @param objPoints array of object points of all the marker corners
* @param estimateParameters set the origin of coordinate system and the coordinates of the four corners of the marker * @param estimateParameters set the origin of coordinate system and the coordinates of the four corners of the marker
* (default estimateParameters.pattern = PatternPos::CCW_center, estimateParameters.useExtrinsicGuess = false, * (default estimateParameters.pattern = PatternPos::CCW_CENTER, estimateParameters.useExtrinsicGuess = false,
* estimateParameters.solvePnPMethod = SOLVEPNP_ITERATIVE). * estimateParameters.solvePnPMethod = SOLVEPNP_ITERATIVE).
* *
* This function receives the detected markers and returns their pose estimation respect to * This function receives the detected markers and returns their pose estimation respect to
@@ -103,8 +101,8 @@ struct CV_EXPORTS_W EstimateParameters {
*/ */
CV_EXPORTS_W void estimatePoseSingleMarkers(InputArrayOfArrays corners, float markerLength, CV_EXPORTS_W void estimatePoseSingleMarkers(InputArrayOfArrays corners, float markerLength,
InputArray cameraMatrix, InputArray distCoeffs, InputArray cameraMatrix, InputArray distCoeffs,
OutputArray rvecs, OutputArray tvecs, OutputArray _objPoints = noArray(), OutputArray rvecs, OutputArray tvecs, OutputArray objPoints = noArray(),
Ptr<EstimateParameters> estimateParameters = EstimateParameters::create()); const Ptr<EstimateParameters>& estimateParameters = EstimateParameters::create());
/** /**
* @brief Pose estimation for a board of markers * @brief Pose estimation for a board of markers
@@ -193,15 +191,17 @@ double calibrateCameraAruco(InputArrayOfArrays corners, InputArray ids, InputArr
Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, OutputArray stdDeviationsIntrinsics, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, OutputArray stdDeviationsIntrinsics,
OutputArray stdDeviationsExtrinsics, OutputArray perViewErrors, int flags = 0, OutputArray stdDeviationsExtrinsics, OutputArray perViewErrors, int flags = 0,
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON)); const TermCriteria& criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
/** @brief It's the same function as #calibrateCameraAruco but without calibration error estimation. /**
* @brief It's the same function as #calibrateCameraAruco but without calibration error estimation.
* @overload
*/ */
CV_EXPORTS_W double calibrateCameraAruco(InputArrayOfArrays corners, InputArray ids, InputArray counter, CV_EXPORTS_W double calibrateCameraAruco(InputArrayOfArrays corners, InputArray ids, InputArray counter,
const Ptr<Board> &board, Size imageSize, InputOutputArray cameraMatrix, const Ptr<Board> &board, Size imageSize, InputOutputArray cameraMatrix,
InputOutputArray distCoeffs, OutputArrayOfArrays rvecs = noArray(), InputOutputArray distCoeffs, OutputArrayOfArrays rvecs = noArray(),
OutputArrayOfArrays tvecs = noArray(), int flags = 0, OutputArrayOfArrays tvecs = noArray(), int flags = 0,
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, const TermCriteria& criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS,
30, DBL_EPSILON)); 30, DBL_EPSILON));
/** /**
@@ -267,17 +267,18 @@ double calibrateCameraCharuco(InputArrayOfArrays charucoCorners, InputArrayOfArr
const Ptr<CharucoBoard> &board, Size imageSize, InputOutputArray cameraMatrix, const Ptr<CharucoBoard> &board, Size imageSize, InputOutputArray cameraMatrix,
InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
OutputArray stdDeviationsIntrinsics, OutputArray stdDeviationsExtrinsics, OutputArray stdDeviationsIntrinsics, OutputArray stdDeviationsExtrinsics,
OutputArray perViewErrors, int flags = 0, TermCriteria criteria = TermCriteria( OutputArray perViewErrors, int flags = 0, const TermCriteria& criteria = TermCriteria(
TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON)); TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
/** @brief It's the same function as #calibrateCameraCharuco but without calibration error estimation. /**
* @brief It's the same function as #calibrateCameraCharuco but without calibration error estimation.
*/ */
CV_EXPORTS_W double calibrateCameraCharuco(InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, CV_EXPORTS_W double calibrateCameraCharuco(InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds,
const Ptr<CharucoBoard> &board, Size imageSize, const Ptr<CharucoBoard> &board, Size imageSize,
InputOutputArray cameraMatrix, InputOutputArray distCoeffs, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
OutputArrayOfArrays rvecs = noArray(), OutputArrayOfArrays rvecs = noArray(),
OutputArrayOfArrays tvecs = noArray(), int flags = 0, OutputArrayOfArrays tvecs = noArray(), int flags = 0,
TermCriteria criteria=TermCriteria(TermCriteria::COUNT + const TermCriteria& criteria=TermCriteria(TermCriteria::COUNT +
TermCriteria::EPS, 30, DBL_EPSILON)); TermCriteria::EPS, 30, DBL_EPSILON));
//! @} //! @}

View File

@@ -285,8 +285,7 @@ private:
}; };
/** /**
* @brief * @brief The main functionality of ArucoDetector class is detection of markers in an image with detectMarkers() method.
* The main functionality of ArucoDetector class is detection of markers in an image with detectMarkers() method.
* After detecting some markers in the image, you can try to find undetected markers from this dictionary with * After detecting some markers in the image, you can try to find undetected markers from this dictionary with
* refineDetectedMarkers() method. * refineDetectedMarkers() method.
* @see DetectorParameters, RefineParameters * @see DetectorParameters, RefineParameters

View File

@@ -47,13 +47,13 @@ static Mat _getSingleMarkerObjectPoints(float markerLength, const EstimateParame
CV_Assert(markerLength > 0); CV_Assert(markerLength > 0);
Mat objPoints(4, 1, CV_32FC3); Mat objPoints(4, 1, CV_32FC3);
// set coordinate system in the top-left corner of the marker, with Z pointing out // set coordinate system in the top-left corner of the marker, with Z pointing out
if (estimateParameters.pattern == CW_top_left_corner) { if (estimateParameters.pattern == CW_TOP_LEFT_CORNER) {
objPoints.ptr<Vec3f>(0)[0] = Vec3f(0.f, 0.f, 0); objPoints.ptr<Vec3f>(0)[0] = Vec3f(0.f, 0.f, 0);
objPoints.ptr<Vec3f>(0)[1] = Vec3f(markerLength, 0.f, 0); objPoints.ptr<Vec3f>(0)[1] = Vec3f(markerLength, 0.f, 0);
objPoints.ptr<Vec3f>(0)[2] = Vec3f(markerLength, markerLength, 0); objPoints.ptr<Vec3f>(0)[2] = Vec3f(markerLength, markerLength, 0);
objPoints.ptr<Vec3f>(0)[3] = Vec3f(0.f, markerLength, 0); objPoints.ptr<Vec3f>(0)[3] = Vec3f(0.f, markerLength, 0);
} }
else if (estimateParameters.pattern == CCW_center) { else if (estimateParameters.pattern == CCW_CENTER) {
objPoints.ptr<Vec3f>(0)[0] = Vec3f(-markerLength/2.f, markerLength/2.f, 0); objPoints.ptr<Vec3f>(0)[0] = Vec3f(-markerLength/2.f, markerLength/2.f, 0);
objPoints.ptr<Vec3f>(0)[1] = Vec3f(markerLength/2.f, markerLength/2.f, 0); objPoints.ptr<Vec3f>(0)[1] = Vec3f(markerLength/2.f, markerLength/2.f, 0);
objPoints.ptr<Vec3f>(0)[2] = Vec3f(markerLength/2.f, -markerLength/2.f, 0); objPoints.ptr<Vec3f>(0)[2] = Vec3f(markerLength/2.f, -markerLength/2.f, 0);
@@ -67,7 +67,7 @@ static Mat _getSingleMarkerObjectPoints(float markerLength, const EstimateParame
void estimatePoseSingleMarkers(InputArrayOfArrays _corners, float markerLength, void estimatePoseSingleMarkers(InputArrayOfArrays _corners, float markerLength,
InputArray _cameraMatrix, InputArray _distCoeffs, InputArray _cameraMatrix, InputArray _distCoeffs,
OutputArray _rvecs, OutputArray _tvecs, OutputArray _objPoints, OutputArray _rvecs, OutputArray _tvecs, OutputArray _objPoints,
Ptr<EstimateParameters> estimateParameters) { const Ptr<EstimateParameters>& estimateParameters) {
CV_Assert(markerLength > 0); CV_Assert(markerLength > 0);
Mat markerObjPoints = _getSingleMarkerObjectPoints(markerLength, *estimateParameters); Mat markerObjPoints = _getSingleMarkerObjectPoints(markerLength, *estimateParameters);
@@ -178,7 +178,7 @@ double calibrateCameraAruco(InputArrayOfArrays _corners, InputArray _ids, InputA
OutputArray _stdDeviationsIntrinsics, OutputArray _stdDeviationsIntrinsics,
OutputArray _stdDeviationsExtrinsics, OutputArray _stdDeviationsExtrinsics,
OutputArray _perViewErrors, OutputArray _perViewErrors,
int flags, TermCriteria criteria) { int flags, const TermCriteria& criteria) {
// for each frame, get properly processed imagePoints and objectPoints for the calibrateCamera // for each frame, get properly processed imagePoints and objectPoints for the calibrateCamera
// function // function
vector<Mat> processedObjectPoints, processedImagePoints; vector<Mat> processedObjectPoints, processedImagePoints;
@@ -212,7 +212,7 @@ double calibrateCameraAruco(InputArrayOfArrays _corners, InputArray _ids, InputA
double calibrateCameraAruco(InputArrayOfArrays _corners, InputArray _ids, InputArray _counter, const Ptr<Board> &board, double calibrateCameraAruco(InputArrayOfArrays _corners, InputArray _ids, InputArray _counter, const Ptr<Board> &board,
Size imageSize, InputOutputArray _cameraMatrix, InputOutputArray _distCoeffs, Size imageSize, InputOutputArray _cameraMatrix, InputOutputArray _distCoeffs,
OutputArrayOfArrays _rvecs, OutputArrayOfArrays _tvecs, int flags, TermCriteria criteria) { OutputArrayOfArrays _rvecs, OutputArrayOfArrays _tvecs, int flags, const TermCriteria& criteria) {
return calibrateCameraAruco(_corners, _ids, _counter, board, imageSize, _cameraMatrix, _distCoeffs, return calibrateCameraAruco(_corners, _ids, _counter, board, imageSize, _cameraMatrix, _distCoeffs,
_rvecs, _tvecs, noArray(), noArray(), noArray(), flags, criteria); _rvecs, _tvecs, noArray(), noArray(), noArray(), flags, criteria);
} }
@@ -224,7 +224,7 @@ double calibrateCameraCharuco(InputArrayOfArrays _charucoCorners, InputArrayOfAr
OutputArray _stdDeviationsIntrinsics, OutputArray _stdDeviationsIntrinsics,
OutputArray _stdDeviationsExtrinsics, OutputArray _stdDeviationsExtrinsics,
OutputArray _perViewErrors, OutputArray _perViewErrors,
int flags, TermCriteria criteria) { int flags, const TermCriteria& criteria) {
CV_Assert(_charucoIds.total() > 0 && (_charucoIds.total() == _charucoCorners.total())); CV_Assert(_charucoIds.total() > 0 && (_charucoIds.total() == _charucoCorners.total()));
// Join object points of charuco corners in a single vector for calibrateCamera() function // Join object points of charuco corners in a single vector for calibrateCamera() function
@@ -248,7 +248,7 @@ double calibrateCameraCharuco(InputArrayOfArrays _charucoCorners, InputArrayOfAr
double calibrateCameraCharuco(InputArrayOfArrays _charucoCorners, InputArrayOfArrays _charucoIds, double calibrateCameraCharuco(InputArrayOfArrays _charucoCorners, InputArrayOfArrays _charucoIds,
const Ptr<CharucoBoard> &_board, Size imageSize, InputOutputArray _cameraMatrix, const Ptr<CharucoBoard> &_board, Size imageSize, InputOutputArray _cameraMatrix,
InputOutputArray _distCoeffs, OutputArrayOfArrays _rvecs, OutputArrayOfArrays _tvecs, InputOutputArray _distCoeffs, OutputArrayOfArrays _rvecs, OutputArrayOfArrays _tvecs,
int flags, TermCriteria criteria) { int flags, const TermCriteria& criteria) {
return calibrateCameraCharuco(_charucoCorners, _charucoIds, _board, imageSize, _cameraMatrix, _distCoeffs, _rvecs, return calibrateCameraCharuco(_charucoCorners, _charucoIds, _board, imageSize, _cameraMatrix, _distCoeffs, _rvecs,
_tvecs, noArray(), noArray(), noArray(), flags, criteria); _tvecs, noArray(), noArray(), noArray(), flags, criteria);
} }

View File

@@ -441,7 +441,7 @@ void CV_CharucoDiamondDetection::run(int) {
} }
Ptr<aruco::EstimateParameters> estimateParameters = aruco::EstimateParameters::create(); Ptr<aruco::EstimateParameters> estimateParameters = aruco::EstimateParameters::create();
estimateParameters->pattern = aruco::CW_top_left_corner; estimateParameters->pattern = aruco::CW_TOP_LEFT_CORNER;
// estimate diamond pose // estimate diamond pose
vector< Vec3d > estimatedRvec, estimatedTvec; vector< Vec3d > estimatedRvec, estimatedTvec;
aruco::estimatePoseSingleMarkers(diamondCorners, squareLength, cameraMatrix, distCoeffs, estimatedRvec, aruco::estimatePoseSingleMarkers(diamondCorners, squareLength, cameraMatrix, distCoeffs, estimatedRvec,