9
9
/* *
10
10
* @defgroup aruco ArUco Marker Detection
11
11
* This module is dedicated to square fiducial markers (also known as Augmented Reality Markers)
12
- * These markers are useful for easy, fast and robust camera pose estimation.ç
12
+ * These markers are useful for easy, fast and robust camera pose estimation.
13
13
*
14
- * The main functionalities are :
14
+ * The main functionality of ArucoDetector class is :
15
15
* - Detection of markers in an image
16
+ *
17
+ * There are even more functionalities implemented in charuco.hpp and aruco_calib_pose.hpp:
16
18
* - Pose estimation from a single marker or from a board/set of markers
17
19
* - Detection of ChArUco board for high subpixel accuracy
18
20
* - Camera calibration from both, ArUco boards and ChArUco boards.
@@ -48,6 +50,9 @@ enum CornerRefineMethod{
48
50
CORNER_REFINE_APRILTAG, // /< Tag and corners detection based on the AprilTag 2 approach @cite wang2016iros
49
51
};
50
52
53
+ /* *
54
+ * @brief struct DetectorParameters is used by ArucoDetector
55
+ */
51
56
struct CV_EXPORTS_W DetectorParameters {
52
57
DetectorParameters () {
53
58
adaptiveThreshWinSizeMin = 3 ;
@@ -84,8 +89,7 @@ struct CV_EXPORTS_W DetectorParameters {
84
89
minMarkerLengthRatioOriginalImg = 0.0 ;
85
90
};
86
91
87
- /* *
88
- * @brief Create a new set of DetectorParameters with default values.
92
+ /* * @brief Create a new set of DetectorParameters with default values.
89
93
*/
90
94
CV_WRAP static Ptr<DetectorParameters> create () {
91
95
Ptr<DetectorParameters> params = makePtr<DetectorParameters>();
@@ -114,12 +118,14 @@ struct CV_EXPORTS_W DetectorParameters {
114
118
// / constant for adaptive thresholding before finding contours (default 7)
115
119
CV_PROP_RW double adaptiveThreshConstant;
116
120
117
- // / determine minimum perimeter for marker contour to be detected. This is defined as a rate respect to the
118
- // / maximum dimension of the input image (default 0.03).
121
+ /* * @brief determine minimum perimeter for marker contour to be detected. This is defined as a rate respect to the
122
+ * maximum dimension of the input image (default 0.03).
123
+ */
119
124
CV_PROP_RW double minMarkerPerimeterRate;
120
125
121
- // / determine maximum perimeter for marker contour to be detected. This is defined as a rate respect to
122
- // / the maximum dimension of the input image (default 4.0).
126
+ /* * @brief determine maximum perimeter for marker contour to be detected. This is defined as a rate respect to
127
+ * the maximum dimension of the input image (default 4.0).
128
+ */
123
129
CV_PROP_RW double maxMarkerPerimeterRate;
124
130
125
131
// / minimum accuracy during the polygonal approximation process to determine which contours are squares. (default 0.03)
@@ -131,15 +137,17 @@ struct CV_EXPORTS_W DetectorParameters {
131
137
// / minimum distance of any corner to the image border for detected markers (in pixels) (default 3)
132
138
CV_PROP_RW int minDistanceToBorder;
133
139
134
- // / minimum mean distance beetween two marker corners to be considered imilar, so that the
135
- // / smaller one is removed. The rate is relative to the smaller perimeter of the two markers (default 0.05).
140
+ /* * @brief minimum mean distance beetween two marker corners to be considered imilar, so that the
141
+ * smaller one is removed. The rate is relative to the smaller perimeter of the two markers (default 0.05).
142
+ */
136
143
CV_PROP_RW double minMarkerDistanceRate;
137
144
138
- // / corner refinement method (default CORNER_REFINE_NONE).
139
- // / 0:CORNER_REFINE_NONE, no refinement.
140
- // / 1: CORNER_REFINE_SUBPIX, do subpixel refinement.
141
- // / 2: CORNER_REFINE_CONTOUR use contour-Points,
142
- // / 3: CORNER_REFINE_APRILTAG use the AprilTag2 approach).
145
+ /* * @brief default CORNER_REFINE_NONE.
146
+ * 0:CORNER_REFINE_NONE, no refinement.
147
+ * 1: CORNER_REFINE_SUBPIX, do subpixel refinement.
148
+ * 2: CORNER_REFINE_CONTOUR use contour-Points,
149
+ * 3: CORNER_REFINE_APRILTAG use the AprilTag2 approach).
150
+ */
143
151
CV_PROP_RW int cornerRefinementMethod;
144
152
145
153
// / window size for the corner refinement process (in pixels) (default 5).
@@ -157,25 +165,29 @@ struct CV_EXPORTS_W DetectorParameters {
157
165
// / number of bits (per dimension) for each cell of the marker when removing the perspective (default 4).
158
166
CV_PROP_RW int perspectiveRemovePixelPerCell;
159
167
160
- // / width of the margin of pixels on each cell not considered for the
161
- // / determination of the cell bit. Represents the rate respect to the total size of the cell, i.e.
162
- // / perspectiveRemovePixelPerCell (default 0.13)
168
+ /* * @brief width of the margin of pixels on each cell not considered for the
169
+ * determination of the cell bit. Represents the rate respect to the total size of the cell, i.e.
170
+ * perspectiveRemovePixelPerCell (default 0.13)
171
+ */
163
172
CV_PROP_RW double perspectiveRemoveIgnoredMarginPerCell;
164
173
165
- // / maximum number of accepted erroneous bits in the border (i.e. number of allowed
166
- // / white bits in the border). Represented as a rate respect to the total number of bits per marker (default 0.35).
174
+ /* * @brief maximum number of accepted erroneous bits in the border (i.e. number of allowed
175
+ * white bits in the border). Represented as a rate respect to the total number of bits per marker (default 0.35).
176
+ */
167
177
CV_PROP_RW double maxErroneousBitsInBorderRate;
168
178
169
- // / minimun standard deviation in pixels values during the decodification step to apply Otsu
170
- // / thresholding (otherwise, all the bits are set to 0 or 1 depending on mean higher than 128 or not) (default 5.0)
179
+ /* * @brief minimun standard deviation in pixels values during the decodification step to apply Otsu
180
+ * thresholding (otherwise, all the bits are set to 0 or 1 depending on mean higher than 128 or not) (default 5.0)
181
+ */
171
182
CV_PROP_RW double minOtsuStdDev;
172
183
173
184
// / error correction rate respect to the maximun error correction capability for each dictionary (default 0.6).
174
185
CV_PROP_RW double errorCorrectionRate;
175
186
176
- // April :: User-configurable parameters.
177
- // / detection of quads can be done on a lower-resolution image, improving speed at a cost of
178
- // / pose accuracy and a slight decrease in detection rate. Decoding the binary payload is still
187
+ /* * @brief April :: User-configurable parameters.
188
+ * detection of quads can be done on a lower-resolution image, improving speed at a cost of
189
+ * pose accuracy and a slight decrease in detection rate. Decoding the binary payload is still
190
+ */
179
191
CV_PROP_RW float aprilTagQuadDecimate;
180
192
181
193
// / what Gaussian blur should be applied to the segmented image (used for quad detection?)
@@ -188,28 +200,32 @@ struct CV_EXPORTS_W DetectorParameters {
188
200
// / how many corner candidates to consider when segmenting a group of pixels into a quad (default 10).
189
201
CV_PROP_RW int aprilTagMaxNmaxima;
190
202
191
- // / reject quads where pairs of edges have angles that are close to straight or close to 180 degrees.
192
- // / Zero means that no quads are rejected. (In radians) (default 10*PI/180)
203
+ /* * @brief reject quads where pairs of edges have angles that are close to straight or close to 180 degrees.
204
+ * Zero means that no quads are rejected. (In radians) (default 10*PI/180)
205
+ */
193
206
CV_PROP_RW float aprilTagCriticalRad;
194
207
195
208
// / when fitting lines to the contours, what is the maximum mean squared error
196
209
CV_PROP_RW float aprilTagMaxLineFitMse;
197
210
198
- // / when we build our model of black & white pixels, we add an extra check that the
199
- // / white model must be (overall) brighter than the black model. How much brighter? (in pixel values, [0,255]).
200
- // / (default 5)
211
+ /* * @brief when we build our model of black & white pixels, we add an extra check that the
212
+ * white model must be (overall) brighter than the black model. How much brighter? (in pixel values, [0,255]).
213
+ * (default 5)
214
+ */
201
215
CV_PROP_RW int aprilTagMinWhiteBlackDiff;
202
216
203
217
// / should the thresholded image be deglitched? Only useful for very noisy images (default 0).
204
218
CV_PROP_RW int aprilTagDeglitch;
205
219
206
- // / to check if there is a white marker. In order to generate a "white" marker just invert a
207
- // / normal marker by using a tilde, ~markerImage. (default false)
220
+ /* * @brief to check if there is a white marker. In order to generate a "white" marker just invert a
221
+ * normal marker by using a tilde, ~markerImage. (default false)
222
+ */
208
223
CV_PROP_RW bool detectInvertedMarker;
209
224
210
- // / new Aruco functionality proposed in the paper:
211
- // / Romero-Ramirez et al: Speeded up detection of squared fiducial markers (2018)
212
- // / https://www.researchgate.net/publication/325787310_Speeded_Up_Detection_of_Squared_Fiducial_Markers
225
+ /* * @brief new Aruco functionality proposed in the paper:
226
+ * Romero-Ramirez et al: Speeded up detection of squared fiducial markers (2018)
227
+ * https://www.researchgate.net/publication/325787310_Speeded_Up_Detection_of_Squared_Fiducial_Markers
228
+ */
213
229
214
230
// / to enable the new and faster Aruco detection strategy.
215
231
CV_PROP_RW bool useAruco3Detection;
@@ -224,6 +240,9 @@ struct CV_EXPORTS_W DetectorParameters {
224
240
bool readWrite (const Ptr<FileNode>& readNode = nullptr , const Ptr<FileStorage>& writeStorage = nullptr );
225
241
};
226
242
243
+ /* *
244
+ * @brief struct RefineParameters is used by ArucoDetector
245
+ */
227
246
struct CV_EXPORTS_W RefineParameters {
228
247
RefineParameters () {
229
248
minRepDistance = 10 .f ;
@@ -245,37 +264,53 @@ struct CV_EXPORTS_W RefineParameters {
245
264
*/
246
265
CV_WRAP bool readRefineParameters (const FileNode& fn);
247
266
248
- /* *
249
- * @brief Write a set of RefineParameters to FileStorage
267
+ /* * @brief Write a set of RefineParameters to FileStorage
250
268
*/
251
269
CV_WRAP bool writeRefineParameters (const Ptr<FileStorage>& fs);
252
270
253
- // / minRepDistance minimum distance between the corners of the rejected candidate and the reprojected marker in
254
- // / order to consider it as a correspondence.
271
+ /* * @brief minRepDistance minimum distance between the corners of the rejected candidate and the reprojected marker in
272
+ * order to consider it as a correspondence.
273
+ */
255
274
CV_PROP_RW float minRepDistance;
256
- // / minRepDistance rate of allowed erroneous bits respect to the error correction
257
- // / capability of the used dictionary. -1 ignores the error correction step.
275
+ /* * @brief minRepDistance rate of allowed erroneous bits respect to the error correction
276
+ * capability of the used dictionary. -1 ignores the error correction step.
277
+ */
258
278
CV_PROP_RW float errorCorrectionRate;
259
- // / checkAllOrders consider the four posible corner orders in the rejectedCorners array.
260
- // * If it set to false, only the provided corner order is considered (default true).
279
+ /* * @brief checkAllOrders consider the four posible corner orders in the rejectedCorners array.
280
+ * If it set to false, only the provided corner order is considered (default true).
281
+ */
261
282
CV_PROP_RW bool checkAllOrders;
262
283
private:
263
284
bool readWrite (const Ptr<FileNode>& readNode = nullptr , const Ptr<FileStorage>& writeStorage = nullptr );
264
285
};
265
286
287
+ /* *
288
+ * @brief
289
+ * The main functionality of ArucoDetector class is detection of markers in an image with detectMarkers() method.
290
+ * After detecting some markers in the image, you can try to find undetected markers from this dictionary with
291
+ * refineDetectedMarkers() method.
292
+ * @see DetectorParameters, RefineParameters
293
+ */
266
294
class CV_EXPORTS_W ArucoDetector : public Algorithm
267
295
{
268
296
public:
269
297
// / dictionary indicates the type of markers that will be searched
270
298
CV_PROP_RW Ptr<Dictionary> dictionary;
271
299
272
- // / marker detection parameters
300
+ // / marker detection parameters, check DetectorParameters docs to see available settings
273
301
CV_PROP_RW Ptr<DetectorParameters> params;
274
302
275
303
// / marker refine parameters
276
304
CV_PROP_RW Ptr<RefineParameters> refineParams;
277
305
278
- ArucoDetector (const Ptr<Dictionary> &_dictionary = getPredefinedDictionary(DICT_4X4_50), const Ptr<DetectorParameters> &_params = DetectorParameters::create(),
306
+ /* *
307
+ * @brief Basic ArucoDetector constructor
308
+ * @param _dictionary indicates the type of markers that will be searched
309
+ * @param _params marker detection parameters
310
+ * @param _refineParams marker refine detection parameters
311
+ */
312
+ ArucoDetector (const Ptr<Dictionary> &_dictionary = getPredefinedDictionary(DICT_4X4_50),
313
+ const Ptr<DetectorParameters> &_params = DetectorParameters::create(),
279
314
const Ptr<RefineParameters> &_refineParams = RefineParameters::create()):
280
315
dictionary (_dictionary), params(_params), refineParams(_refineParams) {}
281
316
@@ -303,7 +338,6 @@ class CV_EXPORTS_W ArucoDetector : public Algorithm
303
338
* @note The function does not correct lens distortion or takes it into account. It's recommended to undistort
304
339
* input image with corresponging camera model, if camera parameters are known
305
340
* @sa undistort, estimatePoseSingleMarkers, estimatePoseBoard
306
- *
307
341
*/
308
342
CV_WRAP void detectMarkers (InputArray image, OutputArrayOfArrays corners, OutputArray ids,
309
343
OutputArrayOfArrays rejectedImgPoints = noArray());
0 commit comments