From ca922443db5958460d24bb46abcd591dcc6f56c3 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 22 Mar 2018 16:19:47 +0300 Subject: [PATCH] next(calib3d): eliminate CirclesGridFinderParameters2 --- modules/calib3d/include/opencv2/calib3d.hpp | 17 +++++------------ modules/calib3d/misc/java/gen_dict.json | 3 +-- modules/calib3d/src/calibinit.cpp | 18 +++++------------- modules/calib3d/src/circlesgrid.cpp | 8 ++------ modules/calib3d/src/circlesgrid.hpp | 4 +--- 5 files changed, 14 insertions(+), 36 deletions(-) diff --git a/modules/calib3d/include/opencv2/calib3d.hpp b/modules/calib3d/include/opencv2/calib3d.hpp index 22bb124627..83a707337f 100644 --- a/modules/calib3d/include/opencv2/calib3d.hpp +++ b/modules/calib3d/include/opencv2/calib3d.hpp @@ -881,16 +881,15 @@ struct CV_EXPORTS_W_SIMPLE CirclesGridFinderParameters SYMMETRIC_GRID, ASYMMETRIC_GRID }; GridType gridType; -}; - -struct CV_EXPORTS_W_SIMPLE CirclesGridFinderParameters2 : public CirclesGridFinderParameters -{ - CV_WRAP CirclesGridFinderParameters2(); CV_PROP_RW float squareSize; //!< Distance between two adjacent points. Used by CALIB_CB_CLUSTERING. CV_PROP_RW float maxRectifiedDistance; //!< Max deviation from predicion. Used by CALIB_CB_CLUSTERING. }; +#ifndef DISABLE_OPENCV_3_COMPATIBILITY +typedef CirclesGridFinderParameters CirclesGridFinderParameters2; +#endif + /** @brief Finds centers in the grid of circles. @param image grid view of input circles; it must be an 8-bit grayscale or color image. @@ -926,13 +925,7 @@ the board to make the detection more robust in various environments. CV_EXPORTS_W bool findCirclesGrid( InputArray image, Size patternSize, OutputArray centers, int flags, const Ptr &blobDetector, - CirclesGridFinderParameters parameters); - -/** @overload */ -CV_EXPORTS_W bool findCirclesGrid2( InputArray image, Size patternSize, - OutputArray centers, int flags, - const Ptr &blobDetector, - CirclesGridFinderParameters2 parameters); + const CirclesGridFinderParameters& parameters); /** @overload */ CV_EXPORTS_W bool findCirclesGrid( InputArray image, Size patternSize, diff --git a/modules/calib3d/misc/java/gen_dict.json b/modules/calib3d/misc/java/gen_dict.json index 4c2d9d2f86..0e3519608b 100644 --- a/modules/calib3d/misc/java/gen_dict.json +++ b/modules/calib3d/misc/java/gen_dict.json @@ -1,7 +1,6 @@ { "class_ignore_list": [ - "CirclesGridFinderParameters", - "CirclesGridFinderParameters2" + "CirclesGridFinderParameters" ], "missing_consts" : { "Calib3d": { diff --git a/modules/calib3d/src/calibinit.cpp b/modules/calib3d/src/calibinit.cpp index 283a9217a9..f157ede587 100644 --- a/modules/calib3d/src/calibinit.cpp +++ b/modules/calib3d/src/calibinit.cpp @@ -2094,22 +2094,14 @@ void cv::drawChessboardCorners( InputOutputArray _image, Size patternSize, nelems, patternWasFound ); } -bool cv::findCirclesGrid( InputArray image, Size patternSize, - OutputArray centers, int flags, - const Ptr &blobDetector, - CirclesGridFinderParameters parameters) -{ - CirclesGridFinderParameters2 parameters2; - *((CirclesGridFinderParameters*)¶meters2) = parameters; - return cv::findCirclesGrid2(image, patternSize, centers, flags, blobDetector, parameters2); -} - -bool cv::findCirclesGrid2( InputArray _image, Size patternSize, +bool cv::findCirclesGrid( InputArray _image, Size patternSize, OutputArray _centers, int flags, const Ptr &blobDetector, - CirclesGridFinderParameters2 parameters) + const CirclesGridFinderParameters& parameters_) { CV_INSTRUMENT_REGION() + CirclesGridFinderParameters parameters = parameters_; // parameters.gridType is amended below + bool isAsymmetricGrid = (flags & CALIB_CB_ASYMMETRIC_GRID) ? true : false; bool isSymmetricGrid = (flags & CALIB_CB_SYMMETRIC_GRID ) ? true : false; CV_Assert(isAsymmetricGrid ^ isSymmetricGrid); @@ -2201,7 +2193,7 @@ bool cv::findCirclesGrid2( InputArray _image, Size patternSize, bool cv::findCirclesGrid( InputArray _image, Size patternSize, OutputArray _centers, int flags, const Ptr &blobDetector) { - return cv::findCirclesGrid2(_image, patternSize, _centers, flags, blobDetector, CirclesGridFinderParameters2()); + return cv::findCirclesGrid(_image, patternSize, _centers, flags, blobDetector, CirclesGridFinderParameters()); } /* End of file. */ diff --git a/modules/calib3d/src/circlesgrid.cpp b/modules/calib3d/src/circlesgrid.cpp index 694644bbd5..1a08e3db8f 100644 --- a/modules/calib3d/src/circlesgrid.cpp +++ b/modules/calib3d/src/circlesgrid.cpp @@ -565,13 +565,9 @@ CirclesGridFinderParameters::CirclesGridFinderParameters() minRNGEdgeSwitchDist = 5.f; gridType = SYMMETRIC_GRID; -} -CirclesGridFinderParameters2::CirclesGridFinderParameters2() -: CirclesGridFinderParameters() -{ - squareSize = 1.0f; - maxRectifiedDistance = squareSize/2.0f; + squareSize = 1.0f; + maxRectifiedDistance = squareSize/2.0f; } CirclesGridFinder::CirclesGridFinder(Size _patternSize, const std::vector &testKeypoints, diff --git a/modules/calib3d/src/circlesgrid.hpp b/modules/calib3d/src/circlesgrid.hpp index ad0f916eed..9ddc7d552c 100644 --- a/modules/calib3d/src/circlesgrid.hpp +++ b/modules/calib3d/src/circlesgrid.hpp @@ -49,14 +49,12 @@ #include #include -#include "precomp.hpp" - class CirclesGridClusterFinder { CirclesGridClusterFinder& operator=(const CirclesGridClusterFinder&); CirclesGridClusterFinder(const CirclesGridClusterFinder&); public: - CirclesGridClusterFinder(const cv::CirclesGridFinderParameters2 ¶meters) + CirclesGridClusterFinder(const cv::CirclesGridFinderParameters ¶meters) { isAsymmetricGrid = parameters.gridType == cv::CirclesGridFinderParameters::ASYMMETRIC_GRID; squareSize = parameters.squareSize;