Skip to content

Commit 4f21f5c

Browse files
author
AleksandrPanov
committed
move estimatePoseBoard() to board class
1 parent f808569 commit 4f21f5c

File tree

7 files changed

+48
-10
lines changed

7 files changed

+48
-10
lines changed

modules/aruco/include/opencv2/aruco.hpp

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ namespace aruco {
1212

1313

1414
/**
15-
@deprecated Use class ArucoDetector
15+
@deprecated Use class ArucoDetector::detectMarkers
1616
*/
1717
CV_EXPORTS_W void detectMarkers(InputArray image, const Ptr<Dictionary> &dictionary, OutputArrayOfArrays corners,
1818
OutputArray ids, const Ptr<DetectorParameters> &parameters = DetectorParameters::create(),
1919
OutputArrayOfArrays rejectedImgPoints = noArray());
2020

2121
/**
22-
@deprecated Use class ArucoDetector
22+
@deprecated Use class ArucoDetector::refineDetectedMarkers
2323
*/
2424
CV_EXPORTS_W void refineDetectedMarkers(InputArray image,const Ptr<Board> &board,
2525
InputOutputArrayOfArrays detectedCorners,
@@ -30,11 +30,33 @@ CV_EXPORTS_W void refineDetectedMarkers(InputArray image,const Ptr<Board> &boar
3030
const Ptr<DetectorParameters> &parameters = DetectorParameters::create());
3131

3232
/**
33-
@deprecated Use Board::draw()
33+
@deprecated Use Board::draw
3434
*/
3535
CV_EXPORTS_W void drawPlanarBoard(const Ptr<Board> &board, Size outSize, OutputArray img, int marginSize,
3636
int borderBits);
3737

38+
/**
39+
@deprecated Use Board::getBoardObjectAndImagePoints
40+
*/
41+
CV_EXPORTS_W void getBoardObjectAndImagePoints(const Ptr<Board> &board, InputArrayOfArrays detectedCorners,
42+
InputArray detectedIds, OutputArray objPoints, OutputArray imgPoints);
43+
44+
45+
/**
46+
@deprecated Use Board::estimatePose
47+
*/
48+
CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, const Ptr<Board> &board,
49+
InputArray cameraMatrix, InputArray distCoeffs, InputOutputArray rvec,
50+
InputOutputArray tvec, bool useExtrinsicGuess = false);
51+
52+
/**
53+
@deprecated Use CharucoBoard::estimatePose
54+
*/
55+
CV_EXPORTS_W bool estimatePoseCharucoBoard(InputArray charucoCorners, InputArray charucoIds,
56+
const Ptr<CharucoBoard> &board, InputArray cameraMatrix,
57+
InputArray distCoeffs, InputOutputArray rvec,
58+
InputOutputArray tvec, bool useExtrinsicGuess = false);
59+
3860
}
3961
}
4062

modules/aruco/samples/detect_board.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ int main(int argc, char *argv[]) {
180180
int markersOfBoardDetected = 0;
181181
if(ids.size() > 0)
182182
markersOfBoardDetected =
183-
aruco::estimatePoseBoard(corners, ids, board, camMatrix, distCoeffs, rvec, tvec);
183+
board->estimatePose(corners, ids, camMatrix, distCoeffs, rvec, tvec);
184184

185185
double currentTime = ((double)getTickCount() - tick) / getTickFrequency();
186186
totalTime += currentTime;

modules/aruco/samples/detect_board_charuco.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ int main(int argc, char *argv[]) {
182182
// estimate charuco board pose
183183
bool validPose = false;
184184
if(camMatrix.total() != 0)
185-
validPose = aruco::estimatePoseCharucoBoard(charucoCorners, charucoIds, charucoboard,
186-
camMatrix, distCoeffs, rvec, tvec);
185+
validPose = charucoboard->estimateCharucoPose(charucoCorners, charucoIds, camMatrix, distCoeffs, rvec, tvec);
187186

188187

189188

modules/aruco/src/aruco.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,23 @@ void drawPlanarBoard(const Ptr<Board> &board, Size outSize, const _OutputArray &
3232
board->draw(outSize, img, marginSize, borderBits);
3333
}
3434

35+
void getBoardObjectAndImagePoints(const Ptr<Board> &board, InputArrayOfArrays detectedCorners, InputArray detectedIds,
36+
OutputArray objPoints, OutputArray imgPoints) {
37+
board->getBoardObjectAndImagePoints(detectedCorners, detectedIds, objPoints, imgPoints);
38+
}
39+
40+
int estimatePoseBoard(InputArrayOfArrays _corners, InputArray _ids, const Ptr<Board> &board,
41+
InputArray _cameraMatrix, InputArray _distCoeffs, InputOutputArray _rvec,
42+
InputOutputArray _tvec, bool useExtrinsicGuess) {
43+
return board->estimatePose(_corners, _ids, _cameraMatrix, _distCoeffs, _rvec, _tvec, useExtrinsicGuess);
44+
}
45+
46+
bool estimatePoseCharucoBoard(InputArray charucoCorners, InputArray charucoIds,
47+
const Ptr<CharucoBoard> &board, InputArray cameraMatrix,
48+
InputArray distCoeffs, InputOutputArray rvec,
49+
InputOutputArray tvec, bool useExtrinsicGuess) {
50+
return board->estimateCharucoPose(charucoCorners, charucoIds, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess);
51+
}
52+
3553
}
3654
}

modules/aruco/src/aruco_calib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ double calibrateCameraAruco(InputArrayOfArrays _corners, InputArray _ids, InputA
3636
}
3737
markerCounter += nMarkersInThisFrame;
3838
Mat currentImgPoints, currentObjPoints;
39-
getBoardObjectAndImagePoints(board, thisFrameCorners, thisFrameIds, currentObjPoints,
39+
board->getBoardObjectAndImagePoints(thisFrameCorners, thisFrameIds, currentObjPoints,
4040
currentImgPoints);
4141
if(currentImgPoints.total() > 0 && currentObjPoints.total() > 0) {
4242
processedImagePoints.push_back(currentImgPoints);

modules/aruco/test/test_boarddetection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void CV_ArucoBoardPose::run(int) {
107107

108108
// estimate pose
109109
Mat rvec, tvec;
110-
aruco::estimatePoseBoard(corners, ids, board, cameraMatrix, distCoeffs, rvec, tvec);
110+
board->estimatePose(corners, ids, cameraMatrix, distCoeffs, rvec, tvec);
111111

112112
// check axes
113113
vector<Point2f> axes = getAxis(cameraMatrix, distCoeffs, rvec, tvec, gridboard->getRightBottomBorder().x);

modules/aruco/test/test_charucodetection.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,7 @@ void CV_CharucoPoseEstimation::run(int) {
284284
if(charucoIds.size() == 0) continue;
285285

286286
// estimate charuco pose
287-
aruco::estimatePoseCharucoBoard(charucoCorners, charucoIds, board, cameraMatrix,
288-
distCoeffs, rvec, tvec);
287+
board->estimateCharucoPose(charucoCorners, charucoIds, cameraMatrix, distCoeffs, rvec, tvec);
289288

290289

291290
// check axes

0 commit comments

Comments
 (0)