Skip to content

Commit

Permalink
fix indentation, add enum prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandrPanov committed Jul 4, 2022
1 parent 926e57c commit 059ade9
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 40 deletions.
10 changes: 5 additions & 5 deletions modules/aruco/include/opencv2/aruco/aruco_calib_pose.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ enum PatternPos {
* These pattern points define this coordinate system:
* ![Image with axes drawn](images/singlemarkersaxes.jpg)
*/
CCW_CENTER,
ARUCO_CCW_CENTER,
/** @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:
* (0, 0, 0), (markerLength, 0, 0),
Expand All @@ -38,11 +38,11 @@ enum PatternPos {
*
* These pattern dots are convenient to use with a chessboard/ChArUco board.
*/
CW_TOP_LEFT_CORNER
ARUCO_CW_TOP_LEFT_CORNER
};

/** @brief 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::ARUCO_CCW_CENTER).
* @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
* optimizes them (default false).
Expand All @@ -54,7 +54,7 @@ struct CV_EXPORTS_W EstimateParameters {
CV_PROP_RW bool useExtrinsicGuess;
CV_PROP_RW SolvePnPMethod solvePnPMethod;

EstimateParameters(): pattern(CCW_CENTER), useExtrinsicGuess(false),
EstimateParameters(): pattern(ARUCO_CCW_CENTER), useExtrinsicGuess(false),
solvePnPMethod(SOLVEPNP_ITERATIVE) {}

CV_WRAP static Ptr<EstimateParameters> create() {
Expand Down Expand Up @@ -82,7 +82,7 @@ struct CV_EXPORTS_W EstimateParameters {
* Each element in tvecs corresponds to the specific marker in imgPoints.
* @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
* (default estimateParameters.pattern = PatternPos::CCW_CENTER, estimateParameters.useExtrinsicGuess = false,
* (default estimateParameters.pattern = PatternPos::ARUCO_CCW_CENTER, estimateParameters.useExtrinsicGuess = false,
* estimateParameters.solvePnPMethod = SOLVEPNP_ITERATIVE).
*
* This function receives the detected markers and returns their pose estimation respect to
Expand Down
58 changes: 26 additions & 32 deletions modules/aruco/include/opencv2/aruco/board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,44 +25,40 @@ class Dictionary;
* - The identifier of all the markers in the board.
*/
class CV_EXPORTS_W Board {
public:
/**
* @brief Provide way to create Board by passing necessary data. Specially needed in Python.
*
* @param objPoints array of object points of all the marker corners in the board
* @param dictionary the dictionary of markers employed for this board
* @param ids vector of the identifiers of the markers in the board
*
*/
public:
/** @brief Provide way to create Board by passing necessary data. Specially needed in Python.
* @param objPoints array of object points of all the marker corners in the board
* @param dictionary the dictionary of markers employed for this board
* @param ids vector of the identifiers of the markers in the board
*/
CV_WRAP static Ptr<Board> create(InputArrayOfArrays objPoints, const Ptr<Dictionary> &dictionary, InputArray ids);

/**
* @brief Set ids vector
*
* @param ids vector of the identifiers of the markers in the board (should be the same size
* as objPoints)
*
* Recommended way to set ids vector, which will fail if the size of ids does not match size
* of objPoints.
*/
/** @brief Set ids vector
* @param ids vector of the identifiers of the markers in the board (should be the same size
* as objPoints)
*
* Recommended way to set ids vector, which will fail if the size of ids does not match size
* of objPoints.
*/
CV_WRAP void setIds(InputArray ids);

/// array of object points of all the marker corners in the board
/// each marker include its 4 corners in this order:
///- objPoints[i][0] - left-top point of i-th marker
///- objPoints[i][1] - right-top point of i-th marker
///- objPoints[i][2] - right-bottom point of i-th marker
///- objPoints[i][3] - left-bottom point of i-th marker
///
/// Markers are placed in a certain order - row by row, left to right in every row.
/// For M markers, the size is Mx4.
/** @brief array of object points of all the marker corners in the board each marker include its 4 corners in this order:
* - objPoints[i][0] - left-top point of i-th marker
* - objPoints[i][1] - right-top point of i-th marker
* - objPoints[i][2] - right-bottom point of i-th marker
* - objPoints[i][3] - left-bottom point of i-th marker
*
* Markers are placed in a certain order - row by row, left to right in every row.
* For M markers, the size is Mx4.
*/
CV_PROP std::vector<std::vector<Point3f> > objPoints;

/// the dictionary of markers employed for this board
CV_PROP Ptr<Dictionary> dictionary;

/// vector of the identifiers of the markers in the board (same size than objPoints)
/// The identifiers refers to the board dictionary
/** @brief vector of the identifiers of the markers in the board (same size than objPoints)
* The identifiers refers to the board dictionary
*/
CV_PROP_RW std::vector<int> ids;

/// coordinate of the bottom right corner of the board, is set when calling the function create()
Expand Down Expand Up @@ -173,9 +169,7 @@ class CV_EXPORTS_W CharucoBoard : public Board {
CV_WRAP void draw(Size outSize, OutputArray img, int marginSize = 0, int borderBits = 1);


/**
* @brief Create a CharucoBoard object
*
/** @brief Create a CharucoBoard object
* @param squaresX number of chessboard squares in X direction
* @param squaresY number of chessboard squares in Y direction
* @param squareLength chessboard square side length (normally in meters)
Expand Down
4 changes: 2 additions & 2 deletions modules/aruco/src/aruco_calib_pose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ static Mat _getSingleMarkerObjectPoints(float markerLength, const EstimateParame
CV_Assert(markerLength > 0);
Mat objPoints(4, 1, CV_32FC3);
// 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 == ARUCO_CW_TOP_LEFT_CORNER) {
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)[2] = Vec3f(markerLength, markerLength, 0);
objPoints.ptr<Vec3f>(0)[3] = Vec3f(0.f, markerLength, 0);
}
else if (estimateParameters.pattern == CCW_CENTER) {
else if (estimateParameters.pattern == ARUCO_CCW_CENTER) {
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)[2] = Vec3f(markerLength/2.f, -markerLength/2.f, 0);
Expand Down
2 changes: 1 addition & 1 deletion modules/aruco/test/test_charucodetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ void CV_CharucoDiamondDetection::run(int) {
}

Ptr<aruco::EstimateParameters> estimateParameters = aruco::EstimateParameters::create();
estimateParameters->pattern = aruco::CW_TOP_LEFT_CORNER;
estimateParameters->pattern = aruco::ARUCO_CW_TOP_LEFT_CORNER;
// estimate diamond pose
vector< Vec3d > estimatedRvec, estimatedTvec;
aruco::estimatePoseSingleMarkers(diamondCorners, squareLength, cameraMatrix, distCoeffs, estimatedRvec,
Expand Down

0 comments on commit 059ade9

Please sign in to comment.