1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +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
+45 -44
View File
@@ -14,8 +14,8 @@ namespace cv {
Mat _InputArray::getMat_(int i) const
{
int k = kind();
int accessFlags = flags & ACCESS_MASK;
_InputArray::KindFlag k = kind();
AccessFlag accessFlags = flags & ACCESS_MASK;
if( k == MAT )
{
@@ -132,8 +132,8 @@ Mat _InputArray::getMat_(int i) const
UMat _InputArray::getUMat(int i) const
{
int k = kind();
int accessFlags = flags & ACCESS_MASK;
_InputArray::KindFlag k = kind();
AccessFlag accessFlags = flags & ACCESS_MASK;
if( k == UMAT )
{
@@ -164,8 +164,8 @@ UMat _InputArray::getUMat(int i) const
void _InputArray::getMatVector(std::vector<Mat>& mv) const
{
int k = kind();
int accessFlags = flags & ACCESS_MASK;
_InputArray::KindFlag k = kind();
AccessFlag accessFlags = flags & ACCESS_MASK;
if( k == MAT )
{
@@ -272,8 +272,8 @@ void _InputArray::getMatVector(std::vector<Mat>& mv) const
void _InputArray::getUMatVector(std::vector<UMat>& umv) const
{
int k = kind();
int accessFlags = flags & ACCESS_MASK;
_InputArray::KindFlag k = kind();
AccessFlag accessFlags = flags & ACCESS_MASK;
if( k == NONE )
{
@@ -334,7 +334,7 @@ void _InputArray::getUMatVector(std::vector<UMat>& umv) const
cuda::GpuMat _InputArray::getGpuMat() const
{
int k = kind();
_InputArray::KindFlag k = kind();
if (k == CUDA_GPU_MAT)
{
@@ -360,7 +360,7 @@ cuda::GpuMat _InputArray::getGpuMat() const
}
void _InputArray::getGpuMatVector(std::vector<cuda::GpuMat>& gpumv) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if (k == STD_VECTOR_CUDA_GPU_MAT)
{
gpumv = *(std::vector<cuda::GpuMat>*)obj;
@@ -368,7 +368,7 @@ void _InputArray::getGpuMatVector(std::vector<cuda::GpuMat>& gpumv) const
}
ogl::Buffer _InputArray::getOGlBuffer() const
{
int k = kind();
_InputArray::KindFlag k = kind();
CV_Assert(k == OPENGL_BUFFER);
@@ -376,7 +376,7 @@ ogl::Buffer _InputArray::getOGlBuffer() const
return *gl_buf;
}
int _InputArray::kind() const
_InputArray::KindFlag _InputArray::kind() const
{
return flags & KIND_MASK;
}
@@ -393,7 +393,7 @@ int _InputArray::cols(int i) const
Size _InputArray::size(int i) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT )
{
@@ -515,7 +515,8 @@ Size _InputArray::size(int i) const
int _InputArray::sizend(int* arrsz, int i) const
{
int j, d=0, k = kind();
int j, d = 0;
_InputArray::KindFlag k = kind();
if( k == NONE )
;
@@ -583,7 +584,7 @@ int _InputArray::sizend(int* arrsz, int i) const
bool _InputArray::sameSize(const _InputArray& arr) const
{
int k1 = kind(), k2 = arr.kind();
_InputArray::KindFlag k1 = kind(), k2 = arr.kind();
Size sz1;
if( k1 == MAT )
@@ -617,7 +618,7 @@ bool _InputArray::sameSize(const _InputArray& arr) const
int _InputArray::dims(int i) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT )
{
@@ -714,7 +715,7 @@ int _InputArray::dims(int i) const
size_t _InputArray::total(int i) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT )
{
@@ -763,7 +764,7 @@ size_t _InputArray::total(int i) const
int _InputArray::type(int i) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT )
return ((const Mat*)obj)->type();
@@ -852,7 +853,7 @@ int _InputArray::channels(int i) const
bool _InputArray::empty() const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT )
return ((const Mat*)obj)->empty();
@@ -924,7 +925,7 @@ bool _InputArray::empty() const
bool _InputArray::isContinuous(int i) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT )
return i < 0 ? ((const Mat*)obj)->isContinuous() : true;
@@ -965,7 +966,7 @@ bool _InputArray::isContinuous(int i) const
bool _InputArray::isSubmatrix(int i) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT )
return i < 0 ? ((const Mat*)obj)->isSubmatrix() : false;
@@ -1003,7 +1004,7 @@ bool _InputArray::isSubmatrix(int i) const
size_t _InputArray::offset(int i) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT )
{
@@ -1067,7 +1068,7 @@ size_t _InputArray::offset(int i) const
size_t _InputArray::step(int i) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT )
{
@@ -1127,7 +1128,7 @@ size_t _InputArray::step(int i) const
void _InputArray::copyTo(const _OutputArray& arr) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == NONE )
arr.release();
@@ -1156,7 +1157,7 @@ void _InputArray::copyTo(const _OutputArray& arr) const
void _InputArray::copyTo(const _OutputArray& arr, const _InputArray & mask) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == NONE )
arr.release();
@@ -1185,9 +1186,9 @@ bool _OutputArray::fixedType() const
return (flags & FIXED_TYPE) == FIXED_TYPE;
}
void _OutputArray::create(Size _sz, int mtype, int i, bool allowTransposed, int fixedDepthMask) const
void _OutputArray::create(Size _sz, int mtype, int i, bool allowTransposed, _OutputArray::DepthMask fixedDepthMask) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT && i < 0 && !allowTransposed && fixedDepthMask == 0 )
{
CV_Assert(!fixedSize() || ((Mat*)obj)->size.operator()() == _sz);
@@ -1227,9 +1228,9 @@ void _OutputArray::create(Size _sz, int mtype, int i, bool allowTransposed, int
create(2, sizes, mtype, i, allowTransposed, fixedDepthMask);
}
void _OutputArray::create(int _rows, int _cols, int mtype, int i, bool allowTransposed, int fixedDepthMask) const
void _OutputArray::create(int _rows, int _cols, int mtype, int i, bool allowTransposed, _OutputArray::DepthMask fixedDepthMask) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT && i < 0 && !allowTransposed && fixedDepthMask == 0 )
{
CV_Assert(!fixedSize() || ((Mat*)obj)->size.operator()() == Size(_cols, _rows));
@@ -1270,7 +1271,7 @@ void _OutputArray::create(int _rows, int _cols, int mtype, int i, bool allowTran
}
void _OutputArray::create(int d, const int* sizes, int mtype, int i,
bool allowTransposed, int fixedDepthMask) const
bool allowTransposed, _OutputArray::DepthMask fixedDepthMask) const
{
int sizebuf[2];
if(d == 1)
@@ -1280,7 +1281,7 @@ void _OutputArray::create(int d, const int* sizes, int mtype, int i,
sizebuf[1] = 1;
sizes = sizebuf;
}
int k = kind();
_InputArray::KindFlag k = kind();
mtype = CV_MAT_TYPE(mtype);
if( k == MAT )
@@ -1667,7 +1668,7 @@ void _OutputArray::release() const
{
CV_Assert(!fixedSize());
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT )
{
@@ -1735,7 +1736,7 @@ void _OutputArray::release() const
void _OutputArray::clear() const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == MAT )
{
@@ -1754,7 +1755,7 @@ bool _OutputArray::needed() const
Mat& _OutputArray::getMatRef(int i) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( i < 0 )
{
CV_Assert( k == MAT );
@@ -1779,7 +1780,7 @@ Mat& _OutputArray::getMatRef(int i) const
UMat& _OutputArray::getUMatRef(int i) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( i < 0 )
{
CV_Assert( k == UMAT );
@@ -1796,34 +1797,34 @@ UMat& _OutputArray::getUMatRef(int i) const
cuda::GpuMat& _OutputArray::getGpuMatRef() const
{
int k = kind();
_InputArray::KindFlag k = kind();
CV_Assert( k == CUDA_GPU_MAT );
return *(cuda::GpuMat*)obj;
}
std::vector<cuda::GpuMat>& _OutputArray::getGpuMatVecRef() const
{
int k = kind();
_InputArray::KindFlag k = kind();
CV_Assert(k == STD_VECTOR_CUDA_GPU_MAT);
return *(std::vector<cuda::GpuMat>*)obj;
}
ogl::Buffer& _OutputArray::getOGlBufferRef() const
{
int k = kind();
_InputArray::KindFlag k = kind();
CV_Assert( k == OPENGL_BUFFER );
return *(ogl::Buffer*)obj;
}
cuda::HostMem& _OutputArray::getHostMemRef() const
{
int k = kind();
_InputArray::KindFlag k = kind();
CV_Assert( k == CUDA_HOST_MEM );
return *(cuda::HostMem*)obj;
}
void _OutputArray::setTo(const _InputArray& arr, const _InputArray & mask) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if( k == NONE )
;
@@ -1847,7 +1848,7 @@ void _OutputArray::setTo(const _InputArray& arr, const _InputArray & mask) const
void _OutputArray::assign(const UMat& u) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if (k == UMAT)
{
*(UMat*)obj = u;
@@ -1869,7 +1870,7 @@ void _OutputArray::assign(const UMat& u) const
void _OutputArray::assign(const Mat& m) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if (k == UMAT)
{
m.copyTo(*(UMat*)obj); // TODO check m.getUMat()
@@ -1891,7 +1892,7 @@ void _OutputArray::assign(const Mat& m) const
void _OutputArray::assign(const std::vector<UMat>& v) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if (k == STD_VECTOR_UMAT)
{
std::vector<UMat>& this_v = *(std::vector<UMat>*)obj;
@@ -1929,7 +1930,7 @@ void _OutputArray::assign(const std::vector<UMat>& v) const
void _OutputArray::assign(const std::vector<Mat>& v) const
{
int k = kind();
_InputArray::KindFlag k = kind();
if (k == STD_VECTOR_UMAT)
{
std::vector<UMat>& this_v = *(std::vector<UMat>*)obj;