OpenCV 4.5.3(日本語機械翻訳)
aruco.hpp
1 /*
2 By downloading, copying, installing or using the software you agree to this
3 license. If you do not agree to this license, do not download, install,
4 copy or use the software.
5
6 License Agreement
7 For Open Source Computer Vision Library
8 (3-clause BSD License)
9
10 Copyright (C) 2013, OpenCV Foundation, all rights reserved.
11 Third party copyrights are property of their respective owners.
12
13 Redistribution and use in source and binary forms, with or without modification,
14 are permitted provided that the following conditions are met:
15
16 * Redistributions of source code must retain the above copyright notice,
17 this list of conditions and the following disclaimer.
18
19 * Redistributions in binary form must reproduce the above copyright notice,
20 this list of conditions and the following disclaimer in the documentation
21 and/or other materials provided with the distribution.
22
23 * Neither the names of the copyright holders nor the names of the contributors
24 may be used to endorse or promote products derived from this software
25 without specific prior written permission.
26
27 This software is provided by the copyright holders and contributors "as is" and
28 any express or implied warranties, including, but not limited to, the implied
29 warranties of merchantability and fitness for a particular purpose are
30 disclaimed. In no event shall copyright holders or contributors be liable for
31 any direct, indirect, incidental, special, exemplary, or consequential damages
32 (including, but not limited to, procurement of substitute goods or services;
33 loss of use, data, or profits; or business interruption) however caused
34 and on any theory of liability, whether in contract, strict liability,
35 or tort (including negligence or otherwise) arising in any way out of
36 the use of this software, even if advised of the possibility of such damage.
37 */
38
39 #ifndef __OPENCV_ARUCO_HPP__
40 #define __OPENCV_ARUCO_HPP__
41
42 #include <opencv2/core.hpp>
43 #include <vector>
44 #include "opencv2/aruco/dictionary.hpp"
45
75 namespace cv {
76 namespace aruco {
77
80
86};
87
150 struct CV_EXPORTS_W DetectorParameters {
151
153
154 CV_WRAP static Ptr<DetectorParameters> create();
155
156 CV_PROP_RW int adaptiveThreshWinSizeMin;
157 CV_PROP_RW int adaptiveThreshWinSizeMax;
158 CV_PROP_RW int adaptiveThreshWinSizeStep;
159 CV_PROP_RW double adaptiveThreshConstant;
160 CV_PROP_RW double minMarkerPerimeterRate;
161 CV_PROP_RW double maxMarkerPerimeterRate;
162 CV_PROP_RW double polygonalApproxAccuracyRate;
163 CV_PROP_RW double minCornerDistanceRate;
164 CV_PROP_RW int minDistanceToBorder;
165 CV_PROP_RW double minMarkerDistanceRate;
166 CV_PROP_RW int cornerRefinementMethod;
167 CV_PROP_RW int cornerRefinementWinSize;
168 CV_PROP_RW int cornerRefinementMaxIterations;
169 CV_PROP_RW double cornerRefinementMinAccuracy;
170 CV_PROP_RW int markerBorderBits;
171 CV_PROP_RW int perspectiveRemovePixelPerCell;
172 CV_PROP_RW double perspectiveRemoveIgnoredMarginPerCell;
173 CV_PROP_RW double maxErroneousBitsInBorderRate;
174 CV_PROP_RW double minOtsuStdDev;
175 CV_PROP_RW double errorCorrectionRate;
176
177 // April :: User-configurable parameters.
178 CV_PROP_RW float aprilTagQuadDecimate;
179 CV_PROP_RW float aprilTagQuadSigma;
180
181 // April :: Internal variables
182 CV_PROP_RW int aprilTagMinClusterPixels;
183 CV_PROP_RW int aprilTagMaxNmaxima;
184 CV_PROP_RW float aprilTagCriticalRad;
185 CV_PROP_RW float aprilTagMaxLineFitMse;
186 CV_PROP_RW int aprilTagMinWhiteBlackDiff;
187 CV_PROP_RW int aprilTagDeglitch;
188
189 // to detect white (inverted) markers
190 CV_PROP_RW bool detectInvertedMarker;
191};
192
193
194
221 CV_EXPORTS_W void detectMarkers(InputArray image, const Ptr<Dictionary> &dictionary, OutputArrayOfArrays corners,
222 OutputArray ids, const Ptr<DetectorParameters> &parameters = DetectorParameters::create(),
223 OutputArrayOfArrays rejectedImgPoints = noArray(), InputArray cameraMatrix= noArray(), InputArray distCoeff= noArray());
224
225
226
256 CV_EXPORTS_W void estimatePoseSingleMarkers(InputArrayOfArrays corners, float markerLength,
257 InputArray cameraMatrix, InputArray distCoeffs,
258 OutputArray rvecs, OutputArray tvecs, OutputArray _objPoints = noArray());
259
260
261
272 class CV_EXPORTS_W Board {
273
274 public:
283 CV_WRAP static Ptr<Board> create(InputArrayOfArrays objPoints, const Ptr<Dictionary> &dictionary, InputArray ids);
284
294 CV_WRAP void setIds(InputArray ids);
295
298 CV_PROP std::vector< std::vector< Point3f > > objPoints;
299
301 CV_PROP Ptr<Dictionary> dictionary;
302
305 CV_PROP_RW std::vector< int > ids;
306};
307
308
309
315 class CV_EXPORTS_W GridBoard : public Board {
316
317 public:
329 CV_WRAP void draw(Size outSize, OutputArray img, int marginSize = 0, int borderBits = 1);
330
331
346 CV_WRAP static Ptr<GridBoard> create(int markersX, int markersY, float markerLength,
347 float markerSeparation, const Ptr<Dictionary> &dictionary, int firstMarker = 0);
348
352 CV_WRAP Size getGridSize() const { return Size(_markersX, _markersY); }
353
357 CV_WRAP float getMarkerLength() const { return _markerLength; }
358
362 CV_WRAP float getMarkerSeparation() const { return _markerSeparation; }
363
364
365 private:
366 // number of markers in X and Y directions
367 int _markersX, _markersY;
368
369 // marker side length (normally in meters)
370 float _markerLength;
371
372 // separation between markers in the grid
373 float _markerSeparation;
374};
375
376
377
406 CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, const Ptr<Board> &board,
407 InputArray cameraMatrix, InputArray distCoeffs, InputOutputArray rvec,
408 InputOutputArray tvec, bool useExtrinsicGuess = false);
409
410
411
412
444 CV_EXPORTS_W void refineDetectedMarkers(
445 InputArray image,const Ptr<Board> &board, InputOutputArrayOfArrays detectedCorners,
446 InputOutputArray detectedIds, InputOutputArrayOfArrays rejectedCorners,
447 InputArray cameraMatrix = noArray(), InputArray distCoeffs = noArray(),
448 float minRepDistance = 10.f, float errorCorrectionRate = 3.f, bool checkAllOrders = true,
449 OutputArray recoveredIdxs = noArray(), const Ptr<DetectorParameters> &parameters = DetectorParameters::create());
450
451
452
470 CV_EXPORTS_W void drawDetectedMarkers(InputOutputArray image, InputArrayOfArrays corners,
471 InputArray ids = noArray(),
472 Scalar borderColor = Scalar(0, 255, 0));
473
474
475
494 CV_EXPORTS_W void drawAxis(InputOutputArray image, InputArray cameraMatrix, InputArray distCoeffs,
495 InputArray rvec, InputArray tvec, float length);
496
497
498
511 CV_EXPORTS_W void drawMarker(const Ptr<Dictionary> &dictionary, int id, int sidePixels, OutputArray img,
512 int borderBits = 1);
513
514
515
531 CV_EXPORTS_W void drawPlanarBoard(const Ptr<Board> &board, Size outSize, OutputArray img,
532 int marginSize = 0, int borderBits = 1);
533
534
535
539 void _drawPlanarBoardImpl(Board *board, Size outSize, OutputArray img,
540 int marginSize = 0, int borderBits = 1);
541
542
543
580 CV_EXPORTS_AS(calibrateCameraArucoExtended) double calibrateCameraAruco(
581 InputArrayOfArrays corners, InputArray ids, InputArray counter, const Ptr<Board> &board,
582 Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
584 OutputArray stdDeviationsIntrinsics, OutputArray stdDeviationsExtrinsics,
585 OutputArray perViewErrors, int flags = 0,
586 TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
587
588
591 CV_EXPORTS_W double calibrateCameraAruco(
592 InputArrayOfArrays corners, InputArray ids, InputArray counter, const Ptr<Board> &board,
593 Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
594 OutputArrayOfArrays rvecs = noArray(), OutputArrayOfArrays tvecs = noArray(), int flags = 0,
595 TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
596
597
608 CV_EXPORTS_W void getBoardObjectAndImagePoints(const Ptr<Board> &board, InputArrayOfArrays detectedCorners,
609 InputArray detectedIds, OutputArray objPoints, OutputArray imgPoints);
610
611
613}
614}
615
616 #endif
Definition: mat.hpp:386
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:295
Template class for specifying the size of an image or rectangle.
Definition: core/types.hpp:316
The class defining termination criteria for iterative algorithms.
Definition: core/types.hpp:853
@ EPS
the desired accuracy or change in parameters at which the iterative algorithm stops
Definition: core/types.hpp:862
@ COUNT
the maximum number of iterations or elements to compute
Definition: core/types.hpp:860
Board of markers
Definition: aruco.hpp:272
Planar board with grid arrangement of markers More common type of board. All markers are placed in th...
Definition: aruco.hpp:315
CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, const Ptr< Board > &board, InputArray cameraMatrix, InputArray distCoeffs, InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess=false)
Pose estimation for a board of markers
CV_EXPORTS_W void drawAxis(InputOutputArray image, InputArray cameraMatrix, InputArray distCoeffs, InputArray rvec, InputArray tvec, float length)
Draw coordinate system axis from pose estimation
CV_EXPORTS_W void getBoardObjectAndImagePoints(const Ptr< Board > &board, InputArrayOfArrays detectedCorners, InputArray detectedIds, OutputArray objPoints, OutputArray imgPoints)
Given a board configuration and a set of detected markers, returns the corresponding image points and...
CV_EXPORTS_W void estimatePoseSingleMarkers(InputArrayOfArrays corners, float markerLength, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvecs, OutputArray tvecs, OutputArray _objPoints=noArray())
Pose estimation for single markers
CV_EXPORTS_W void detectMarkers(InputArray image, const Ptr< Dictionary > &dictionary, OutputArrayOfArrays corners, OutputArray ids, const Ptr< DetectorParameters > &parameters=DetectorParameters::create(), OutputArrayOfArrays rejectedImgPoints=noArray(), InputArray cameraMatrix=noArray(), InputArray distCoeff=noArray())
Basic marker detection
CV_EXPORTS_W void drawPlanarBoard(const Ptr< Board > &board, Size outSize, OutputArray img, int marginSize=0, int borderBits=1)
Draw a planar board
CV_EXPORTS_W void refineDetectedMarkers(InputArray image, const Ptr< Board > &board, InputOutputArrayOfArrays detectedCorners, InputOutputArray detectedIds, InputOutputArrayOfArrays rejectedCorners, InputArray cameraMatrix=noArray(), InputArray distCoeffs=noArray(), float minRepDistance=10.f, float errorCorrectionRate=3.f, bool checkAllOrders=true, OutputArray recoveredIdxs=noArray(), const Ptr< DetectorParameters > &parameters=DetectorParameters::create())
Refind not detected markers based on the already detected and the board layout
CV_EXPORTS_W void drawDetectedMarkers(InputOutputArray image, InputArrayOfArrays corners, InputArray ids=noArray(), Scalar borderColor=Scalar(0, 255, 0))
Draw detected markers in image
void _drawPlanarBoardImpl(Board *board, Size outSize, OutputArray img, int marginSize=0, int borderBits=1)
Implementation of drawPlanarBoard that accepts a raw Board pointer.
CV_EXPORTS_W double calibrateCameraAruco(InputArrayOfArrays corners, InputArray ids, InputArray counter, const Ptr< Board > &board, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs=noArray(), OutputArrayOfArrays tvecs=noArray(), int flags=0, TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON))
It's the same function as #calibrateCameraAruco but without calibration error estimation.
CornerRefineMethod
Definition: aruco.hpp:81
@ CORNER_REFINE_APRILTAG
Tag and corners detection based on the AprilTag 2 approach
Definition: aruco.hpp:85
@ CORNER_REFINE_SUBPIX
ArUco approach and refine the corners locations using corner subpixel accuracy
Definition: aruco.hpp:83
@ CORNER_REFINE_CONTOUR
ArUco approach and refine the corners locations using the contour-points line fitting
Definition: aruco.hpp:84
@ CORNER_REFINE_NONE
Tag and corners detection based on the ArUco approach
Definition: aruco.hpp:82
CV_EXPORTS_AS(calibrateCameraExtended) double calibrateCamera(InputArrayOfArrays objectPoints
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
CV_EXPORTS_W void drawMarker(InputOutputArray img, Point position, const Scalar &color, int markerType=MARKER_CROSS, int markerSize=20, int thickness=1, int line_type=8)
Draws a marker on a predefined position in an image.
cv
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: cvstd_wrapper.hpp:74
Parameters for the detectMarker process:
Definition: aruco.hpp:150