Skip to content

Commit a76f731

Browse files
committed
add setIds and make ids field RW in python
1 parent 4613c51 commit a76f731

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

modules/aruco/include/opencv2/aruco.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ class CV_EXPORTS_W Board {
290290

291291
/// vector of the identifiers of the markers in the board (same size than objPoints)
292292
/// The identifiers refers to the board dictionary
293-
CV_PROP std::vector< int > ids;
293+
CV_PROP_RW std::vector< int > ids;
294294
};
295295

296296

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

+11
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ class CV_EXPORTS_W CharucoBoard : public Board {
100100
CV_WRAP static Ptr<CharucoBoard> create(int squaresX, int squaresY, float squareLength,
101101
float markerLength, const Ptr<Dictionary> &dictionary);
102102

103+
/**
104+
* @brief Set ids vector
105+
*
106+
* @param ids vector of the identifiers of the markers in the board (should be the same size
107+
* as objPoints)
108+
*
109+
* Safe way to set ids vector instead of backward-compatible legacy solution using direct assignment
110+
* to ids field.
111+
*/
112+
CV_WRAP void setIds(InputArray ids);
113+
103114
/**
104115
*
105116
*/

modules/aruco/src/charuco.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ Ptr<CharucoBoard> CharucoBoard::create(int squaresX, int squaresY, float squareL
170170
return res;
171171
}
172172

173-
173+
void CharucoBoard::setIds(InputArray ids_) {
174+
CV_Assert(objPoints.size() == ids_.total());
175+
ids_.copyTo(this->ids);
176+
}
174177

175178
/**
176179
* Fill nearestMarkerIdx and nearestMarkerCorners arrays

0 commit comments

Comments
 (0)