Merge pull request #12310 from cv3d:chunks/enum_interface
* Cleanup macros and enable expansion of `__VA_ARGS__` for Visual Studio * Macros for enum-arguments backwards compatibility * Convert struct Param to enum struct * Enabled ParamType.type for enum types * Enabled `cv.read` and `cv.write` for enum types * Rename unnamed enum to AAKAZE.DescriptorType * Rename unnamed enum to AccessFlag * Rename unnamed enum to AgastFeatureDetector.DetectorType * Convert struct DrawMatchesFlags to enum struct * Rename unnamed enum to FastFeatureDetector.DetectorType * Rename unnamed enum to Formatter.FormatType * Rename unnamed enum to HOGDescriptor.HistogramNormType * Rename unnamed enum to DescriptorMatcher.MatcherType * Rename unnamed enum to KAZE.DiffusivityType * Rename unnamed enum to ORB.ScoreType * Rename unnamed enum to UMatData.MemoryFlag * Rename unnamed enum to _InputArray.KindFlag * Rename unnamed enum to _OutputArray.DepthMask * Convert normType enums to static const NormTypes * Avoid conflicts with ElemType * Rename unnamed enum to DescriptorStorageFormat
This commit is contained in:
committed by
Alexander Alekhin
parent
84ae8097b1
commit
ef5579dc86
@@ -293,7 +293,8 @@ k-tuples) are rotated according to the measured orientation).
|
||||
class CV_EXPORTS_W ORB : public Feature2D
|
||||
{
|
||||
public:
|
||||
enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 };
|
||||
enum ScoreType { HARRIS_SCORE=0, FAST_SCORE=1 };
|
||||
static const int kBytes = 32;
|
||||
|
||||
/** @brief The ORB constructor
|
||||
|
||||
@@ -327,7 +328,7 @@ public:
|
||||
@param fastThreshold
|
||||
*/
|
||||
CV_WRAP static Ptr<ORB> create(int nfeatures=500, float scaleFactor=1.2f, int nlevels=8, int edgeThreshold=31,
|
||||
int firstLevel=0, int WTA_K=2, int scoreType=ORB::HARRIS_SCORE, int patchSize=31, int fastThreshold=20);
|
||||
int firstLevel=0, int WTA_K=2, ORB::ScoreType scoreType=ORB::HARRIS_SCORE, int patchSize=31, int fastThreshold=20);
|
||||
|
||||
CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
|
||||
CV_WRAP virtual int getMaxFeatures() const = 0;
|
||||
@@ -347,8 +348,8 @@ public:
|
||||
CV_WRAP virtual void setWTA_K(int wta_k) = 0;
|
||||
CV_WRAP virtual int getWTA_K() const = 0;
|
||||
|
||||
CV_WRAP virtual void setScoreType(int scoreType) = 0;
|
||||
CV_WRAP virtual int getScoreType() const = 0;
|
||||
CV_WRAP virtual void setScoreType(ORB::ScoreType scoreType) = 0;
|
||||
CV_WRAP virtual ORB::ScoreType getScoreType() const = 0;
|
||||
|
||||
CV_WRAP virtual void setPatchSize(int patchSize) = 0;
|
||||
CV_WRAP virtual int getPatchSize() const = 0;
|
||||
@@ -418,6 +419,41 @@ public:
|
||||
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
|
||||
};
|
||||
|
||||
//! @} features2d_main
|
||||
|
||||
//! @addtogroup features2d_main
|
||||
//! @{
|
||||
|
||||
/** @brief Wrapping class for feature detection using the FAST method. :
|
||||
*/
|
||||
class CV_EXPORTS_W FastFeatureDetector : public Feature2D
|
||||
{
|
||||
public:
|
||||
enum DetectorType
|
||||
{
|
||||
TYPE_5_8 = 0, TYPE_7_12 = 1, TYPE_9_16 = 2
|
||||
};
|
||||
enum
|
||||
{
|
||||
THRESHOLD = 10000, NONMAX_SUPPRESSION=10001, FAST_N=10002
|
||||
};
|
||||
|
||||
|
||||
CV_WRAP static Ptr<FastFeatureDetector> create( int threshold=10,
|
||||
bool nonmaxSuppression=true,
|
||||
FastFeatureDetector::DetectorType type=FastFeatureDetector::TYPE_9_16 );
|
||||
|
||||
CV_WRAP virtual void setThreshold(int threshold) = 0;
|
||||
CV_WRAP virtual int getThreshold() const = 0;
|
||||
|
||||
CV_WRAP virtual void setNonmaxSuppression(bool f) = 0;
|
||||
CV_WRAP virtual bool getNonmaxSuppression() const = 0;
|
||||
|
||||
CV_WRAP virtual void setType(FastFeatureDetector::DetectorType type) = 0;
|
||||
CV_WRAP virtual FastFeatureDetector::DetectorType getType() const = 0;
|
||||
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
|
||||
};
|
||||
|
||||
/** @overload */
|
||||
CV_EXPORTS void FAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
|
||||
int threshold, bool nonmaxSuppression=true );
|
||||
@@ -441,27 +477,31 @@ cv2.FAST_FEATURE_DETECTOR_TYPE_7_12 and cv2.FAST_FEATURE_DETECTOR_TYPE_9_16. For
|
||||
detection, use cv2.FAST.detect() method.
|
||||
*/
|
||||
CV_EXPORTS void FAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
|
||||
int threshold, bool nonmaxSuppression, int type );
|
||||
int threshold, bool nonmaxSuppression, FastFeatureDetector::DetectorType type );
|
||||
|
||||
//! @} features2d_main
|
||||
|
||||
//! @addtogroup features2d_main
|
||||
//! @{
|
||||
|
||||
/** @brief Wrapping class for feature detection using the FAST method. :
|
||||
/** @brief Wrapping class for feature detection using the AGAST method. :
|
||||
*/
|
||||
class CV_EXPORTS_W FastFeatureDetector : public Feature2D
|
||||
class CV_EXPORTS_W AgastFeatureDetector : public Feature2D
|
||||
{
|
||||
public:
|
||||
enum
|
||||
enum DetectorType
|
||||
{
|
||||
TYPE_5_8 = 0, TYPE_7_12 = 1, TYPE_9_16 = 2,
|
||||
THRESHOLD = 10000, NONMAX_SUPPRESSION=10001, FAST_N=10002,
|
||||
AGAST_5_8 = 0, AGAST_7_12d = 1, AGAST_7_12s = 2, OAST_9_16 = 3,
|
||||
};
|
||||
|
||||
CV_WRAP static Ptr<FastFeatureDetector> create( int threshold=10,
|
||||
bool nonmaxSuppression=true,
|
||||
int type=FastFeatureDetector::TYPE_9_16 );
|
||||
enum
|
||||
{
|
||||
THRESHOLD = 10000, NONMAX_SUPPRESSION = 10001,
|
||||
};
|
||||
|
||||
CV_WRAP static Ptr<AgastFeatureDetector> create( int threshold=10,
|
||||
bool nonmaxSuppression=true,
|
||||
AgastFeatureDetector::DetectorType type = AgastFeatureDetector::OAST_9_16);
|
||||
|
||||
CV_WRAP virtual void setThreshold(int threshold) = 0;
|
||||
CV_WRAP virtual int getThreshold() const = 0;
|
||||
@@ -469,8 +509,8 @@ public:
|
||||
CV_WRAP virtual void setNonmaxSuppression(bool f) = 0;
|
||||
CV_WRAP virtual bool getNonmaxSuppression() const = 0;
|
||||
|
||||
CV_WRAP virtual void setType(int type) = 0;
|
||||
CV_WRAP virtual int getType() const = 0;
|
||||
CV_WRAP virtual void setType(AgastFeatureDetector::DetectorType type) = 0;
|
||||
CV_WRAP virtual AgastFeatureDetector::DetectorType getType() const = 0;
|
||||
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
|
||||
};
|
||||
|
||||
@@ -497,37 +537,7 @@ Detects corners using the AGAST algorithm by @cite mair2010_agast .
|
||||
|
||||
*/
|
||||
CV_EXPORTS void AGAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
|
||||
int threshold, bool nonmaxSuppression, int type );
|
||||
//! @} features2d_main
|
||||
|
||||
//! @addtogroup features2d_main
|
||||
//! @{
|
||||
|
||||
/** @brief Wrapping class for feature detection using the AGAST method. :
|
||||
*/
|
||||
class CV_EXPORTS_W AgastFeatureDetector : public Feature2D
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
AGAST_5_8 = 0, AGAST_7_12d = 1, AGAST_7_12s = 2, OAST_9_16 = 3,
|
||||
THRESHOLD = 10000, NONMAX_SUPPRESSION = 10001,
|
||||
};
|
||||
|
||||
CV_WRAP static Ptr<AgastFeatureDetector> create( int threshold=10,
|
||||
bool nonmaxSuppression=true,
|
||||
int type=AgastFeatureDetector::OAST_9_16 );
|
||||
|
||||
CV_WRAP virtual void setThreshold(int threshold) = 0;
|
||||
CV_WRAP virtual int getThreshold() const = 0;
|
||||
|
||||
CV_WRAP virtual void setNonmaxSuppression(bool f) = 0;
|
||||
CV_WRAP virtual bool getNonmaxSuppression() const = 0;
|
||||
|
||||
CV_WRAP virtual void setType(int type) = 0;
|
||||
CV_WRAP virtual int getType() const = 0;
|
||||
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
|
||||
};
|
||||
int threshold, bool nonmaxSuppression, AgastFeatureDetector::DetectorType type );
|
||||
|
||||
/** @brief Wrapping class for feature detection using the goodFeaturesToTrack function. :
|
||||
*/
|
||||
@@ -639,7 +649,7 @@ F. Alcantarilla, Adrien Bartoli and Andrew J. Davison. In European Conference on
|
||||
class CV_EXPORTS_W KAZE : public Feature2D
|
||||
{
|
||||
public:
|
||||
enum
|
||||
enum DiffusivityType
|
||||
{
|
||||
DIFF_PM_G1 = 0,
|
||||
DIFF_PM_G2 = 1,
|
||||
@@ -660,7 +670,7 @@ public:
|
||||
CV_WRAP static Ptr<KAZE> create(bool extended=false, bool upright=false,
|
||||
float threshold = 0.001f,
|
||||
int nOctaves = 4, int nOctaveLayers = 4,
|
||||
int diffusivity = KAZE::DIFF_PM_G2);
|
||||
KAZE::DiffusivityType diffusivity = KAZE::DIFF_PM_G2);
|
||||
|
||||
CV_WRAP virtual void setExtended(bool extended) = 0;
|
||||
CV_WRAP virtual bool getExtended() const = 0;
|
||||
@@ -677,8 +687,8 @@ public:
|
||||
CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0;
|
||||
CV_WRAP virtual int getNOctaveLayers() const = 0;
|
||||
|
||||
CV_WRAP virtual void setDiffusivity(int diff) = 0;
|
||||
CV_WRAP virtual int getDiffusivity() const = 0;
|
||||
CV_WRAP virtual void setDiffusivity(KAZE::DiffusivityType diff) = 0;
|
||||
CV_WRAP virtual KAZE::DiffusivityType getDiffusivity() const = 0;
|
||||
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
|
||||
};
|
||||
|
||||
@@ -702,7 +712,7 @@ class CV_EXPORTS_W AKAZE : public Feature2D
|
||||
{
|
||||
public:
|
||||
// AKAZE descriptor type
|
||||
enum
|
||||
enum DescriptorType
|
||||
{
|
||||
DESCRIPTOR_KAZE_UPRIGHT = 2, ///< Upright descriptors, not invariant to rotation
|
||||
DESCRIPTOR_KAZE = 3,
|
||||
@@ -722,13 +732,13 @@ public:
|
||||
@param diffusivity Diffusivity type. DIFF_PM_G1, DIFF_PM_G2, DIFF_WEICKERT or
|
||||
DIFF_CHARBONNIER
|
||||
*/
|
||||
CV_WRAP static Ptr<AKAZE> create(int descriptor_type=AKAZE::DESCRIPTOR_MLDB,
|
||||
CV_WRAP static Ptr<AKAZE> create(AKAZE::DescriptorType descriptor_type = AKAZE::DESCRIPTOR_MLDB,
|
||||
int descriptor_size = 0, int descriptor_channels = 3,
|
||||
float threshold = 0.001f, int nOctaves = 4,
|
||||
int nOctaveLayers = 4, int diffusivity = KAZE::DIFF_PM_G2);
|
||||
int nOctaveLayers = 4, KAZE::DiffusivityType diffusivity = KAZE::DIFF_PM_G2);
|
||||
|
||||
CV_WRAP virtual void setDescriptorType(int dtype) = 0;
|
||||
CV_WRAP virtual int getDescriptorType() const = 0;
|
||||
CV_WRAP virtual void setDescriptorType(AKAZE::DescriptorType dtype) = 0;
|
||||
CV_WRAP virtual AKAZE::DescriptorType getDescriptorType() const = 0;
|
||||
|
||||
CV_WRAP virtual void setDescriptorSize(int dsize) = 0;
|
||||
CV_WRAP virtual int getDescriptorSize() const = 0;
|
||||
@@ -745,8 +755,8 @@ public:
|
||||
CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0;
|
||||
CV_WRAP virtual int getNOctaveLayers() const = 0;
|
||||
|
||||
CV_WRAP virtual void setDiffusivity(int diff) = 0;
|
||||
CV_WRAP virtual int getDiffusivity() const = 0;
|
||||
CV_WRAP virtual void setDiffusivity(KAZE::DiffusivityType diff) = 0;
|
||||
CV_WRAP virtual KAZE::DiffusivityType getDiffusivity() const = 0;
|
||||
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
|
||||
};
|
||||
|
||||
@@ -773,7 +783,7 @@ template<> struct Accumulator<short> { typedef float Type; };
|
||||
template<class T>
|
||||
struct CV_EXPORTS SL2
|
||||
{
|
||||
enum { normType = NORM_L2SQR };
|
||||
static const NormTypes normType = NORM_L2SQR;
|
||||
typedef T ValueType;
|
||||
typedef typename Accumulator<T>::Type ResultType;
|
||||
|
||||
@@ -789,7 +799,7 @@ struct CV_EXPORTS SL2
|
||||
template<class T>
|
||||
struct L2
|
||||
{
|
||||
enum { normType = NORM_L2 };
|
||||
static const NormTypes normType = NORM_L2;
|
||||
typedef T ValueType;
|
||||
typedef typename Accumulator<T>::Type ResultType;
|
||||
|
||||
@@ -805,7 +815,7 @@ struct L2
|
||||
template<class T>
|
||||
struct L1
|
||||
{
|
||||
enum { normType = NORM_L1 };
|
||||
static const NormTypes normType = NORM_L1;
|
||||
typedef T ValueType;
|
||||
typedef typename Accumulator<T>::Type ResultType;
|
||||
|
||||
@@ -830,7 +840,7 @@ an image set.
|
||||
class CV_EXPORTS_W DescriptorMatcher : public Algorithm
|
||||
{
|
||||
public:
|
||||
enum
|
||||
enum MatcherType
|
||||
{
|
||||
FLANNBASED = 1,
|
||||
BRUTEFORCE = 2,
|
||||
@@ -839,6 +849,7 @@ public:
|
||||
BRUTEFORCE_HAMMINGLUT = 5,
|
||||
BRUTEFORCE_SL2 = 6
|
||||
};
|
||||
|
||||
virtual ~DescriptorMatcher();
|
||||
|
||||
/** @brief Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor
|
||||
@@ -1016,7 +1027,7 @@ public:
|
||||
*/
|
||||
CV_WRAP static Ptr<DescriptorMatcher> create( const String& descriptorMatcherType );
|
||||
|
||||
CV_WRAP static Ptr<DescriptorMatcher> create( int matcherType );
|
||||
CV_WRAP static Ptr<DescriptorMatcher> create( const DescriptorMatcher::MatcherType& matcherType );
|
||||
|
||||
|
||||
// see corresponding cv::Algorithm method
|
||||
@@ -1171,20 +1182,20 @@ protected:
|
||||
//! @addtogroup features2d_draw
|
||||
//! @{
|
||||
|
||||
struct CV_EXPORTS DrawMatchesFlags
|
||||
enum struct DrawMatchesFlags
|
||||
{
|
||||
enum{ DEFAULT = 0, //!< Output image matrix will be created (Mat::create),
|
||||
//!< i.e. existing memory of output image may be reused.
|
||||
//!< Two source image, matches and single keypoints will be drawn.
|
||||
//!< For each keypoint only the center point will be drawn (without
|
||||
//!< the circle around keypoint with keypoint size and orientation).
|
||||
DRAW_OVER_OUTIMG = 1, //!< Output image matrix will not be created (Mat::create).
|
||||
//!< Matches will be drawn on existing content of output image.
|
||||
NOT_DRAW_SINGLE_POINTS = 2, //!< Single keypoints will not be drawn.
|
||||
DRAW_RICH_KEYPOINTS = 4 //!< For each keypoint the circle around keypoint with keypoint size and
|
||||
//!< orientation will be drawn.
|
||||
};
|
||||
DEFAULT = 0, //!< Output image matrix will be created (Mat::create),
|
||||
//!< i.e. existing memory of output image may be reused.
|
||||
//!< Two source image, matches and single keypoints will be drawn.
|
||||
//!< For each keypoint only the center point will be drawn (without
|
||||
//!< the circle around keypoint with keypoint size and orientation).
|
||||
DRAW_OVER_OUTIMG = 1, //!< Output image matrix will not be created (Mat::create).
|
||||
//!< Matches will be drawn on existing content of output image.
|
||||
NOT_DRAW_SINGLE_POINTS = 2, //!< Single keypoints will not be drawn.
|
||||
DRAW_RICH_KEYPOINTS = 4 //!< For each keypoint the circle around keypoint with keypoint size and
|
||||
//!< orientation will be drawn.
|
||||
};
|
||||
CV_ENUM_FLAGS(DrawMatchesFlags);
|
||||
|
||||
/** @brief Draws keypoints.
|
||||
|
||||
@@ -1202,7 +1213,7 @@ cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv2.DRAW_MATCHES_FLAGS_DRAW_OVER_OUT
|
||||
cv2.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS
|
||||
*/
|
||||
CV_EXPORTS_W void drawKeypoints( InputArray image, const std::vector<KeyPoint>& keypoints, InputOutputArray outImage,
|
||||
const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT );
|
||||
const Scalar& color=Scalar::all(-1), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT );
|
||||
|
||||
/** @brief Draws the found matches of keypoints from two images.
|
||||
|
||||
@@ -1230,14 +1241,14 @@ CV_EXPORTS_W void drawMatches( InputArray img1, const std::vector<KeyPoint>& key
|
||||
InputArray img2, const std::vector<KeyPoint>& keypoints2,
|
||||
const std::vector<DMatch>& matches1to2, InputOutputArray outImg,
|
||||
const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1),
|
||||
const std::vector<char>& matchesMask=std::vector<char>(), int flags=DrawMatchesFlags::DEFAULT );
|
||||
const std::vector<char>& matchesMask=std::vector<char>(), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT );
|
||||
|
||||
/** @overload */
|
||||
CV_EXPORTS_AS(drawMatchesKnn) void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
|
||||
InputArray img2, const std::vector<KeyPoint>& keypoints2,
|
||||
const std::vector<std::vector<DMatch> >& matches1to2, InputOutputArray outImg,
|
||||
const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1),
|
||||
const std::vector<std::vector<char> >& matchesMask=std::vector<std::vector<char> >(), int flags=DrawMatchesFlags::DEFAULT );
|
||||
const std::vector<std::vector<char> >& matchesMask=std::vector<std::vector<char> >(), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT );
|
||||
|
||||
//! @} features2d_draw
|
||||
|
||||
|
||||
Reference in New Issue
Block a user