1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

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
+28 -18
View File
@@ -2997,7 +2997,8 @@ public:
class CV_EXPORTS Formatter
{
public:
enum { FMT_DEFAULT = 0,
enum FormatType {
FMT_DEFAULT = 0,
FMT_MATLAB = 1,
FMT_CSV = 2,
FMT_PYTHON = 3,
@@ -3014,7 +3015,7 @@ public:
virtual void set64fPrecision(int p = 16) = 0;
virtual void setMultiline(bool ml = true) = 0;
static Ptr<Formatter> get(int fmt = FMT_DEFAULT);
static Ptr<Formatter> get(Formatter::FormatType fmt = FMT_DEFAULT);
};
@@ -3037,7 +3038,7 @@ String& operator << (String& out, const Mat& mtx)
class CV_EXPORTS Algorithm;
template<typename _Tp> struct ParamType {};
template<typename _Tp, typename _EnumTp = void> struct ParamType {};
/** @brief This is a base class for all more or less complex algorithms in OpenCV
@@ -3150,9 +3151,9 @@ protected:
void writeFormat(FileStorage& fs) const;
};
struct Param {
enum { INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, MAT_VECTOR=5, ALGORITHM=6, FLOAT=7,
UNSIGNED_INT=8, UINT64=9, UCHAR=11, SCALAR=12 };
enum struct Param {
INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, MAT_VECTOR=5, ALGORITHM=6, FLOAT=7,
UNSIGNED_INT=8, UINT64=9, UCHAR=11, SCALAR=12
};
@@ -3162,7 +3163,7 @@ template<> struct ParamType<bool>
typedef bool const_param_type;
typedef bool member_type;
enum { type = Param::BOOLEAN };
static const Param type = Param::BOOLEAN;
};
template<> struct ParamType<int>
@@ -3170,7 +3171,7 @@ template<> struct ParamType<int>
typedef int const_param_type;
typedef int member_type;
enum { type = Param::INT };
static const Param type = Param::INT;
};
template<> struct ParamType<double>
@@ -3178,7 +3179,7 @@ template<> struct ParamType<double>
typedef double const_param_type;
typedef double member_type;
enum { type = Param::REAL };
static const Param type = Param::REAL;
};
template<> struct ParamType<String>
@@ -3186,7 +3187,7 @@ template<> struct ParamType<String>
typedef const String& const_param_type;
typedef String member_type;
enum { type = Param::STRING };
static const Param type = Param::STRING;
};
template<> struct ParamType<Mat>
@@ -3194,7 +3195,7 @@ template<> struct ParamType<Mat>
typedef const Mat& const_param_type;
typedef Mat member_type;
enum { type = Param::MAT };
static const Param type = Param::MAT;
};
template<> struct ParamType<std::vector<Mat> >
@@ -3202,7 +3203,7 @@ template<> struct ParamType<std::vector<Mat> >
typedef const std::vector<Mat>& const_param_type;
typedef std::vector<Mat> member_type;
enum { type = Param::MAT_VECTOR };
static const Param type = Param::MAT_VECTOR;
};
template<> struct ParamType<Algorithm>
@@ -3210,7 +3211,7 @@ template<> struct ParamType<Algorithm>
typedef const Ptr<Algorithm>& const_param_type;
typedef Ptr<Algorithm> member_type;
enum { type = Param::ALGORITHM };
static const Param type = Param::ALGORITHM;
};
template<> struct ParamType<float>
@@ -3218,7 +3219,7 @@ template<> struct ParamType<float>
typedef float const_param_type;
typedef float member_type;
enum { type = Param::FLOAT };
static const Param type = Param::FLOAT;
};
template<> struct ParamType<unsigned>
@@ -3226,7 +3227,7 @@ template<> struct ParamType<unsigned>
typedef unsigned const_param_type;
typedef unsigned member_type;
enum { type = Param::UNSIGNED_INT };
static const Param type = Param::UNSIGNED_INT;
};
template<> struct ParamType<uint64>
@@ -3234,7 +3235,7 @@ template<> struct ParamType<uint64>
typedef uint64 const_param_type;
typedef uint64 member_type;
enum { type = Param::UINT64 };
static const Param type = Param::UINT64;
};
template<> struct ParamType<uchar>
@@ -3242,7 +3243,7 @@ template<> struct ParamType<uchar>
typedef uchar const_param_type;
typedef uchar member_type;
enum { type = Param::UCHAR };
static const Param type = Param::UCHAR;
};
template<> struct ParamType<Scalar>
@@ -3250,7 +3251,16 @@ template<> struct ParamType<Scalar>
typedef const Scalar& const_param_type;
typedef Scalar member_type;
enum { type = Param::SCALAR };
static const Param type = Param::SCALAR;
};
template<typename _Tp>
struct ParamType<_Tp, typename std::enable_if< std::is_enum<_Tp>::value >::type>
{
typedef typename std::underlying_type<_Tp>::type const_param_type;
typedef typename std::underlying_type<_Tp>::type member_type;
static const Param type = Param::INT;
};
//! @} core_basic