diff --git a/modules/aruco/samples/calibrate_camera.cpp b/modules/aruco/samples/calibrate_camera.cpp index 7f07f8df8..90fc3ff93 100644 --- a/modules/aruco/samples/calibrate_camera.cpp +++ b/modules/aruco/samples/calibrate_camera.cpp @@ -154,8 +154,7 @@ int main(int argc, char *argv[]) { } // create board object - Ptr gridboard = - aruco::GridBoard::create(markersX, markersY, markerLength, markerSeparation, dictionary); + Ptr gridboard = new aruco::GridBoard(Size(markersX, markersY), markerLength, markerSeparation, dictionary); Ptr board = gridboard.staticCast(); // collected frames for calibration @@ -176,7 +175,7 @@ int main(int argc, char *argv[]) { detector.detectMarkers(image, corners, ids, rejected); // refind strategy to detect more markers - if(refindStrategy) detector.refineDetectedMarkers(image, board, corners, ids, rejected); + if(refindStrategy) detector.refineDetectedMarkers(image, *board, corners, ids, rejected); // draw results image.copyTo(imageCopy); diff --git a/modules/aruco/samples/calibrate_camera_charuco.cpp b/modules/aruco/samples/calibrate_camera_charuco.cpp index fb1430b04..6e386fedd 100644 --- a/modules/aruco/samples/calibrate_camera_charuco.cpp +++ b/modules/aruco/samples/calibrate_camera_charuco.cpp @@ -154,8 +154,7 @@ int main(int argc, char *argv[]) { } // create charuco board object - Ptr charucoboard = - aruco::CharucoBoard::create(squaresX, squaresY, squareLength, markerLength, dictionary); + Ptr charucoboard = new aruco::CharucoBoard(Size(squaresX, squaresY), squareLength, markerLength, dictionary); Ptr board = charucoboard.staticCast(); // collect data from each frame diff --git a/modules/aruco/samples/create_board.cpp b/modules/aruco/samples/create_board.cpp index 2e0f47c4a..adb3a1947 100644 --- a/modules/aruco/samples/create_board.cpp +++ b/modules/aruco/samples/create_board.cpp @@ -115,12 +115,11 @@ int main(int argc, char *argv[]) { return 0; } - Ptr board = aruco::GridBoard::create(markersX, markersY, float(markerLength), - float(markerSeparation), dictionary); + aruco::GridBoard board(Size(markersX, markersY), float(markerLength), float(markerSeparation), dictionary); // show created board Mat boardImage; - board->generateImage(imageSize, boardImage, margins, borderBits); + board.generateImage(imageSize, boardImage, margins, borderBits); if(showImage) { imshow("board", boardImage); diff --git a/modules/aruco/samples/create_board_charuco.cpp b/modules/aruco/samples/create_board_charuco.cpp index 5a1c5c835..2a32500f7 100644 --- a/modules/aruco/samples/create_board_charuco.cpp +++ b/modules/aruco/samples/create_board_charuco.cpp @@ -115,12 +115,11 @@ int main(int argc, char *argv[]) { imageSize.width = squaresX * squareLength + 2 * margins; imageSize.height = squaresY * squareLength + 2 * margins; - Ptr board = aruco::CharucoBoard::create(squaresX, squaresY, (float)squareLength, - (float)markerLength, dictionary); + aruco::CharucoBoard board(Size(squaresX, squaresY), (float)squareLength, (float)markerLength, dictionary); // show created board Mat boardImage; - board->generateImage(imageSize, boardImage, margins, borderBits); + board.generateImage(imageSize, boardImage, margins, borderBits); if(showImage) { imshow("board", boardImage); diff --git a/modules/aruco/samples/detect_board.cpp b/modules/aruco/samples/detect_board.cpp index 8a2e201e6..a1c8d659c 100644 --- a/modules/aruco/samples/detect_board.cpp +++ b/modules/aruco/samples/detect_board.cpp @@ -150,8 +150,7 @@ int main(int argc, char *argv[]) { markerSeparation); // create board object - Ptr gridboard = - aruco::GridBoard::create(markersX, markersY, markerLength, markerSeparation, dictionary); + Ptr gridboard = new aruco::GridBoard(Size(markersX, markersY), markerLength, markerSeparation, dictionary); Ptr board = gridboard.staticCast(); double totalTime = 0; @@ -172,7 +171,7 @@ int main(int argc, char *argv[]) { // refind strategy to detect more markers if(refindStrategy) - detector.refineDetectedMarkers(image, board, corners, ids, rejected, camMatrix, + detector.refineDetectedMarkers(image, *board, corners, ids, rejected, camMatrix, distCoeffs); // estimate board pose diff --git a/modules/aruco/samples/detect_board_charuco.cpp b/modules/aruco/samples/detect_board_charuco.cpp index 0e0a1d332..68290e58d 100644 --- a/modules/aruco/samples/detect_board_charuco.cpp +++ b/modules/aruco/samples/detect_board_charuco.cpp @@ -145,8 +145,7 @@ int main(int argc, char *argv[]) { float axisLength = 0.5f * ((float)min(squaresX, squaresY) * (squareLength)); // create charuco board object - Ptr charucoboard = - aruco::CharucoBoard::create(squaresX, squaresY, squareLength, markerLength, dictionary); + Ptr charucoboard = new aruco::CharucoBoard(Size(squaresX, squaresY), squareLength, markerLength, dictionary); Ptr board = charucoboard.staticCast(); double totalTime = 0; diff --git a/modules/aruco/samples/tutorial_charuco_create_detect.cpp b/modules/aruco/samples/tutorial_charuco_create_detect.cpp index 84ea04df4..0e0d027a3 100644 --- a/modules/aruco/samples/tutorial_charuco_create_detect.cpp +++ b/modules/aruco/samples/tutorial_charuco_create_detect.cpp @@ -15,9 +15,9 @@ static inline void createBoard() { cv::aruco::Dictionary dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250); //! [createBoard] - cv::Ptr board = cv::aruco::CharucoBoard::create(5, 7, 0.04f, 0.02f, dictionary); + cv::aruco::CharucoBoard board(cv::Size(5, 7), 0.04f, 0.02f, dictionary); cv::Mat boardImage; - board->generateImage(cv::Size(600, 500), boardImage, 10, 1); + board.generateImage(cv::Size(600, 500), boardImage, 10, 1); //! [createBoard] cv::imwrite("BoardImage.jpg", boardImage); } @@ -37,7 +37,7 @@ static inline void detectCharucoBoardWithCalibrationPose() } else { //! [dictboard] cv::aruco::Dictionary dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250); - cv::Ptr board = cv::aruco::CharucoBoard::create(5, 7, 0.04f, 0.02f, dictionary); + cv::Ptr board = new cv::aruco::CharucoBoard(cv::Size(5, 7), 0.04f, 0.02f, dictionary); cv::Ptr params = cv::makePtr(); //! [dictboard] while (inputVideo.grab()) { @@ -90,7 +90,7 @@ static inline void detectCharucoBoardWithoutCalibration() cv::VideoCapture inputVideo; inputVideo.open(0); cv::aruco::Dictionary dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250); - cv::Ptr board = cv::aruco::CharucoBoard::create(5, 7, 0.04f, 0.02f, dictionary); + cv::Ptr board = new cv::aruco::CharucoBoard(cv::Size(5, 7), 0.04f, 0.02f, dictionary); cv::Ptr params = cv::makePtr(); params->cornerRefinementMethod = cv::aruco::CORNER_REFINE_NONE; diff --git a/modules/aruco/src/aruco.cpp b/modules/aruco/src/aruco.cpp index 52ec072c1..3d43e9424 100644 --- a/modules/aruco/src/aruco.cpp +++ b/modules/aruco/src/aruco.cpp @@ -26,7 +26,7 @@ void refineDetectedMarkers(InputArray _image, const Ptr &_board, const Ptr &_params) { RefineParameters refineParams(minRepDistance, errorCorrectionRate, checkAllOrders); ArucoDetector detector(_board->getDictionary(), *_params, refineParams); - detector.refineDetectedMarkers(_image, _board, _detectedCorners, _detectedIds, _rejectedCorners, _cameraMatrix, + detector.refineDetectedMarkers(_image, *_board, _detectedCorners, _detectedIds, _rejectedCorners, _cameraMatrix, _distCoeffs, _recoveredIdxs); } diff --git a/modules/aruco/src/charuco.cpp b/modules/aruco/src/charuco.cpp index 8b7f747f6..b38b3396c 100644 --- a/modules/aruco/src/charuco.cpp +++ b/modules/aruco/src/charuco.cpp @@ -383,14 +383,13 @@ void detectCharucoDiamond(InputArray _image, InputArrayOfArrays _markerCorners, // current id is assigned to [0], so it is the marker on the top tmpIds[0] = currentId; // create Charuco board layout for diamond (3x3 layout) - Ptr _charucoDiamondLayout = CharucoBoard::create(3, 3, squareMarkerLengthRate, 1., *dictionary, - tmpIds); + Ptr _charucoDiamondLayout = new CharucoBoard(Size(3, 3), squareMarkerLengthRate, 1., *dictionary, tmpIds); // try to find the rest of markers in the diamond vector< int > acceptedIdxs; RefineParameters refineParameters(minRepDistance, -1.f, false); ArucoDetector detector(*dictionary, DetectorParameters(), refineParameters); - detector.refineDetectedMarkers(grey, _charucoDiamondLayout, currentMarker, currentMarkerId, candidates, + detector.refineDetectedMarkers(grey, *_charucoDiamondLayout, currentMarker, currentMarkerId, candidates, noArray(), noArray(), acceptedIdxs); // if found, we have a diamond @@ -456,9 +455,9 @@ void drawCharucoDiamond(const Ptr &dictionary, Vec4i ids, int square for(int i = 0; i < 4; i++) tmpIds[i] = ids[i]; // create a charuco board similar to a charuco marker and print it - Ptr board = CharucoBoard::create(3, 3, (float)squareLength, (float)markerLength, *dictionary, tmpIds); + CharucoBoard board(Size(3, 3), (float)squareLength, (float)markerLength, *dictionary, tmpIds); Size outSize(3 * squareLength + 2 * marginSize, 3 * squareLength + 2 * marginSize); - board->generateImage(outSize, _img, marginSize, borderBits); + board.generateImage(outSize, _img, marginSize, borderBits); } }