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:
Hamdi Sahloul
2018-09-22 00:12:35 +09:00
committed by Alexander Alekhin
parent 84ae8097b1
commit ef5579dc86
51 changed files with 567 additions and 333 deletions
@@ -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
@@ -1,3 +1,24 @@
#ifdef HAVE_OPENCV_FEATURES2D
typedef SimpleBlobDetector::Params SimpleBlobDetector_Params;
typedef AKAZE::DescriptorType AKAZE_DescriptorType;
typedef AgastFeatureDetector::DetectorType AgastFeatureDetector_DetectorType;
typedef FastFeatureDetector::DetectorType FastFeatureDetector_DetectorType;
typedef DescriptorMatcher::MatcherType DescriptorMatcher_MatcherType;
typedef KAZE::DiffusivityType KAZE_DiffusivityType;
typedef ORB::ScoreType ORB_ScoreType;
CV_PY_FROM_ENUM(AKAZE::DescriptorType);
CV_PY_TO_ENUM(AKAZE::DescriptorType);
CV_PY_FROM_ENUM(AgastFeatureDetector::DetectorType);
CV_PY_TO_ENUM(AgastFeatureDetector::DetectorType);
CV_PY_FROM_ENUM(DrawMatchesFlags);
CV_PY_TO_ENUM(DrawMatchesFlags);
CV_PY_FROM_ENUM(FastFeatureDetector::DetectorType);
CV_PY_TO_ENUM(FastFeatureDetector::DetectorType);
CV_PY_FROM_ENUM(DescriptorMatcher::MatcherType);
CV_PY_TO_ENUM(DescriptorMatcher::MatcherType);
CV_PY_FROM_ENUM(KAZE::DiffusivityType);
CV_PY_TO_ENUM(KAZE::DiffusivityType);
CV_PY_FROM_ENUM(ORB::ScoreType);
CV_PY_TO_ENUM(ORB::ScoreType);
#endif
+8 -8
View File
@@ -7446,7 +7446,7 @@ static void OAST_9_16(InputArray _img, std::vector<KeyPoint>& keypoints, int thr
#else // !(defined __i386__ || defined(_M_IX86) || defined __x86_64__ || defined(_M_X64))
static void AGAST_ALL(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, int agasttype)
static void AGAST_ALL(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, AgastFeatureDetector::DetectorType agasttype)
{
cv::Mat img;
if(!_img.getMat().isContinuous())
@@ -7944,8 +7944,8 @@ void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, boo
class AgastFeatureDetector_Impl CV_FINAL : public AgastFeatureDetector
{
public:
AgastFeatureDetector_Impl( int _threshold, bool _nonmaxSuppression, int _type )
: threshold(_threshold), nonmaxSuppression(_nonmaxSuppression), type((short)_type)
AgastFeatureDetector_Impl( int _threshold, bool _nonmaxSuppression, DetectorType _type )
: threshold(_threshold), nonmaxSuppression(_nonmaxSuppression), type(_type)
{}
void detect( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask ) CV_OVERRIDE
@@ -7998,20 +7998,20 @@ public:
void setNonmaxSuppression(bool f) CV_OVERRIDE { nonmaxSuppression = f; }
bool getNonmaxSuppression() const CV_OVERRIDE { return nonmaxSuppression; }
void setType(int type_) CV_OVERRIDE { type = type_; }
int getType() const CV_OVERRIDE { return type; }
void setType(DetectorType type_) CV_OVERRIDE{ type = type_; }
DetectorType getType() const CV_OVERRIDE{ return type; }
int threshold;
bool nonmaxSuppression;
int type;
DetectorType type;
};
Ptr<AgastFeatureDetector> AgastFeatureDetector::create( int threshold, bool nonmaxSuppression, int type )
Ptr<AgastFeatureDetector> AgastFeatureDetector::create( int threshold, bool nonmaxSuppression, AgastFeatureDetector::DetectorType type )
{
return makePtr<AgastFeatureDetector_Impl>(threshold, nonmaxSuppression, type);
}
void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression, int type)
void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression, AgastFeatureDetector::DetectorType type)
{
CV_INSTRUMENT_REGION();
+2 -2
View File
@@ -47,7 +47,7 @@ The references are:
namespace cv
{
void makeAgastOffsets(int pixel[16], int rowStride, int type)
void makeAgastOffsets(int pixel[16], int rowStride, AgastFeatureDetector::DetectorType type)
{
static const int offsets16[][2] =
{
@@ -9400,7 +9400,7 @@ int agast_tree_search(const uint32_t table_struct32[], int pixel_[], const unsig
}
// universal pixel mask
int AGAST_ALL_SCORE(const uchar* ptr, const int pixel[], int threshold, int agasttype)
int AGAST_ALL_SCORE(const uchar* ptr, const int pixel[], int threshold, AgastFeatureDetector::DetectorType agasttype)
{
int bmin = threshold;
int bmax = 255;
+3 -3
View File
@@ -54,13 +54,13 @@ namespace cv
#if !(defined __i386__ || defined(_M_IX86) || defined __x86_64__ || defined(_M_X64))
int agast_tree_search(const uint32_t table_struct32[], int pixel_[], const unsigned char* const ptr, int threshold);
int AGAST_ALL_SCORE(const uchar* ptr, const int pixel[], int threshold, int agasttype);
int AGAST_ALL_SCORE(const uchar* ptr, const int pixel[], int threshold, AgastFeatureDetector::DetectorType agasttype);
#endif //!(defined __i386__ || defined(_M_IX86) || defined __x86_64__ || defined(_M_X64))
void makeAgastOffsets(int pixel[16], int row_stride, int type);
void makeAgastOffsets(int pixel[16], int row_stride, AgastFeatureDetector::DetectorType type);
template<int type>
template<AgastFeatureDetector::DetectorType type>
int agast_cornerScore(const uchar* ptr, const int pixel[], int threshold);
+12 -12
View File
@@ -60,8 +60,8 @@ namespace cv
class AKAZE_Impl : public AKAZE
{
public:
AKAZE_Impl(int _descriptor_type, int _descriptor_size, int _descriptor_channels,
float _threshold, int _octaves, int _sublevels, int _diffusivity)
AKAZE_Impl(DescriptorType _descriptor_type, int _descriptor_size, int _descriptor_channels,
float _threshold, int _octaves, int _sublevels, KAZE::DiffusivityType _diffusivity)
: descriptor(_descriptor_type)
, descriptor_channels(_descriptor_channels)
, descriptor_size(_descriptor_size)
@@ -77,8 +77,8 @@ namespace cv
}
void setDescriptorType(int dtype) CV_OVERRIDE { descriptor = dtype; }
int getDescriptorType() const CV_OVERRIDE { return descriptor; }
void setDescriptorType(DescriptorType dtype) CV_OVERRIDE{ descriptor = dtype; }
DescriptorType getDescriptorType() const CV_OVERRIDE{ return descriptor; }
void setDescriptorSize(int dsize) CV_OVERRIDE { descriptor_size = dsize; }
int getDescriptorSize() const CV_OVERRIDE { return descriptor_size; }
@@ -95,8 +95,8 @@ namespace cv
void setNOctaveLayers(int octaveLayers_) CV_OVERRIDE { sublevels = octaveLayers_; }
int getNOctaveLayers() const CV_OVERRIDE { return sublevels; }
void setDiffusivity(int diff_) CV_OVERRIDE { diffusivity = diff_; }
int getDiffusivity() const CV_OVERRIDE { return diffusivity; }
void setDiffusivity(KAZE::DiffusivityType diff_) CV_OVERRIDE{ diffusivity = diff_; }
KAZE::DiffusivityType getDiffusivity() const CV_OVERRIDE{ return diffusivity; }
// returns the descriptor size in bytes
int descriptorSize() const CV_OVERRIDE
@@ -218,28 +218,28 @@ namespace cv
void read(const FileNode& fn) CV_OVERRIDE
{
descriptor = (int)fn["descriptor"];
descriptor = static_cast<DescriptorType>((int)fn["descriptor"]);
descriptor_channels = (int)fn["descriptor_channels"];
descriptor_size = (int)fn["descriptor_size"];
threshold = (float)fn["threshold"];
octaves = (int)fn["octaves"];
sublevels = (int)fn["sublevels"];
diffusivity = (int)fn["diffusivity"];
diffusivity = static_cast<KAZE::DiffusivityType>((int)fn["diffusivity"]);
}
int descriptor;
DescriptorType descriptor;
int descriptor_channels;
int descriptor_size;
float threshold;
int octaves;
int sublevels;
int diffusivity;
KAZE::DiffusivityType diffusivity;
};
Ptr<AKAZE> AKAZE::create(int descriptor_type,
Ptr<AKAZE> AKAZE::create(DescriptorType descriptor_type,
int descriptor_size, int descriptor_channels,
float threshold, int octaves,
int sublevels, int diffusivity)
int sublevels, KAZE::DiffusivityType diffusivity)
{
return makePtr<AKAZE_Impl>(descriptor_type, descriptor_size, descriptor_channels,
threshold, octaves, sublevels, diffusivity);
+8 -8
View File
@@ -50,12 +50,12 @@ namespace cv
/*
* Functions to draw keypoints and matches.
*/
static inline void _drawKeypoint( InputOutputArray img, const KeyPoint& p, const Scalar& color, int flags )
static inline void _drawKeypoint( InputOutputArray img, const KeyPoint& p, const Scalar& color, DrawMatchesFlags flags )
{
CV_Assert( !img.empty() );
Point center( cvRound(p.pt.x * draw_multiplier), cvRound(p.pt.y * draw_multiplier) );
if( flags & DrawMatchesFlags::DRAW_RICH_KEYPOINTS )
if( !!(flags & DrawMatchesFlags::DRAW_RICH_KEYPOINTS) )
{
int radius = cvRound(p.size/2 * draw_multiplier); // KeyPoint::size is a diameter
@@ -89,7 +89,7 @@ static inline void _drawKeypoint( InputOutputArray img, const KeyPoint& p, const
}
void drawKeypoints( InputArray image, const std::vector<KeyPoint>& keypoints, InputOutputArray outImage,
const Scalar& _color, int flags )
const Scalar& _color, DrawMatchesFlags flags )
{
CV_INSTRUMENT_REGION();
@@ -125,12 +125,12 @@ void drawKeypoints( InputArray image, const std::vector<KeyPoint>& keypoints, In
static void _prepareImgAndDrawKeypoints( InputArray img1, const std::vector<KeyPoint>& keypoints1,
InputArray img2, const std::vector<KeyPoint>& keypoints2,
InputOutputArray _outImg, Mat& outImg1, Mat& outImg2,
const Scalar& singlePointColor, int flags )
const Scalar& singlePointColor, DrawMatchesFlags flags )
{
Mat outImg;
Size img1size = img1.size(), img2size = img2.size();
Size size( img1size.width + img2size.width, MAX(img1size.height, img2size.height) );
if( flags & DrawMatchesFlags::DRAW_OVER_OUTIMG )
if( !!(flags & DrawMatchesFlags::DRAW_OVER_OUTIMG) )
{
outImg = _outImg.getMat();
if( size.width > outImg.cols || size.height > outImg.rows )
@@ -169,7 +169,7 @@ static void _prepareImgAndDrawKeypoints( InputArray img1, const std::vector<KeyP
}
static inline void _drawMatch( InputOutputArray outImg, InputOutputArray outImg1, InputOutputArray outImg2 ,
const KeyPoint& kp1, const KeyPoint& kp2, const Scalar& matchColor, int flags )
const KeyPoint& kp1, const KeyPoint& kp2, const Scalar& matchColor, DrawMatchesFlags flags )
{
RNG& rng = theRNG();
bool isRandMatchColor = matchColor == Scalar::all(-1);
@@ -192,7 +192,7 @@ void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
InputArray img2, const std::vector<KeyPoint>& keypoints2,
const std::vector<DMatch>& matches1to2, InputOutputArray outImg,
const Scalar& matchColor, const Scalar& singlePointColor,
const std::vector<char>& matchesMask, int flags )
const std::vector<char>& matchesMask, DrawMatchesFlags flags )
{
if( !matchesMask.empty() && matchesMask.size() != matches1to2.size() )
CV_Error( Error::StsBadSize, "matchesMask must have the same size as matches1to2" );
@@ -221,7 +221,7 @@ 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, const Scalar& singlePointColor,
const std::vector<std::vector<char> >& matchesMask, int flags )
const std::vector<std::vector<char> >& matchesMask, DrawMatchesFlags flags )
{
if( !matchesMask.empty() && matchesMask.size() != matches1to2.size() )
CV_Error( Error::StsBadSize, "matchesMask must have the same size as matches1to2" );
+10 -10
View File
@@ -415,7 +415,7 @@ static bool openvx_FAST(InputArray _img, std::vector<KeyPoint>& keypoints,
#endif
static inline int hal_FAST(cv::Mat& src, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression, int type)
static inline int hal_FAST(cv::Mat& src, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression, FastFeatureDetector::DetectorType type)
{
if (threshold > 20)
return CV_HAL_ERROR_NOT_IMPLEMENTED;
@@ -472,7 +472,7 @@ static inline int hal_FAST(cv::Mat& src, std::vector<KeyPoint>& keypoints, int t
return CV_HAL_ERROR_OK;
}
void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression, int type)
void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression, FastFeatureDetector::DetectorType type)
{
CV_INSTRUMENT_REGION();
@@ -514,8 +514,8 @@ void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool
class FastFeatureDetector_Impl CV_FINAL : public FastFeatureDetector
{
public:
FastFeatureDetector_Impl( int _threshold, bool _nonmaxSuppression, int _type )
: threshold(_threshold), nonmaxSuppression(_nonmaxSuppression), type((short)_type)
FastFeatureDetector_Impl( int _threshold, bool _nonmaxSuppression, FastFeatureDetector::DetectorType _type )
: threshold(_threshold), nonmaxSuppression(_nonmaxSuppression), type(_type)
{}
void detect( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask ) CV_OVERRIDE
@@ -548,7 +548,7 @@ public:
else if(prop == NONMAX_SUPPRESSION)
nonmaxSuppression = value != 0;
else if(prop == FAST_N)
type = cvRound(value);
type = static_cast<FastFeatureDetector::DetectorType>(cvRound(value));
else
CV_Error(Error::StsBadArg, "");
}
@@ -560,7 +560,7 @@ public:
if(prop == NONMAX_SUPPRESSION)
return nonmaxSuppression;
if(prop == FAST_N)
return type;
return static_cast<int>(type);
CV_Error(Error::StsBadArg, "");
return 0;
}
@@ -571,15 +571,15 @@ public:
void setNonmaxSuppression(bool f) CV_OVERRIDE { nonmaxSuppression = f; }
bool getNonmaxSuppression() const CV_OVERRIDE { return nonmaxSuppression; }
void setType(int type_) CV_OVERRIDE { type = type_; }
int getType() const CV_OVERRIDE { return type; }
void setType(FastFeatureDetector::DetectorType type_) CV_OVERRIDE{ type = type_; }
FastFeatureDetector::DetectorType getType() const CV_OVERRIDE{ return type; }
int threshold;
bool nonmaxSuppression;
int type;
FastFeatureDetector::DetectorType type;
};
Ptr<FastFeatureDetector> FastFeatureDetector::create( int threshold, bool nonmaxSuppression, int type )
Ptr<FastFeatureDetector> FastFeatureDetector::create( int threshold, bool nonmaxSuppression, FastFeatureDetector::DetectorType type )
{
return makePtr<FastFeatureDetector_Impl>(threshold, nonmaxSuppression, type);
}
+2 -2
View File
@@ -66,7 +66,7 @@
@param width,height Source image dimensions
@param type FAST type
*/
inline int hal_ni_FAST_dense(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int type) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
inline int hal_ni_FAST_dense(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, cv::FastFeatureDetector::DetectorType type) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
//! @cond IGNORED
#define cv_hal_FAST_dense hal_ni_FAST_dense
@@ -94,7 +94,7 @@ inline int hal_ni_FAST_NMS(const uchar* src_data, size_t src_step, uchar* dst_da
@param nonmax_suppression Indicates if make nonmaxima suppression or not.
@param type FAST type
*/
inline int hal_ni_FAST(const uchar* src_data, size_t src_step, int width, int height, uchar* keypoints_data, size_t* keypoints_count, int threshold, bool nonmax_suppression, int type) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
inline int hal_ni_FAST(const uchar* src_data, size_t src_step, int width, int height, uchar* keypoints_data, size_t* keypoints_count, int threshold, bool nonmax_suppression, int /*cv::FastFeatureDetector::DetectorType*/ type) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
//! @cond IGNORED
#define cv_hal_FAST hal_ni_FAST
+6 -6
View File
@@ -57,7 +57,7 @@ namespace cv
{
public:
KAZE_Impl(bool _extended, bool _upright, float _threshold, int _octaves,
int _sublevels, int _diffusivity)
int _sublevels, KAZE::DiffusivityType _diffusivity)
: extended(_extended)
, upright(_upright)
, threshold(_threshold)
@@ -84,8 +84,8 @@ namespace cv
void setNOctaveLayers(int octaveLayers_) CV_OVERRIDE { sublevels = octaveLayers_; }
int getNOctaveLayers() const CV_OVERRIDE { return sublevels; }
void setDiffusivity(int diff_) CV_OVERRIDE { diffusivity = diff_; }
int getDiffusivity() const CV_OVERRIDE { return diffusivity; }
void setDiffusivity(KAZE::DiffusivityType diff_) CV_OVERRIDE{ diffusivity = diff_; }
KAZE::DiffusivityType getDiffusivity() const CV_OVERRIDE{ return diffusivity; }
// returns the descriptor size in bytes
int descriptorSize() const CV_OVERRIDE
@@ -178,7 +178,7 @@ namespace cv
threshold = (float)fn["threshold"];
octaves = (int)fn["octaves"];
sublevels = (int)fn["sublevels"];
diffusivity = (int)fn["diffusivity"];
diffusivity = static_cast<KAZE::DiffusivityType>((int)fn["diffusivity"]);
}
bool extended;
@@ -186,13 +186,13 @@ namespace cv
float threshold;
int octaves;
int sublevels;
int diffusivity;
KAZE::DiffusivityType diffusivity;
};
Ptr<KAZE> KAZE::create(bool extended, bool upright,
float threshold,
int octaves, int sublevels,
int diffusivity)
KAZE::DiffusivityType diffusivity)
{
return makePtr<KAZE_Impl>(extended, upright, threshold, octaves, sublevels, diffusivity);
}
+2 -2
View File
@@ -45,12 +45,12 @@ struct AKAZEOptions {
float soffset; ///< Base scale offset (sigma units)
float derivative_factor; ///< Factor for the multiscale derivatives
float sderivatives; ///< Smoothing factor for the derivatives
int diffusivity; ///< Diffusivity type
KAZE::DiffusivityType diffusivity; ///< Diffusivity type
float dthreshold; ///< Detector response threshold to accept point
float min_dthreshold; ///< Minimum detector threshold to accept a point
int descriptor; ///< Type of descriptor
AKAZE::DescriptorType descriptor; ///< Type of descriptor
int descriptor_size; ///< Size of the descriptor in bits. 0->Full size
int descriptor_channels; ///< Number of channels in the descriptor (1, 2, 3)
int descriptor_pattern_size; ///< Actual patch size is 2*pattern_size*point.scale
@@ -377,7 +377,7 @@ ocl_pm_g2(InputArray Lx_, InputArray Ly_, OutputArray Lflow_, float kcontrast)
#endif // HAVE_OPENCL
static inline void
compute_diffusivity(InputArray Lx, InputArray Ly, OutputArray Lflow, float kcontrast, int diffusivity)
compute_diffusivity(InputArray Lx, InputArray Ly, OutputArray Lflow, float kcontrast, KAZE::DiffusivityType diffusivity)
{
CV_INSTRUMENT_REGION();
@@ -398,7 +398,7 @@ compute_diffusivity(InputArray Lx, InputArray Ly, OutputArray Lflow, float kcont
charbonnier_diffusivity(Lx, Ly, Lflow, kcontrast);
break;
default:
CV_Error(diffusivity, "Diffusivity is not supported");
CV_Error_(Error::StsError, ("Diffusivity is not supported: %d", static_cast<int>(diffusivity)));
break;
}
}
+1 -1
View File
@@ -36,7 +36,7 @@ struct KAZEOptions {
{
}
int diffusivity;
KAZE::DiffusivityType diffusivity;
float soffset;
int omax;
int nsublevels;
+1 -1
View File
@@ -1049,7 +1049,7 @@ Ptr<DescriptorMatcher> DescriptorMatcher::create( const String& descriptorMatche
return dm;
}
Ptr<DescriptorMatcher> DescriptorMatcher::create(int matcherType)
Ptr<DescriptorMatcher> DescriptorMatcher::create( const MatcherType& matcherType )
{
+6 -6
View File
@@ -655,7 +655,7 @@ class ORB_Impl CV_FINAL : public ORB
{
public:
explicit ORB_Impl(int _nfeatures, float _scaleFactor, int _nlevels, int _edgeThreshold,
int _firstLevel, int _WTA_K, int _scoreType, int _patchSize, int _fastThreshold) :
int _firstLevel, int _WTA_K, ORB::ScoreType _scoreType, int _patchSize, int _fastThreshold) :
nfeatures(_nfeatures), scaleFactor(_scaleFactor), nlevels(_nlevels),
edgeThreshold(_edgeThreshold), firstLevel(_firstLevel), wta_k(_WTA_K),
scoreType(_scoreType), patchSize(_patchSize), fastThreshold(_fastThreshold)
@@ -679,8 +679,8 @@ public:
void setWTA_K(int wta_k_) CV_OVERRIDE { wta_k = wta_k_; }
int getWTA_K() const CV_OVERRIDE { return wta_k; }
void setScoreType(int scoreType_) CV_OVERRIDE { scoreType = scoreType_; }
int getScoreType() const CV_OVERRIDE { return scoreType; }
void setScoreType(ORB::ScoreType scoreType_) CV_OVERRIDE{ scoreType = scoreType_; }
ORB::ScoreType getScoreType() const CV_OVERRIDE{ return scoreType; }
void setPatchSize(int patchSize_) CV_OVERRIDE { patchSize = patchSize_; }
int getPatchSize() const CV_OVERRIDE { return patchSize; }
@@ -707,7 +707,7 @@ protected:
int edgeThreshold;
int firstLevel;
int wta_k;
int scoreType;
ORB::ScoreType scoreType;
int patchSize;
int fastThreshold;
};
@@ -775,7 +775,7 @@ static void computeKeyPoints(const Mat& imagePyramid,
const std::vector<float>& layerScale,
std::vector<KeyPoint>& allKeypoints,
int nfeatures, double scaleFactor,
int edgeThreshold, int patchSize, int scoreType,
int edgeThreshold, int patchSize, ORB::ScoreType scoreType,
bool useOCL, int fastThreshold )
{
#ifndef HAVE_OPENCL
@@ -1195,7 +1195,7 @@ void ORB_Impl::detectAndCompute( InputArray _image, InputArray _mask,
}
Ptr<ORB> ORB::create(int nfeatures, float scaleFactor, int nlevels, int edgeThreshold,
int firstLevel, int wta_k, int scoreType, int patchSize, int fastThreshold)
int firstLevel, int wta_k, ORB::ScoreType scoreType, int patchSize, int fastThreshold)
{
CV_Assert(firstLevel >= 0);
return makePtr<ORB_Impl>(nfeatures, scaleFactor, nlevels, edgeThreshold,
+2 -2
View File
@@ -75,8 +75,8 @@ void CV_AgastTest::run( int )
vector<KeyPoint> keypoints1;
vector<KeyPoint> keypoints2;
AGAST(gray1, keypoints1, 30, true, type);
AGAST(gray2, keypoints2, (type > 0 ? 30 : 20), true, type);
AGAST(gray1, keypoints1, 30, true, static_cast<AgastFeatureDetector::DetectorType>(type));
AGAST(gray2, keypoints2, (type > 0 ? 30 : 20), true, static_cast<AgastFeatureDetector::DetectorType>(type));
for(size_t i = 0; i < keypoints1.size(); ++i)
{
+2 -2
View File
@@ -75,8 +75,8 @@ void CV_FastTest::run( int )
vector<KeyPoint> keypoints1;
vector<KeyPoint> keypoints2;
FAST(gray1, keypoints1, 30, true, type);
FAST(gray2, keypoints2, (type > 0 ? 30 : 20), true, type);
FAST(gray1, keypoints1, 30, true, static_cast<FastFeatureDetector::DetectorType>(type));
FAST(gray2, keypoints2, (type > 0 ? 30 : 20), true, static_cast<FastFeatureDetector::DetectorType>(type));
for(size_t i = 0; i < keypoints1.size(); ++i)
{
+1 -1
View File
@@ -100,7 +100,7 @@ TEST(Features2D_ORB, crash)
int edgeThreshold = 4;
int firstLevel = 0;
int WTA_K = 2;
int scoreType = cv::ORB::HARRIS_SCORE;
ORB::ScoreType scoreType = cv::ORB::HARRIS_SCORE;
int patchSize = 47;
int fastThreshold = 20;