From b6573a7be6a12e635624b7cc74cff37ae1182208 Mon Sep 17 00:00:00 2001 From: Steve Nicholson Date: Thu, 18 Feb 2016 09:48:38 -0800 Subject: [PATCH] Allow creating GridBoard beginning with user-specified marker id --- modules/aruco/include/opencv2/aruco.hpp | 8 ++++---- modules/aruco/src/aruco.cpp | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/aruco/include/opencv2/aruco.hpp b/modules/aruco/include/opencv2/aruco.hpp index 1e646ceb0..3f45dc11f 100644 --- a/modules/aruco/include/opencv2/aruco.hpp +++ b/modules/aruco/include/opencv2/aruco.hpp @@ -268,16 +268,16 @@ class CV_EXPORTS_W GridBoard : public Board { * @param markersX number of markers in X direction * @param markersY number of markers in Y direction * @param markerLength marker side length (normally in meters) - * @param markerSeparation separation between two markers (same unit than markerLenght) - * @param dictionary dictionary of markers indicating the type of markers. - * The first markersX*markersY markers in the dictionary are used. + * @param markerSeparation separation between two markers (same unit as markerLength) + * @param dictionary dictionary of markers indicating the type of markers + * @param firstMarker id of first marker in dictionary to use on board. * @return the output GridBoard object * * This functions creates a GridBoard object given the number of markers in each direction and * the marker size and marker separation. */ CV_WRAP static Ptr create(int markersX, int markersY, float markerLength, - float markerSeparation, Ptr &dictionary); + float markerSeparation, Ptr &dictionary, int firstMarker = 0); /** * diff --git a/modules/aruco/src/aruco.cpp b/modules/aruco/src/aruco.cpp index c7395be38..b06dd5f71 100644 --- a/modules/aruco/src/aruco.cpp +++ b/modules/aruco/src/aruco.cpp @@ -1329,11 +1329,10 @@ void GridBoard::draw(Size outSize, OutputArray _img, int marginSize, int borderB } - /** */ Ptr GridBoard::create(int markersX, int markersY, float markerLength, float markerSeparation, - Ptr &dictionary) { + Ptr &dictionary, int firstMarker) { CV_Assert(markersX > 0 && markersY > 0 && markerLength > 0 && markerSeparation > 0); @@ -1351,7 +1350,7 @@ Ptr GridBoard::create(int markersX, int markersY, float markerLength, // fill ids with first identifiers for(unsigned int i = 0; i < totalMarkers; i++) { - res->ids[i] = i; + res->ids[i] = i + firstMarker; } // calculate Board objPoints