EstervQrCode 1.1.1
Library for qr code manipulation
aruco_detector.hpp
1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html
4 #ifndef OPENCV_OBJDETECT_ARUCO_DETECTOR_HPP
5 #define OPENCV_OBJDETECT_ARUCO_DETECTOR_HPP
6 
7 #include <opencv2/objdetect/aruco_dictionary.hpp>
8 #include <opencv2/objdetect/aruco_board.hpp>
9 
10 namespace cv {
11 namespace aruco {
12 
15 
21 };
22 
27  adaptiveThreshWinSizeMin = 3;
28  adaptiveThreshWinSizeMax = 23;
29  adaptiveThreshWinSizeStep = 10;
30  adaptiveThreshConstant = 7;
31  minMarkerPerimeterRate = 0.03;
32  maxMarkerPerimeterRate = 4.;
33  polygonalApproxAccuracyRate = 0.03;
34  minCornerDistanceRate = 0.05;
35  minDistanceToBorder = 3;
36  minMarkerDistanceRate = 0.125;
37  cornerRefinementMethod = (int)CORNER_REFINE_NONE;
38  cornerRefinementWinSize = 5;
39  relativeCornerRefinmentWinSize = 0.3f;
40  cornerRefinementMaxIterations = 30;
41  cornerRefinementMinAccuracy = 0.1;
42  markerBorderBits = 1;
43  perspectiveRemovePixelPerCell = 4;
44  perspectiveRemoveIgnoredMarginPerCell = 0.13;
45  maxErroneousBitsInBorderRate = 0.35;
46  minOtsuStdDev = 5.0;
47  errorCorrectionRate = 0.6;
48  aprilTagQuadDecimate = 0.0;
49  aprilTagQuadSigma = 0.0;
50  aprilTagMinClusterPixels = 5;
51  aprilTagMaxNmaxima = 10;
52  aprilTagCriticalRad = (float)(10* CV_PI /180);
53  aprilTagMaxLineFitMse = 10.0;
54  aprilTagMinWhiteBlackDiff = 5;
55  aprilTagDeglitch = 0;
56  detectInvertedMarker = false;
57  useAruco3Detection = false;
58  minSideLengthCanonicalImg = 32;
59  minMarkerLengthRatioOriginalImg = 0.0;
60  }
61 
65 
69 
72 
75 
78 
81 
87 
93 
96 
99 
102 
116 
121  CV_PROP_RW float minGroupDistance = 0.21f;
122 
125 
135 
146 
149 
152 
155 
158 
164 
170 
175 
178 
185 
188 
189  // April :: Internal variables
192 
195 
201 
204 
211 
214 
220 
228 
231 
234 };
235 
239  CV_WRAP RefineParameters(float minRepDistance = 10.f, float errorCorrectionRate = 3.f, bool checkAllOrders = true);
240 
241 
245 
249 
254 
260 
266 };
267 
276 {
277 public:
285  const DetectorParameters &detectorParams = DetectorParameters(),
286  const RefineParameters& refineParams = RefineParameters());
287 
309  OutputArrayOfArrays rejectedImgPoints = noArray()) const;
310 
333  CV_WRAP void refineDetectedMarkers(InputArray image, const Board &board,
334  InputOutputArrayOfArrays detectedCorners,
335  InputOutputArray detectedIds, InputOutputArrayOfArrays rejectedCorners,
337  OutputArray recoveredIdxs = noArray()) const;
338 
340  CV_WRAP void setDictionary(const Dictionary& dictionary);
341 
343  CV_WRAP void setDetectorParameters(const DetectorParameters& detectorParameters);
344 
346  CV_WRAP void setRefineParameters(const RefineParameters& refineParameters);
347 
350  virtual void write(FileStorage& fs) const override;
351 
354  CV_WRAP inline void write(FileStorage& fs, const String& name) { Algorithm::write(fs, name); }
355 
358  CV_WRAP virtual void read(const FileNode& fn) override;
359 protected:
360  struct ArucoDetectorImpl;
362 };
363 
380  InputArray ids = noArray(), Scalar borderColor = Scalar(0, 255, 0));
381 
392 CV_EXPORTS_W void generateImageMarker(const Dictionary &dictionary, int id, int sidePixels, OutputArray img,
393  int borderBits = 1);
394 
396 
397 }
398 }
399 
400 #endif
This is a base class for all more or less complex algorithms in OpenCV.
Definition: core.hpp:3197
virtual CV_WRAP void write(FileStorage &fs) const
Stores algorithm parameters in a file storage.
Definition: core.hpp:3208
File Storage Node class.
Definition: persistence.hpp:482
XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or readi...
Definition: persistence.hpp:304
Definition: mat.hpp:387
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:296
The main functionality of ArucoDetector class is detection of markers in an image with detectMarkers(...
Definition: aruco_detector.hpp:276
virtual void write(FileStorage &fs) const override
Stores algorithm parameters in a file storage.
CV_WRAP const DetectorParameters & getDetectorParameters() const
CV_WRAP void setDictionary(const Dictionary &dictionary)
CV_WRAP ArucoDetector(const Dictionary &dictionary=getPredefinedDictionary(cv::aruco::DICT_4X4_50), const DetectorParameters &detectorParams=DetectorParameters(), const RefineParameters &refineParams=RefineParameters())
Basic ArucoDetector constructor.
CV_WRAP void setRefineParameters(const RefineParameters &refineParameters)
CV_WRAP void setDetectorParameters(const DetectorParameters &detectorParameters)
Ptr< ArucoDetectorImpl > arucoDetectorImpl
Definition: aruco_detector.hpp:360
virtual CV_WRAP void read(const FileNode &fn) override
Reads algorithm parameters from a file storage.
CV_WRAP const RefineParameters & getRefineParameters() const
CV_WRAP void write(FileStorage &fs, const String &name)
simplified API for language bindings
Definition: aruco_detector.hpp:354
CV_WRAP const Dictionary & getDictionary() const
CV_WRAP void refineDetectedMarkers(InputArray image, const Board &board, InputOutputArrayOfArrays detectedCorners, InputOutputArray detectedIds, InputOutputArrayOfArrays rejectedCorners, InputArray cameraMatrix=noArray(), InputArray distCoeffs=noArray(), OutputArray recoveredIdxs=noArray()) const
Refine not detected markers based on the already detected and the board layout.
CV_WRAP void detectMarkers(InputArray image, OutputArrayOfArrays corners, OutputArray ids, OutputArrayOfArrays rejectedImgPoints=noArray()) const
Basic marker detection.
Board of ArUco markers.
Definition: aruco_board.hpp:25
Dictionary is a set of unique ArUco markers of the same size.
Definition: aruco_dictionary.hpp:29
InputArrayOfArrays Size InputOutputArray InputOutputArray distCoeffs
Definition: calib3d.hpp:1612
InputArrayOfArrays Size InputOutputArray cameraMatrix
Definition: calib3d.hpp:1612
std::string String
Definition: cvstd.hpp:151
Scalar_< double > Scalar
Definition: types.hpp:702
CV_EXPORTS InputOutputArray noArray()
InputArray InputArrayOfArrays
Definition: mat.hpp:443
CV__DEBUG_NS_END typedef const _InputArray & InputArray
Definition: mat.hpp:442
#define CV_EXPORTS_W_SIMPLE
Definition: cvdef.h:473
#define CV_PI
Definition: cvdef.h:380
#define CV_EXPORTS_W
Definition: cvdef.h:472
#define CV_PROP_RW
Definition: cvdef.h:480
#define CV_WRAP
Definition: cvdef.h:481
CV_EXPORTS OutputArray corners
Definition: imgproc.hpp:2130
CV_EXPORTS Dictionary getPredefinedDictionary(PredefinedDictionaryType name)
Returns one of the predefined dictionaries defined in PredefinedDictionaryType.
CV_EXPORTS_W void drawDetectedMarkers(InputOutputArray image, InputArrayOfArrays corners, InputArray ids=noArray(), Scalar borderColor=Scalar(0, 255, 0))
Draw detected markers in image.
CV_EXPORTS_W void generateImageMarker(const Dictionary &dictionary, int id, int sidePixels, OutputArray img, int borderBits=1)
Generate a canonical marker image.
CornerRefineMethod
Definition: aruco_detector.hpp:16
@ DICT_4X4_50
4x4 bits, minimum hamming distance between any two codes = 4, 50 codes
Definition: aruco_dictionary.hpp:100
@ CORNER_REFINE_APRILTAG
Tag and corners detection based on the AprilTag 2 approach .
Definition: aruco_detector.hpp:20
@ CORNER_REFINE_SUBPIX
ArUco approach and refine the corners locations using corner subpixel accuracy.
Definition: aruco_detector.hpp:18
@ CORNER_REFINE_CONTOUR
ArUco approach and refine the corners locations using the contour-points line fitting.
Definition: aruco_detector.hpp:19
@ CORNER_REFINE_NONE
Tag and corners detection based on the ArUco approach.
Definition: aruco_detector.hpp:17
"black box" representation of the file storage associated with a file on disk.
Definition: calib3d.hpp:441
struct DetectorParameters is used by ArucoDetector
Definition: aruco_detector.hpp:25
CV_PROP_RW float aprilTagMaxLineFitMse
when fitting lines to the contours, what is the maximum mean squared error
Definition: aruco_detector.hpp:203
CV_PROP_RW int aprilTagMinClusterPixels
reject quads containing too few pixels (default 5).
Definition: aruco_detector.hpp:191
CV_PROP_RW bool detectInvertedMarker
to check if there is a white marker.
Definition: aruco_detector.hpp:219
CV_PROP_RW int aprilTagMaxNmaxima
how many corner candidates to consider when segmenting a group of pixels into a quad (default 10).
Definition: aruco_detector.hpp:194
CV_PROP_RW double polygonalApproxAccuracyRate
minimum accuracy during the polygonal approximation process to determine which contours are squares....
Definition: aruco_detector.hpp:95
CV_PROP_RW int minDistanceToBorder
minimum distance of any corner to the image border for detected markers (in pixels) (default 3)
Definition: aruco_detector.hpp:101
CV_PROP_RW int aprilTagDeglitch
should the thresholded image be deglitched? Only useful for very noisy images (default 0).
Definition: aruco_detector.hpp:213
CV_PROP_RW double maxErroneousBitsInBorderRate
maximum number of accepted erroneous bits in the border (i.e. number of allowed white bits in the bor...
Definition: aruco_detector.hpp:169
CV_WRAP DetectorParameters()
Definition: aruco_detector.hpp:26
CV_PROP_RW int minSideLengthCanonicalImg
minimum side length of a marker in the canonical image. Latter is the binarized image in which contou...
Definition: aruco_detector.hpp:230
CV_PROP_RW int adaptiveThreshWinSizeMin
minimum window size for adaptive thresholding before finding contours (default 3).
Definition: aruco_detector.hpp:71
CV_PROP_RW int cornerRefinementMethod
default value CORNER_REFINE_NONE
Definition: aruco_detector.hpp:124
CV_PROP_RW int cornerRefinementWinSize
maximum window size for the corner refinement process (in pixels) (default 5).
Definition: aruco_detector.hpp:134
CV_PROP_RW double maxMarkerPerimeterRate
determine maximum perimeter for marker contour to be detected.
Definition: aruco_detector.hpp:92
CV_PROP_RW float aprilTagQuadSigma
what Gaussian blur should be applied to the segmented image (used for quad detection?...
Definition: aruco_detector.hpp:187
CV_WRAP bool writeDetectorParameters(FileStorage &fs, const String &name=String())
Write a set of DetectorParameters to FileStorage.
CV_PROP_RW double minMarkerDistanceRate
minimum average distance between the corners of the two markers to be grouped (default 0....
Definition: aruco_detector.hpp:115
CV_PROP_RW float aprilTagQuadDecimate
April :: User-configurable parameters.
Definition: aruco_detector.hpp:184
CV_PROP_RW double minMarkerPerimeterRate
determine minimum perimeter for marker contour to be detected.
Definition: aruco_detector.hpp:86
CV_PROP_RW int aprilTagMinWhiteBlackDiff
add an extra check that the white model must be (overall) brighter than the black model.
Definition: aruco_detector.hpp:210
CV_PROP_RW double perspectiveRemoveIgnoredMarginPerCell
width of the margin of pixels on each cell not considered for the determination of the cell bit.
Definition: aruco_detector.hpp:163
CV_PROP_RW double errorCorrectionRate
error correction rate respect to the maximun error correction capability for each dictionary (default...
Definition: aruco_detector.hpp:177
CV_PROP_RW float minMarkerLengthRatioOriginalImg
range [0,1], eq (2) from paper. The parameter tau_i has a direct influence on the processing speed.
Definition: aruco_detector.hpp:233
CV_PROP_RW int perspectiveRemovePixelPerCell
number of bits (per dimension) for each cell of the marker when removing the perspective (default 4).
Definition: aruco_detector.hpp:157
CV_PROP_RW double adaptiveThreshConstant
constant for adaptive thresholding before finding contours (default 7)
Definition: aruco_detector.hpp:80
CV_PROP_RW bool useAruco3Detection
enable the new and faster Aruco detection strategy.
Definition: aruco_detector.hpp:227
CV_WRAP bool readDetectorParameters(const FileNode &fn)
Read a new set of DetectorParameters from FileNode (use FileStorage.root()).
CV_PROP_RW double minCornerDistanceRate
minimum distance between corners for detected markers relative to its perimeter (default 0....
Definition: aruco_detector.hpp:98
CV_PROP_RW int adaptiveThreshWinSizeMax
maximum window size for adaptive thresholding before finding contours (default 23).
Definition: aruco_detector.hpp:74
CV_PROP_RW double minOtsuStdDev
minimun standard deviation in pixels values during the decodification step to apply Otsu thresholding...
Definition: aruco_detector.hpp:174
CV_PROP_RW int markerBorderBits
number of bits of the marker border, i.e. marker border width (default 1).
Definition: aruco_detector.hpp:154
CV_PROP_RW int cornerRefinementMaxIterations
maximum number of iterations for stop criteria of the corner refinement process (default 30).
Definition: aruco_detector.hpp:148
CV_PROP_RW double cornerRefinementMinAccuracy
minimum error for the stop cristeria of the corner refinement process (default: 0....
Definition: aruco_detector.hpp:151
CV_PROP_RW float relativeCornerRefinmentWinSize
Dynamic window size for corner refinement relative to Aruco module size (default 0....
Definition: aruco_detector.hpp:145
CV_PROP_RW int adaptiveThreshWinSizeStep
increments from adaptiveThreshWinSizeMin to adaptiveThreshWinSizeMax during the thresholding (default...
Definition: aruco_detector.hpp:77
CV_PROP_RW float aprilTagCriticalRad
reject quads where pairs of edges have angles that are close to straight or close to 180 degrees.
Definition: aruco_detector.hpp:200
struct RefineParameters is used by ArucoDetector
Definition: aruco_detector.hpp:238
CV_WRAP bool readRefineParameters(const FileNode &fn)
Read a new set of RefineParameters from FileNode (use FileStorage.root()).
CV_WRAP bool writeRefineParameters(FileStorage &fs, const String &name=String())
Write a set of RefineParameters to FileStorage.
CV_PROP_RW float errorCorrectionRate
errorCorrectionRate rate of allowed erroneous bits respect to the error correction capability of the ...
Definition: aruco_detector.hpp:259
CV_PROP_RW float minRepDistance
minRepDistance minimum distance between the corners of the rejected candidate and the reprojected mar...
Definition: aruco_detector.hpp:253
CV_PROP_RW bool checkAllOrders
checkAllOrders consider the four posible corner orders in the rejectedCorners array.
Definition: aruco_detector.hpp:265
CV_WRAP RefineParameters(float minRepDistance=10.f, float errorCorrectionRate=3.f, bool checkAllOrders=true)