@@ -10,8 +10,7 @@ namespace cv {
10
10
namespace aruco {
11
11
using namespace std ;
12
12
13
- /* *
14
- * @brief Implementation of drawPlanarBoard that accepts a raw Board pointer.
13
+ /* * @brief Implementation of drawPlanarBoard that accepts a raw Board pointer.
15
14
*/
16
15
static void _drawPlanarBoardImpl (Board *_board, Size outSize, OutputArray _img, int marginSize, int borderBits) {
17
16
CV_Assert (!outSize.empty ());
@@ -99,6 +98,20 @@ void drawPlanarBoard(const Ptr<Board> &_board, Size outSize, OutputArray _img, i
99
98
_drawPlanarBoardImpl (_board, outSize, _img, marginSize, borderBits);
100
99
}
101
100
101
+ struct GridBoard ::GridImpl {
102
+ GridImpl (){};
103
+ // number of markers in X and Y directions
104
+ int sizeX = 3 , sizeY = 3 ;
105
+
106
+ // marker side length (normally in meters)
107
+ float markerLength = 1 .f;
108
+
109
+ // separation between markers in the grid
110
+ float markerSeparation = .5f ;
111
+ };
112
+
113
+ GridBoard::GridBoard (): gridImpl(makePtr<GridImpl>()) {}
114
+
102
115
Ptr<Board> Board::create (InputArrayOfArrays objPoints, const Ptr<Dictionary> &dictionary, InputArray ids) {
103
116
CV_Assert (objPoints.total () == ids.total ());
104
117
CV_Assert (objPoints.type () == CV_32FC3 || objPoints.type () == CV_32FC1);
@@ -139,10 +152,10 @@ Ptr<GridBoard> GridBoard::create(int markersX, int markersY, float markerLength,
139
152
const Ptr<Dictionary> &dictionary, int firstMarker) {
140
153
CV_Assert (markersX > 0 && markersY > 0 && markerLength > 0 && markerSeparation > 0 );
141
154
Ptr<GridBoard> res = makePtr<GridBoard>();
142
- res->_markersX = markersX;
143
- res->_markersY = markersY;
144
- res->_markerLength = markerLength;
145
- res->_markerSeparation = markerSeparation;
155
+ res->gridImpl -> sizeX = markersX;
156
+ res->gridImpl -> sizeY = markersY;
157
+ res->gridImpl -> markerLength = markerLength;
158
+ res->gridImpl -> markerSeparation = markerSeparation;
146
159
res->dictionary = dictionary;
147
160
148
161
size_t totalMarkers = (size_t ) markersX * markersY;
@@ -175,6 +188,19 @@ void GridBoard::draw(Size outSize, OutputArray _img, int marginSize, int borderB
175
188
_drawPlanarBoardImpl ((Board*)this , outSize, _img, marginSize, borderBits);
176
189
}
177
190
191
+ Size GridBoard::getGridSize () const {
192
+ return Size (gridImpl->sizeX , gridImpl->sizeY );
193
+ }
194
+
195
+ float GridBoard::getMarkerLength () {
196
+ return gridImpl->markerLength ;
197
+ }
198
+
199
+ float GridBoard::getMarkerSeparation () {
200
+ return gridImpl->markerSeparation ;
201
+ }
202
+
203
+
178
204
void CharucoBoard::draw (Size outSize, OutputArray _img, int marginSize, int borderBits) {
179
205
CV_Assert (!outSize.empty ());
180
206
CV_Assert (marginSize >= 0 );
0 commit comments