OpenCV453
charuco.hpp
1/*
2By downloading, copying, installing or using the software you agree to this
3license. If you do not agree to this license, do not download, install,
4copy or use the software.
5
6 License Agreement
7 For Open Source Computer Vision Library
8 (3-clause BSD License)
9
10Copyright (C) 2013, OpenCV Foundation, all rights reserved.
11Third party copyrights are property of their respective owners.
12
13Redistribution and use in source and binary forms, with or without modification,
14are 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
27This software is provided by the copyright holders and contributors "as is" and
28any express or implied warranties, including, but not limited to, the implied
29warranties of merchantability and fitness for a particular purpose are
30disclaimed. In no event shall copyright holders or contributors be liable for
31any direct, indirect, incidental, special, exemplary, or consequential damages
32(including, but not limited to, procurement of substitute goods or services;
33loss of use, data, or profits; or business interruption) however caused
34and on any theory of liability, whether in contract, strict liability,
35or tort (including negligence or otherwise) arising in any way out of
36the use of this software, even if advised of the possibility of such damage.
37*/
38
39#ifndef __OPENCV_CHARUCO_HPP__
40#define __OPENCV_CHARUCO_HPP__
41
42#include <opencv2/core.hpp>
43#include <vector>
44#include <opencv2/aruco.hpp>
45
46
47namespace cv {
48namespace aruco {
49
52
53
62class CV_EXPORTS_W CharucoBoard : public Board {
63
64 public:
65 // vector of chessboard 3D corners precalculated
66 CV_PROP std::vector< Point3f > chessboardCorners;
67
68 // for each charuco corner, nearest marker id and nearest marker corner id of each marker
69 CV_PROP std::vector< std::vector< int > > nearestMarkerIdx;
70 CV_PROP std::vector< std::vector< int > > nearestMarkerCorners;
71
83 CV_WRAP void draw(Size outSize, OutputArray img, int marginSize = 0, int borderBits = 1);
84
85
100 CV_WRAP static Ptr<CharucoBoard> create(int squaresX, int squaresY, float squareLength,
101 float markerLength, const Ptr<Dictionary> &dictionary);
102
106 CV_WRAP Size getChessboardSize() const { return Size(_squaresX, _squaresY); }
107
111 CV_WRAP float getSquareLength() const { return _squareLength; }
112
116 CV_WRAP float getMarkerLength() const { return _markerLength; }
117
118 private:
119 void _getNearestMarkerCorners();
120
121 // number of markers in X and Y directions
122 int _squaresX, _squaresY;
123
124 // size of chessboard squares side (normally in meters)
125 float _squareLength;
126
127 // marker side length (normally in meters)
128 float _markerLength;
129};
130
131
132
133
158CV_EXPORTS_W int interpolateCornersCharuco(InputArrayOfArrays markerCorners, InputArray markerIds,
159 InputArray image, const Ptr<CharucoBoard> &board,
160 OutputArray charucoCorners, OutputArray charucoIds,
161 InputArray cameraMatrix = noArray(),
162 InputArray distCoeffs = noArray(), int minMarkers = 2);
163
164
165
166
185CV_EXPORTS_W bool estimatePoseCharucoBoard(InputArray charucoCorners, InputArray charucoIds,
186 const Ptr<CharucoBoard> &board, InputArray cameraMatrix,
187 InputArray distCoeffs, InputOutputArray rvec,
188 InputOutputArray tvec, bool useExtrinsicGuess = false);
189
190
191
192
204CV_EXPORTS_W void drawDetectedCornersCharuco(InputOutputArray image, InputArray charucoCorners,
205 InputArray charucoIds = noArray(),
206 Scalar cornerColor = Scalar(255, 0, 0));
207
208
209
244CV_EXPORTS_AS(calibrateCameraCharucoExtended) double calibrateCameraCharuco(
245 InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, const Ptr<CharucoBoard> &board,
246 Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
248 OutputArray stdDeviationsIntrinsics, OutputArray stdDeviationsExtrinsics,
249 OutputArray perViewErrors, int flags = 0,
250 TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
251
254CV_EXPORTS_W double calibrateCameraCharuco(
255 InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, const Ptr<CharucoBoard> &board,
256 Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
257 OutputArrayOfArrays rvecs = noArray(), OutputArrayOfArrays tvecs = noArray(), int flags = 0,
258 TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
259
260
261
284CV_EXPORTS_W void detectCharucoDiamond(InputArray image, InputArrayOfArrays markerCorners,
285 InputArray markerIds, float squareMarkerLengthRate,
286 OutputArrayOfArrays diamondCorners, OutputArray diamondIds,
287 InputArray cameraMatrix = noArray(),
288 InputArray distCoeffs = noArray());
289
290
291
310CV_EXPORTS_W void drawDetectedDiamonds(InputOutputArray image, InputArrayOfArrays diamondCorners,
311 InputArray diamondIds = noArray(),
312 Scalar borderColor = Scalar(0, 0, 255));
313
314
315
316
331// TODO cannot be exported yet; conversion from/to Vec4i is not wrapped in core
332CV_EXPORTS void drawCharucoDiamond(const Ptr<Dictionary> &dictionary, Vec4i ids, int squareLength,
333 int markerLength, OutputArray img, int marginSize = 0,
334 int borderBits = 1);
335
336
347CV_EXPORTS_W bool testCharucoCornersCollinear(const Ptr<CharucoBoard> &_board,
348 InputArray _charucoIds);
349
351}
352}
353
354#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
Template class for short numerical vectors, a partial case of Matx
Definition: matx.hpp:342
Board of markers
Definition: aruco.hpp:272
ChArUco board Specific class for ChArUco boards. A ChArUco board is a planar board where the markers ...
Definition: charuco.hpp:62
CV_EXPORTS_W void detectCharucoDiamond(InputArray image, InputArrayOfArrays markerCorners, InputArray markerIds, float squareMarkerLengthRate, OutputArrayOfArrays diamondCorners, OutputArray diamondIds, InputArray cameraMatrix=noArray(), InputArray distCoeffs=noArray())
Detect ChArUco Diamond markers
CV_EXPORTS_W int interpolateCornersCharuco(InputArrayOfArrays markerCorners, InputArray markerIds, InputArray image, const Ptr< CharucoBoard > &board, OutputArray charucoCorners, OutputArray charucoIds, InputArray cameraMatrix=noArray(), InputArray distCoeffs=noArray(), int minMarkers=2)
Interpolate position of ChArUco board corners
CV_EXPORTS void drawCharucoDiamond(const Ptr< Dictionary > &dictionary, Vec4i ids, int squareLength, int markerLength, OutputArray img, int marginSize=0, int borderBits=1)
Draw a ChArUco Diamond marker
CV_EXPORTS_W void drawDetectedDiamonds(InputOutputArray image, InputArrayOfArrays diamondCorners, InputArray diamondIds=noArray(), Scalar borderColor=Scalar(0, 0, 255))
Draw a set of detected ChArUco Diamond markers
CV_EXPORTS_W bool testCharucoCornersCollinear(const Ptr< CharucoBoard > &_board, InputArray _charucoIds)
test whether the ChArUco markers are collinear
CV_EXPORTS_W double calibrateCameraCharuco(InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, const Ptr< CharucoBoard > &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 #calibrateCameraCharuco but without calibration error estimation.
CV_EXPORTS_W void drawDetectedCornersCharuco(InputOutputArray image, InputArray charucoCorners, InputArray charucoIds=noArray(), Scalar cornerColor=Scalar(255, 0, 0))
Draws a set of Charuco corners
CV_EXPORTS_W bool estimatePoseCharucoBoard(InputArray charucoCorners, InputArray charucoIds, const Ptr< CharucoBoard > &board, InputArray cameraMatrix, InputArray distCoeffs, InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess=false)
Pose estimation for a ChArUco board given some of their corners
CV_EXPORTS_AS(calibrateCameraExtended) double calibrateCamera(InputArrayOfArrays objectPoints
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: cvstd_wrapper.hpp:74