Skip to content

Commit 806b6c8

Browse files
author
AleksandrPanov
committed
fixed cerr, added deprecated
1 parent a90019b commit 806b6c8

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed

modules/aruco/include/opencv2/aruco.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ CV_EXPORTS_W void getBoardObjectAndImagePoints(const Ptr<Board> &board, InputArr
5252
InputArray detectedIds, OutputArray objPoints, OutputArray imgPoints);
5353

5454

55-
/** @deprecated Use cv::solvePnP
55+
/** @deprecated Use Board::matchImagePoints and cv::solvePnP
5656
*/
5757
CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, const Ptr<Board> &board,
5858
InputArray cameraMatrix, InputArray distCoeffs, InputOutputArray rvec,
@@ -75,6 +75,7 @@ CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, c
7575
* This function estimates a Charuco board pose from some detected corners.
7676
* The function checks if the input corners are enough and valid to perform pose estimation.
7777
* If pose estimation is valid, returns true, else returns false.
78+
* @deprecated Use CharucoBoard::matchImagePoints and cv::solvePnP
7879
* @sa use cv::drawFrameAxes to get world coordinate system axis for object points
7980
*/
8081
CV_EXPORTS_W bool estimatePoseCharucoBoard(InputArray charucoCorners, InputArray charucoIds,

modules/aruco/include/opencv2/aruco/aruco_calib.hpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ namespace aruco {
1616
* PatternPositionType defines center this system and axes direction.
1717
* Axis X (red color) - first coordinate, axis Y (green color) - second coordinate,
1818
* axis Z (blue color) - third coordinate.
19-
* @sa estimatePoseSingleMarkers(), check tutorial_aruco_detection in aruco contrib
19+
*
20+
* @deprecated Use Board::matchImagePoints and cv::solvePnP
21+
*
22+
* @sa estimatePoseSingleMarkers()
2023
*/
2124
enum PatternPositionType {
2225
/** @brief The marker coordinate system is centered on the middle of the marker.
2326
*
2427
* The coordinates of the four corners (CCW order) of the marker in its own coordinate system are:
2528
* (-markerLength/2, markerLength/2, 0), (markerLength/2, markerLength/2, 0),
2629
* (markerLength/2, -markerLength/2, 0), (-markerLength/2, -markerLength/2, 0).
27-
*
28-
* These pattern points define this coordinate system:
29-
* ![Image with axes drawn](tutorials/images/singlemarkersaxes2.jpg)
3030
*/
3131
ARUCO_CCW_CENTER,
3232
/** @brief The marker coordinate system is centered on the top-left corner of the marker.
@@ -35,9 +35,6 @@ enum PatternPositionType {
3535
* (0, 0, 0), (markerLength, 0, 0),
3636
* (markerLength, markerLength, 0), (0, markerLength, 0).
3737
*
38-
* These pattern points define this coordinate system:
39-
* ![Image with axes drawn](tutorials/images/singlemarkersaxes.jpg)
40-
*
4138
* These pattern dots are convenient to use with a chessboard/ChArUco board.
4239
*/
4340
ARUCO_CW_TOP_LEFT_CORNER
@@ -50,7 +47,10 @@ enum PatternPositionType {
5047
* rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further
5148
* optimizes them (default false).
5249
* @param solvePnPMethod Method for solving a PnP problem: see @ref calib3d_solvePnP_flags (default SOLVEPNP_ITERATIVE).
53-
* @sa PatternPositionType, solvePnP(), check tutorial_aruco_detection in aruco contrib
50+
*
51+
* @deprecated Use Board::matchImagePoints and cv::solvePnP
52+
*
53+
* @sa PatternPositionType, solvePnP()
5454
*/
5555
struct CV_EXPORTS_W_SIMPLE EstimateParameters {
5656
CV_PROP_RW PatternPositionType pattern;
@@ -95,6 +95,8 @@ struct CV_EXPORTS_W_SIMPLE EstimateParameters {
9595
* This function calibrates a camera using an Aruco Board. The function receives a list of
9696
* detected markers from several views of the Board. The process is similar to the chessboard
9797
* calibration in calibrateCamera(). The function returns the final re-projection error.
98+
*
99+
* @deprecated Use Board::matchImagePoints and cv::solvePnP
98100
*/
99101
CV_EXPORTS_AS(calibrateCameraArucoExtended)
100102
double calibrateCameraAruco(InputArrayOfArrays corners, InputArray ids, InputArray counter, const Ptr<Board> &board,
@@ -105,6 +107,7 @@ double calibrateCameraAruco(InputArrayOfArrays corners, InputArray ids, InputArr
105107

106108
/** @overload
107109
* @brief It's the same function as #calibrateCameraAruco but without calibration error estimation.
110+
* @deprecated Use Board::matchImagePoints and cv::solvePnP
108111
*/
109112
CV_EXPORTS_W double calibrateCameraAruco(InputArrayOfArrays corners, InputArray ids, InputArray counter,
110113
const Ptr<Board> &board, Size imageSize, InputOutputArray cameraMatrix,
@@ -147,6 +150,8 @@ CV_EXPORTS_W double calibrateCameraAruco(InputArrayOfArrays corners, InputArray
147150
* This function calibrates a camera using a set of corners of a Charuco Board. The function
148151
* receives a list of detected corners and its identifiers from several views of the Board.
149152
* The function returns the final re-projection error.
153+
*
154+
* @deprecated Use CharucoBoard::matchImagePoints and cv::solvePnP
150155
*/
151156
CV_EXPORTS_AS(calibrateCameraCharucoExtended)
152157
double calibrateCameraCharuco(InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds,
@@ -158,6 +163,8 @@ double calibrateCameraCharuco(InputArrayOfArrays charucoCorners, InputArrayOfArr
158163

159164
/**
160165
* @brief It's the same function as #calibrateCameraCharuco but without calibration error estimation.
166+
*
167+
* @deprecated Use CharucoBoard::matchImagePoints and cv::solvePnP
161168
*/
162169
CV_EXPORTS_W double calibrateCameraCharuco(InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds,
163170
const Ptr<CharucoBoard> &board, Size imageSize,

modules/aruco/include/opencv2/aruco/charuco.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ CV_EXPORTS_W void detectCharucoDiamond(InputArray image, InputArrayOfArrays mark
9696
* @param borderBits width of the marker borders.
9797
*
9898
* This function return the image of a ChArUco marker, ready to be printed.
99+
*
100+
* @deprecated Use CharucoBoard::generateImage()
99101
*/
100102
CV_EXPORTS_W void drawCharucoDiamond(const Ptr<Dictionary> &dictionary, Vec4i ids, int squareLength,
101103
int markerLength, OutputArray img, int marginSize = 0,

modules/aruco/samples/aruco_samples_utility.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ inline static cv::aruco::DetectorParameters readDetectorParamsFromCommandLine(cv
5252
cv::FileStorage fs(parser.get<std::string>("dp"), cv::FileStorage::READ);
5353
bool readOk = detectorParams.readDetectorParameters(fs.root());
5454
if(!readOk) {
55-
std::cerr << "Invalid detector parameters file" << std::endl;
56-
throw -1;
55+
throw std::runtime_error("Invalid detector parameters file\n");
5756
}
5857
}
5958
return detectorParams;
@@ -64,8 +63,7 @@ inline static void readCameraParamsFromCommandLine(cv::CommandLineParser &parser
6463
if(parser.has("c")) {
6564
bool readOk = readCameraParameters(parser.get<std::string>("c"), camMatrix, distCoeffs);
6665
if(!readOk) {
67-
std::cerr << "Invalid camera file" << std::endl;
68-
throw -1;
66+
throw std::runtime_error("Invalid camera file\n");
6967
}
7068
}
7169
//! [camDistCoeffs]
@@ -77,8 +75,7 @@ inline static cv::aruco::Dictionary readDictionatyFromCommandLine(cv::CommandLin
7775
cv::FileStorage fs(parser.get<std::string>("cd"), cv::FileStorage::READ);
7876
bool readOk = dictionary.readDictionary(fs.root());
7977
if(!readOk) {
80-
std::cerr << "Invalid dictionary file" << std::endl;
81-
throw -1;
78+
throw std::runtime_error("Invalid dictionary file\n");
8279
}
8380
}
8481
else {

modules/aruco/samples/calibrate_camera.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ int main(int argc, char *argv[]) {
143143
//! [CalibrationWithArucoBoard2]
144144

145145
if(allMarkerIds.empty()) {
146-
cerr << "Not enough captures for calibration" << endl;
147-
return 0;
146+
throw std::runtime_error("Not enough captures for calibration\n");
148147
}
149148

150149
//! [CalibrationWithArucoBoard3]
@@ -180,8 +179,7 @@ int main(int argc, char *argv[]) {
180179
cameraMatrix, distCoeffs, repError);
181180

182181
if(!saveOk) {
183-
cerr << "Cannot save output file" << endl;
184-
return 0;
182+
throw std::runtime_error("Cannot save output file\n");
185183
}
186184

187185
cout << "Rep Error: " << repError << endl;

modules/aruco/samples/create_diamond.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ int main(int argc, char *argv[]) {
5151
while(getline(ss, token, ','))
5252
splittedIds.push_back(token);
5353
if(splittedIds.size() < 4) {
54-
cerr << "Incorrect ids format" << endl;
55-
parser.printMessage();
56-
return 0;
54+
throw std::runtime_error("Incorrect ids format\n");
5755
}
5856
Vec4i ids;
5957
for(int i = 0; i < 4; i++)

0 commit comments

Comments
 (0)