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
+
1
5
#include < ctime>
2
6
#include < iostream>
3
7
#include < vector>
@@ -116,10 +120,7 @@ int main(int argc, char *argv[]) {
116
120
}
117
121
118
122
// Create board object
119
- Ptr<aruco::GridBoard> gridboard = new aruco::GridBoard (
120
- Size (markersX, markersY), markerLength, markerSeparation, dictionary
121
- );
122
- Ptr<aruco::Board> board = gridboard.staticCast <aruco::Board>();
123
+ aruco::GridBoard gridboard (Size (markersX, markersY), markerLength, markerSeparation, dictionary);
123
124
124
125
// Collected frames for calibration
125
126
vector<vector<vector<Point2f>>> allMarkerCorners;
@@ -141,7 +142,7 @@ int main(int argc, char *argv[]) {
141
142
// Refind strategy to detect more markers
142
143
if (refindStrategy) {
143
144
detector.refineDetectedMarkers (
144
- image, *board , markerCorners, markerIds, rejectedMarkers
145
+ image, gridboard , markerCorners, markerIds, rejectedMarkers
145
146
);
146
147
}
147
148
@@ -194,7 +195,7 @@ int main(int argc, char *argv[]) {
194
195
for (size_t frame = 0 ; frame < nFrames; frame++) {
195
196
Mat currentImgPoints, currentObjPoints;
196
197
197
- board-> matchImagePoints (
198
+ gridboard. matchImagePoints (
198
199
allMarkerCorners[frame], allMarkerIds[frame],
199
200
currentObjPoints, currentImgPoints
200
201
);
0 commit comments