diff --git a/modules/core/include/opencv2/core.hpp b/modules/core/include/opencv2/core.hpp index 48d643636583..726b34f65eda 100644 --- a/modules/core/include/opencv2/core.hpp +++ b/modules/core/include/opencv2/core.hpp @@ -327,7 +327,7 @@ The input arrays and the output array can all have the same or different depths. can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit floating-point array. Depth of the output array is determined by the ddepth parameter. In the second and third cases above, as well as in the first case, when src1.depth() == src2.depth(), ddepth can -be set to the default CV_TYPE_AUTO. In this case, the output array will have the same depth as the input +be set to the default CV_DEPTH_AUTO. In this case, the output array will have the same depth as the input array, be it src1, src2 or both. @note Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow. @@ -341,13 +341,13 @@ output array to be changed. @sa subtract, addWeighted, scaleAdd, Mat::convertTo */ CV_EXPORTS_W void add(InputArray src1, InputArray src2, OutputArray dst, - InputArray mask = noArray(), ElemType ddepth = CV_TYPE_AUTO); + InputArray mask = noArray(), ElemDepth ddepth = CV_DEPTH_AUTO); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) static inline void add(InputArray src1, InputArray src2, OutputArray dst, InputArray mask, int ddepth) { - add(src1, src2, dst, mask, static_cast(ddepth)); + add(src1, src2, dst, mask, static_cast(ddepth)); } #endif // CV_TYPE_COMPATIBLE_API @@ -376,7 +376,7 @@ The first function in the list above can be replaced with matrix expressions: The input arrays and the output array can all have the same or different depths. For example, you can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of the output array is determined by ddepth parameter. In the second and third cases above, as well as -in the first case, when src1.depth() == src2.depth(), ddepth can be set to the default CV_TYPE_AUTO. In this +in the first case, when src1.depth() == src2.depth(), ddepth can be set to the default CV_DEPTH_AUTO. In this case the output array will have the same depth as the input array, be it src1, src2 or both. @note Saturation is not applied when the output array has the depth CV_32S. You may even get result of an incorrect sign in the case of overflow. @@ -389,13 +389,13 @@ of the output array to be changed. @sa add, addWeighted, scaleAdd, Mat::convertTo */ CV_EXPORTS_W void subtract(InputArray src1, InputArray src2, OutputArray dst, - InputArray mask = noArray(), ElemType ddepth = CV_TYPE_AUTO); + InputArray mask = noArray(), ElemDepth ddepth = CV_DEPTH_AUTO); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) static inline void subtract(InputArray src1, InputArray src2, OutputArray dst, InputArray mask, int ddepth) { - subtract(src1, src2, dst, mask, static_cast(ddepth)); + subtract(src1, src2, dst, mask, static_cast(ddepth)); } #endif // CV_TYPE_COMPATIBLE_API @@ -422,13 +422,13 @@ overflow. Mat::convertTo */ CV_EXPORTS_W void multiply(InputArray src1, InputArray src2, - OutputArray dst, double scale = 1, ElemType ddepth = CV_TYPE_AUTO); + OutputArray dst, double scale = 1, ElemDepth ddepth = CV_DEPTH_AUTO); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) static inline void multiply(InputArray src1, InputArray src2, OutputArray dst, double scale, int ddepth) { - multiply(src1, src2, dst, scale, static_cast(ddepth)); + multiply(src1, src2, dst, scale, static_cast(ddepth)); } #endif // CV_TYPE_COMPATIBLE_API @@ -448,30 +448,30 @@ result of an incorrect sign in the case of overflow. @param src2 second input array of the same size and type as src1. @param scale scalar factor. @param dst output array of the same size and type as src2. -@param ddepth optional depth of the output array; if CV_TYPE_AUTO, dst will have depth src2.depth(), but in +@param ddepth optional depth of the output array; if CV_DEPTH_AUTO, dst will have depth src2.depth(), but in case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth(). @sa multiply, add, subtract */ CV_EXPORTS_W void divide(InputArray src1, InputArray src2, OutputArray dst, - double scale = 1, ElemType ddepth = CV_TYPE_AUTO); + double scale = 1, ElemDepth ddepth = CV_DEPTH_AUTO); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) static inline void divide(InputArray src1, InputArray src2, OutputArray dst, double scale, int ddepth) { - divide(src1, src2, dst, scale, static_cast(ddepth)); + divide(src1, src2, dst, scale, static_cast(ddepth)); } #endif // CV_TYPE_COMPATIBLE_API /** @overload */ CV_EXPORTS_W void divide(double scale, InputArray src2, - OutputArray dst, ElemType ddepth = CV_TYPE_AUTO); + OutputArray dst, ElemDepth ddepth = CV_DEPTH_AUTO); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) static inline void divide(double scale, InputArray src2, OutputArray dst, int ddepth) { - divide(scale, src2, dst, static_cast(ddepth)); + divide(scale, src2, dst, static_cast(ddepth)); } #endif // CV_TYPE_COMPATIBLE_API @@ -518,17 +518,17 @@ result of an incorrect sign in the case of overflow. @param gamma scalar added to each sum. @param dst output array that has the same size and number of channels as the input arrays. @param ddepth optional depth of the output array; when both input arrays have the same depth, ddepth -can be set to CV_TYPE_AUTO, which will be equivalent to src1.depth(). +can be set to CV_DEPTH_AUTO, which will be equivalent to src1.depth(). @sa add, subtract, scaleAdd, Mat::convertTo */ CV_EXPORTS_W void addWeighted(InputArray src1, double alpha, InputArray src2, - double beta, double gamma, OutputArray dst, ElemType ddepth = CV_TYPE_AUTO); + double beta, double gamma, OutputArray dst, ElemDepth ddepth = CV_DEPTH_AUTO); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) static inline void addWeighted(InputArray src1, double alpha, InputArray src2, double beta, double gamma, OutputArray dst, int ddepth) { - addWeighted(src1, alpha, src2, beta, gamma, dst, static_cast(ddepth)); + addWeighted(src1, alpha, src2, beta, gamma, dst, static_cast(ddepth)); } #endif // CV_TYPE_COMPATIBLE_API @@ -754,19 +754,19 @@ see http://en.wikipedia.org/wiki/Nearest_neighbor_search @todo document */ CV_EXPORTS_W void batchDistance(InputArray src1, InputArray src2, - OutputArray dist, ElemType dtype, OutputArray nidx, + OutputArray dist, ElemDepth ddepth, OutputArray nidx, int normType = NORM_L2, int K = 0, InputArray mask = noArray(), int update = 0, bool crosscheck = false); #ifdef CV_TYPE_COMPATIBLE_API -CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, dtype) +CV_DEPRECATED_INT_TO_ELEMDEPTH_ATTR(dtype, ddepth) static inline void batchDistance(InputArray src1, InputArray src2, - OutputArray dist, int dtype, OutputArray nidx, + OutputArray dist, int ddepth, OutputArray nidx, int normType = NORM_L2, int K = 0, InputArray mask = noArray(), int update = 0, bool crosscheck = false) { - batchDistance(src1, src2, dist, static_cast(dtype), nidx, normType, K, mask, update, crosscheck); + batchDistance(src1, src2, dist, static_cast(ddepth), nidx, normType, K, mask, update, crosscheck); } #endif // CV_TYPE_COMPATIBLE_API @@ -824,18 +824,18 @@ normalization. @param beta upper range boundary in case of the range normalization; it is not used for the norm normalization. @param norm_type normalization type (see cv::NormTypes). -@param ddepth desired output matrix depth. when it is CV_TYPE_AUTO, the output array has the same type as src. +@param ddepth desired output matrix depth. when it is CV_DEPTH_AUTO, the output array has the same type as src. @param mask optional operation mask. @sa norm, Mat::convertTo, SparseMat::convertTo */ CV_EXPORTS_W void normalize( InputArray src, InputOutputArray dst, double alpha = 1, double beta = 0, - int norm_type = NORM_L2, ElemType ddepth = CV_TYPE_AUTO, InputArray mask = noArray()); + int norm_type = NORM_L2, ElemDepth ddepth = CV_DEPTH_AUTO, InputArray mask = noArray()); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) static inline void normalize( InputArray src, InputOutputArray dst, double alpha, double beta, int norm_type, int ddepth, InputArray mask = noArray()) { - normalize(src, dst, alpha, beta, norm_type, static_cast(ddepth), mask); + normalize(src, dst, alpha, beta, norm_type, static_cast(ddepth), mask); } #endif // CV_TYPE_COMPATIBLE_API @@ -929,17 +929,17 @@ And the following code demonstrates its usage for a two-channel matrix. @param dim dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row. 1 means that the matrix is reduced to a single column. @param rtype reduction operation that could be one of #ReduceTypes -@param ddepth when it is CV_TYPE_AUTO, the output vector will have the same type as the input matrix, +@param ddepth when it is CV_DEPTH_AUTO, the output vector will have the same type as the input matrix, otherwise, its type will be CV_MAKE_TYPE(ddepth, src.channels()). @sa repeat */ -CV_EXPORTS_W void reduce(InputArray src, OutputArray dst, int dim, int rtype, ElemType ddepth = CV_TYPE_AUTO); +CV_EXPORTS_W void reduce(InputArray src, OutputArray dst, int dim, int rtype, ElemDepth ddepth = CV_DEPTH_AUTO); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) static inline void reduce(InputArray src, OutputArray dst, int dim, int rtype, int ddepth) { - reduce(src, dst, dim, rtype, static_cast(ddepth)); + reduce(src, dst, dim, rtype, static_cast(ddepth)); } #endif // CV_TYPE_COMPATIBLE_API @@ -1726,21 +1726,21 @@ repeat ) to cover the full src and then subtracted. Type of the delta matrix, when it is not empty, must be the same as the type of created output matrix. See the ddepth parameter description below. @param scale Optional scale factor for the matrix product. -@param ddepth Optional depth of the output matrix. When it is CV_TYPE_AUTO, +@param ddepth Optional depth of the output matrix. When it is CV_DEPTH_AUTO, the output matrix will have the same type as src . Otherwise, it should be either CV_32F or CV_64F, and the output type will be CV_MAKE_TYPE(ddepth, src.channels()). @sa calcCovarMatrix, gemm, repeat, reduce */ CV_EXPORTS_W void mulTransposed( InputArray src, OutputArray dst, bool aTa, InputArray delta = noArray(), - double scale = 1, ElemType ddepth = CV_TYPE_AUTO); + double scale = 1, ElemDepth ddepth = CV_DEPTH_AUTO); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) static inline void mulTransposed(InputArray src, OutputArray dst, bool aTa, InputArray delta, double scale, int ddepth) { - mulTransposed(src, dst, aTa, delta, scale, static_cast(ddepth)); + mulTransposed(src, dst, aTa, delta, scale, static_cast(ddepth)); } #endif // CV_TYPE_COMPATIBLE_API @@ -2030,13 +2030,13 @@ the set of input vectors. @todo InputArrayOfArrays */ CV_EXPORTS void calcCovarMatrix( const Mat* samples, int nsamples, Mat& covar, Mat& mean, - int flags, ElemType cdepth = CV_64F); + int flags, ElemDepth cdepth = CV_64F); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(ctype, ctype) static inline void calcCovarMatrix(const Mat* samples, int nsamples, Mat& covar, Mat& mean, int flags, int ctype) { - calcCovarMatrix(samples, nsamples, covar, mean, flags, static_cast(ctype)); + calcCovarMatrix(samples, nsamples, covar, mean, flags, static_cast(ctype)); } #endif // CV_TYPE_COMPATIBLE_API @@ -2049,13 +2049,13 @@ static inline void calcCovarMatrix(const Mat* samples, int nsamples, Mat& covar, @param cdepth depth of the matrixl; it equals 'CV_64F' by default. */ CV_EXPORTS_W void calcCovarMatrix( InputArray samples, OutputArray covar, - InputOutputArray mean, int flags, ElemType cdepth = CV_64F); + InputOutputArray mean, int flags, ElemDepth cdepth = CV_64F); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(ctype, ctype) static inline void calcCovarMatrix(InputArray samples, OutputArray covar, InputOutputArray mean, int flags, int ctype) { - calcCovarMatrix(samples, covar, mean, flags, static_cast(ctype)); + calcCovarMatrix(samples, covar, mean, flags, static_cast(ctype)); } #endif // CV_TYPE_COMPATIBLE_API diff --git a/modules/core/include/opencv2/core/affine.hpp b/modules/core/include/opencv2/core/affine.hpp index 203e191aaf2e..b2fbdc9b4b88 100644 --- a/modules/core/include/opencv2/core/affine.hpp +++ b/modules/core/include/opencv2/core/affine.hpp @@ -304,7 +304,7 @@ namespace cv static const int channels = 16; static const int fmt = traits::SafeFmt::fmt + ((channels - 1) << 8); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif @@ -313,7 +313,7 @@ namespace cv namespace traits { template - struct Depth< Affine3<_Tp> > { static const ElemType value = Depth<_Tp>::value; }; + struct Depth< Affine3<_Tp> > { static const ElemDepth value = Depth<_Tp>::value; }; template struct Type< Affine3<_Tp> > { static const ElemType value = CV_MAKETYPE(Depth<_Tp>::value, 16); }; } // namespace diff --git a/modules/core/include/opencv2/core/base.hpp b/modules/core/include/opencv2/core/base.hpp index 42d08b03d423..4eeee67ee35e 100644 --- a/modules/core/include/opencv2/core/base.hpp +++ b/modules/core/include/opencv2/core/base.hpp @@ -60,9 +60,9 @@ #ifdef CV_TYPE_COMPATIBLE_API #define CV_DEPRECATED_MAX_DEPTH_DEPTH "use `CV_MAX_DEPTH(...)` instead" -#define CV_DEPRECATED_MAX_DEPTH_INT "max() between `ElemType` and `int` is deprecated" +#define CV_DEPRECATED_MAX_DEPTH_INT "max() between `ElemDepth` and `int` is deprecated" #define CV_DEPRECATED_MIN_DEPTH_DEPTH "use `CV_MIN_DEPTH(...)` instead" -#define CV_DEPRECATED_MIN_DEPTH_INT "min() between `ElemType` and `int` is deprecated" +#define CV_DEPRECATED_MIN_DEPTH_INT "min() between `ElemDepth` and `int` is deprecated" #define CV_DEPRECATED_ELEMTYPE_CMP_INT "comparing `ElemType` directly with `int` is deprecated. " #define CV_DEPRECATED_PARAM(depr_type, depr_var, new_type, new_var) \ "parameter `" CV_STR(depr_type) " " CV_STR(depr_var) "` is deprecated. " \ @@ -91,32 +91,32 @@ namespace std { - CV_DEPRECATED_MAX_DEPTH_INT_ATTR static inline int max(const ElemType left, const int right) + CV_DEPRECATED_MAX_DEPTH_INT_ATTR static inline int max(const ElemDepth left, const int right) { return static_cast(CV_MAX_DEPTH(left, right)); } - CV_DEPRECATED_MAX_DEPTH_INT_ATTR static inline int max(const int left, const ElemType right) + CV_DEPRECATED_MAX_DEPTH_INT_ATTR static inline int max(const int left, const ElemDepth right) { return static_cast(CV_MAX_DEPTH(left, right)); } - CV_DEPRECATED_MAX_DEPTH_DEPTH_ATTR static inline int max(const ElemType left, const ElemType right) + CV_DEPRECATED_MAX_DEPTH_DEPTH_ATTR static inline int max(const ElemDepth left, const ElemDepth right) { return static_cast(CV_MAX_DEPTH(left, right)); } - CV_DEPRECATED_MIN_DEPTH_INT_ATTR static inline int min(const ElemType left, const int right) + CV_DEPRECATED_MIN_DEPTH_INT_ATTR static inline int min(const ElemDepth left, const int right) { return static_cast(CV_MIN_DEPTH(left, right)); } - CV_DEPRECATED_MIN_DEPTH_INT_ATTR static inline int min(const int left, const ElemType right) + CV_DEPRECATED_MIN_DEPTH_INT_ATTR static inline int min(const int left, const ElemDepth right) { return static_cast(CV_MIN_DEPTH(left, right)); } - CV_DEPRECATED_MIN_DEPTH_DEPTH_ATTR static inline int min(const ElemType left, const ElemType right) + CV_DEPRECATED_MIN_DEPTH_DEPTH_ATTR static inline int min(const ElemDepth left, const ElemDepth right) { return static_cast(CV_MIN_DEPTH(left, right)); } diff --git a/modules/core/include/opencv2/core/check.hpp b/modules/core/include/opencv2/core/check.hpp index 9a8d495db201..451ca21e4051 100644 --- a/modules/core/include/opencv2/core/check.hpp +++ b/modules/core/include/opencv2/core/check.hpp @@ -10,11 +10,11 @@ namespace cv { /** Returns string of cv::Mat depth value: CV_8U -> "CV_8U" or "" */ -CV_EXPORTS const char* depthToString(ElemType depth); +CV_EXPORTS const char* depthToString(ElemDepth depth); #ifdef CV_TRANSNATIONAL_API static inline const char* depthToString(int depth) { - return depthToString(static_cast(depth)); + return depthToString(static_cast(depth)); } #endif // CV_TRANSNATIONAL_API @@ -32,11 +32,11 @@ static inline const String typeToString(int type) namespace detail { /** Returns string of cv::Mat depth value: CV_8U -> "CV_8U" or NULL */ -CV_EXPORTS const char* depthToString_(ElemType depth); +CV_EXPORTS const char* depthToString_(ElemDepth depth); #ifdef CV_TRANSNATIONAL_API static inline const char* depthToString_(int depth) { - return depthToString_(static_cast(depth)); + return depthToString_(static_cast(depth)); } #endif // CV_TRANSNATIONAL_API @@ -93,11 +93,11 @@ CV_EXPORTS void CV_NORETURN check_failed_auto(const int v1, const int v2, const CV_EXPORTS void CV_NORETURN check_failed_auto(const size_t v1, const size_t v2, const CheckContext& ctx); CV_EXPORTS void CV_NORETURN check_failed_auto(const float v1, const float v2, const CheckContext& ctx); CV_EXPORTS void CV_NORETURN check_failed_auto(const double v1, const double v2, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_MatDepth(const ElemType v1, const ElemType v2, const CheckContext& ctx); +CV_EXPORTS void CV_NORETURN check_failed_MatDepth(const ElemDepth v1, const ElemDepth v2, const CheckContext& ctx); #ifdef CV_TRANSNATIONAL_API static inline void CV_NORETURN check_failed_MatDepth(const int v1, const int v2, const CheckContext& ctx) { - check_failed_MatDepth(static_cast(v1), static_cast(v2), ctx); + check_failed_MatDepth(static_cast(v1), static_cast(v2), ctx); } #endif // CV_TRANSNATIONAL_API CV_EXPORTS void CV_NORETURN check_failed_MatType(const ElemType v1, const ElemType v2, const CheckContext& ctx); @@ -113,11 +113,11 @@ CV_EXPORTS void CV_NORETURN check_failed_auto(const int v, const CheckContext& c CV_EXPORTS void CV_NORETURN check_failed_auto(const size_t v, const CheckContext& ctx); CV_EXPORTS void CV_NORETURN check_failed_auto(const float v, const CheckContext& ctx); CV_EXPORTS void CV_NORETURN check_failed_auto(const double v, const CheckContext& ctx); -CV_EXPORTS void CV_NORETURN check_failed_MatDepth(const ElemType v, const CheckContext& ctx); +CV_EXPORTS void CV_NORETURN check_failed_MatDepth(const ElemDepth v, const CheckContext& ctx); #ifdef CV_TRANSNATIONAL_API static inline void CV_NORETURN check_failed_MatDepth(const int v, const CheckContext& ctx) { - check_failed_MatDepth(static_cast(v), ctx); + check_failed_MatDepth(static_cast(v), ctx); } #endif // CV_TRANSNATIONAL_API CV_EXPORTS void CV_NORETURN check_failed_MatType(const ElemType v, const CheckContext& ctx); diff --git a/modules/core/include/opencv2/core/cuda.hpp b/modules/core/include/opencv2/core/cuda.hpp index 34e8a8438f9b..326171dce5ef 100644 --- a/modules/core/include/opencv2/core/cuda.hpp +++ b/modules/core/include/opencv2/core/cuda.hpp @@ -278,62 +278,62 @@ class CV_EXPORTS_W GpuMat CV_WRAP GpuMat& setTo(Scalar s, InputArray mask, Stream& stream); //! converts GpuMat to another datatype (Blocking call) - CV_WRAP void convertTo(OutputArray dst, ElemType ddepth) const; + CV_WRAP void convertTo(OutputArray dst, ElemDepth ddepth) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) inline void convertTo(OutputArray dst, int ddepth) const { - convertTo(dst, static_cast(ddepth)); + convertTo(dst, static_cast(ddepth)); } #endif // CV_TYPE_COMPATIBLE_API //! converts GpuMat to another datatype (Non-Blocking call) - CV_WRAP void convertTo(OutputArray dst, ElemType ddepth, Stream& stream) const; + CV_WRAP void convertTo(OutputArray dst, ElemDepth ddepth, Stream& stream) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) inline void convertTo(OutputArray dst, int ddepth, Stream& stream) const { - convertTo(dst, static_cast(ddepth), stream); + convertTo(dst, static_cast(ddepth), stream); } #endif // CV_TYPE_COMPATIBLE_API //! converts GpuMat to another datatype with scaling (Blocking call) - CV_WRAP void convertTo(OutputArray dst, ElemType ddepth, double alpha, double beta = 0.0) const; + CV_WRAP void convertTo(OutputArray dst, ElemDepth ddepth, double alpha, double beta = 0.0) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) inline void convertTo(OutputArray dst, int ddepth, double alpha, double beta = 0.0) const { - convertTo(dst, static_cast(ddepth), alpha, beta ); + convertTo(dst, static_cast(ddepth), alpha, beta ); } #endif // CV_TYPE_COMPATIBLE_API //! converts GpuMat to another datatype with scaling (Non-Blocking call) - CV_WRAP void convertTo(OutputArray dst, ElemType ddepth, double alpha, Stream& stream) const; + CV_WRAP void convertTo(OutputArray dst, ElemDepth ddepth, double alpha, Stream& stream) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) inline void convertTo(OutputArray dst, int ddepth, double alpha, Stream& stream) const { - convertTo(dst, static_cast(ddepth), alpha, stream); + convertTo(dst, static_cast(ddepth), alpha, stream); } #endif // CV_TYPE_COMPATIBLE_API //! converts GpuMat to another datatype with scaling (Non-Blocking call) - CV_WRAP void convertTo(OutputArray dst, ElemType ddepth, double alpha, double beta, Stream& stream) const; + CV_WRAP void convertTo(OutputArray dst, ElemDepth ddepth, double alpha, double beta, Stream& stream) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) inline void convertTo(OutputArray dst, int ddepth, double alpha, double beta, Stream& stream) const { - convertTo(dst, static_cast(ddepth), alpha, beta, stream); + convertTo(dst, static_cast(ddepth), alpha, beta, stream); } #endif // CV_TYPE_COMPATIBLE_API - CV_WRAP void assignTo(GpuMat& m, ElemType depth = CV_TYPE_AUTO) const; + CV_WRAP void assignTo(GpuMat& m, ElemDepth depth = CV_DEPTH_AUTO) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(type, depth) inline void assignTo(GpuMat& m, int _depth) const { - assignTo(m, static_cast(_depth) ); + assignTo(m, static_cast(_depth) ); } #endif // CV_TYPE_COMPATIBLE_API @@ -390,7 +390,7 @@ class CV_EXPORTS_W GpuMat CV_WRAP ElemType type() const; //! returns element type - CV_WRAP ElemType depth() const; + CV_WRAP ElemDepth depth() const; //! returns number of channels CV_WRAP int channels() const; @@ -731,7 +731,7 @@ class CV_EXPORTS_W HostMem CV_WRAP size_t elemSize() const; CV_WRAP size_t elemSize1() const; CV_WRAP ElemType type() const; - CV_WRAP ElemType depth() const; + CV_WRAP ElemDepth depth() const; CV_WRAP int channels() const; CV_WRAP size_t step1() const; CV_WRAP Size size() const; diff --git a/modules/core/include/opencv2/core/cuda.inl.hpp b/modules/core/include/opencv2/core/cuda.inl.hpp index 263db8b88682..04a219300cc2 100644 --- a/modules/core/include/opencv2/core/cuda.inl.hpp +++ b/modules/core/include/opencv2/core/cuda.inl.hpp @@ -177,27 +177,27 @@ GpuMat& GpuMat::setTo(Scalar s, InputArray mask) } inline -void GpuMat::convertTo(OutputArray dst, ElemType ddepth) const +void GpuMat::convertTo(OutputArray dst, ElemDepth ddepth) const { convertTo(dst, ddepth, Stream::Null()); } inline -void GpuMat::convertTo(OutputArray dst, ElemType ddepth, double alpha, double beta) const +void GpuMat::convertTo(OutputArray dst, ElemDepth ddepth, double alpha, double beta) const { convertTo(dst, ddepth, alpha, beta, Stream::Null()); } inline -void GpuMat::convertTo(OutputArray dst, ElemType ddepth, double alpha, Stream& stream) const +void GpuMat::convertTo(OutputArray dst, ElemDepth ddepth, double alpha, Stream& stream) const { convertTo(dst, ddepth, alpha, 0.0, stream); } inline -void GpuMat::assignTo(GpuMat& m, ElemType _depth) const +void GpuMat::assignTo(GpuMat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) m = *this; else convertTo(m, _depth); @@ -314,7 +314,7 @@ ElemType GpuMat::type() const } inline -ElemType GpuMat::depth() const +ElemDepth GpuMat::depth() const { return CV_MAT_DEPTH(flags); } @@ -527,7 +527,7 @@ ElemType HostMem::type() const } inline -ElemType HostMem::depth() const +ElemDepth HostMem::depth() const { return CV_MAT_DEPTH(flags); } diff --git a/modules/core/include/opencv2/core/cvstd.inl.hpp b/modules/core/include/opencv2/core/cvstd.inl.hpp index f293ce2772d6..8b3c3ddac5fa 100644 --- a/modules/core/include/opencv2/core/cvstd.inl.hpp +++ b/modules/core/include/opencv2/core/cvstd.inl.hpp @@ -65,7 +65,7 @@ template class DataType< std::complex<_Tp> > typedef _Tp channel_type; static const bool generic_type = false; - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const int channels = 2; static const int fmt = DataType::fmt + ((channels - 1) << 8); static const ElemType type = CV_MAKETYPE(depth, channels); diff --git a/modules/core/include/opencv2/core/eigen.hpp b/modules/core/include/opencv2/core/eigen.hpp index c8603aca9731..8be03c60dc5b 100644 --- a/modules/core/include/opencv2/core/eigen.hpp +++ b/modules/core/include/opencv2/core/eigen.hpp @@ -104,17 +104,17 @@ void cv2eigen( const Mat& src, transpose(src, _dst); else if( src.cols == src.rows ) { - src.convertTo(_dst, _dst.type()); + src.convertTo(_dst, _dst.depth()); transpose(_dst, _dst); } else - Mat(src.t()).convertTo(_dst, _dst.type()); + Mat(src.t()).convertTo(_dst, _dst.depth()); } else { const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value, dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - src.convertTo(_dst, _dst.type()); + src.convertTo(_dst, _dst.depth()); } } @@ -150,17 +150,17 @@ void cv2eigen( const Mat& src, transpose(src, _dst); else if( src.cols == src.rows ) { - src.convertTo(_dst, _dst.type()); + src.convertTo(_dst, _dst.depth()); transpose(_dst, _dst); } else - Mat(src.t()).convertTo(_dst, _dst.type()); + Mat(src.t()).convertTo(_dst, _dst.depth()); } else { const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value, dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - src.convertTo(_dst, _dst.type()); + src.convertTo(_dst, _dst.depth()); } } @@ -198,13 +198,13 @@ void cv2eigen( const Mat& src, if( src.type() == _dst.type() ) transpose(src, _dst); else - Mat(src.t()).convertTo(_dst, _dst.type()); + Mat(src.t()).convertTo(_dst, _dst.depth()); } else { const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value, dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - src.convertTo(_dst, _dst.type()); + src.convertTo(_dst, _dst.depth()); } } @@ -243,13 +243,13 @@ void cv2eigen( const Mat& src, if( src.type() == _dst.type() ) transpose(src, _dst); else - Mat(src.t()).convertTo(_dst, _dst.type()); + Mat(src.t()).convertTo(_dst, _dst.depth()); } else { const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value, dst.data(), (size_t)(dst.outerStride()*sizeof(_Tp))); - src.convertTo(_dst, _dst.type()); + src.convertTo(_dst, _dst.depth()); } } diff --git a/modules/core/include/opencv2/core/hal/hal.hpp b/modules/core/include/opencv2/core/hal/hal.hpp index 6abc7307332b..eb175fb601bb 100644 --- a/modules/core/include/opencv2/core/hal/hal.hpp +++ b/modules/core/include/opencv2/core/hal/hal.hpp @@ -203,11 +203,11 @@ CV_EXPORTS void addRNGBias64f( double* arr, const double* scaleBiasPairs, int le struct CV_EXPORTS DFT1D { - static Ptr create(int len, int count, ElemType depth, int flags, bool * useBuffer = 0); + static Ptr create(int len, int count, ElemDepth depth, int flags, bool * useBuffer = 0); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(type, depth) static inline Ptr create(int len, int count, int depth, int flags, bool * useBuffer = 0) - { return create(len, count, static_cast(depth), flags, useBuffer); + { return create(len, count, static_cast(depth), flags, useBuffer); } #endif // CV_TYPE_COMPATIBLE_API virtual void apply(const uchar *src, uchar *dst) = 0; @@ -216,7 +216,7 @@ struct CV_EXPORTS DFT1D struct CV_EXPORTS DFT2D { - static Ptr create(int width, int height, ElemType depth, + static Ptr create(int width, int height, ElemDepth depth, int src_channels, int dst_channels, int flags, int nonzero_rows = 0); #ifdef CV_TYPE_COMPATIBLE_API @@ -224,7 +224,7 @@ struct CV_EXPORTS DFT2D static inline Ptr create(int width, int height, int depth, int src_channels, int dst_channels, int flags, int nonzero_rows = 0) - { return create(width, height, static_cast(depth), src_channels, dst_channels, flags, nonzero_rows); + { return create(width, height, static_cast(depth), src_channels, dst_channels, flags, nonzero_rows); } #endif // CV_TYPE_COMPATIBLE_API virtual void apply(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step) = 0; @@ -233,11 +233,11 @@ struct CV_EXPORTS DFT2D struct CV_EXPORTS DCT2D { - static Ptr create(int width, int height, ElemType depth, int flags); + static Ptr create(int width, int height, ElemDepth depth, int flags); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(type, depth) static inline Ptr create(int width, int height, int depth, int flags) - { return create(width, height, static_cast(depth), flags); + { return create(width, height, static_cast(depth), flags); } #endif // CV_TYPE_COMPATIBLE_API virtual void apply(const uchar *src_data, size_t src_step, uchar *dst_data, size_t dst_step) = 0; diff --git a/modules/core/include/opencv2/core/hal/interface.h b/modules/core/include/opencv2/core/hal/interface.h index 3c6a9d8fd030..07ffa227c038 100644 --- a/modules/core/include/opencv2/core/hal/interface.h +++ b/modules/core/include/opencv2/core/hal/interface.h @@ -69,14 +69,14 @@ typedef signed char schar; #define __CV_MAX_DEPTH_2(d1, d2) __CV_MAX_DEPTH_1(static_cast(d1), static_cast(d2)) #define __CV_MAX_DEPTH_3(d, ...) __CV_EXPAND(__CV_MAX_DEPTH_2(d, __CV_MAX_DEPTH_2(__VA_ARGS__))) #define __CV_MAX_DEPTH_4(d, ...) __CV_EXPAND(__CV_MAX_DEPTH_2(d, __CV_MAX_DEPTH_3(__VA_ARGS__))) -#define CV_MAX_DEPTH(...) __CV_EXPAND(static_cast(__CV_CAT(__CV_MAX_DEPTH_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__))) +#define CV_MAX_DEPTH(...) __CV_EXPAND(static_cast(__CV_CAT(__CV_MAX_DEPTH_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__))) #define __CV_MIN_DEPTH_0(m, n) (m == 7 && n >= 4 ? m : n) /* CV_16F workaround */ #define __CV_MIN_DEPTH_1(d1, d2) __CV_MIN_DEPTH_0(std::max(d1, d2), std::min(d1, d2)) #define __CV_MIN_DEPTH_2(d1, d2) __CV_MIN_DEPTH_1(static_cast(d1), static_cast(d2)) #define __CV_MIN_DEPTH_3(d, ...) __CV_EXPAND(__CV_MIN_DEPTH_2(d, __CV_MIN_DEPTH_2(__VA_ARGS__))) #define __CV_MIN_DEPTH_4(d, ...) __CV_EXPAND(__CV_MIN_DEPTH_2(d, __CV_MIN_DEPTH_3(__VA_ARGS__))) -#define CV_MIN_DEPTH(...) __CV_EXPAND(static_cast(__CV_CAT(__CV_MIN_DEPTH_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__))) +#define CV_MIN_DEPTH(...) __CV_EXPAND(static_cast(__CV_CAT(__CV_MIN_DEPTH_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__))) #define CV_CN_MAX 512 #define CV_CN_SHIFT 3 @@ -84,7 +84,7 @@ typedef signed char schar; #define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1) #define __CV_MAT_DEPTH(flags) (static_cast(flags) & CV_MAT_DEPTH_MASK) -#define CV_MAT_DEPTH(flags) static_cast(__CV_MAT_DEPTH(flags)) +#define CV_MAT_DEPTH(flags) static_cast(__CV_MAT_DEPTH(flags)) #define __CV_MAKETYPE(depth,cn) (__CV_MAT_DEPTH(depth) | (((cn)-1) << CV_CN_SHIFT)) #define CV_MAKETYPE(depth,cn) static_cast(__CV_MAKETYPE(depth,cn)) #define CV_MAKE_TYPE CV_MAKETYPE @@ -114,7 +114,7 @@ enum MagicFlag { CV_MAGIC_FLAG_NONE = 0 }; -enum ElemType { +enum ElemDepth { CV_8U = 0, CV_8S = 1, CV_16U = 2, @@ -123,6 +123,11 @@ enum ElemType { CV_32S = 4, CV_32F = 5, CV_64F = 6, +}; +#define CV_DEPTH_AUTO static_cast(-1) + +enum ElemType { + CV_SEQ_ELTYPE_PTR = __CV_MAKETYPE(CV_8U, 8 /*sizeof(void*)*/), CV_8UC1 = __CV_MAKETYPE(CV_8U, 1), CV_8UC2 = __CV_MAKETYPE(CV_8U, 2), @@ -163,8 +168,6 @@ enum ElemType { CV_64FC2 = __CV_MAKETYPE(CV_64F, 2), CV_64FC3 = __CV_MAKETYPE(CV_64F, 3), CV_64FC4 = __CV_MAKETYPE(CV_64F, 4), - - CV_SEQ_ELTYPE_PTR = __CV_MAKETYPE(CV_8U, 8 /*sizeof(void*)*/), }; #define CV_TYPE_AUTO static_cast(-1) #define CV_TYPE_UNDEFINED static_cast(-2) @@ -175,8 +178,8 @@ enum ElemType { typedef int MagicFlag; #define CV_MAGIC_FLAG_NONE 0 -typedef int ElemType; -#define CV_TYPE_AUTO -1 +typedef int ElemDepth; +#define CV_DEPTH_AUTO -1 #define CV_8U 0 #define CV_8S 1 #define CV_16U 2 diff --git a/modules/core/include/opencv2/core/mat.hpp b/modules/core/include/opencv2/core/mat.hpp index ef19db46c413..25908b1355c1 100644 --- a/modules/core/include/opencv2/core/mat.hpp +++ b/modules/core/include/opencv2/core/mat.hpp @@ -251,7 +251,7 @@ class CV_EXPORTS _InputArray bool sameSize(const _InputArray& arr) const; size_t total(int i=-1) const; ElemType type(int i = -1) const; - ElemType depth(int i = -1) const; + ElemDepth depth(int i = -1) const; int channels(int i=-1) const; bool isContinuous(int i=-1) const; bool isSubmatrix(int i=-1) const; @@ -1372,12 +1372,12 @@ class CV_EXPORTS Mat @param alpha optional scale factor. @param beta optional delta added to the scaled values. */ - void convertTo(OutputArray m, ElemType ddepth, double alpha = 1, double beta = 0) const; + void convertTo(OutputArray m, ElemDepth ddepth, double alpha = 1, double beta = 0) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) inline void convertTo(OutputArray m, int ddepth, double alpha = 1, double beta = 0) const { - convertTo(m, static_cast(ddepth), alpha, beta); + convertTo(m, static_cast(ddepth), alpha, beta); } #endif // CV_TYPE_COMPATIBLE_API @@ -1385,15 +1385,15 @@ class CV_EXPORTS Mat This is an internally used method called by the @ref MatrixExpressions engine. @param m Destination array. - @param depth Desired destination array depth (or CV_TYPE_AUTO if it should be the same as the source type). + @param depth Desired destination array depth (or CV_DEPTH_AUTO if it should be the same as the source type). */ - void assignTo(Mat& m, ElemType depth = CV_TYPE_AUTO) const; + void assignTo(Mat& m, ElemDepth depth = CV_DEPTH_AUTO) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(type, depth) inline void assignTo(Mat& m, int _depth) const { - assignTo(m, static_cast(_depth)); + assignTo(m, static_cast(_depth)); } #endif // CV_TYPE_COMPATIBLE_API @@ -1987,7 +1987,7 @@ class CV_EXPORTS Mat - CV_32F - 32-bit floating-point numbers ( -FLT_MAX..FLT_MAX, INF, NAN ) - CV_64F - 64-bit floating-point numbers ( -DBL_MAX..DBL_MAX, INF, NAN ) */ - ElemType depth() const; + ElemDepth depth() const; /** @brief Returns the number of matrix channels. @@ -2031,7 +2031,7 @@ class CV_EXPORTS Mat * if the number of planes is not one, then the number of rows * within every plane has to be 1; if the number of rows within * every plane is not 1, then the number of planes has to be 1. - * @param depth The depth the matrix should have. Set it to CV_TYPE_AUTO when any depth is fine. + * @param depth The depth the matrix should have. Set it to CV_DEPTH_AUTO when any depth is fine. * @param requireContinuous Set it to true to require the matrix to be continuous * @return -1 if the requirement is not satisfied. * Otherwise, it returns the number of elements in the matrix. Note @@ -2044,12 +2044,12 @@ class CV_EXPORTS Mat * @snippet snippets/core_mat_checkVector.cpp example-3d */ - int checkVector(int elemChannels, ElemType depth = CV_TYPE_AUTO, bool requireContinuous = true) const; + int checkVector(int elemChannels, ElemDepth depth = CV_DEPTH_AUTO, bool requireContinuous = true) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(type, depth) inline int checkVector(int elemChannels, int _depth, bool requireContinuous = true) const { - return checkVector(elemChannels, static_cast(_depth), requireContinuous); + return checkVector(elemChannels, static_cast(_depth), requireContinuous); } #endif // CV_TYPE_COMPATIBLE_API @@ -2512,7 +2512,7 @@ template class Mat_ : public Mat size_t elemSize() const; size_t elemSize1() const; ElemType type() const; - ElemType depth() const; + ElemDepth depth() const; int channels() const; size_t step1(int i=0) const; //! returns step()/sizeof(_Tp) @@ -2730,22 +2730,22 @@ class CV_EXPORTS UMat //! copies those matrix elements to "m" that are marked with non-zero mask elements. void copyTo( OutputArray m, InputArray mask ) const; //! converts matrix to another datatype with optional scaling. See cvConvertScale. - void convertTo(OutputArray m, ElemType ddepth, double alpha = 1, double beta = 0) const; + void convertTo(OutputArray m, ElemDepth ddepth, double alpha = 1, double beta = 0) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) inline void convertTo(OutputArray m, int ddepth, double alpha = 1, double beta = 0) const { - convertTo(m, static_cast(ddepth), alpha, beta); + convertTo(m, static_cast(ddepth), alpha, beta); } #endif // CV_TYPE_COMPATIBLE_API - void assignTo(UMat& m, ElemType depth = CV_TYPE_AUTO) const; + void assignTo(UMat& m, ElemDepth depth = CV_DEPTH_AUTO) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(type, depth) inline void assignTo(UMat& m, int _depth) const { - assignTo(m, static_cast(_depth)); + assignTo(m, static_cast(_depth)); } #endif // CV_TYPE_COMPATIBLE_API @@ -2907,7 +2907,7 @@ class CV_EXPORTS UMat //! returns element type, similar to CV_MAT_TYPE(cvmat->type) ElemType type() const; //! returns element type, similar to CV_MAT_DEPTH(cvmat->type) - ElemType depth() const; + ElemDepth depth() const; //! returns element type, similar to CV_MAT_CN(cvmat->type) int channels() const; //! returns step/elemSize1() @@ -2919,12 +2919,12 @@ class CV_EXPORTS UMat //! returns N if the matrix is 1-channel (N x ptdim) or ptdim-channel (1 x N) or (N x 1); negative number otherwise - int checkVector(int elemChannels, ElemType depth = CV_TYPE_AUTO, bool requireContinuous = true) const; + int checkVector(int elemChannels, ElemDepth depth = CV_DEPTH_AUTO, bool requireContinuous = true) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(type, depth) inline int checkVector(int elemChannels, int _depth, bool requireContinuous = true) const { - return checkVector(elemChannels, static_cast(_depth), requireContinuous ); + return checkVector(elemChannels, static_cast(_depth), requireContinuous ); } #endif // CV_TYPE_COMPATIBLE_API @@ -3159,12 +3159,12 @@ class CV_EXPORTS SparseMat //! converts sparse matrix to dense matrix. void copyTo( Mat& m ) const; //! multiplies all the matrix elements by the specified scale factor alpha and converts the results to the specified data type - void convertTo(SparseMat& m, ElemType ddepth, double alpha = 1) const; + void convertTo(SparseMat& m, ElemDepth ddepth, double alpha = 1) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) inline void convertTo(SparseMat& m, int ddepth, double alpha = 1) const { - convertTo(m, static_cast(ddepth), alpha ); + convertTo(m, static_cast(ddepth), alpha ); } #endif // CV_TYPE_COMPATIBLE_API //! converts sparse matrix to dense n-dim matrix with optional type conversion and scaling. @@ -3175,23 +3175,23 @@ class CV_EXPORTS SparseMat @param [in] alpha - optional scale factor @param [in] beta - optional delta added to the scaled values */ - void convertTo(Mat& m, ElemType ddepth, double alpha = 1, double beta = 0) const; + void convertTo(Mat& m, ElemDepth ddepth, double alpha = 1, double beta = 0) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) inline void convertTo(Mat& m, int ddepth, double alpha = 1, double beta = 0) const { - convertTo(m, static_cast(ddepth), alpha, beta ); + convertTo(m, static_cast(ddepth), alpha, beta ); } #endif // CV_TYPE_COMPATIBLE_API // not used now - void assignTo(SparseMat& m, ElemType depth = CV_TYPE_AUTO) const; + void assignTo(SparseMat& m, ElemDepth depth = CV_DEPTH_AUTO) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(type, depth) inline void assignTo(SparseMat& m, int _depth) const { - assignTo(m, static_cast(_depth) ); + assignTo(m, static_cast(_depth) ); } #endif // CV_TYPE_COMPATIBLE_API @@ -3226,7 +3226,7 @@ class CV_EXPORTS SparseMat //! returns type of sparse matrix elements ElemType type() const; //! returns the depth of sparse matrix elements - ElemType depth() const; + ElemDepth depth() const; //! returns the number of channels int channels() const; @@ -3426,7 +3426,7 @@ template class SparseMat_ : public SparseMat //! returns type of the matrix elements ElemType type() const; //! returns depth of the matrix elements - ElemType depth() const; + ElemDepth depth() const; //! returns the number of channels in each matrix element int channels() const; @@ -3885,12 +3885,12 @@ class CV_EXPORTS MatOp virtual bool elementWise(const MatExpr& expr) const; - virtual void assign(const MatExpr& expr, Mat& m, ElemType depth = CV_TYPE_AUTO) const = 0; + virtual void assign(const MatExpr& expr, Mat& m, ElemDepth depth = CV_DEPTH_AUTO) const = 0; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(type, depth) inline virtual void assign(const MatExpr& expr, Mat& m, int _depth) const { - assign(expr, m, static_cast(_depth)); + assign(expr, m, static_cast(_depth)); } #endif // CV_TYPE_COMPATIBLE_API virtual void roi(const MatExpr& expr, const Range& rowRange, diff --git a/modules/core/include/opencv2/core/mat.inl.hpp b/modules/core/include/opencv2/core/mat.inl.hpp index bb800ddce4b5..5ece6f5ffef2 100644 --- a/modules/core/include/opencv2/core/mat.inl.hpp +++ b/modules/core/include/opencv2/core/mat.inl.hpp @@ -813,9 +813,9 @@ Mat Mat::clone() const } inline -void Mat::assignTo(Mat& m, ElemType _depth) const +void Mat::assignTo(Mat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) m = *this; else convertTo(m, _depth); @@ -922,7 +922,7 @@ ElemType Mat::type() const } inline -ElemType Mat::depth() const +ElemDepth Mat::depth() const { return CV_MAT_DEPTH(flags); } @@ -1320,7 +1320,7 @@ Mat::operator Vec<_Tp, n>() const return Vec<_Tp, n>((_Tp*)data); Vec<_Tp, n> v; Mat tmp(rows, cols, traits::Type<_Tp>::value, v.val); - convertTo(tmp, tmp.type()); + convertTo(tmp, tmp.depth()); return v; } @@ -1333,7 +1333,7 @@ Mat::operator Matx<_Tp, m, n>() const return Matx<_Tp, m, n>((_Tp*)data); Matx<_Tp, m, n> mtx; Mat tmp(rows, cols, traits::Type<_Tp>::value, mtx.val); - convertTo(tmp, tmp.type()); + convertTo(tmp, tmp.depth()); return mtx; } @@ -1709,7 +1709,7 @@ Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat& m) return (*this = m.reshape(DataType<_Tp>::channels, m.dims, 0)); } CV_Assert(DataType<_Tp>::channels == m.channels() || m.empty()); - m.convertTo(*this, type()); + m.convertTo(*this, depth()); return *this; } @@ -1813,7 +1813,7 @@ ElemType Mat_<_Tp>::type() const } template inline -ElemType Mat_<_Tp>::depth() const +ElemDepth Mat_<_Tp>::depth() const { CV_DbgAssert( Mat::depth() == traits::Depth<_Tp>::value ); return traits::Depth<_Tp>::value; @@ -2087,7 +2087,7 @@ Mat_<_Tp>& Mat_<_Tp>::operator = (Mat&& m) return *this; } CV_DbgAssert(DataType<_Tp>::channels == m.channels()); - m.convertTo(*this, type()); + m.convertTo(*this, depth()); return *this; } @@ -2156,9 +2156,9 @@ SparseMat SparseMat::clone() const } inline -void SparseMat::assignTo(SparseMat& m, ElemType _depth) const +void SparseMat::assignTo(SparseMat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) m = *this; else convertTo(m, _depth); @@ -2198,7 +2198,7 @@ ElemType SparseMat::type() const } inline -ElemType SparseMat::depth() const +ElemDepth SparseMat::depth() const { return CV_MAT_DEPTH(flags); } @@ -2513,7 +2513,7 @@ ElemType SparseMat_<_Tp>::type() const } template inline -ElemType SparseMat_<_Tp>::depth() const +ElemDepth SparseMat_<_Tp>::depth() const { return traits::Depth<_Tp>::value; } @@ -3740,9 +3740,9 @@ UMat UMat::clone() const } inline -void UMat::assignTo(UMat& m, ElemType _depth) const +void UMat::assignTo(UMat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) m = *this; else convertTo(m, _depth); @@ -3837,7 +3837,7 @@ ElemType UMat::type() const } inline -ElemType UMat::depth() const +ElemDepth UMat::depth() const { return CV_MAT_DEPTH(flags); } diff --git a/modules/core/include/opencv2/core/matx.hpp b/modules/core/include/opencv2/core/matx.hpp index 3fcd73b17436..863a798c2c45 100644 --- a/modules/core/include/opencv2/core/matx.hpp +++ b/modules/core/include/opencv2/core/matx.hpp @@ -104,7 +104,7 @@ template class Matx static const int channels = rows*cols; static const int shortdim = (m < n ? m : n); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = traits::Depth<_Tp>::value; + static const ElemDepth depth = traits::Depth<_Tp>::value; static const ElemType type = CV_MAKETYPE(depth, channels); #endif @@ -260,14 +260,14 @@ template class DataType< Matx<_Tp, m, n> > static const int channels = m * n; static const int fmt = traits::SafeFmt::fmt + ((channels - 1) << 8); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif }; namespace traits { template -struct Depth< Matx<_Tp, m, n> > { static const ElemType value = Depth<_Tp>::value; }; +struct Depth< Matx<_Tp, m, n> > { static const ElemDepth value = Depth<_Tp>::value; }; template struct Type< Matx<_Tp, m, n> > { static const ElemType value = CV_MAKETYPE(Depth<_Tp>::value, n*m); }; } // namespace @@ -332,7 +332,7 @@ template class Vec : public Matx<_Tp, cn, 1> typedef _Tp value_type; static const int channels = cn; #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = Matx<_Tp, cn, 1>::depth; + static const ElemDepth depth = Matx<_Tp, cn, 1>::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif @@ -431,14 +431,14 @@ template class DataType< Vec<_Tp, cn> > static const int channels = cn; static const int fmt = DataType::fmt + ((channels - 1) << 8); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif }; namespace traits { template -struct Depth< Vec<_Tp, cn> > { static const ElemType value = Depth<_Tp>::value; }; +struct Depth< Vec<_Tp, cn> > { static const ElemDepth value = Depth<_Tp>::value; }; template struct Type< Vec<_Tp, cn> > { static const ElemType value = CV_MAKETYPE(Depth<_Tp>::value, cn); }; } // namespace diff --git a/modules/core/include/opencv2/core/ocl.hpp b/modules/core/include/opencv2/core/ocl.hpp index f970ebe8ca7b..60d3e52cc3d0 100644 --- a/modules/core/include/opencv2/core/ocl.hpp +++ b/modules/core/include/opencv2/core/ocl.hpp @@ -735,14 +735,14 @@ class CV_EXPORTS PlatformInfo Impl* p; }; -CV_EXPORTS const char* convertTypeStr(ElemType sdepth, ElemType ddepth, int cn, char* buf); +CV_EXPORTS const char* convertTypeStr(ElemDepth sdepth, ElemDepth ddepth, int cn, char* buf); #ifdef CV_TYPE_COMPATIBLE_API # ifndef OPENCV_DISABLE_DEPRECATED_WARNING_INT_ELEMTYPE_OVERLOAD -CV_DEPRECATED_MSG(CV_DEPRECATED_PARAM(int, stype, ElemType, sdepth) ". Similarly, " CV_DEPRECATED_PARAM(int, dtype, ElemType, ddepth)) +CV_DEPRECATED_MSG(CV_DEPRECATED_PARAM(int, stype, ElemDepth, sdepth) ". Similarly, " CV_DEPRECATED_PARAM(int, dtype, ElemDepth, ddepth)) # endif static inline const char* convertTypeStr(int sdepth, int ddepth, int cn, char* buf) { - return convertTypeStr(static_cast(sdepth), static_cast(ddepth), cn, buf); + return convertTypeStr(static_cast(sdepth), static_cast(ddepth), cn, buf); } #endif // CV_TYPE_COMPATIBLE_API CV_EXPORTS const char* typeToStr(int t); @@ -750,12 +750,12 @@ CV_EXPORTS const char* memopTypeToStr(int t); CV_EXPORTS const char* vecopTypeToStr(int t); CV_EXPORTS const char* getOpenCLErrorString(int errorCode); -CV_EXPORTS String kernelToStr(InputArray _kernel, ElemType ddepth = CV_TYPE_AUTO, const char * name = NULL); +CV_EXPORTS String kernelToStr(InputArray _kernel, ElemDepth ddepth = CV_DEPTH_AUTO, const char * name = NULL); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) static inline String kernelToStr(InputArray _kernel, int ddepth, const char * name = NULL) { - return kernelToStr(_kernel, static_cast(ddepth), name); + return kernelToStr(_kernel, static_cast(ddepth), name); } #endif // CV_TYPE_COMPATIBLE_API CV_EXPORTS void getPlatfomsInfo(std::vector& platform_info); @@ -815,12 +815,12 @@ class CV_EXPORTS Image2D /** Indicates if the image format is supported. */ - static bool isFormatSupported(ElemType depth, int cn, bool norm); + static bool isFormatSupported(ElemDepth depth, int cn, bool norm); #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(type, depth) static inline bool isFormatSupported(int depth, int cn, bool norm) { - return isFormatSupported(static_cast(depth), cn, norm); + return isFormatSupported(static_cast(depth), cn, norm); } #endif // CV_TYPE_COMPATIBLE_API diff --git a/modules/core/include/opencv2/core/opengl.hpp b/modules/core/include/opencv2/core/opengl.hpp index 65a503615ebb..d404fb9946cc 100644 --- a/modules/core/include/opencv2/core/opengl.hpp +++ b/modules/core/include/opencv2/core/opengl.hpp @@ -303,7 +303,7 @@ class CV_EXPORTS Buffer bool empty() const; ElemType type() const; - ElemType depth() const; + ElemDepth depth() const; int channels() const; int elemSize() const; int elemSize1() const; @@ -416,12 +416,12 @@ class CV_EXPORTS Texture2D @param ddepth Destination depth. @param autoRelease Auto release mode for destination buffer (if arr is OpenGL buffer or texture). */ - void copyTo(OutputArray arr, ElemType ddepth = CV_32F, bool autoRelease = false) const; + void copyTo(OutputArray arr, ElemDepth ddepth = CV_32F, bool autoRelease = false) const; #ifdef CV_TYPE_COMPATIBLE_API CV_DEPRECATED_INT_TO_ELEMTYPE_ATTR(dtype, ddepth) inline void copyTo(OutputArray arr, int ddepth, bool autoRelease = false) const { - copyTo(arr, static_cast(ddepth), autoRelease ); + copyTo(arr, static_cast(ddepth), autoRelease ); } #endif // CV_TYPE_COMPATIBLE_API @@ -681,7 +681,7 @@ ElemType cv::ogl::Buffer::type() const } inline -ElemType cv::ogl::Buffer::depth() const +ElemDepth cv::ogl::Buffer::depth() const { return CV_MAT_DEPTH(type_); } diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp index 6481fb953445..6754165d9c37 100644 --- a/modules/core/include/opencv2/core/operations.hpp +++ b/modules/core/include/opencv2/core/operations.hpp @@ -267,14 +267,14 @@ CV_MAT_AUG_OPERATOR_T(-=, cv::subtract(a,b,a), Mat_<_Tp>, Mat_<_Tp>) CV_MAT_AUG_OPERATOR (*=, cv::gemm(a, b, 1, Mat(), 0, a, 0), Mat, Mat) CV_MAT_AUG_OPERATOR_T(*=, cv::gemm(a, b, 1, Mat(), 0, a, 0), Mat_<_Tp>, Mat) CV_MAT_AUG_OPERATOR_T(*=, cv::gemm(a, b, 1, Mat(), 0, a, 0), Mat_<_Tp>, Mat_<_Tp>) -CV_MAT_AUG_OPERATOR (*=, a.convertTo(a, CV_TYPE_AUTO, b), Mat, double) -CV_MAT_AUG_OPERATOR_T(*= , a.convertTo(a, CV_TYPE_AUTO, b), Mat_<_Tp>, double) +CV_MAT_AUG_OPERATOR (*=, a.convertTo(a, CV_DEPTH_AUTO, b), Mat, double) +CV_MAT_AUG_OPERATOR_T(*= , a.convertTo(a, CV_DEPTH_AUTO, b), Mat_<_Tp>, double) CV_MAT_AUG_OPERATOR (/=, cv::divide(a,b,a), Mat, Mat) CV_MAT_AUG_OPERATOR_T(/=, cv::divide(a,b,a), Mat_<_Tp>, Mat) CV_MAT_AUG_OPERATOR_T(/=, cv::divide(a,b,a), Mat_<_Tp>, Mat_<_Tp>) -CV_MAT_AUG_OPERATOR(/= , a.convertTo((Mat&)a, CV_TYPE_AUTO, 1. / b), Mat, double) -CV_MAT_AUG_OPERATOR_T(/= , a.convertTo((Mat&)a, CV_TYPE_AUTO, 1. / b), Mat_<_Tp>, double) +CV_MAT_AUG_OPERATOR(/= , a.convertTo((Mat&)a, CV_DEPTH_AUTO, 1. / b), Mat, double) +CV_MAT_AUG_OPERATOR_T(/= , a.convertTo((Mat&)a, CV_DEPTH_AUTO, 1. / b), Mat_<_Tp>, double) CV_MAT_AUG_OPERATOR (&=, cv::bitwise_and(a,b,a), Mat, Mat) CV_MAT_AUG_OPERATOR (&=, cv::bitwise_and(a,b,a), Mat, Scalar) diff --git a/modules/core/include/opencv2/core/private.hpp b/modules/core/include/opencv2/core/private.hpp index f6fe2741674d..f7cdddccc998 100644 --- a/modules/core/include/opencv2/core/private.hpp +++ b/modules/core/include/opencv2/core/private.hpp @@ -313,7 +313,7 @@ static inline IppiMaskSize ippiGetMaskSize(int kx, int ky) (IppiMaskSize)-1; } -static inline IppDataType ippiGetDataType(ElemType depth) +static inline IppDataType ippiGetDataType(ElemDepth depth) { depth = CV_MAT_DEPTH(depth); return depth == CV_8U ? ipp8u : @@ -329,7 +329,7 @@ static inline IppDataType ippiGetDataType(ElemType depth) #ifdef CV_TRANSNATIONAL_API static inline IppDataType ippiGetDataType(int depth) { - return ippiGetDataType(static_cast(depth)); + return ippiGetDataType(static_cast(depth)); } #endif // CV_TRANSNATIONAL_API diff --git a/modules/core/include/opencv2/core/traits.hpp b/modules/core/include/opencv2/core/traits.hpp index 73c0ad33cae7..c3f2f2c6c2e1 100644 --- a/modules/core/include/opencv2/core/traits.hpp +++ b/modules/core/include/opencv2/core/traits.hpp @@ -91,7 +91,7 @@ DataType itself that is used but its specialized versions, such as: typedef _Tp channel_type; // DataDepth is another helper trait class - static const ElemType depth = DataDepth<_Tp>::value; + static const ElemDepth depth = DataDepth<_Tp>::value; static const int channels = 2; static const int fmt = (channels-1)*256 + DataDepth<_Tp>::fmt; static const ElemType type = CV_MAKETYPE(depth, channels); @@ -125,7 +125,7 @@ template class DataType typedef value_type vec_type; static const bool generic_type = true; - static const ElemType depth = CV_TYPE_AUTO; + static const ElemDepth depth = CV_DEPTH_AUTO; static const int channels = 1; static const int fmt = 0; static const ElemType type = CV_MAKETYPE(depth, channels); @@ -141,7 +141,7 @@ template<> class DataType typedef value_type vec_type; static const bool generic_type = false; - static const ElemType depth = CV_8U; + static const ElemDepth depth = CV_8U; static const int channels = 1; static const int fmt = (int)'u'; static const ElemType type = CV_MAKETYPE(depth, channels); @@ -156,7 +156,7 @@ template<> class DataType typedef value_type vec_type; static const bool generic_type = false; - static const ElemType depth = CV_8U; + static const ElemDepth depth = CV_8U; static const int channels = 1; static const int fmt = (int)'u'; static const ElemType type = CV_MAKETYPE(depth, channels); @@ -171,7 +171,7 @@ template<> class DataType typedef value_type vec_type; static const bool generic_type = false; - static const ElemType depth = CV_8S; + static const ElemDepth depth = CV_8S; static const int channels = 1; static const int fmt = (int)'c'; static const ElemType type = CV_MAKETYPE(depth, channels); @@ -186,7 +186,7 @@ template<> class DataType typedef value_type vec_type; static const bool generic_type = false; - static const ElemType depth = CV_8S; + static const ElemDepth depth = CV_8S; static const int channels = 1; static const int fmt = (int)'c'; static const ElemType type = CV_MAKETYPE(depth, channels); @@ -201,7 +201,7 @@ template<> class DataType typedef value_type vec_type; static const bool generic_type = false; - static const ElemType depth = CV_16U; + static const ElemDepth depth = CV_16U; static const int channels = 1; static const int fmt = (int)'w'; static const ElemType type = CV_MAKETYPE(depth, channels); @@ -216,7 +216,7 @@ template<> class DataType typedef value_type vec_type; static const bool generic_type = false; - static const ElemType depth = CV_16S; + static const ElemDepth depth = CV_16S; static const int channels = 1; static const int fmt = (int)'s'; static const ElemType type = CV_MAKETYPE(depth, channels); @@ -231,7 +231,7 @@ template<> class DataType typedef value_type vec_type; static const bool generic_type = false; - static const ElemType depth = CV_32S; + static const ElemDepth depth = CV_32S; static const int channels = 1; static const int fmt = (int)'i'; static const ElemType type = CV_MAKETYPE(depth, channels); @@ -246,7 +246,7 @@ template<> class DataType typedef value_type vec_type; static const bool generic_type = false; - static const ElemType depth = CV_32F; + static const ElemDepth depth = CV_32F; static const int channels = 1; static const int fmt = (int)'f'; static const ElemType type = CV_MAKETYPE(depth, channels); @@ -261,7 +261,7 @@ template<> class DataType typedef value_type vec_type; static const bool generic_type = false; - static const ElemType depth = CV_64F; + static const ElemDepth depth = CV_64F; static const int channels = 1; static const int fmt = (int)'d'; static const ElemType type = CV_MAKETYPE(depth, channels); @@ -290,7 +290,7 @@ DataDepth::value constant. template class DataDepth { public: - static const ElemType value = DataType<_Tp>::depth; + static const ElemDepth value = DataType<_Tp>::depth; static const int fmt = DataType<_Tp>::fmt; }; @@ -382,7 +382,7 @@ CV_CREATE_MEMBER_CHECK(type) template struct Depth -{ static const ElemType value = DataType::depth; }; +{ static const ElemDepth value = DataType::depth; }; template struct Type diff --git a/modules/core/include/opencv2/core/types.hpp b/modules/core/include/opencv2/core/types.hpp index 048100bdedda..61ccd42aaef3 100644 --- a/modules/core/include/opencv2/core/types.hpp +++ b/modules/core/include/opencv2/core/types.hpp @@ -101,7 +101,7 @@ template class DataType< Complex<_Tp> > static const int channels = 2; static const int fmt = DataType::fmt + ((channels - 1) << 8); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif @@ -110,7 +110,7 @@ template class DataType< Complex<_Tp> > namespace traits { template -struct Depth< Complex<_Tp> > { static const ElemType value = Depth<_Tp>::value; }; +struct Depth< Complex<_Tp> > { static const ElemDepth value = Depth<_Tp>::value; }; template struct Type< Complex<_Tp> > { static const ElemType value = CV_MAKETYPE(Depth<_Tp>::value, 2); }; } // namespace @@ -203,7 +203,7 @@ template class DataType< Point_<_Tp> > static const int channels = 2; static const int fmt = traits::SafeFmt::fmt + ((channels - 1) << 8); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif @@ -212,7 +212,7 @@ template class DataType< Point_<_Tp> > namespace traits { template -struct Depth< Point_<_Tp> > { static const ElemType value = Depth<_Tp>::value; }; +struct Depth< Point_<_Tp> > { static const ElemDepth value = Depth<_Tp>::value; }; template struct Type< Point_<_Tp> > { static const ElemType value = CV_MAKETYPE(Depth<_Tp>::value, 2); }; } // namespace @@ -280,7 +280,7 @@ template class DataType< Point3_<_Tp> > static const int channels = 3; static const int fmt = traits::SafeFmt::fmt + ((channels - 1) << 8); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif @@ -289,7 +289,7 @@ template class DataType< Point3_<_Tp> > namespace traits { template -struct Depth< Point3_<_Tp> > { static const ElemType value = Depth<_Tp>::value; }; +struct Depth< Point3_<_Tp> > { static const ElemDepth value = Depth<_Tp>::value; }; template struct Type< Point3_<_Tp> > { static const ElemType value = CV_MAKETYPE(Depth<_Tp>::value, 3); }; } // namespace @@ -354,7 +354,7 @@ template class DataType< Size_<_Tp> > static const int channels = 2; static const int fmt = DataType::fmt + ((channels - 1) << 8); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif @@ -363,7 +363,7 @@ template class DataType< Size_<_Tp> > namespace traits { template -struct Depth< Size_<_Tp> > { static const ElemType value = Depth<_Tp>::value; }; +struct Depth< Size_<_Tp> > { static const ElemDepth value = Depth<_Tp>::value; }; template struct Type< Size_<_Tp> > { static const ElemType value = CV_MAKETYPE(Depth<_Tp>::value, 2); }; } // namespace @@ -468,7 +468,7 @@ template class DataType< Rect_<_Tp> > static const int channels = 4; static const int fmt = traits::SafeFmt::fmt + ((channels - 1) << 8); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif @@ -477,7 +477,7 @@ template class DataType< Rect_<_Tp> > namespace traits { template -struct Depth< Rect_<_Tp> > { static const ElemType value = Depth<_Tp>::value; }; +struct Depth< Rect_<_Tp> > { static const ElemDepth value = Depth<_Tp>::value; }; template struct Type< Rect_<_Tp> > { static const ElemType value = CV_MAKETYPE(Depth<_Tp>::value, 4); }; } // namespace @@ -540,7 +540,7 @@ template<> class DataType< RotatedRect > static const int channels = (int)sizeof(value_type) / sizeof(channel_type); // 5 static const int fmt = traits::SafeFmt::fmt + ((channels - 1) << 8); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif @@ -549,7 +549,7 @@ template<> class DataType< RotatedRect > namespace traits { template<> -struct Depth< RotatedRect > { static const ElemType value = Depth::value; }; +struct Depth< RotatedRect > { static const ElemDepth value = Depth::value; }; template<> struct Type< RotatedRect > { static const ElemType value = CV_MAKETYPE(Depth::value, (int)sizeof(RotatedRect)/sizeof(float)); }; } // namespace @@ -603,7 +603,7 @@ template<> class DataType static const int channels = 2; static const int fmt = traits::SafeFmt::fmt + ((channels - 1) << 8); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif @@ -612,7 +612,7 @@ template<> class DataType namespace traits { template<> -struct Depth< Range > { static const ElemType value = Depth::value; }; +struct Depth< Range > { static const ElemDepth value = Depth::value; }; template<> struct Type< Range > { static const ElemType value = CV_MAKETYPE(Depth::value, 2); }; } // namespace @@ -672,7 +672,7 @@ template class DataType< Scalar_<_Tp> > static const int channels = 4; static const int fmt = traits::SafeFmt::fmt + ((channels - 1) << 8); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif @@ -681,7 +681,7 @@ template class DataType< Scalar_<_Tp> > namespace traits { template -struct Depth< Scalar_<_Tp> > { static const ElemType value = Depth<_Tp>::value; }; +struct Depth< Scalar_<_Tp> > { static const ElemDepth value = Depth<_Tp>::value; }; template struct Type< Scalar_<_Tp> > { static const ElemType value = CV_MAKETYPE(Depth<_Tp>::value, 4); }; } // namespace @@ -779,7 +779,7 @@ template<> class DataType typedef float channel_type; static const bool generic_type = false; - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const int channels = (int)(sizeof(value_type)/sizeof(channel_type)); // 7 static const int fmt = DataType::fmt + ((channels - 1) << 8); static const ElemType type = CV_MAKETYPE(depth, channels); @@ -822,7 +822,7 @@ template<> class DataType typedef int channel_type; static const bool generic_type = false; - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const int channels = (int)(sizeof(value_type)/sizeof(channel_type)); // 4 static const int fmt = DataType::fmt + ((channels - 1) << 8); static const ElemType type = CV_MAKETYPE(depth, channels); @@ -953,7 +953,7 @@ template<> class DataType static const int channels = (int)(sizeof(value_type) / sizeof(channel_type)); // 24 static const int fmt = DataType::fmt + ((channels - 1) << 8); #ifdef OPENCV_TRAITS_ENABLE_DEPRECATED - static const ElemType depth = DataType::depth; + static const ElemDepth depth = DataType::depth; static const ElemType type = CV_MAKETYPE(depth, channels); #endif @@ -962,7 +962,7 @@ template<> class DataType namespace traits { template<> -struct Depth< Moments > { static const ElemType value = Depth::value; }; +struct Depth< Moments > { static const ElemDepth value = Depth::value; }; template<> struct Type< Moments > { static const ElemType value = CV_MAKETYPE(Depth::value, (int)(sizeof(Moments)/sizeof(double))); }; } // namespace diff --git a/modules/core/include/opencv2/core/types_c.h b/modules/core/include/opencv2/core/types_c.h index f2e2a70f2de5..c9bde01cdcf4 100644 --- a/modules/core/include/opencv2/core/types_c.h +++ b/modules/core/include/opencv2/core/types_c.h @@ -656,7 +656,7 @@ CV_INLINE void cvmSet( CvMat* mat, int row, int col, double value ) CV_INLINE int cvIplDepth( int type ) { - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); return CV_ELEM_SIZE1(depth)*8 | (depth == CV_8S || depth == CV_16S || depth == CV_32S ? IPL_DEPTH_SIGN : 0); } diff --git a/modules/core/misc/java/src/cpp/core_manual.hpp b/modules/core/misc/java/src/cpp/core_manual.hpp index 2329bd1cbf11..d09d96d206a3 100644 --- a/modules/core/misc/java/src/cpp/core_manual.hpp +++ b/modules/core/misc/java/src/cpp/core_manual.hpp @@ -13,13 +13,13 @@ CV_EXPORTS_W void setErrorVerbosity(bool verbose); namespace cv { -CV_EXPORTS_W void add(InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), ElemType ddepth = CV_TYPE_AUTO); +CV_EXPORTS_W void add(InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), ElemDepth ddepth = CV_DEPTH_AUTO); -CV_EXPORTS_W void subtract(InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), ElemType ddepth = CV_TYPE_AUTO); +CV_EXPORTS_W void subtract(InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), ElemDepth ddepth = CV_DEPTH_AUTO); -CV_EXPORTS_W void multiply(InputArray src1, Scalar src2, OutputArray dst, double scale=1, ElemType ddepth = CV_TYPE_AUTO); +CV_EXPORTS_W void multiply(InputArray src1, Scalar src2, OutputArray dst, double scale=1, ElemDepth ddepth = CV_DEPTH_AUTO); -CV_EXPORTS_W void divide(InputArray src1, Scalar src2, OutputArray dst, double scale=1, ElemType ddepth = CV_TYPE_AUTO); +CV_EXPORTS_W void divide(InputArray src1, Scalar src2, OutputArray dst, double scale=1, ElemDepth ddepth = CV_DEPTH_AUTO); CV_EXPORTS_W void absdiff(InputArray src1, Scalar src2, OutputArray dst); diff --git a/modules/core/misc/python/pyopencv_core.hpp b/modules/core/misc/python/pyopencv_core.hpp index 28c11ced08b4..60deeffc069b 100644 --- a/modules/core/misc/python/pyopencv_core.hpp +++ b/modules/core/misc/python/pyopencv_core.hpp @@ -5,6 +5,9 @@ #ifdef CV_TYPE_SAFE_API CV_PY_FROM_ENUM(ElemType); CV_PY_TO_ENUM(ElemType); + +CV_PY_FROM_ENUM(ElemDepth); +CV_PY_TO_ENUM(ElemDepth); #endif #endif diff --git a/modules/core/src/arithm.cpp b/modules/core/src/arithm.cpp index 2b5f36a581f9..2ea8dc22c1f2 100644 --- a/modules/core/src/arithm.cpp +++ b/modules/core/src/arithm.cpp @@ -91,7 +91,7 @@ static bool ocl_binary_op(InputArray _src1, InputArray _src2, OutputArray _dst, { bool haveMask = !_mask.empty(); int srctype = _src1.type(); - ElemType srcdepth = CV_MAT_DEPTH(srctype); + ElemDepth srcdepth = CV_MAT_DEPTH(srctype); int cn = CV_MAT_CN(srctype); const ocl::Device d = ocl::Device::getDefault(); @@ -169,10 +169,10 @@ static void binary_op( InputArray _src1, InputArray _src2, OutputArray _dst, const _InputArray *psrc1 = &_src1, *psrc2 = &_src2; _InputArray::KindFlag kind1 = psrc1->kind(), kind2 = psrc2->kind(); ElemType type1 = psrc1->type(); - ElemType depth1 = CV_MAT_DEPTH(type1); + ElemDepth depth1 = CV_MAT_DEPTH(type1); int cn = CV_MAT_CN(type1); ElemType type2 = psrc2->type(); - ElemType depth2 = CV_MAT_DEPTH(type2); + ElemDepth depth2 = CV_MAT_DEPTH(type2); int cn2 = CV_MAT_CN(type2); int dims1 = psrc1->dims(), dims2 = psrc2->dims(); Size sz1 = dims1 <= 2 ? psrc1->size() : Size(); @@ -457,7 +457,7 @@ void cv::min(const UMat& src1, const UMat& src2, UMat& dst) namespace cv { -static ElemType actualScalarDepth(const double* data, int len) +static ElemDepth actualScalarDepth(const double* data, int len) { int i = 0, minval = INT_MAX, maxval = INT_MIN; for(; i < len; ++i) @@ -486,7 +486,7 @@ static bool ocl_arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, const ocl::Device d = ocl::Device::getDefault(); bool doubleSupport = d.doubleFPConfig() > 0; ElemType type1 = _src1.type(); - ElemType depth1 = CV_MAT_DEPTH(type1); + ElemDepth depth1 = CV_MAT_DEPTH(type1); int cn = CV_MAT_CN(type1); bool haveMask = !_mask.empty(); @@ -494,14 +494,14 @@ static bool ocl_arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, return false; ElemType dtype = _dst.type(); - ElemType ddepth = CV_MAT_DEPTH(dtype); - ElemType wdepth = CV_MAX_DEPTH(CV_32S, CV_MAT_DEPTH(wtype)); + ElemDepth ddepth = CV_MAT_DEPTH(dtype); + ElemDepth wdepth = CV_MAX_DEPTH(CV_32S, CV_MAT_DEPTH(wtype)); if (!doubleSupport) wdepth = CV_MIN_DEPTH(wdepth, CV_32F); wtype = CV_MAKETYPE(wdepth, cn); ElemType type2 = haveScalar ? wtype : _src2.type(); - ElemType depth2 = CV_MAT_DEPTH(type2); + ElemDepth depth2 = CV_MAT_DEPTH(type2); if (!doubleSupport && (depth2 == CV_64F || depth1 == CV_64F)) return false; @@ -605,7 +605,7 @@ static bool ocl_arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, #endif static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, - InputArray _mask, ElemType ddepth, BinaryFuncC* tab, bool muldiv=false, + InputArray _mask, ElemDepth ddepth, BinaryFuncC* tab, bool muldiv=false, void* usrdata=0, int oclop=-1 ) { const _InputArray *psrc1 = &_src1, *psrc2 = &_src2; @@ -613,10 +613,10 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, bool haveMask = !_mask.empty(); bool reallocate = false; ElemType type1 = psrc1->type(); - ElemType depth1 = CV_MAT_DEPTH(type1); + ElemDepth depth1 = CV_MAT_DEPTH(type1); int cn = CV_MAT_CN(type1); ElemType type2 = psrc2->type(); - ElemType depth2 = CV_MAT_DEPTH(type2); + ElemDepth depth2 = CV_MAT_DEPTH(type2); int cn2 = CV_MAT_CN(type2); ElemType wtype; int dims1 = psrc1->dims(), dims2 = psrc2->dims(); @@ -629,7 +629,7 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, bool src2Scalar = checkScalar(*psrc2, type1, kind2, kind1); if( (kind1 == kind2 || cn == 1) && sz1 == sz2 && dims1 <= 2 && dims2 <= 2 && type1 == type2 && - !haveMask && ((!_dst.fixedType() && (ddepth == CV_TYPE_AUTO || ddepth == depth1)) || + !haveMask && ((!_dst.fixedType() && (ddepth == CV_DEPTH_AUTO || ddepth == depth1)) || (_dst.fixedType() && _dst.type() == type1)) && (src1Scalar == src2Scalar) ) { @@ -685,13 +685,13 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, depth2 = CV_64F; } - if (ddepth == CV_TYPE_AUTO && !_dst.fixedType() && !haveScalar && type1 != type2) + if (ddepth == CV_DEPTH_AUTO && !_dst.fixedType() && !haveScalar && type1 != type2) { CV_Error(CV_StsBadArg, "When the input arrays in add/subtract/multiply/divide functions have different types, " "the output array type must be explicitly specified"); } - if (ddepth == CV_TYPE_AUTO) + if (ddepth == CV_DEPTH_AUTO) ddepth = _dst.fixedType() ? _dst.depth() : CV_MAT_DEPTH(type1); ElemType dtype = CV_MAKETYPE(ddepth, 1); @@ -699,15 +699,15 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst, wtype = dtype; else if( !muldiv ) { - wtype = depth1 <= CV_8S && depth2 <= CV_8S ? CV_16S : - depth1 <= CV_32S && depth2 <= CV_32S ? CV_32S : CV_MAX_DEPTH(depth1, depth2); - wtype = CV_MAX_DEPTH(wtype, dtype); + wtype = CV_MAKETYPE(depth1 <= CV_8S && depth2 <= CV_8S ? CV_16S : + depth1 <= CV_32S && depth2 <= CV_32S ? CV_32S : CV_MAX_DEPTH(depth1, depth2), 1); + wtype = CV_MAKETYPE(CV_MAX_DEPTH(wtype, dtype), 1); // when the result of addition should be converted to an integer type, // and just one of the input arrays is floating-point, it makes sense to convert that input to integer type before the operation, // instead of converting the other input to floating-point and then converting the operation result back to integers. if( dtype < CV_32F && (depth1 < CV_32F || depth2 < CV_32F) ) - wtype = CV_32S; + wtype = CV_32SC1; } else { @@ -928,7 +928,7 @@ static BinaryFuncC* getAbsDiffTab() } void cv::add( InputArray src1, InputArray src2, OutputArray dst, - InputArray mask, ElemType ddepth ) + InputArray mask, ElemDepth ddepth ) { CV_INSTRUMENT_REGION(); @@ -936,7 +936,7 @@ void cv::add( InputArray src1, InputArray src2, OutputArray dst, } void cv::subtract( InputArray _src1, InputArray _src2, OutputArray _dst, - InputArray mask, ElemType ddepth ) + InputArray mask, ElemDepth ddepth ) { CV_INSTRUMENT_REGION(); @@ -947,7 +947,7 @@ void cv::absdiff( InputArray src1, InputArray src2, OutputArray dst ) { CV_INSTRUMENT_REGION(); - arithm_op(src1, src2, dst, noArray(), CV_TYPE_AUTO, getAbsDiffTab(), false, 0, OCL_OP_ABSDIFF); + arithm_op(src1, src2, dst, noArray(), CV_DEPTH_AUTO, getAbsDiffTab(), false, 0, OCL_OP_ABSDIFF); } /****************************************************************************************\ @@ -996,7 +996,7 @@ static BinaryFuncC* getRecipTab() } void cv::multiply(InputArray src1, InputArray src2, - OutputArray dst, double scale, ElemType ddepth) + OutputArray dst, double scale, ElemDepth ddepth) { CV_INSTRUMENT_REGION(); @@ -1005,7 +1005,7 @@ void cv::multiply(InputArray src1, InputArray src2, } void cv::divide(InputArray src1, InputArray src2, - OutputArray dst, double scale, ElemType ddepth) + OutputArray dst, double scale, ElemDepth ddepth) { CV_INSTRUMENT_REGION(); @@ -1013,7 +1013,7 @@ void cv::divide(InputArray src1, InputArray src2, } void cv::divide(double scale, InputArray src2, - OutputArray dst, ElemType ddepth) + OutputArray dst, ElemDepth ddepth) { CV_INSTRUMENT_REGION(); @@ -1042,7 +1042,7 @@ static BinaryFuncC* getAddWeightedTab() } void cv::addWeighted( InputArray src1, double alpha, InputArray src2, - double beta, double gamma, OutputArray dst, ElemType ddepth ) + double beta, double gamma, OutputArray dst, ElemDepth ddepth ) { CV_INSTRUMENT_REGION(); @@ -1058,7 +1058,7 @@ void cv::addWeighted( InputArray src1, double alpha, InputArray src2, namespace cv { -static BinaryFuncC getCmpFunc(ElemType depth) +static BinaryFuncC getCmpFunc(ElemDepth depth) { static BinaryFuncC cmpTab[] = { @@ -1072,13 +1072,13 @@ static BinaryFuncC getCmpFunc(ElemType depth) return cmpTab[depth]; } -static double getMinVal(ElemType depth) +static double getMinVal(ElemDepth depth) { static const double tab[] = {0, -128, 0, -32768, INT_MIN, -FLT_MAX, -DBL_MAX, 0}; return tab[depth]; } -static double getMaxVal(ElemType depth) +static double getMaxVal(ElemDepth depth) { static const double tab[] = {255, 127, 65535, 32767, INT_MAX, FLT_MAX, DBL_MAX, 0}; return tab[depth]; @@ -1091,10 +1091,10 @@ static bool ocl_compare(InputArray _src1, InputArray _src2, OutputArray _dst, in const ocl::Device& dev = ocl::Device::getDefault(); bool doubleSupport = dev.doubleFPConfig() > 0; int type1 = _src1.type(); - ElemType depth1 = CV_MAT_DEPTH(type1); + ElemDepth depth1 = CV_MAT_DEPTH(type1); int cn = CV_MAT_CN(type1); ElemType type2 = _src2.type(); - ElemType depth2 = CV_MAT_DEPTH(type2); + ElemDepth depth2 = CV_MAT_DEPTH(type2); if (!doubleSupport && depth1 == CV_64F) return false; @@ -1240,7 +1240,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op) } int cn = src1.channels(); - ElemType depth1 = src1.depth(), depth2 = src2.depth(); + ElemDepth depth1 = src1.depth(), depth2 = src2.depth(); _dst.create(src1.dims, src1.size, CV_8UC(cn)); src1 = src1.reshape(1); src2 = src2.reshape(1); @@ -1582,7 +1582,7 @@ static void inRangeReduce(const uchar* src, uchar* dst, size_t len, int cn) typedef void (*InRangeFunc)( const uchar* src1, size_t step1, const uchar* src2, size_t step2, const uchar* src3, size_t step3, uchar* dst, size_t step, Size sz ); -static InRangeFunc getInRangeFunc(ElemType depth) +static InRangeFunc getInRangeFunc(ElemDepth depth) { static InRangeFunc inRangeTab[] = { @@ -1603,7 +1603,7 @@ static bool ocl_inRange( InputArray _src, InputArray _lowerb, _InputArray::KindFlag skind = _src.kind(), lkind = _lowerb.kind(), ukind = _upperb.kind(); Size ssize = _src.size(), lsize = _lowerb.size(), usize = _upperb.size(); ElemType stype = _src.type(), ltype = _lowerb.type(), utype = _upperb.type(); - ElemType sdepth = CV_MAT_DEPTH(stype), ldepth = CV_MAT_DEPTH(ltype), udepth = CV_MAT_DEPTH(utype); + ElemDepth sdepth = CV_MAT_DEPTH(stype), ldepth = CV_MAT_DEPTH(ltype), udepth = CV_MAT_DEPTH(utype); int cn = CV_MAT_CN(stype), rowsPerWI = d.isIntel() ? 4 : 1; bool lbScalar = false, ubScalar = false; @@ -1682,8 +1682,8 @@ static bool ocl_inRange( InputArray _src, InputArray _lowerb, uscalar = Mat(cn, 1, CV_32S, iubuf); } - lscalar.convertTo(lscalar, stype); - uscalar.convertTo(uscalar, stype); + lscalar.convertTo(lscalar, sdepth); + uscalar.convertTo(uscalar, sdepth); } else { @@ -1751,7 +1751,7 @@ void cv::inRange(InputArray _src, InputArray _lowerb, CV_Assert(lbScalar == ubScalar); int cn = src.channels(); - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); size_t esz = src.elemSize(); size_t blocksize0 = (size_t)(BLOCK_SIZE + esz-1)/esz; @@ -1777,7 +1777,7 @@ void cv::inRange(InputArray _src, InputArray _lowerb, ubuf = buf = alignPtr(buf + blocksize*esz, 16); CV_Assert( lb.type() == ub.type() ); - ElemType scdepth = lb.depth(); + ElemDepth scdepth = lb.depth(); if( scdepth != depth && depth < CV_32S ) { diff --git a/modules/core/src/array.cpp b/modules/core/src/array.cpp index 05983b0f1088..6879c6a511be 100644 --- a/modules/core/src/array.cpp +++ b/modules/core/src/array.cpp @@ -1457,7 +1457,7 @@ cvScalarToRawData(const CvScalar* scalar, void* data, int type, int extend_to_12 { type = CV_MAT_TYPE(type); int cn = CV_MAT_CN( type ); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); assert( scalar && data ); if( (unsigned)(cn - 1) >= 4 ) @@ -1601,7 +1601,7 @@ static double icvGetReal( const void* data, int type ) static void icvSetReal(double value, const void* data, int _depth) { - ElemType depth = static_cast(_depth); + ElemDepth depth = static_cast(_depth); switch (depth) { case CV_8U: @@ -2797,7 +2797,7 @@ cvGetImage( const CvArr* array, IplImage* img ) if( mat->data.ptr == 0 ) CV_Error( CV_StsNullPtr, "" ); - ElemType depth = static_cast(cvIplDepth(mat->type)); + ElemDepth depth = static_cast(cvIplDepth(mat->type)); cvInitImageHeader( img, cvSize(mat->cols, mat->rows), depth, CV_MAT_CN(mat->type) ); @@ -3221,7 +3221,7 @@ void scalarToRawData(const Scalar& s, void* _buf, int type, int unroll_to) { CV_INSTRUMENT_REGION(); - const ElemType depth = CV_MAT_DEPTH(type); + const ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type); CV_Assert(cn <= 4); switch(depth) diff --git a/modules/core/src/batch_distance.cpp b/modules/core/src/batch_distance.cpp index 02ac0c0ce923..209807a5dcaa 100644 --- a/modules/core/src/batch_distance.cpp +++ b/modules/core/src/batch_distance.cpp @@ -263,7 +263,7 @@ struct BatchDistInvoker : public ParallelLoopBody } void cv::batchDistance( InputArray _src1, InputArray _src2, - OutputArray _dist, ElemType dtype, OutputArray _nidx, + OutputArray _dist, ElemDepth ddepth, OutputArray _nidx, int normType, int K, InputArray _mask, int update, bool crosscheck ) { @@ -275,15 +275,15 @@ void cv::batchDistance( InputArray _src1, InputArray _src2, (type == CV_32F || type == CV_8U)); CV_Assert( _nidx.needed() == (K > 0) ); - if( dtype == -1 ) + if( ddepth == CV_DEPTH_AUTO ) { - dtype = normType == NORM_HAMMING || normType == NORM_HAMMING2 ? CV_32S : CV_32F; + ddepth = normType == NORM_HAMMING || normType == NORM_HAMMING2 ? CV_32S : CV_32F; } - CV_Assert( (type == CV_8U && dtype == CV_32S) || dtype == CV_32F); + CV_Assert((type == CV_8U && ddepth == CV_32S) || ddepth == CV_32F); K = std::min(K, src2.rows); - _dist.create(src1.rows, (K > 0 ? K : src2.rows), dtype); + _dist.create(src1.rows, (K > 0 ? K : src2.rows), ddepth); Mat dist = _dist.getMat(), nidx; if( _nidx.needed() ) { @@ -293,7 +293,7 @@ void cv::batchDistance( InputArray _src1, InputArray _src2, if( update == 0 && K > 0 ) { - dist = Scalar::all(dtype == CV_32S ? (double)INT_MAX : (double)FLT_MAX); + dist = Scalar::all(ddepth == CV_32S ? (double)INT_MAX : (double)FLT_MAX); nidx = Scalar::all(-1); } @@ -302,7 +302,7 @@ void cv::batchDistance( InputArray _src1, InputArray _src2, CV_Assert( K == 1 && update == 0 && mask.empty() ); CV_Assert(!nidx.empty()); Mat tdist, tidx; - batchDistance(src2, src1, tdist, dtype, tidx, normType, K, mask, 0, false); + batchDistance(src2, src1, tdist, ddepth, tidx, normType, K, mask, 0, false); // if an idx-th element from src1 appeared to be the nearest to i-th element of src2, // we update the minimum mutual distance between idx-th element of src1 and the whole src2 set. @@ -310,7 +310,7 @@ void cv::batchDistance( InputArray _src1, InputArray _src2, // to i*-th element of src2 and i*-th element of src2 is the closest to idx-th element of src1. // If nidx[idx] = -1, it means that there is no such ideal couple for it in src2. // This O(N) procedure is called cross-check and it helps to eliminate some false matches. - if( dtype == CV_32S ) + if (ddepth == CV_32S) { for( int i = 0; i < tdist.rows; i++ ) { @@ -342,22 +342,22 @@ void cv::batchDistance( InputArray _src1, InputArray _src2, BatchDistFunc func = 0; if( type == CV_8U ) { - if( normType == NORM_L1 && dtype == CV_32S ) + if (normType == NORM_L1 && ddepth == CV_32S) func = (BatchDistFunc)batchDistL1_8u32s; - else if( normType == NORM_L1 && dtype == CV_32F ) + else if (normType == NORM_L1 && ddepth == CV_32F) func = (BatchDistFunc)batchDistL1_8u32f; - else if( normType == NORM_L2SQR && dtype == CV_32S ) + else if (normType == NORM_L2SQR && ddepth == CV_32S) func = (BatchDistFunc)batchDistL2Sqr_8u32s; - else if( normType == NORM_L2SQR && dtype == CV_32F ) + else if (normType == NORM_L2SQR && ddepth == CV_32F) func = (BatchDistFunc)batchDistL2Sqr_8u32f; - else if( normType == NORM_L2 && dtype == CV_32F ) + else if (normType == NORM_L2 && ddepth == CV_32F) func = (BatchDistFunc)batchDistL2_8u32f; - else if( normType == NORM_HAMMING && dtype == CV_32S ) + else if (normType == NORM_HAMMING && ddepth == CV_32S) func = (BatchDistFunc)batchDistHamming; - else if( normType == NORM_HAMMING2 && dtype == CV_32S ) + else if (normType == NORM_HAMMING2 && ddepth == CV_32S) func = (BatchDistFunc)batchDistHamming2; } - else if( type == CV_32F && dtype == CV_32F ) + else if (type == CV_32F && ddepth == CV_32F) { if( normType == NORM_L1 ) func = (BatchDistFunc)batchDistL1_32f; @@ -369,8 +369,8 @@ void cv::batchDistance( InputArray _src1, InputArray _src2, if( func == 0 ) CV_Error_(CV_StsUnsupportedFormat, - ("The combination of type=%d, dtype=%d and normType=%d is not supported", - type, dtype, normType)); + ("The combination of type=%d, ddepth=%d and normType=%d is not supported", + type, ddepth, normType)); parallel_for_(Range(0, src1.rows), BatchDistInvoker(src1, src2, dist, nidx, K, mask, update, func)); diff --git a/modules/core/src/channels.cpp b/modules/core/src/channels.cpp index 7f136e34cd9b..669bbfd4186b 100644 --- a/modules/core/src/channels.cpp +++ b/modules/core/src/channels.cpp @@ -77,7 +77,7 @@ static void mixChannels64s( const int64** src, const int* sdelta, typedef void (*MixChannelsFunc)( const uchar** src, const int* sdelta, uchar** dst, const int* ddelta, int len, int npairs ); -static MixChannelsFunc getMixchFunc(ElemType depth) +static MixChannelsFunc getMixchFunc(ElemDepth depth) { static MixChannelsFunc mixchTab[] = { @@ -101,7 +101,7 @@ void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, cons CV_Assert( src && nsrcs > 0 && dst && ndsts > 0 && fromTo && npairs > 0 ); size_t i, j, k, esz1 = dst[0].elemSize1(); - ElemType depth = dst[0].depth(); + ElemDepth depth = dst[0].depth(); AutoBuffer buf((nsrcs + ndsts + 1)*(sizeof(Mat*) + sizeof(uchar*)) + npairs*(sizeof(uchar*)*2 + sizeof(int)*6)); const Mat** arrays = (const Mat**)(uchar*)buf.data(); @@ -210,7 +210,7 @@ static bool ocl_mixChannels(InputArrayOfArrays _src, InputOutputArrayOfArrays _d CV_Assert(nsrc > 0 && ndst > 0); Size size = src[0].size(); - ElemType depth = src[0].depth(); + ElemDepth depth = src[0].depth(); int esz = CV_ELEM_SIZE(depth), rowsPerWI = ocl::Device::getDefault().isIntel() ? 4 : 1; @@ -423,7 +423,7 @@ void cv::extractChannel(InputArray _src, OutputArray _dst, int coi) CV_INSTRUMENT_REGION(); ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type); CV_Assert( 0 <= coi && coi < cn ); int ch[] = { coi, 0 }; @@ -453,10 +453,10 @@ void cv::insertChannel(InputArray _src, InputOutputArray _dst, int coi) CV_INSTRUMENT_REGION(); ElemType stype = _src.type(); - ElemType sdepth = CV_MAT_DEPTH(stype); + ElemDepth sdepth = CV_MAT_DEPTH(stype); int scn = CV_MAT_CN(stype); ElemType dtype = _dst.type(); - ElemType ddepth = CV_MAT_DEPTH(dtype); + ElemDepth ddepth = CV_MAT_DEPTH(dtype); int dcn = CV_MAT_CN(dtype); CV_Assert( _src.sameSize(_dst) && sdepth == ddepth ); CV_Assert( 0 <= coi && coi < dcn && scn == 1 ); diff --git a/modules/core/src/check.cpp b/modules/core/src/check.cpp index 11779899a6fc..0c09018a0b2b 100644 --- a/modules/core/src/check.cpp +++ b/modules/core/src/check.cpp @@ -8,7 +8,7 @@ namespace cv { -const char* depthToString(ElemType depth) +const char* depthToString(ElemDepth depth) { const char* s = detail::depthToString_(depth); return s ? s : ""; @@ -41,7 +41,7 @@ static const char* getTestOpMath(unsigned testOp) return testOp < CV__LAST_TEST_OP ? _names[testOp] : "???"; } -const char* depthToString_(ElemType depth) +const char* depthToString_(ElemDepth depth) { static const char* depthNames[] = { "CV_8U", "CV_8S", "CV_16U", "CV_16S", "CV_32S", "CV_32F", "CV_64F", "CV_16F" }; return (depth <= CV_16F && depth >= CV_8U) ? depthNames[depth] : NULL; @@ -49,7 +49,7 @@ const char* depthToString_(ElemType depth) const cv::String typeToString_(ElemType type) { - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type); if (depth >= CV_8U && depth <= CV_16F) return cv::format("%sC%d", depthToString_(depth), cn); @@ -69,7 +69,7 @@ void check_failed_auto_(const T& v1, const T& v2, const CheckContext& ctx) ss << " '" << ctx.p2_str << "' is " << v2; cv::error(cv::Error::StsError, ss.str(), ctx.func, ctx.file, ctx.line); } -void check_failed_MatDepth(const ElemType v1, const ElemType v2, const CheckContext& ctx) +void check_failed_MatDepth(const ElemDepth v1, const ElemDepth v2, const CheckContext& ctx) { std::stringstream ss; ss << ctx.message << " (expected: '" << ctx.p1_str << " " << getTestOpMath(ctx.testOp) << " " << ctx.p2_str << "'), where" << std::endl @@ -125,7 +125,7 @@ void check_failed_auto_(const T& v, const CheckContext& ctx) << " '" << ctx.p1_str << "' is " << v; cv::error(cv::Error::StsError, ss.str(), ctx.func, ctx.file, ctx.line); } -void check_failed_MatDepth(const ElemType v, const CheckContext& ctx) +void check_failed_MatDepth(const ElemDepth v, const CheckContext& ctx) { std::stringstream ss; ss << ctx.message << ":" << std::endl diff --git a/modules/core/src/convert.cpp b/modules/core/src/convert.cpp index 593ee92ffaf1..010d9aa0fe57 100644 --- a/modules/core/src/convert.cpp +++ b/modules/core/src/convert.cpp @@ -332,7 +332,7 @@ DEF_CVT_FUNC(32f64f, float, double) DEF_CPY_FUNC(64s, int64) */ -BinaryFunc getConvertFunc(ElemType sdepth, ElemType ddepth) +BinaryFunc getConvertFunc(ElemDepth sdepth, ElemDepth ddepth) { static BinaryFunc cvtTab[][8] = { @@ -380,7 +380,7 @@ BinaryFunc getConvertFunc(ElemType sdepth, ElemType ddepth) } #ifdef HAVE_OPENCL -static bool ocl_convertFp16(InputArray _src, OutputArray _dst, ElemType sdepth, ElemType ddepth) +static bool ocl_convertFp16(InputArray _src, OutputArray _dst, ElemDepth sdepth, ElemDepth ddepth) { int type = _src.type(), cn = CV_MAT_CN(type); @@ -411,7 +411,7 @@ static bool ocl_convertFp16(InputArray _src, OutputArray _dst, ElemType sdepth, } // cv:: -void cv::Mat::convertTo(OutputArray _dst, ElemType ddepth, double alpha, double beta) const +void cv::Mat::convertTo(OutputArray _dst, ElemDepth ddepth, double alpha, double beta) const { CV_INSTRUMENT_REGION(); @@ -424,12 +424,12 @@ void cv::Mat::convertTo(OutputArray _dst, ElemType ddepth, double alpha, double bool noScale = fabs(alpha-1) < DBL_EPSILON && fabs(beta) < DBL_EPSILON; int cn = channels(); - if (ddepth == CV_TYPE_AUTO) + if (ddepth == CV_DEPTH_AUTO) ddepth = _dst.fixedType() ? _dst.depth() : depth(); ddepth = CV_MAT_DEPTH(ddepth); /* backwards compatibility */ ElemType dtype = CV_MAKETYPE(ddepth, cn); - ElemType sdepth = depth(); + ElemDepth sdepth = depth(); if( sdepth == ddepth && noScale ) { copyTo(_dst); @@ -471,7 +471,7 @@ void cv::convertFp16( InputArray _src, OutputArray _dst ) { CV_INSTRUMENT_REGION(); - ElemType sdepth = _src.depth(), ddepth = CV_8U; + ElemDepth sdepth = _src.depth(), ddepth = CV_8U; BinaryFunc func = 0; switch( sdepth ) diff --git a/modules/core/src/convert_c.cpp b/modules/core/src/convert_c.cpp index 5d0770a0c702..656e55912ff1 100644 --- a/modules/core/src/convert_c.cpp +++ b/modules/core/src/convert_c.cpp @@ -110,7 +110,7 @@ cvConvertScale( const void* srcarr, void* dstarr, cv::Mat src = cv::cvarrToMat(srcarr), dst = cv::cvarrToMat(dstarr); CV_Assert( src.size == dst.size && src.channels() == dst.channels() ); - src.convertTo(dst, dst.type(), scale, shift); + src.convertTo(dst, dst.depth(), scale, shift); } diff --git a/modules/core/src/convert_scale.cpp b/modules/core/src/convert_scale.cpp index 485e7e2e9ad7..7fcc5ceb1b8b 100644 --- a/modules/core/src/convert_scale.cpp +++ b/modules/core/src/convert_scale.cpp @@ -287,7 +287,7 @@ DEF_CVT_SCALE_FUNC(32f16f, cvt1_32f, float, float16_t, float) DEF_CVT_SCALE_FUNC(64f16f, cvt_64f, double, float16_t, double) DEF_CVT_SCALE_FUNC(16f, cvt1_32f, float16_t, float16_t, float) -static BinaryFunc getCvtScaleAbsFunc(ElemType depth) +static BinaryFunc getCvtScaleAbsFunc(ElemDepth depth) { static BinaryFunc cvtScaleAbsTab[] = { @@ -299,7 +299,7 @@ static BinaryFunc getCvtScaleAbsFunc(ElemType depth) return cvtScaleAbsTab[depth]; } -BinaryFunc getConvertScaleFunc(ElemType sdepth, ElemType ddepth) +BinaryFunc getConvertScaleFunc(ElemDepth sdepth, ElemDepth ddepth) { static BinaryFunc cvtScaleTab[][8] = { @@ -355,7 +355,7 @@ static bool ocl_convertScaleAbs( InputArray _src, OutputArray _dst, double alpha const ocl::Device & d = ocl::Device::getDefault(); ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type); bool doubleSupport = d.doubleFPConfig() > 0; if (!doubleSupport && depth == CV_64F) @@ -376,7 +376,7 @@ static bool ocl_convertScaleAbs( InputArray _src, OutputArray _dst, double alpha int rowsPerWI = d.isIntel() ? 4 : 1; char cvt[2][50]; - ElemType wdepth = CV_MAX_DEPTH(depth, CV_32F); + ElemDepth wdepth = CV_MAX_DEPTH(depth, CV_32F); String build_opt = format("-D OP_CONVERT_SCALE_ABS -D UNARY_OP -D dstT=%s -D srcT1=%s" " -D workT=%s -D wdepth=%d -D convertToWT1=%s -D convertToDT=%s" " -D workT1=%s -D rowsPerWI=%d%s", @@ -449,7 +449,7 @@ namespace cv { #ifdef HAVE_OPENCL -static bool ocl_normalize( InputArray _src, InputOutputArray _dst, InputArray _mask, ElemType ddepth, +static bool ocl_normalize( InputArray _src, InputOutputArray _dst, InputArray _mask, ElemDepth ddepth, double scale, double delta ) { UMat src = _src.getUMat(); @@ -461,9 +461,9 @@ static bool ocl_normalize( InputArray _src, InputOutputArray _dst, InputArray _m const ocl::Device & dev = ocl::Device::getDefault(); ElemType stype = _src.type(); - ElemType sdepth = CV_MAT_DEPTH(stype); + ElemDepth sdepth = CV_MAT_DEPTH(stype); int cn = CV_MAT_CN(stype); - ElemType wdepth = CV_MAX_DEPTH(CV_32F, sdepth, ddepth); + ElemDepth wdepth = CV_MAX_DEPTH(CV_32F, sdepth, ddepth); int rowsPerWI = dev.isIntel() ? 4 : 1; float fscale = static_cast(scale), fdelta = static_cast(delta); @@ -541,15 +541,15 @@ static bool ocl_normalize( InputArray _src, InputOutputArray _dst, InputArray _m } // cv:: void cv::normalize( InputArray _src, InputOutputArray _dst, double a, double b, - int norm_type, ElemType ddepth, InputArray _mask ) + int norm_type, ElemDepth ddepth, InputArray _mask ) { CV_INSTRUMENT_REGION(); double scale = 1, shift = 0; ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); - if (ddepth == CV_TYPE_AUTO) + if (ddepth == CV_DEPTH_AUTO) ddepth = _dst.fixedType() ? _dst.depth() : depth; if( norm_type == CV_MINMAX ) diff --git a/modules/core/src/copy.cpp b/modules/core/src/copy.cpp index 8ca8c1dfb53e..4bf062251676 100644 --- a/modules/core/src/copy.cpp +++ b/modules/core/src/copy.cpp @@ -657,7 +657,7 @@ static bool ocl_flip(InputArray _src, OutputArray _dst, int flipCode ) const ocl::Device & dev = ocl::Device::getDefault(); ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type), flipType, kercn = std::min(ocl::predictOptimalVectorWidth(_src, _dst), 4); @@ -843,7 +843,7 @@ static bool ocl_repeat(InputArray _src, int ny, int nx, OutputArray _dst) } ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type), rowsPerWI = ocl::Device::getDefault().isIntel() ? 4 : 1, kercn = ocl::predictOptimalVectorWidth(_src, _dst); @@ -1090,7 +1090,7 @@ static bool ocl_copyMakeBorder( InputArray _src, OutputArray _dst, int top, int { ElemType type = _src.type(); int cn = CV_MAT_CN(type); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int rowsPerWI = ocl::Device::getDefault().isIntel() ? 4 : 1; bool isolated = (borderType & BORDER_ISOLATED) != 0; borderType &= ~cv::BORDER_ISOLATED; diff --git a/modules/core/src/count_non_zero.cpp b/modules/core/src/count_non_zero.cpp index 68a5e5abf17f..6191d3693fbb 100644 --- a/modules/core/src/count_non_zero.cpp +++ b/modules/core/src/count_non_zero.cpp @@ -177,7 +177,7 @@ static int countNonZero64f( const double* src, int len ) typedef int (*CountNonZeroFunc)(const uchar*, int); -static CountNonZeroFunc getCountNonZeroTab(ElemType depth) +static CountNonZeroFunc getCountNonZeroTab(ElemDepth depth) { static CountNonZeroFunc countNonZeroTab[] = { @@ -195,7 +195,7 @@ static CountNonZeroFunc getCountNonZeroTab(ElemType depth) static bool ocl_countNonZero( InputArray _src, int & res ) { ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int kercn = ocl::predictOptimalVectorWidth(_src); bool doubleSupport = ocl::Device::getDefault().doubleFPConfig() > 0; @@ -243,7 +243,7 @@ static bool ipp_countNonZero( Mat &src, int &res ) #endif Ipp32s count = 0; - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); if(src.dims <= 2) { @@ -334,7 +334,7 @@ void cv::findNonZero( InputArray _src, OutputArray _idx ) Mat src = _src.getMat(); CV_Assert( src.channels() == 1 && src.dims == 2 ); - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); std::vector idxvec; int rows = src.rows, cols = src.cols; AutoBuffer buf_(cols + 1); diff --git a/modules/core/src/cuda/gpu_mat.cu b/modules/core/src/cuda/gpu_mat.cu index a1f87744ad3d..a64b13e78e74 100644 --- a/modules/core/src/cuda/gpu_mat.cu +++ b/modules/core/src/cuda/gpu_mat.cu @@ -523,14 +523,14 @@ namespace } } -void cv::cuda::GpuMat::convertTo(OutputArray _dst, ElemType ddepth, Stream& stream) const +void cv::cuda::GpuMat::convertTo(OutputArray _dst, ElemDepth ddepth, Stream& stream) const { - if (ddepth == CV_TYPE_AUTO) + if (ddepth == CV_DEPTH_AUTO) ddepth = _dst.fixedType() ? _dst.depth() : depth(); ddepth = CV_MAT_DEPTH(ddepth); /* backwards compatibility */ ElemType dtype = CV_MAKETYPE(ddepth, channels()); - const ElemType sdepth = depth(); + const ElemDepth sdepth = depth(); if (sdepth == ddepth) { if (stream) @@ -563,14 +563,14 @@ void cv::cuda::GpuMat::convertTo(OutputArray _dst, ElemType ddepth, Stream& stre funcs[sdepth][ddepth](reshape(1), dst.reshape(1), stream); } -void cv::cuda::GpuMat::convertTo(OutputArray _dst, ElemType ddepth, double alpha, double beta, Stream& stream) const +void cv::cuda::GpuMat::convertTo(OutputArray _dst, ElemDepth ddepth, double alpha, double beta, Stream& stream) const { - if (ddepth == CV_TYPE_AUTO) + if (ddepth == CV_DEPTH_AUTO) ddepth = _dst.fixedType() ? _dst.depth() : depth(); ddepth = CV_MAT_DEPTH(ddepth); /* backwards compatibility */ ElemType dtype = CV_MAKETYPE(ddepth, channels()); - const ElemType sdepth = depth(); + const ElemDepth sdepth = depth(); GpuMat src = *this; @@ -595,7 +595,7 @@ void cv::cuda::GpuMat::convertTo(OutputArray _dst, ElemType ddepth, double alpha void cv::cuda::convertFp16(InputArray _src, OutputArray _dst, Stream& stream) { GpuMat src = _src.getGpuMat(); - ElemType ddepth = CV_TYPE_AUTO; + ElemDepth ddepth = CV_DEPTH_AUTO; switch(src.depth()) { diff --git a/modules/core/src/cuda_gpu_mat.cpp b/modules/core/src/cuda_gpu_mat.cpp index 93047ccc13f6..b004b43005a7 100644 --- a/modules/core/src/cuda_gpu_mat.cpp +++ b/modules/core/src/cuda_gpu_mat.cpp @@ -494,7 +494,7 @@ GpuMat& cv::cuda::GpuMat::setTo(Scalar s, InputArray _mask, Stream& _stream) throw_no_cuda(); } -void cv::cuda::GpuMat::convertTo(OutputArray _dst, ElemType ddepth, Stream& _stream) const +void cv::cuda::GpuMat::convertTo(OutputArray _dst, ElemDepth ddepth, Stream& _stream) const { CV_UNUSED(_dst); CV_UNUSED(ddepth); @@ -502,7 +502,7 @@ void cv::cuda::GpuMat::convertTo(OutputArray _dst, ElemType ddepth, Stream& _str throw_no_cuda(); } -void cv::cuda::GpuMat::convertTo(OutputArray _dst, ElemType ddepth, double alpha, double beta, Stream& _stream) const +void cv::cuda::GpuMat::convertTo(OutputArray _dst, ElemDepth ddepth, double alpha, double beta, Stream& _stream) const { CV_UNUSED(_dst); CV_UNUSED(ddepth); diff --git a/modules/core/src/downhill_simplex.cpp b/modules/core/src/downhill_simplex.cpp index 425a63a8a777..b86d6a6526f9 100644 --- a/modules/core/src/downhill_simplex.cpp +++ b/modules/core/src/downhill_simplex.cpp @@ -201,7 +201,7 @@ class DownhillSolverImpl CV_FINAL : public DownhillSolver } else { - ElemType x_depth = x_.fixedType() ? x_.depth() : CV_64F; + ElemDepth x_depth = x_.fixedType() ? x_.depth() : CV_64F; simplex.row(0).convertTo(x_, x_depth); } return res; diff --git a/modules/core/src/dxt.cpp b/modules/core/src/dxt.cpp index d2f2516949b5..39ee78a08b3e 100644 --- a/modules/core/src/dxt.cpp +++ b/modules/core/src/dxt.cpp @@ -1885,11 +1885,11 @@ struct OCL_FftPlan String buildOptions; int thread_count; int dft_size; - ElemType dft_depth; + ElemDepth dft_depth; bool status; public: - OCL_FftPlan(int _size, ElemType _depth) : dft_size(_size), dft_depth(_depth), status(true) + OCL_FftPlan(int _size, ElemDepth _depth) : dft_size(_size), dft_depth(_depth), status(true) { CV_Assert( dft_depth == CV_32F || dft_depth == CV_64F ); @@ -2092,7 +2092,7 @@ class OCL_FftPlanCache CV_SINGLETON_LAZY_INIT_REF(OCL_FftPlanCache, new OCL_FftPlanCache()) } - Ptr getFftPlan(int dft_size, ElemType depth) + Ptr getFftPlan(int dft_size, ElemDepth depth) { int key = (dft_size << 16) | (depth & 0xFFFF); std::map >::iterator f = planStorage.find(key); @@ -2124,7 +2124,7 @@ class OCL_FftPlanCache static bool ocl_dft_rows(InputArray _src, OutputArray _dst, int nonzero_rows, int flags, int fftType) { ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); Ptr plan = OCL_FftPlanCache::getInstance().getFftPlan(_src.cols(), depth); return plan->enqueueTransform(_src, _dst, nonzero_rows, flags, fftType, true); } @@ -2132,7 +2132,7 @@ static bool ocl_dft_rows(InputArray _src, OutputArray _dst, int nonzero_rows, in static bool ocl_dft_cols(InputArray _src, OutputArray _dst, int nonzero_cols, int flags, int fftType) { ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); Ptr plan = OCL_FftPlanCache::getInstance().getFftPlan(_src.rows(), depth); return plan->enqueueTransform(_src, _dst, nonzero_cols, flags, fftType, false); } @@ -2164,7 +2164,7 @@ static bool ocl_dft(InputArray _src, OutputArray _dst, int flags, int nonzero_ro { ElemType type = _src.type(); int cn = CV_MAT_CN(type); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); Size ssize = _src.size(); bool doubleSupport = ocl::Device::getDefault().doubleFPConfig() > 0; @@ -2418,7 +2418,7 @@ static void CL_CALLBACK oclCleanupCallback(cl_event e, cl_int, void *p) static bool ocl_dft_amdfft(InputArray _src, OutputArray _dst, int flags) { ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type); Size ssize = _src.size(); @@ -2506,7 +2506,7 @@ static void complementComplex(T * ptr, size_t step, int n, int len, int dft_dims } } -static void complementComplexOutput(ElemType depth, uchar * ptr, size_t step, int count, int len, int dft_dims) +static void complementComplexOutput(ElemDepth depth, uchar * ptr, size_t step, int count, int len, int dft_dims) { if( depth == CV_32F ) complementComplex((float*)ptr, step, count, len, dft_dims); @@ -2626,7 +2626,7 @@ class OcvDftImpl CV_FINAL : public hal::DFT2D DftMode mode; int elem_size; int complex_elem_size; - ElemType depth; + ElemDepth depth; bool real_transform; int nonzero_rows; bool isRowTransform; @@ -2662,7 +2662,7 @@ class OcvDftImpl CV_FINAL : public hal::DFT2D dst_channels = 0; } - void init(int _width, int _height, ElemType _depth, int _src_channels, int _dst_channels, int flags, int _nonzero_rows) + void init(int _width, int _height, ElemDepth _depth, int _src_channels, int _dst_channels, int flags, int _nonzero_rows) { bool isComplex = _src_channels != _dst_channels; nonzero_rows = _nonzero_rows; @@ -3062,7 +3062,7 @@ class OcvDftBasicImpl CV_FINAL : public hal::DFT1D { opt.factors = _factors; } - void init(int len, int count, ElemType depth, int flags, bool *needBuffer) + void init(int len, int count, ElemDepth depth, int flags, bool *needBuffer) { int prev_len = opt.n; @@ -3214,7 +3214,7 @@ struct ReplacementDFT1D : public hal::DFT1D bool isInitialized; ReplacementDFT1D() : context(0), isInitialized(false) {} - bool init(int len, int count, ElemType depth, int flags, bool *needBuffer) + bool init(int len, int count, ElemDepth depth, int flags, bool *needBuffer) { int res = cv_hal_dftInit1D(&context, len, count, depth, flags, needBuffer); isInitialized = (res == CV_HAL_ERROR_OK); @@ -3242,7 +3242,7 @@ struct ReplacementDFT2D : public hal::DFT2D bool isInitialized; ReplacementDFT2D() : context(0), isInitialized(false) {} - bool init(int width, int height, ElemType depth, + bool init(int width, int height, ElemDepth depth, int src_channels, int dst_channels, int flags, int nonzero_rows) { @@ -3270,7 +3270,7 @@ namespace hal { //================== 1D ====================== -Ptr DFT1D::create(int len, int count, ElemType depth, int flags, bool *needBuffer) +Ptr DFT1D::create(int len, int count, ElemDepth depth, int flags, bool *needBuffer) { { ReplacementDFT1D *impl = new ReplacementDFT1D(); @@ -3289,7 +3289,7 @@ Ptr DFT1D::create(int len, int count, ElemType depth, int flags, bool *ne //================== 2D ====================== -Ptr DFT2D::create(int width, int height, ElemType depth, +Ptr DFT2D::create(int width, int height, ElemDepth depth, int src_channels, int dst_channels, int flags, int nonzero_rows) { @@ -3336,7 +3336,7 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows ) Mat src0 = _src0.getMat(), src = src0; bool inv = (flags & DFT_INVERSE) != 0; ElemType type = src.type(); - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); CV_Assert( type == CV_32FC1 || type == CV_32FC2 || type == CV_64FC1 || type == CV_64FC2 ); @@ -3541,7 +3541,7 @@ void cv::mulSpectrums( InputArray _srcA, InputArray _srcB, ocl_mulSpectrums(_srcA, _srcB, _dst, flags, conjB)) Mat srcA = _srcA.getMat(), srcB = _srcB.getMat(); - ElemType depth = srcA.depth(); + ElemDepth depth = srcA.depth(); int cn = srcA.channels(); ElemType type = srcA.type(); size_t rows = srcA.rows, cols = srcA.cols; @@ -4073,9 +4073,9 @@ class OcvDctImpl CV_FINAL : public hal::DCT2D int end_stage; int width; int height; - ElemType depth; + ElemDepth depth; - void init(int _width, int _height, ElemType _depth, int flags) + void init(int _width, int _height, ElemDepth _depth, int flags) { width = _width; height = _height; @@ -4198,7 +4198,7 @@ struct ReplacementDCT2D : public hal::DCT2D bool isInitialized; ReplacementDCT2D() : context(0), isInitialized(false) {} - bool init(int width, int height, ElemType depth, int flags) + bool init(int width, int height, ElemDepth depth, int flags) { int res = hal_ni_dctInit2D(&context, width, height, depth, flags); isInitialized = (res == CV_HAL_ERROR_OK); @@ -4222,7 +4222,7 @@ struct ReplacementDCT2D : public hal::DCT2D namespace hal { -Ptr DCT2D::create(int width, int height, ElemType depth, int flags) +Ptr DCT2D::create(int width, int height, ElemDepth depth, int flags) { { ReplacementDCT2D *impl = new ReplacementDCT2D(); @@ -4248,7 +4248,7 @@ void cv::dct( InputArray _src0, OutputArray _dst, int flags ) Mat src0 = _src0.getMat(), src = src0; ElemType type = src.type(); - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); CV_Assert( type == CV_32FC1 || type == CV_64FC1 ); _dst.create( src.rows, src.cols, type ); diff --git a/modules/core/src/hal_replacement.hpp b/modules/core/src/hal_replacement.hpp index e837ae850aa2..24361fe61087 100644 --- a/modules/core/src/hal_replacement.hpp +++ b/modules/core/src/hal_replacement.hpp @@ -507,7 +507,7 @@ struct cvhalDFT {}; @param flags algorithm options (combination of CV_HAL_DFT_INVERSE, CV_HAL_DFT_SCALE, ...) @param needBuffer pointer to boolean variable, if valid pointer provided, then variable value should be set to true to signal that additional memory buffer is needed for operations */ -inline int hal_ni_dftInit1D(cvhalDFT **context, int len, int count, ElemType depth, int flags, bool *needBuffer) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } +inline int hal_ni_dftInit1D(cvhalDFT **context, int len, int count, ElemDepth depth, int flags, bool *needBuffer) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } /** @param context pointer to context storing all necessary data @param src source data @@ -534,7 +534,7 @@ inline int hal_ni_dftFree1D(cvhalDFT *context) { return CV_HAL_ERROR_NOT_IMPLEME @param flags algorithm options (combination of CV_HAL_DFT_INVERSE, ...) @param nonzero_rows number of nonzero rows in image, can be used for optimization */ -inline int hal_ni_dftInit2D(cvhalDFT **context, int width, int height, ElemType depth, int src_channels, int dst_channels, int flags, int nonzero_rows) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } +inline int hal_ni_dftInit2D(cvhalDFT **context, int width, int height, ElemDepth depth, int src_channels, int dst_channels, int flags, int nonzero_rows) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } /** @param context pointer to context storing all necessary data @param src_data,src_step source image data and step @@ -558,7 +558,7 @@ inline int hal_ni_dftFree2D(cvhalDFT *context) { return CV_HAL_ERROR_NOT_IMPLEME @param depth image type (CV_32F or CV64F) @param flags algorithm options (combination of CV_HAL_DFT_INVERSE, ...) */ -inline int hal_ni_dctInit2D(cvhalDFT **context, int width, int height, ElemType depth, int flags) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } +inline int hal_ni_dctInit2D(cvhalDFT **context, int width, int height, ElemDepth depth, int flags) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } /** @param context pointer to context storing all necessary data @param src_data,src_step source image data and step @@ -721,7 +721,7 @@ inline int hal_ni_gemm64fc(const double* src1, size_t src1_step, const double* s @param minIdx,maxIdx Pointer to the returned minimum and maximum location. @param mask Specified array region. */ -inline int hal_ni_minMaxIdx(const uchar* src_data, size_t src_step, int width, int height, ElemType depth, double* minVal, double* maxVal, +inline int hal_ni_minMaxIdx(const uchar* src_data, size_t src_step, int width, int height, ElemDepth depth, double* minVal, double* maxVal, int* minIdx, int* maxIdx, uchar* mask) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } //! @cond IGNORED diff --git a/modules/core/src/lapack.cpp b/modules/core/src/lapack.cpp index 666f27e2d9cf..e352038409cf 100644 --- a/modules/core/src/lapack.cpp +++ b/modules/core/src/lapack.cpp @@ -1695,7 +1695,7 @@ cvEigenVV( CvArr* srcarr, CvArr* evectsarr, CvArr* evalsarr, double, if( evects0.data != evects.data ) { const uchar* p = evects0.ptr(); - evects.convertTo(evects0, evects0.type()); + evects.convertTo(evects0, evects0.depth()); CV_Assert( p == evects0.ptr() ); } } @@ -1705,11 +1705,11 @@ cvEigenVV( CvArr* srcarr, CvArr* evectsarr, CvArr* evalsarr, double, { const uchar* p = evals0.ptr(); if( evals0.size() == evals.size() ) - evals.convertTo(evals0, evals0.type()); + evals.convertTo(evals0, evals0.depth()); else if( evals0.type() == evals.type() ) cv::transpose(evals, evals0); else - cv::Mat(evals.t()).convertTo(evals0, evals0.type()); + cv::Mat(evals.t()).convertTo(evals0, evals0.depth()); CV_Assert( p == evals0.ptr() ); } } diff --git a/modules/core/src/lda.cpp b/modules/core/src/lda.cpp index 053dffedb51f..ae36e37c005b 100644 --- a/modules/core/src/lda.cpp +++ b/modules/core/src/lda.cpp @@ -78,9 +78,9 @@ static Mat asRowMatrix(InputArrayOfArrays src, ElemType rtype, double alpha = 1, Mat xi = data.row(i); // make reshape happy by cloning for non-continuous matrices if(src.getMat(i).isContinuous()) { - src.getMat(i).reshape(1, 1).convertTo(xi, rtype, alpha, beta); + src.getMat(i).reshape(1, 1).convertTo(xi, CV_MAT_DEPTH(rtype), alpha, beta); } else { - src.getMat(i).clone().reshape(1, 1).convertTo(xi, rtype, alpha, beta); + src.getMat(i).clone().reshape(1, 1).convertTo(xi, CV_MAT_DEPTH(rtype), alpha, beta); } } return data; @@ -190,7 +190,7 @@ Mat LDA::subspaceProject(InputArray _W, InputArray _mean, InputArray _src) { // create temporary matrices Mat X, Y; // make sure you operate on correct type - src.convertTo(X, W.type()); + src.convertTo(X, W.depth()); // safe to do, because of above assertion if(!mean.empty()) { for(int i=0; i sorted_eigenvalues64f(n); for (size_t i = 0; i < n; i++) sorted_eigenvalues64f[i] = eigenvalues64f[sort_indexes[i]]; - Mat(sorted_eigenvalues64f).convertTo(_evals, type); + Mat(sorted_eigenvalues64f).convertTo(_evals, depth); if( _evects.needed() ) { @@ -988,7 +988,7 @@ void eigenNonSymmetric(InputArray _src, OutputArray _evals, OutputArray _evects) CV_Assert(pSrc != NULL); memcpy(pDst, pSrc, n * sizeof(double)); } - sorted_eigenvectors64f.convertTo(_evects, type); + sorted_eigenvectors64f.convertTo(_evects, depth); } } @@ -1109,10 +1109,10 @@ void LDA::lda(InputArrayOfArrays _src, InputArray _lbls) { numClass[classIdx]++; } // calculate total mean - meanTotal.convertTo(meanTotal, meanTotal.type(), 1.0 / static_cast (N)); + meanTotal.convertTo(meanTotal, meanTotal.depth(), 1.0 / static_cast (N)); // calculate class means for (int i = 0; i < C; i++) { - meanClass[i].convertTo(meanClass[i], meanClass[i].type(), 1.0 / static_cast (numClass[i])); + meanClass[i].convertTo(meanClass[i], meanClass[i].depth(), 1.0 / static_cast (numClass[i])); } // subtract class means for (int i = 0; i < N; i++) { diff --git a/modules/core/src/lut.cpp b/modules/core/src/lut.cpp index 309812544b0e..c03b4b940fc1 100644 --- a/modules/core/src/lut.cpp +++ b/modules/core/src/lut.cpp @@ -79,7 +79,7 @@ static LUTFunc lutTab[] = static bool ocl_LUT(InputArray _src, InputArray _lut, OutputArray _dst) { int lcn = _lut.channels(), dcn = _src.channels(); - ElemType ddepth = _lut.depth(); + ElemDepth ddepth = _lut.depth(); UMat src = _src.getUMat(), lut = _lut.getUMat(); _dst.create(src.size(), CV_MAKETYPE(ddepth, dcn)); @@ -362,7 +362,7 @@ void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst ) CV_INSTRUMENT_REGION(); int cn = _src.channels(); - ElemType depth = _src.depth(); + ElemDepth depth = _src.depth(); int lutcn = _lut.channels(); CV_Assert( (lutcn == cn || lutcn == 1) && diff --git a/modules/core/src/mathfuncs.cpp b/modules/core/src/mathfuncs.cpp index c16b8523ad4e..67e114110c0a 100644 --- a/modules/core/src/mathfuncs.cpp +++ b/modules/core/src/mathfuncs.cpp @@ -61,7 +61,7 @@ static const char* oclop2str[] = { "OP_LOG", "OP_EXP", "OP_MAG", "OP_PHASE_DEGRE static bool ocl_math_op(InputArray _src1, InputArray _src2, OutputArray _dst, int oclop) { ElemType type = _src1.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type); int kercn = oclop == OCL_OP_PHASE_DEGREES || oclop == OCL_OP_PHASE_RADIANS ? 1 : ocl::predictOptimalVectorWidth(_src1, _src2, _dst); @@ -150,7 +150,7 @@ void magnitude( InputArray src1, InputArray src2, OutputArray dst ) CV_INSTRUMENT_REGION(); int type = src1.type(); - ElemType depth = src1.depth(); + ElemDepth depth = src1.depth(); int cn = src1.channels(); CV_Assert( src1.size() == src2.size() && type == src2.type() && (depth == CV_32F || depth == CV_64F)); @@ -188,7 +188,7 @@ void phase( InputArray src1, InputArray src2, OutputArray dst, bool angleInDegre CV_INSTRUMENT_REGION(); ElemType type = src1.type(); - ElemType depth = src1.depth(); + ElemDepth depth = src1.depth(); int cn = src1.channels(); CV_Assert( src1.size() == src2.size() && type == src2.type() && (depth == CV_32F || depth == CV_64F)); @@ -235,7 +235,7 @@ static bool ocl_cartToPolar( InputArray _src1, InputArray _src2, { const ocl::Device & d = ocl::Device::getDefault(); ElemType type = _src1.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type), rowsPerWI = d.isIntel() ? 4 : 1; bool doubleSupport = d.doubleFPConfig() > 0; @@ -282,7 +282,7 @@ void cartToPolar( InputArray src1, InputArray src2, Mat X = src1.getMat(), Y = src2.getMat(); ElemType type = X.type(); - ElemType depth = X.depth(); + ElemDepth depth = X.depth(); int cn = X.channels(); CV_Assert( X.size == Y.size && type == Y.type() && (depth == CV_32F || depth == CV_64F)); dst1.create( X.dims, X.size, type ); @@ -477,7 +477,7 @@ static bool ocl_polarToCart( InputArray _mag, InputArray _angle, { const ocl::Device & d = ocl::Device::getDefault(); ElemType type = _angle.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type), rowsPerWI = d.isIntel() ? 4 : 1; bool doubleSupport = d.doubleFPConfig() > 0; @@ -515,7 +515,7 @@ static bool ipp_polarToCart(Mat &mag, Mat &angle, Mat &x, Mat &y) { CV_INSTRUMENT_REGION_IPP(); - ElemType depth = angle.depth(); + ElemDepth depth = angle.depth(); if(depth != CV_32F && depth != CV_64F) return false; @@ -575,7 +575,7 @@ void polarToCart( InputArray src1, InputArray src2, CV_INSTRUMENT_REGION(); ElemType type = src2.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type); CV_Assert((depth == CV_32F || depth == CV_64F) && (src1.empty() || src1.type() == type)); @@ -680,7 +680,7 @@ void exp( InputArray _src, OutputArray _dst ) CV_INSTRUMENT_REGION(); ElemType type = _src.type(); - ElemType depth = _src.depth(); + ElemDepth depth = _src.depth(); int cn = _src.channels(); CV_Assert( depth == CV_32F || depth == CV_64F ); @@ -715,7 +715,7 @@ void log( InputArray _src, OutputArray _dst ) CV_INSTRUMENT_REGION(); ElemType type = _src.type(); - ElemType depth = _src.depth(); + ElemDepth depth = _src.depth(); int cn = _src.channels(); CV_Assert( depth == CV_32F || depth == CV_64F ); @@ -1155,7 +1155,7 @@ static bool ocl_pow(InputArray _src, double power, OutputArray _dst, { const ocl::Device & d = ocl::Device::getDefault(); ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type), rowsPerWI = d.isIntel() ? 4 : 1; bool doubleSupport = d.doubleFPConfig() > 0; @@ -1225,7 +1225,7 @@ void pow( InputArray _src, double power, OutputArray _dst ) CV_INSTRUMENT_REGION(); ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type), ipower = cvRound(power); bool is_ipower = fabs(ipower - power) < DBL_EPSILON; #ifdef HAVE_OPENCL @@ -1417,7 +1417,7 @@ template<> struct mat_type_assotiations static const type max_allowable = INT_MAX; }; -template +template static bool checkIntegerRange(cv::Mat src, Point& bad_pt, int minVal, int maxVal) { typedef mat_type_assotiations type_ass; @@ -1483,7 +1483,7 @@ bool checkRange(InputArray _src, bool quiet, Point* pt, double minVal, double ma return true; } - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); Point badPt(-1, -1); if (depth < CV_32F) @@ -1912,7 +1912,7 @@ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters ) int iter, i, j; Mat coeffs0 = _coeffs0.getMat(); ElemType ctype = _coeffs0.type(); - ElemType cdepth = CV_MAT_DEPTH(ctype); + ElemDepth cdepth = CV_MAT_DEPTH(ctype); CV_Assert( CV_MAT_DEPTH(ctype) >= CV_32F && CV_MAT_CN(ctype) <= 2 ); CV_Assert( coeffs0.rows == 1 || coeffs0.cols == 1 ); @@ -1925,7 +1925,7 @@ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters ) AutoBuffer buf(n*2+2); C *coeffs = buf.data(), *roots = coeffs + n + 1; Mat coeffs1(coeffs0.size(), CV_MAKETYPE(CV_64F, coeffs0.channels()), coeffs0.channels() == 2 ? coeffs : roots); - coeffs0.convertTo(coeffs1, coeffs1.type()); + coeffs0.convertTo(coeffs1, coeffs1.depth()); if( coeffs0.channels() == 1 ) { const double* rcoeffs = (const double*)roots; @@ -2020,7 +2020,7 @@ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters ) for( ; n < n0; n++ ) roots[n+1] = roots[n]; - Mat(roots0.size(), CV_64FC2, roots).convertTo(roots0, roots0.type()); + Mat(roots0.size(), CV_64FC2, roots).convertTo(roots0, roots0.depth()); return maxDiff; } diff --git a/modules/core/src/matmul.cpp b/modules/core/src/matmul.cpp index 7a181eaa1b59..e2560e5886ad 100644 --- a/modules/core/src/matmul.cpp +++ b/modules/core/src/matmul.cpp @@ -794,7 +794,7 @@ static bool ocl_gemm_amdblas( InputArray matA, InputArray matB, double alpha, static bool ocl_gemm( InputArray matA, InputArray matB, double alpha, InputArray matC, double beta, OutputArray matD, int flags ) { - ElemType depth = matA.depth(); + ElemDepth depth = matA.depth(); int cn = matA.channels(); ElemType type = CV_MAKETYPE(depth, cn); @@ -1513,7 +1513,7 @@ void cv::hal::gemm32f(const float* src1, size_t src1_step, const float* src2, si { CALL_HAL(gemm32f, cv_hal_gemm32f, src1, src1_step, src2, src2_step, alpha, src3, src3_step, beta, dst, dst_step, m_a, n_a, n_d, flags) - callGemmImpl(src1, src1_step, src2, src2_step, alpha, src3, src3_step, beta, dst, dst_step, m_a, n_a, n_d, flags, CV_32F); + callGemmImpl(src1, src1_step, src2, src2_step, alpha, src3, src3_step, beta, dst, dst_step, m_a, n_a, n_d, flags, CV_32FC1); } void cv::hal::gemm64f(const double* src1, size_t src1_step, const double* src2, size_t src2_step, @@ -1521,7 +1521,7 @@ void cv::hal::gemm64f(const double* src1, size_t src1_step, const double* src2, int m_a, int n_a, int n_d, int flags) { CALL_HAL(gemm64f, cv_hal_gemm64f, src1, src1_step, src2, src2_step, alpha, src3, src3_step, beta, dst, dst_step, m_a, n_a, n_d, flags) - callGemmImpl(src1, src1_step, src2, src2_step, alpha, src3, src3_step, beta, dst, dst_step, m_a, n_a, n_d, flags, CV_64F); + callGemmImpl(src1, src1_step, src2, src2_step, alpha, src3, src3_step, beta, dst, dst_step, m_a, n_a, n_d, flags, CV_64FC1); } CV_EXPORTS void cv::hal::gemm32fc(const float* src1, size_t src1_step, const float* src2, size_t src2_step, @@ -2057,7 +2057,7 @@ diagtransform_64f(const double* src, double* dst, const double* m, int len, int typedef void (*TransformFunc)( const uchar* src, uchar* dst, const uchar* m, int, int, int ); -static TransformFunc getTransformFunc(ElemType depth) +static TransformFunc getTransformFunc(ElemDepth depth) { static TransformFunc transformTab[] = { @@ -2069,7 +2069,7 @@ static TransformFunc getTransformFunc(ElemType depth) return transformTab[depth]; } -static TransformFunc getDiagTransformFunc(ElemType depth) +static TransformFunc getDiagTransformFunc(ElemDepth depth) { static TransformFunc diagTransformTab[] = { @@ -2088,7 +2088,7 @@ void cv::transform( InputArray _src, OutputArray _dst, InputArray _mtx ) CV_INSTRUMENT_REGION(); Mat src = _src.getMat(), m = _mtx.getMat(); - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); int scn = src.channels(), dcn = m.rows; CV_Assert( scn == m.cols || scn + 1 == m.cols ); bool isDiag = false; @@ -2107,11 +2107,11 @@ void cv::transform( InputArray _src, OutputArray _dst, InputArray _mtx ) Mat tmp(dcn, scn+1, mtype, mbuf); memset(tmp.ptr(), 0, tmp.total()*tmp.elemSize()); if( m.cols == scn+1 ) - m.convertTo(tmp, mtype); + m.convertTo(tmp, CV_MAT_DEPTH(mtype)); else { Mat tmppart = tmp.colRange(0, m.cols); - m.convertTo(tmppart, mtype); + m.convertTo(tmppart, CV_MAT_DEPTH(mtype)); } m = tmp; } @@ -2130,7 +2130,7 @@ void cv::transform( InputArray _src, OutputArray _dst, InputArray _mtx ) alpha = m.at(0), beta = m.at(1); else alpha = m.at(0), beta = m.at(1); - src.convertTo(dst, dst.type(), alpha, beta); + src.convertTo(dst, dst.depth(), alpha, beta); return; } @@ -2269,7 +2269,7 @@ void cv::perspectiveTransform( InputArray _src, OutputArray _dst, InputArray _mt CV_INSTRUMENT_REGION(); Mat src = _src.getMat(), m = _mtx.getMat(); - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); int scn = src.channels(), dcn = m.rows - 1; CV_Assert( scn + 1 == m.cols ); CV_Assert( depth == CV_32F || depth == CV_64F ); @@ -2286,7 +2286,7 @@ void cv::perspectiveTransform( InputArray _src, OutputArray _dst, InputArray _mt _mbuf.allocate((dcn+1)*(scn+1)); mbuf = _mbuf.data(); Mat tmp(dcn+1, scn+1, mtype, mbuf); - m.convertTo(tmp, mtype); + m.convertTo(tmp, CV_MAT_DEPTH(mtype)); m = tmp; } @@ -2370,13 +2370,13 @@ static bool ocl_scaleAdd(InputArray _src1, double alpha, InputArray _src2, Outpu bool doubleSupport = d.doubleFPConfig() > 0; Size size = _src1.size(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); if ( (!doubleSupport && depth == CV_64F) || size != _src2.size() ) return false; _dst.create(size, type); int cn = CV_MAT_CN(type); - ElemType wdepth = CV_MAX_DEPTH(depth, CV_32F); + ElemDepth wdepth = CV_MAX_DEPTH(depth, CV_32F); int kercn = ocl::predictOptimalVectorWidthMax(_src1, _src2, _dst), rowsPerWI = d.isIntel() ? 4 : 1; @@ -2418,7 +2418,7 @@ void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray CV_INSTRUMENT_REGION(); ElemType type = _src1.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type); CV_Assert( type == _src2.type() ); @@ -2462,7 +2462,7 @@ void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray * Covariation Matrix * \****************************************************************************************/ -void cv::calcCovarMatrix( const Mat* data, int nsamples, Mat& covar, Mat& _mean, int flags, ElemType cdepth ) +void cv::calcCovarMatrix( const Mat* data, int nsamples, Mat& covar, Mat& _mean, int flags, ElemDepth cdepth ) { CV_INSTRUMENT_REGION(); @@ -2505,7 +2505,7 @@ void cv::calcCovarMatrix( const Mat* data, int nsamples, Mat& covar, Mat& _mean, _mean = mean.reshape(1, size.height); } -void cv::calcCovarMatrix(InputArray _src, OutputArray _covar, InputOutputArray _mean, int flags, ElemType cdepth) +void cv::calcCovarMatrix(InputArray _src, OutputArray _covar, InputOutputArray _mean, int flags, ElemDepth cdepth) { CV_INSTRUMENT_REGION(); @@ -2601,7 +2601,7 @@ double cv::Mahalanobis( InputArray _v1, InputArray _v2, InputArray _icovar ) Mat v1 = _v1.getMat(), v2 = _v2.getMat(), icovar = _icovar.getMat(); ElemType type = v1.type(); - ElemType depth = v1.depth(); + ElemDepth depth = v1.depth(); Size sz = v1.size(); int i, j, len = sz.width*sz.height*v1.channels(); AutoBuffer buf(len); @@ -2888,13 +2888,13 @@ typedef void (*MulTransposedFunc)(const Mat& src, Mat& dst, const Mat& delta, do } void cv::mulTransposed( InputArray _src, OutputArray _dst, bool ata, - InputArray _delta, double scale, ElemType ddepth ) + InputArray _delta, double scale, ElemDepth ddepth ) { CV_INSTRUMENT_REGION(); Mat src = _src.getMat(), delta = _delta.getMat(); const int gemm_level = 100; // boundary above which GEMM is faster. - ElemType sdepth = src.depth(); + ElemDepth sdepth = src.depth(); ddepth = CV_MAX_DEPTH(ddepth >= CV_8U ? ddepth : sdepth, delta.depth(), CV_32F); CV_Assert( src.channels() == 1 ); @@ -3283,7 +3283,7 @@ static double dotProd_64f(const double* src1, const double* src2, int len) typedef double (*DotProdFunc)(const uchar* src1, const uchar* src2, int len); -static DotProdFunc getDotProdFunc(ElemType depth) +static DotProdFunc getDotProdFunc(ElemDepth depth) { static DotProdFunc dotProdTab[] = { @@ -3357,8 +3357,8 @@ cvTransform( const CvArr* srcarr, CvArr* dstarr, { cv::Mat v = cv::cvarrToMat(shiftvec).reshape(1,m.rows), _m(m.rows, m.cols + 1, m.type()), m1 = _m.colRange(0,m.cols), v1 = _m.col(m.cols); - m.convertTo(m1, m1.type()); - v.convertTo(v1, v1.type()); + m.convertTo(m1, m1.depth()); + v.convertTo(v1, v1.depth()); m = _m; } @@ -3412,10 +3412,10 @@ cvCalcCovarMatrix( const CvArr** vecarr, int count, } if( mean.data != mean0.data && mean0.data ) - mean.convertTo(mean0, mean0.type()); + mean.convertTo(mean0, mean0.depth()); if( cov.data != cov0.data ) - cov.convertTo(cov0, cov0.type()); + cov.convertTo(cov0, cov0.depth()); } @@ -3435,7 +3435,7 @@ cvMulTransposed( const CvArr* srcarr, CvArr* dstarr, delta = cv::cvarrToMat(deltaarr); cv::mulTransposed( src, dst, order != 0, delta, scale, dst.depth()); if( dst.data != dst0.data ) - dst.convertTo(dst0, dst0.type()); + dst.convertTo(dst0, dst0.depth()); } CV_IMPL double cvDotProduct( const CvArr* srcAarr, const CvArr* srcBarr ) @@ -3460,10 +3460,10 @@ cvCalcPCA( const CvArr* data_arr, CvArr* avg_arr, CvArr* eigenvals, CvArr* eigen flags, !evals.empty() ? evals.rows + evals.cols - 1 : 0); if( pca.mean.size() == mean.size() ) - pca.mean.convertTo( mean, mean.type() ); + pca.mean.convertTo(mean, mean.depth()); else { - cv::Mat temp; pca.mean.convertTo( temp, mean.type() ); + cv::Mat temp; pca.mean.convertTo(temp, mean.depth()); transpose( temp, mean ); } @@ -3479,12 +3479,12 @@ cvCalcPCA( const CvArr* data_arr, CvArr* avg_arr, CvArr* eigenvals, CvArr* eigen cv::Mat temp = evals0; if( evals.rows == 1 ) - evals.colRange(0, ecount0).convertTo(temp, evals0.type()); + evals.colRange(0, ecount0).convertTo(temp, evals0.depth()); else - evals.rowRange(0, ecount0).convertTo(temp, evals0.type()); + evals.rowRange(0, ecount0).convertTo(temp, evals0.depth()); if( temp.data != evals0.data ) transpose(temp, evals0); - evects.rowRange(0, ecount0).convertTo( evects0, evects0.type() ); + evects.rowRange(0, ecount0).convertTo(evects0, evects0.depth()); // otherwise some datatype's or size's were incorrect, so the output arrays have been reallocated CV_Assert( mean0.data == mean.data ); @@ -3516,7 +3516,7 @@ cvProjectPCA( const CvArr* data_arr, const CvArr* avg_arr, cv::Mat result = pca.project(data); if( result.cols != dst.cols ) result = result.reshape(1, 1); - result.convertTo(dst, dst.type()); + result.convertTo(dst, dst.depth()); CV_Assert(dst0.data == dst.data); } @@ -3545,7 +3545,7 @@ cvBackProjectPCA( const CvArr* proj_arr, const CvArr* avg_arr, pca.eigenvectors = evects.rowRange(0, n); cv::Mat result = pca.backProject(data); - result.convertTo(dst, dst.type()); + result.convertTo(dst, dst.depth()); CV_Assert(dst0.data == dst.data); } diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 976e47d73bff..11ac1db05f59 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -931,7 +931,7 @@ Mat Mat::diag(const Mat& d) return m; } -int Mat::checkVector(int _elemChannels, ElemType _depth, bool _requireContinuous) const +int Mat::checkVector(int _elemChannels, ElemDepth _depth, bool _requireContinuous) const { return data && (depth() == _depth || _depth <= CV_8U) && (isContinuous() || !_requireContinuous) && diff --git a/modules/core/src/matrix_c.cpp b/modules/core/src/matrix_c.cpp index 7fc00e499ec0..825151d83fc5 100644 --- a/modules/core/src/matrix_c.cpp +++ b/modules/core/src/matrix_c.cpp @@ -97,7 +97,7 @@ static Mat iplImageToMat(const IplImage* img, bool copyData) m.dims = 2; CV_DbgAssert(CV_IS_IMAGE(img) && img->imageData != 0); - ElemType imgdepth = static_cast(IPL2CV_DEPTH(img->depth)); + ElemDepth imgdepth = static_cast(IPL2CV_DEPTH(img->depth)); size_t esz; m.step[0] = img->widthStep; diff --git a/modules/core/src/matrix_expressions.cpp b/modules/core/src/matrix_expressions.cpp index 150293f9a154..c292abe7336e 100644 --- a/modules/core/src/matrix_expressions.cpp +++ b/modules/core/src/matrix_expressions.cpp @@ -21,7 +21,7 @@ class MatOp_Identity CV_FINAL : public MatOp virtual ~MatOp_Identity() {} bool elementWise(const MatExpr& /*expr*/) const CV_OVERRIDE { return true; } - void assign(const MatExpr& expr, Mat& m, ElemType depth = CV_TYPE_AUTO) const CV_OVERRIDE; + void assign(const MatExpr& expr, Mat& m, ElemDepth depth = CV_DEPTH_AUTO) const CV_OVERRIDE; static void makeExpr(MatExpr& res, const Mat& m); }; @@ -35,7 +35,7 @@ class MatOp_AddEx CV_FINAL : public MatOp virtual ~MatOp_AddEx() {} bool elementWise(const MatExpr& /*expr*/) const CV_OVERRIDE { return true; } - void assign(const MatExpr& expr, Mat& m, ElemType depth = CV_TYPE_AUTO) const CV_OVERRIDE; + void assign(const MatExpr& expr, Mat& m, ElemDepth depth = CV_DEPTH_AUTO) const CV_OVERRIDE; void add(const MatExpr& e1, const Scalar& s, MatExpr& res) const CV_OVERRIDE; void subtract(const Scalar& s, const MatExpr& expr, MatExpr& res) const CV_OVERRIDE; @@ -57,7 +57,7 @@ class MatOp_Bin CV_FINAL : public MatOp virtual ~MatOp_Bin() {} bool elementWise(const MatExpr& /*expr*/) const CV_OVERRIDE { return true; } - void assign(const MatExpr& expr, Mat& m, ElemType depth = CV_TYPE_AUTO) const CV_OVERRIDE; + void assign(const MatExpr& expr, Mat& m, ElemDepth depth = CV_DEPTH_AUTO) const CV_OVERRIDE; void multiply(const MatExpr& e1, double s, MatExpr& res) const CV_OVERRIDE; void divide(double s, const MatExpr& e, MatExpr& res) const CV_OVERRIDE; @@ -75,7 +75,7 @@ class MatOp_Cmp CV_FINAL : public MatOp virtual ~MatOp_Cmp() {} bool elementWise(const MatExpr& /*expr*/) const CV_OVERRIDE { return true; } - void assign(const MatExpr& expr, Mat& m, ElemType depth = CV_TYPE_AUTO) const CV_OVERRIDE; + void assign(const MatExpr& expr, Mat& m, ElemDepth depth = CV_DEPTH_AUTO) const CV_OVERRIDE; static void makeExpr(MatExpr& res, int cmpop, const Mat& a, const Mat& b); static void makeExpr(MatExpr& res, int cmpop, const Mat& a, double alpha); @@ -90,7 +90,7 @@ class MatOp_GEMM CV_FINAL : public MatOp virtual ~MatOp_GEMM() {} bool elementWise(const MatExpr& /*expr*/) const CV_OVERRIDE { return false; } - void assign(const MatExpr& expr, Mat& m, ElemType depth = CV_TYPE_AUTO) const CV_OVERRIDE; + void assign(const MatExpr& expr, Mat& m, ElemDepth depth = CV_DEPTH_AUTO) const CV_OVERRIDE; void add(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const CV_OVERRIDE; void subtract(const MatExpr& e1, const MatExpr& e2, MatExpr& res) const CV_OVERRIDE; @@ -111,7 +111,7 @@ class MatOp_Invert CV_FINAL : public MatOp virtual ~MatOp_Invert() {} bool elementWise(const MatExpr& /*expr*/) const CV_OVERRIDE { return false; } - void assign(const MatExpr& expr, Mat& m, ElemType depth = CV_TYPE_AUTO) const CV_OVERRIDE; + void assign(const MatExpr& expr, Mat& m, ElemDepth depth = CV_DEPTH_AUTO) const CV_OVERRIDE; void matmul(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const CV_OVERRIDE; @@ -127,7 +127,7 @@ class MatOp_T CV_FINAL : public MatOp virtual ~MatOp_T() {} bool elementWise(const MatExpr& /*expr*/) const CV_OVERRIDE { return false; } - void assign(const MatExpr& expr, Mat& m, ElemType depth = CV_TYPE_AUTO) const CV_OVERRIDE; + void assign(const MatExpr& expr, Mat& m, ElemDepth depth = CV_DEPTH_AUTO) const CV_OVERRIDE; void multiply(const MatExpr& e1, double s, MatExpr& res) const CV_OVERRIDE; void transpose(const MatExpr& expr, MatExpr& res) const CV_OVERRIDE; @@ -144,7 +144,7 @@ class MatOp_Solve CV_FINAL : public MatOp virtual ~MatOp_Solve() {} bool elementWise(const MatExpr& /*expr*/) const CV_OVERRIDE { return false; } - void assign(const MatExpr& expr, Mat& m, ElemType depth = CV_TYPE_AUTO) const CV_OVERRIDE; + void assign(const MatExpr& expr, Mat& m, ElemDepth depth = CV_DEPTH_AUTO) const CV_OVERRIDE; static void makeExpr(MatExpr& res, int method, const Mat& a, const Mat& b); }; @@ -158,7 +158,7 @@ class MatOp_Initializer CV_FINAL : public MatOp virtual ~MatOp_Initializer() {} bool elementWise(const MatExpr& /*expr*/) const CV_OVERRIDE { return false; } - void assign(const MatExpr& expr, Mat& m, ElemType depth = CV_TYPE_AUTO) const CV_OVERRIDE; + void assign(const MatExpr& expr, Mat& m, ElemDepth depth = CV_DEPTH_AUTO) const CV_OVERRIDE; void multiply(const MatExpr& e, double s, MatExpr& res) const CV_OVERRIDE; @@ -1185,23 +1185,22 @@ ElemType MatExpr::type() const if( isInitializer(*this) ) return a.type(); if( isCmp(*this) ) - return CV_8U; + return CV_8UC1; return op ? op->type(*this) : CV_TYPE_AUTO; } ///////////////////////////////////////////////////////////////////////////////////////////////////// -void MatOp_Identity::assign(const MatExpr& e, Mat& m, ElemType _depth) const +void MatOp_Identity::assign(const MatExpr& e, Mat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) _depth = e.a.depth(); if (_depth == e.a.depth()) m = e.a; else { - CV_Assert( CV_MAT_CN(_depth) == e.a.channels() ); e.a.convertTo(m, _depth); } } @@ -1213,9 +1212,9 @@ inline void MatOp_Identity::makeExpr(MatExpr& res, const Mat& m) ///////////////////////////////////////////////////////////////////////////////////////////////////// -void MatOp_AddEx::assign(const MatExpr& e, Mat& m, ElemType _depth) const +void MatOp_AddEx::assign(const MatExpr& e, Mat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) _depth = e.a.depth(); Mat temp, &dst = e.a.depth() == _depth ? m : temp; @@ -1259,12 +1258,12 @@ void MatOp_AddEx::assign(const MatExpr& e, Mat& m, ElemType _depth) const cv::subtract(e.s, e.a, dst); else { - e.a.convertTo(dst, e.a.type(), e.alpha); + e.a.convertTo(dst, CV_MAT_DEPTH(e.a.depth()), e.alpha); cv::add(dst, e.s, dst); } if( dst.data != m.data ) - dst.convertTo(m, m.type()); + dst.convertTo(m, CV_MAT_DEPTH(m.depth())); } @@ -1337,9 +1336,9 @@ inline void MatOp_AddEx::makeExpr(MatExpr& res, const Mat& a, const Mat& b, doub ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void MatOp_Bin::assign(const MatExpr& e, Mat& m, ElemType _depth) const +void MatOp_Bin::assign(const MatExpr& e, Mat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) _depth = e.a.depth(); Mat temp, &dst = e.a.depth() == _depth ? m : temp; @@ -1418,9 +1417,9 @@ inline void MatOp_Bin::makeExpr(MatExpr& res, char op, const Mat& a, const Scala /////////////////////////////////////////////////////////////////////////////////////////////////////// -void MatOp_Cmp::assign(const MatExpr& e, Mat& m, ElemType _depth) const +void MatOp_Cmp::assign(const MatExpr& e, Mat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) _depth = e.a.depth(); //TODO: Investigate why CV_8U is coded here @@ -1447,9 +1446,9 @@ inline void MatOp_Cmp::makeExpr(MatExpr& res, int cmpop, const Mat& a, double al ///////////////////////////////////////////////////////////////////////////////////////////////////////// -void MatOp_T::assign(const MatExpr& e, Mat& m, ElemType _depth) const +void MatOp_T::assign(const MatExpr& e, Mat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) _depth = e.a.depth(); Mat temp, &dst = _depth == e.a.depth() ? m : temp; @@ -1485,9 +1484,9 @@ inline void MatOp_T::makeExpr(MatExpr& res, const Mat& a, double alpha) ///////////////////////////////////////////////////////////////////////////////////////////////////////// -void MatOp_GEMM::assign(const MatExpr& e, Mat& m, ElemType _depth) const +void MatOp_GEMM::assign(const MatExpr& e, Mat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) _depth = e.a.depth(); Mat temp, &dst = _depth == e.a.depth() ? m : temp; @@ -1563,9 +1562,9 @@ inline void MatOp_GEMM::makeExpr(MatExpr& res, int flags, const Mat& a, const Ma /////////////////////////////////////////////////////////////////////////////////////////////////////// -void MatOp_Invert::assign(const MatExpr& e, Mat& m, ElemType _depth) const +void MatOp_Invert::assign(const MatExpr& e, Mat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) _depth = e.a.depth(); Mat temp, &dst = _depth == e.a.depth() ? m : temp; @@ -1592,9 +1591,9 @@ inline void MatOp_Invert::makeExpr(MatExpr& res, int method, const Mat& m) ///////////////////////////////////////////////////////////////////////////////////////////////////////// -void MatOp_Solve::assign(const MatExpr& e, Mat& m, ElemType _depth) const +void MatOp_Solve::assign(const MatExpr& e, Mat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) _depth = e.a.depth(); Mat temp, &dst = _depth == e.a.depth() ? m : temp; @@ -1611,9 +1610,9 @@ inline void MatOp_Solve::makeExpr(MatExpr& res, int method, const Mat& a, const ////////////////////////////////////////////////////////////////////////////////////////////////////////// -void MatOp_Initializer::assign(const MatExpr& e, Mat& m, ElemType _depth) const +void MatOp_Initializer::assign(const MatExpr& e, Mat& m, ElemDepth _depth) const { - if (_depth == CV_TYPE_AUTO) + if (_depth == CV_DEPTH_AUTO) _depth = e.a.depth(); if( e.a.dims <= 2 ) diff --git a/modules/core/src/matrix_operations.cpp b/modules/core/src/matrix_operations.cpp index 977dae731b8f..c5a91264edf9 100644 --- a/modules/core/src/matrix_operations.cpp +++ b/modules/core/src/matrix_operations.cpp @@ -144,7 +144,7 @@ namespace cv { static bool ocl_setIdentity( InputOutputArray _m, const Scalar& s ) { ElemType type = _m.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type), kercn = cn, rowsPerWI = 1; ElemType sctype = CV_MAKE_TYPE(depth, cn == 3 ? 4 : cn); if (ocl::Device::getDefault().isIntel()) @@ -374,7 +374,7 @@ static bool ocl_transpose( InputArray _src, OutputArray _dst ) const int TILE_DIM = 32, BLOCK_ROWS = 8; ElemType type = _src.type(); int cn = CV_MAT_CN(type); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int rowsPerWI = dev.isIntel() ? 4 : 1; UMat src = _src.getUMat(); @@ -568,7 +568,7 @@ cv::Mat cv::Mat::cross(InputArray _m) const { Mat m = _m.getMat(); ElemType tp = type(); - ElemType d = CV_MAT_DEPTH(tp); + ElemDepth d = CV_MAT_DEPTH(tp); CV_Assert( dims <= 2 && m.dims <= 2 && size() == m.size() && tp == m.type() && ((rows == 3 && cols == 1) || (cols*channels() == 3 && rows == 1))); Mat result(rows, cols, tp); @@ -720,7 +720,7 @@ typedef void (*ReduceFunc)( const Mat& src, Mat& dst ); static inline bool ipp_reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& dstmat) { int sstep = (int)srcmat.step, stype = srcmat.type(); - ElemType ddepth = dstmat.depth(); + ElemDepth ddepth = dstmat.depth(); IppiSize roisize = { srcmat.size().width, 1 }; @@ -777,7 +777,7 @@ static inline void reduceSumC_8u16u16s32f_64f(const cv::Mat& srcmat, cv::Mat& ds if(dstmat.depth() == CV_64F) { - ElemType sdepth = CV_MAT_DEPTH(srcmat.type()); + ElemDepth sdepth = CV_MAT_DEPTH(srcmat.type()); func = sdepth == CV_8U ? (cv::ReduceFunc)cv::reduceC_ > : sdepth == CV_16U ? (cv::ReduceFunc)cv::reduceC_ > : @@ -869,9 +869,9 @@ static bool ocl_reduce(InputArray _src, OutputArray _dst, int dim, int op, int op0, ElemType stype, ElemType dtype) { const int min_opt_cols = 128, buf_cols = 32; - ElemType sdepth = CV_MAT_DEPTH(stype); + ElemDepth sdepth = CV_MAT_DEPTH(stype); int cn = CV_MAT_CN(stype); - ElemType ddepth = CV_MAT_DEPTH(dtype), ddepth0 = ddepth; + ElemDepth ddepth = CV_MAT_DEPTH(dtype), ddepth0 = ddepth; const ocl::Device &defDev = ocl::Device::getDefault(); bool doubleSupport = defDev.doubleFPConfig() > 0; @@ -889,7 +889,7 @@ static bool ocl_reduce(InputArray _src, OutputArray _dst, const char * const ops[4] = { "OCL_CV_REDUCE_SUM", "OCL_CV_REDUCE_AVG", "OCL_CV_REDUCE_MAX", "OCL_CV_REDUCE_MIN" }; - ElemType wdepth = CV_MAX_DEPTH(ddepth, CV_32F); + ElemDepth wdepth = CV_MAX_DEPTH(ddepth, CV_32F); if (useOptimized) { size_t tileHeight = (size_t)(wgs / buf_cols); @@ -969,16 +969,16 @@ static bool ocl_reduce(InputArray _src, OutputArray _dst, #endif -void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, ElemType ddepth) +void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, ElemDepth ddepth) { CV_INSTRUMENT_REGION(); CV_Assert( _src.dims() <= 2 ); int op0 = op; ElemType stype = _src.type(); - ElemType sdepth = _src.depth(); + ElemDepth sdepth = _src.depth(); int cn = CV_MAT_CN(stype); - if (ddepth == CV_TYPE_AUTO) + if (ddepth == CV_DEPTH_AUTO) ddepth = _dst.fixedType() ? _dst.depth() : sdepth; ddepth = CV_MAT_DEPTH(ddepth); /* backwards compatibility */ ElemType dtype = CV_MAKETYPE(ddepth, cn); @@ -1122,7 +1122,7 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, ElemType dde func( src, temp ); if( op0 == CV_REDUCE_AVG ) - temp.convertTo(dst, dst.type(), 1./(dim == 0 ? src.rows : src.cols)); + temp.convertTo(dst, dst.depth(), 1. / (dim == 0 ? src.rows : src.cols)); } @@ -1183,7 +1183,7 @@ template static void sort_( const Mat& src, Mat& dst, int flags ) #ifdef HAVE_IPP typedef IppStatus (CV_STDCALL *IppSortFunc)(void *pSrcDst, int len, Ipp8u *pBuffer); -static IppSortFunc getSortFunc(ElemType depth, bool sortDescending) +static IppSortFunc getSortFunc(ElemDepth depth, bool sortDescending) { if (!sortDescending) return depth == CV_8U ? (IppSortFunc)ippsSortRadixAscend_8u_I : @@ -1210,7 +1210,7 @@ static bool ipp_sort(const Mat& src, Mat& dst, int flags) bool sortRows = (flags & 1) == CV_SORT_EVERY_ROW; bool sortDescending = (flags & CV_SORT_DESCENDING) != 0; bool inplace = (src.data == dst.data); - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); IppDataType type = ippiGetDataType(depth); IppSortFunc ippsSortRadix_I = getSortFunc(depth, sortDescending); @@ -1331,7 +1331,7 @@ template static void sortIdx_( const Mat& src, Mat& dst, int flags ) #ifdef HAVE_IPP typedef IppStatus (CV_STDCALL *IppSortIndexFunc)(const void* pSrc, Ipp32s srcStrideBytes, Ipp32s *pDstIndx, int len, Ipp8u *pBuffer); -static IppSortIndexFunc getSortIndexFunc(ElemType depth, bool sortDescending) +static IppSortIndexFunc getSortIndexFunc(ElemDepth depth, bool sortDescending) { if (!sortDescending) return depth == CV_8U ? (IppSortIndexFunc)ippsSortRadixIndexAscend_8u : @@ -1355,7 +1355,7 @@ static bool ipp_sortIdx( const Mat& src, Mat& dst, int flags ) bool sortRows = (flags & 1) == SORT_EVERY_ROW; bool sortDescending = (flags & SORT_DESCENDING) != 0; - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); IppDataType type = ippiGetDataType(depth); IppSortIndexFunc ippsSortRadixIndex = getSortIndexFunc(depth, sortDescending); diff --git a/modules/core/src/matrix_sparse.cpp b/modules/core/src/matrix_sparse.cpp index ab5c7e0bb0d6..c4cb7acd7ab4 100644 --- a/modules/core/src/matrix_sparse.cpp +++ b/modules/core/src/matrix_sparse.cpp @@ -278,10 +278,10 @@ void SparseMat::copyTo( Mat& m ) const } -void SparseMat::convertTo(SparseMat& m, ElemType ddepth, double alpha) const +void SparseMat::convertTo(SparseMat& m, ElemDepth ddepth, double alpha) const { int cn = channels(); - if (ddepth == CV_TYPE_AUTO) + if (ddepth == CV_DEPTH_AUTO) ddepth = depth(); ddepth = CV_MAT_DEPTH(ddepth); /* backwards compatibility */ ElemType dtype = CV_MAKETYPE(ddepth, cn); @@ -323,10 +323,10 @@ void SparseMat::convertTo(SparseMat& m, ElemType ddepth, double alpha) const } } -void SparseMat::convertTo(Mat& m, ElemType ddepth, double alpha, double beta) const +void SparseMat::convertTo(Mat& m, ElemDepth ddepth, double alpha, double beta) const { int cn = channels(); - if (ddepth == CV_TYPE_AUTO) + if (ddepth == CV_DEPTH_AUTO) ddepth = depth(); ddepth = CV_MAT_DEPTH(ddepth); /* backwards compatibility */ ElemType dtype = CV_MAKETYPE(ddepth, cn); @@ -760,7 +760,7 @@ void normalize( const SparseMat& src, SparseMat& dst, double a, int norm_type ) else CV_Error( CV_StsBadArg, "Unknown/unsupported norm type" ); - src.convertTo(dst, CV_TYPE_AUTO, scale); + src.convertTo(dst, CV_DEPTH_AUTO, scale); } } // cv:: diff --git a/modules/core/src/matrix_wrap.cpp b/modules/core/src/matrix_wrap.cpp index 45990f102ea4..bf0422e28818 100644 --- a/modules/core/src/matrix_wrap.cpp +++ b/modules/core/src/matrix_wrap.cpp @@ -842,7 +842,7 @@ ElemType _InputArray::type(int i) const CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type"); } -ElemType _InputArray::depth(int i) const +ElemDepth _InputArray::depth(int i) const { return CV_MAT_DEPTH(type(i)); } diff --git a/modules/core/src/mean.cpp b/modules/core/src/mean.cpp index a364745a29ab..dd4af74e37b8 100644 --- a/modules/core/src/mean.cpp +++ b/modules/core/src/mean.cpp @@ -112,7 +112,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask ) CV_Assert( mask.empty() || mask.type() == CV_8U ); int k, cn = src.channels(); - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); Scalar s; CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_mean(src, mask, s), s) @@ -467,7 +467,7 @@ static int sqsum64f( const double* src, const uchar* mask, double* sum, double* typedef int (*SumSqrFunc)(const uchar*, const uchar* mask, uchar*, uchar*, int, int); -static SumSqrFunc getSumSqrTab(ElemType depth) +static SumSqrFunc getSumSqrTab(ElemDepth depth) { static SumSqrFunc sumSqrTab[] = { @@ -492,7 +492,7 @@ static bool ocl_meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv { ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); bool doubleSupport = ocl::Device::getDefault().doubleFPConfig() > 0, isContinuous = _src.isContinuous(), isMaskContinuous = _mask.isContinuous(); @@ -505,7 +505,7 @@ static bool ocl_meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv } size_t wgs = defDev.maxWorkGroupSize(); - ElemType ddepth = CV_MAX_DEPTH(CV_32S, depth), sqddepth = CV_MAX_DEPTH(CV_32F, depth); + ElemDepth ddepth = CV_MAX_DEPTH(CV_32S, depth), sqddepth = CV_MAX_DEPTH(CV_32F, depth); ElemType sqdtype = CV_MAKETYPE(sqddepth, cn); ElemType dtype = CV_MAKE_TYPE(ddepth, cn); CV_Assert(!haveMask || _mask.type() == CV_8UC1); @@ -802,7 +802,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_meanStdDev(src, _mean, _sdv, mask)); int k, cn = src.channels(); - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); SumSqrFunc func = getSumSqrTab(depth); diff --git a/modules/core/src/merge.cpp b/modules/core/src/merge.cpp index a0c710b70d99..2ecb3609a5df 100644 --- a/modules/core/src/merge.cpp +++ b/modules/core/src/merge.cpp @@ -212,7 +212,7 @@ void merge64s(const int64** src, int64* dst, int len, int cn ) typedef void (*MergeFunc)(const uchar** src, uchar* dst, int len, int cn); -static MergeFunc getMergeFunc(ElemType depth) +static MergeFunc getMergeFunc(ElemDepth depth) { static MergeFunc mergeTab[] = { @@ -285,7 +285,7 @@ void cv::merge(const Mat* mv, size_t n, OutputArray _dst) CV_Assert( mv && n > 0 ); - ElemType depth = mv[0].depth(); + ElemDepth depth = mv[0].depth(); bool allch1 = true; int k, cn = 0; size_t i; @@ -372,7 +372,7 @@ static bool ocl_merge( InputArrayOfArrays _mv, OutputArray _dst ) CV_Assert(!src.empty()); ElemType type = src[0].type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int rowsPerWI = ocl::Device::getDefault().isIntel() ? 4 : 1; Size size = src[0].size(); @@ -380,7 +380,7 @@ static bool ocl_merge( InputArrayOfArrays _mv, OutputArray _dst ) { int itype = src[i].type(); int icn = CV_MAT_CN(itype); - ElemType idepth = CV_MAT_DEPTH(itype); + ElemDepth idepth = CV_MAT_DEPTH(itype); int esz1 = CV_ELEM_SIZE1(idepth); if (src[i].dims > 2) return false; diff --git a/modules/core/src/minmax.cpp b/modules/core/src/minmax.cpp index d989923508a6..f778193b942f 100644 --- a/modules/core/src/minmax.cpp +++ b/modules/core/src/minmax.cpp @@ -93,7 +93,7 @@ static void minMaxIdx_64f(const double* src, const uchar* mask, double* minval, typedef void (*MinMaxIdxFunc)(const uchar*, const uchar*, int*, int*, size_t*, size_t*, int, size_t); -static MinMaxIdxFunc getMinmaxTab(ElemType depth) +static MinMaxIdxFunc getMinmaxTab(ElemDepth depth) { static MinMaxIdxFunc minmaxTab[] = { @@ -230,7 +230,7 @@ typedef void (*getMinMaxResFunc)(const Mat & db, double * minVal, double * maxVa int * minLoc, int *maxLoc, int gropunum, int cols, double * maxVal2); bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int* minLoc, int* maxLoc, InputArray _mask, - ElemType ddepth, bool absValues, InputArray _src2, double * maxVal2) + ElemDepth ddepth, bool absValues, InputArray _src2, double * maxVal2) { const ocl::Device & dev = ocl::Device::getDefault(); @@ -242,7 +242,7 @@ bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int* minLoc bool doubleSupport = dev.doubleFPConfig() > 0, haveMask = !_mask.empty(), haveSrc2 = _src2.kind() != _InputArray::NONE; ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type), kercn = haveMask ? cn : std::min(4, ocl::predictOptimalVectorWidth(_src, _src2)); @@ -253,7 +253,7 @@ bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int* minLoc CV_Assert( (cn == 1 && (!haveMask || _mask.type() == CV_8U)) || (cn >= 1 && !minLoc && !maxLoc) ); - if (ddepth == CV_TYPE_AUTO) + if (ddepth == CV_DEPTH_AUTO) ddepth = depth; CV_Assert(!haveSrc2 || _src2.type() == type); @@ -751,7 +751,7 @@ void cv::minMaxIdx(InputArray _src, double* minVal, CV_INSTRUMENT_REGION(); ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type); CV_Assert( (cn == 1 && (_mask.empty() || _mask.type() == CV_8U)) || (cn > 1 && _mask.empty() && !minIdx && !maxIdx) ); diff --git a/modules/core/src/norm.cpp b/modules/core/src/norm.cpp index 417bee2a2500..6e1745a945f3 100644 --- a/modules/core/src/norm.cpp +++ b/modules/core/src/norm.cpp @@ -395,7 +395,7 @@ CV_DEF_NORM_ALL(64f, double, double, double, double) typedef int (*NormFunc)(const uchar*, const uchar*, uchar*, int, int); typedef int (*NormDiffFunc)(const uchar*, const uchar*, const uchar*, uchar*, int, int); -static NormFunc getNormFunc(int normType, ElemType depth) +static NormFunc getNormFunc(int normType, ElemDepth depth) { static NormFunc normTab[3][8] = { @@ -416,7 +416,7 @@ static NormFunc getNormFunc(int normType, ElemType depth) return normTab[normType][depth]; } -static NormDiffFunc getNormDiffFunc(int normType, ElemType depth) +static NormDiffFunc getNormDiffFunc(int normType, ElemDepth depth) { static NormDiffFunc normDiffTab[3][8] = { @@ -457,7 +457,7 @@ static bool ocl_norm( InputArray _src, int normType, InputArray _mask, double & if (cn > 4) return false; ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); bool doubleSupport = d.doubleFPConfig() > 0, haveMask = _mask.kind() != _InputArray::NONE; @@ -574,7 +574,7 @@ static bool ipp_norm(Mat &src, int normType, Mat &mask, double &result) else { IppiSize sz = { cols*src.channels(), rows }; - ElemType type = src.depth(); + ElemDepth type = src.depth(); typedef IppStatus (CV_STDCALL* ippiNormFuncHint)(const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); typedef IppStatus (CV_STDCALL* ippiNormFuncNoHint)(const void *, int, IppiSize, Ipp64f *); @@ -646,7 +646,7 @@ double cv::norm( InputArray _src, int normType, InputArray _mask ) Mat src = _src.getMat(), mask = _mask.getMat(); CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_norm(src, normType, mask, _result), _result); - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); int cn = src.channels(); if( src.isContinuous() && mask.empty() ) { @@ -822,7 +822,7 @@ static bool ocl_norm( InputArray _src1, InputArray _src2, int normType, InputArr if (cn > 4) return false; int type = _src1.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); bool relative = (normType & NORM_RELATIVE) != 0; normType &= ~NORM_RELATIVE; bool normsum = normType == NORM_L1 || normType == NORM_L2 || normType == NORM_L2SQR; @@ -925,7 +925,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra else { IppiSize sz = { cols*src1.channels(), rows }; - ElemType type = src1.depth(); + ElemDepth type = src1.depth(); typedef IppStatus (CV_STDCALL* ippiNormRelFuncHint)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); typedef IppStatus (CV_STDCALL* ippiNormRelFuncNoHint)(const void *, int, const void *, int, IppiSize, Ipp64f *); @@ -1054,7 +1054,7 @@ static bool ipp_norm(InputArray _src1, InputArray _src2, int normType, InputArra else { IppiSize sz = { cols*src1.channels(), rows }; - ElemType type = src1.depth(); + ElemDepth type = src1.depth(); typedef IppStatus (CV_STDCALL* ippiNormDiffFuncHint)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); typedef IppStatus (CV_STDCALL* ippiNormDiffFuncNoHint)(const void *, int, const void *, int, IppiSize, Ipp64f *); @@ -1128,7 +1128,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m } Mat src1 = _src1.getMat(), src2 = _src2.getMat(), mask = _mask.getMat(); - ElemType depth = src1.depth(); + ElemDepth depth = src1.depth(); int cn = src1.channels(); normType &= 7; diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 4bdfc031933e..ba353c4f137a 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -5765,7 +5765,7 @@ void convertFromImage(void* cl_mem_image, UMat& dst) cl_image_format fmt = { 0, 0 }; CV_OCL_CHECK(clGetImageInfo(clImage, CL_IMAGE_FORMAT, sizeof(cl_image_format), &fmt, 0)); - ElemType depth = CV_8U; + ElemDepth depth = CV_8U; switch (fmt.image_channel_data_type) { case CL_UNORM_INT8: @@ -5984,7 +5984,7 @@ const char* typeToStr(int type) "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?" }; int cn = CV_MAT_CN(type); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); return cn > 16 ? "?" : tab[depth*16 + cn-1]; } @@ -6002,7 +6002,7 @@ const char* memopTypeToStr(int type) "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?" }; int cn = CV_MAT_CN(type); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); return cn > 16 ? "?" : tab[depth*16 + cn-1]; } @@ -6020,11 +6020,11 @@ const char* vecopTypeToStr(int type) "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?" }; int cn = CV_MAT_CN(type); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); return cn > 16 ? "?" : tab[depth*16 + cn-1]; } -const char* convertTypeStr(ElemType sdepth, ElemType ddepth, int cn, char* buf) +const char* convertTypeStr(ElemDepth sdepth, ElemDepth ddepth, int cn, char* buf) { if( sdepth == ddepth ) return "noconvert"; @@ -6131,7 +6131,7 @@ template static std::string kerToStr(const Mat & k) { int width = k.cols - 1; - ElemType depth = k.depth(); + ElemDepth depth = k.depth(); const T * const data = k.ptr(); std::ostringstream stream; @@ -6160,12 +6160,12 @@ static std::string kerToStr(const Mat & k) return stream.str(); } -String kernelToStr(InputArray _kernel, ElemType ddepth, const char * name) +String kernelToStr(InputArray _kernel, ElemDepth ddepth, const char * name) { Mat kernel = _kernel.getMat().reshape(1, 1); - ElemType depth = kernel.depth(); - if (ddepth == CV_TYPE_AUTO) + ElemDepth depth = kernel.depth(); + if (ddepth == CV_DEPTH_AUTO) ddepth = depth; if (ddepth != depth) @@ -6188,7 +6188,7 @@ String kernelToStr(InputArray _kernel, ElemType ddepth, const char * name) CV_Assert(src.isMat() || src.isUMat()); \ Size csize = src.size(); \ ElemType ctype = src.type(); \ - ElemType cdepth = CV_MAT_DEPTH(ctype); \ + ElemDepth cdepth = CV_MAT_DEPTH(ctype); \ int ccn = CV_MAT_CN(ctype), \ ckercn = vectorWidths[cdepth], cwidth = ccn * csize.width; \ if (cwidth < ckercn || ckercn <= 0) \ @@ -6278,7 +6278,7 @@ void buildOptionsAddMatrixDescription(String& buildOptions, const String& name, if (!buildOptions.empty()) buildOptions += " "; ElemType type = _m.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); buildOptions += format( "-D %s_T=%s -D %s_T1=%s -D %s_CN=%d -D %s_TSIZE=%d -D %s_T1SIZE=%d -D %s_DEPTH=%d", name.c_str(), ocl::typeToStr(type), @@ -6306,7 +6306,7 @@ struct Image2D::Impl clReleaseMemObject(handle); } - static cl_image_format getImageFormat(ElemType depth, int cn, bool norm) + static cl_image_format getImageFormat(ElemDepth depth, int cn, bool norm) { cl_image_format format; static const int channelTypes[] = { CL_UNSIGNED_INT8, CL_SIGNED_INT8, CL_UNSIGNED_INT16, @@ -6358,7 +6358,7 @@ struct Image2D::Impl CV_Assert(ocl::Device::getDefault().imageSupport()); int err; - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); int cn = src.channels(); CV_Assert(cn <= 4); cl_image_format format = getImageFormat(depth, cn, norm); @@ -6472,7 +6472,7 @@ bool Image2D::canCreateAlias(const UMat &m) return ret; } -bool Image2D::isFormatSupported(ElemType depth, int cn, bool norm) +bool Image2D::isFormatSupported(ElemDepth depth, int cn, bool norm) { cl_image_format format = Impl::getImageFormat(depth, cn, norm); diff --git a/modules/core/src/opengl.cpp b/modules/core/src/opengl.cpp index a002a4346d61..ba57f1626837 100644 --- a/modules/core/src/opengl.cpp +++ b/modules/core/src/opengl.cpp @@ -979,7 +979,7 @@ cv::ogl::Texture2D::Texture2D(InputArray arr, bool autoRelease) : rows_(0), cols const Size asize = arr.size(); const ElemType atype = arr.type(); - const ElemType depth = CV_MAT_DEPTH(atype); + const ElemDepth depth = CV_MAT_DEPTH(atype); const int cn = CV_MAT_CN(atype); CV_Assert( depth <= CV_32F ); @@ -1091,7 +1091,7 @@ void cv::ogl::Texture2D::copyFrom(InputArray arr, bool autoRelease) const Size asize = arr.size(); const ElemType atype = arr.type(); - const ElemType depth = CV_MAT_DEPTH(atype); + const ElemDepth depth = CV_MAT_DEPTH(atype); const int cn = CV_MAT_CN(atype); CV_Assert( depth <= CV_32F ); @@ -1146,7 +1146,7 @@ void cv::ogl::Texture2D::copyFrom(InputArray arr, bool autoRelease) #endif } -void cv::ogl::Texture2D::copyTo(OutputArray arr, ElemType ddepth, bool autoRelease) const +void cv::ogl::Texture2D::copyTo(OutputArray arr, ElemDepth ddepth, bool autoRelease) const { #ifndef HAVE_OPENGL CV_UNUSED(arr); @@ -1224,7 +1224,7 @@ unsigned int cv::ogl::Texture2D::texId() const void cv::ogl::Arrays::setVertexArray(InputArray vertex) { const int cn = vertex.channels(); - const ElemType depth = vertex.depth(); + const ElemDepth depth = vertex.depth(); CV_Assert( cn == 2 || cn == 3 || cn == 4 ); CV_Assert( depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F ); @@ -1263,7 +1263,7 @@ void cv::ogl::Arrays::resetColorArray() void cv::ogl::Arrays::setNormalArray(InputArray normal) { const int cn = normal.channels(); - const ElemType depth = normal.depth(); + const ElemDepth depth = normal.depth(); CV_Assert( cn == 3 ); CV_Assert( depth == CV_8S || depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F ); @@ -1282,7 +1282,7 @@ void cv::ogl::Arrays::resetNormalArray() void cv::ogl::Arrays::setTexCoordArray(InputArray texCoord) { const int cn = texCoord.channels(); - const ElemType depth = texCoord.depth(); + const ElemDepth depth = texCoord.depth(); CV_Assert( cn >= 1 && cn <= 4 ); CV_Assert( depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F ); @@ -1515,7 +1515,7 @@ void cv::ogl::render(const ogl::Arrays& arr, InputArray indices, int mode, Scala { ogl::Buffer buf = indices.getOGlBuffer(); - const ElemType depth = buf.depth(); + const ElemDepth depth = buf.depth(); CV_Assert( buf.channels() == 1 ); CV_Assert( depth <= CV_32S ); @@ -1541,7 +1541,7 @@ void cv::ogl::render(const ogl::Arrays& arr, InputArray indices, int mode, Scala { Mat mat = indices.getMat(); - const ElemType depth = mat.depth(); + const ElemDepth depth = mat.depth(); CV_Assert( mat.channels() == 1 ); CV_Assert( depth <= CV_32S ); diff --git a/modules/core/src/pca.cpp b/modules/core/src/pca.cpp index 08adaac7941e..8fd9947d7483 100644 --- a/modules/core/src/pca.cpp +++ b/modules/core/src/pca.cpp @@ -102,7 +102,7 @@ PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, int maxComp if( !_mean.empty() ) { CV_Assert( _mean.size() == mean_sz ); - _mean.convertTo(mean, ctype); + _mean.convertTo(mean, CV_MAT_DEPTH(ctype)); covar_flags |= CV_COVAR_USE_AVG; } @@ -116,7 +116,7 @@ PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, int maxComp Mat tmp_data, tmp_mean = repeat(mean, data.rows/mean.rows, data.cols/mean.cols); if( data.type() != ctype || tmp_mean.data == mean.data ) { - data.convertTo( tmp_data, ctype ); + data.convertTo(tmp_data, CV_MAT_DEPTH(ctype)); subtract( tmp_data, tmp_mean, tmp_data ); } else @@ -238,7 +238,7 @@ PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, double reta if( !_mean.empty() ) { CV_Assert( _mean.size() == mean_sz ); - _mean.convertTo(mean, ctype); + _mean.convertTo(mean, CV_MAT_DEPTH(ctype)); covar_flags |= CV_COVAR_USE_AVG; } @@ -252,7 +252,7 @@ PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, double reta Mat tmp_data, tmp_mean = repeat(mean, data.rows/mean.rows, data.cols/mean.cols); if( data.type() != ctype || tmp_mean.data == mean.data ) { - data.convertTo( tmp_data, ctype ); + data.convertTo(tmp_data, CV_MAT_DEPTH(ctype)); subtract( tmp_data, tmp_mean, tmp_data ); } else @@ -298,7 +298,7 @@ void PCA::project(InputArray _data, OutputArray result) const ElemType ctype = mean.type(); if( data.type() != ctype || tmp_mean.data == mean.data ) { - data.convertTo( tmp_data, ctype ); + data.convertTo(tmp_data, CV_MAT_DEPTH(ctype)); subtract( tmp_data, tmp_mean, tmp_data ); } else @@ -327,7 +327,7 @@ void PCA::backProject(InputArray _data, OutputArray result) const (mean.cols == 1 && eigenvectors.rows == data.rows))); Mat tmp_data, tmp_mean; - data.convertTo(tmp_data, mean.type()); + data.convertTo(tmp_data, mean.depth()); if( mean.rows == 1 ) { tmp_mean = repeat(mean, data.rows, 1); diff --git a/modules/core/src/persistence_base64.cpp b/modules/core/src/persistence_base64.cpp index 3c756b9646bc..e59267137797 100644 --- a/modules/core/src/persistence_base64.cpp +++ b/modules/core/src/persistence_base64.cpp @@ -745,7 +745,7 @@ class BinaryToCvSeqConvertor typedef size_t(*binary_to_t)(uchar const *, uchar *); struct binary_to_filenode_t { - ElemType cv_type; + ElemDepth cv_type; size_t offset; binary_to_t func; }; diff --git a/modules/core/src/persistence_types.cpp b/modules/core/src/persistence_types.cpp index 8a5879e70e96..418402d6feee 100644 --- a/modules/core/src/persistence_types.cpp +++ b/modules/core/src/persistence_types.cpp @@ -385,7 +385,7 @@ static void icvWriteImage( CvFileStorage* fs, const char* name, const void* stru char dt_buf[16], *dt; cv::Size size; int y; - ElemType depth; + ElemDepth depth; assert( CV_IS_IMAGE(image) ); @@ -411,7 +411,7 @@ static void icvWriteImage( CvFileStorage* fs, const char* name, const void* stru cvEndWriteStruct( fs ); } - depth = static_cast(IPL2CV_DEPTH(image->depth)); + depth = static_cast(IPL2CV_DEPTH(image->depth)); dt = icvEncodeFormat(depth, dt_buf); cvWriteString( fs, "dt", dt, 0 ); @@ -441,7 +441,7 @@ static void* icvReadImage( CvFileStorage* fs, CvFileNode* node ) cv::Rect roi; int y, width, height, coi; ElemType elem_type; - ElemType depth; + ElemDepth depth; const char* origin, *data_order; width = cvReadIntByName( fs, node, "width", 0 ); @@ -465,7 +465,7 @@ static void* icvReadImage( CvFileStorage* fs, CvFileNode* node ) CV_Error( CV_StsUnmatchedSizes, "The matrix size does not match to the number of stored elements" ); - depth = static_cast(cvIplDepth(elem_type)); + depth = static_cast(cvIplDepth(elem_type)); image = cvCreateImage( cvSize(width,height), depth, CV_MAT_CN(elem_type) ); roi_node = cvGetFileNodeByName( fs, node, "roi" ); diff --git a/modules/core/src/precomp.hpp b/modules/core/src/precomp.hpp index 9992564825dc..739bdcbe9e7c 100644 --- a/modules/core/src/precomp.hpp +++ b/modules/core/src/precomp.hpp @@ -136,8 +136,8 @@ typedef void (*BinaryFuncC)(const uchar* src1, size_t step1, uchar* dst, size_t step, int width, int height, void*); -BinaryFunc getConvertFunc(ElemType sdepth, ElemType ddepth); -BinaryFunc getConvertScaleFunc(ElemType sdepth, ElemType ddepth); +BinaryFunc getConvertFunc(ElemDepth sdepth, ElemDepth ddepth); +BinaryFunc getConvertScaleFunc(ElemDepth sdepth, ElemDepth ddepth); BinaryFunc getCopyMaskFunc(size_t esz); /* default memory block for sparse array elements */ diff --git a/modules/core/src/rand.cpp b/modules/core/src/rand.cpp index 4e72aa1cf81e..981c18d65961 100644 --- a/modules/core/src/rand.cpp +++ b/modules/core/src/rand.cpp @@ -394,7 +394,7 @@ void RNG::fill( InputOutputArray _mat, int disttype, CV_Assert(!_mat.empty()); Mat mat = _mat.getMat(), _param1 = _param1arg.getMat(), _param2 = _param2arg.getMat(); - ElemType depth = mat.depth(); + ElemDepth depth = mat.depth(); int cn = mat.channels(); AutoBuffer _parambuf; int j, k; @@ -549,7 +549,7 @@ void RNG::fill( InputOutputArray _mat, int disttype, else { Mat tmp(_param1.size(), ptype, parambuf); - _param1.convertTo(tmp, ptype); + _param1.convertTo(tmp, CV_MAT_DEPTH(ptype)); mean = (uchar*)parambuf; } @@ -562,7 +562,7 @@ void RNG::fill( InputOutputArray _mat, int disttype, else { Mat tmp(_param2.size(), ptype, parambuf + MAX(n1, cn)); - _param2.convertTo(tmp, ptype); + _param2.convertTo(tmp, CV_MAT_DEPTH(ptype)); stddev = (uchar*)(parambuf + MAX(n1, cn)); } diff --git a/modules/core/src/split.cpp b/modules/core/src/split.cpp index 9c7dc77badbf..d98e89be5afb 100644 --- a/modules/core/src/split.cpp +++ b/modules/core/src/split.cpp @@ -220,7 +220,7 @@ void split64s(const int64* src, int64** dst, int len, int cn ) typedef void (*SplitFunc)(const uchar* src, uchar** dst, int len, int cn); -static SplitFunc getSplitFunc(ElemType depth) +static SplitFunc getSplitFunc(ElemDepth depth) { static SplitFunc splitTab[] = { @@ -292,7 +292,7 @@ void cv::split(const Mat& src, Mat* mv) CV_INSTRUMENT_REGION(); int k, cn = src.channels(); - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); if( cn == 1 ) { src.copyTo(mv[0]); @@ -349,7 +349,7 @@ namespace cv { static bool ocl_split( InputArray _m, OutputArrayOfArrays _mv ) { ElemType type = _m.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type), rowsPerWI = ocl::Device::getDefault().isIntel() ? 4 : 1; @@ -406,7 +406,7 @@ void cv::split(InputArray _m, OutputArrayOfArrays _mv) CV_Assert( !_mv.fixedType() || _mv.empty() || _mv.type() == CV_MAKETYPE(m.depth(), 1) ); - ElemType depth = m.depth(); + ElemDepth depth = m.depth(); int cn = m.channels(); _mv.create(cn, 1, CV_MAKETYPE(depth, 1)); for (int i = 0; i < cn; ++i) diff --git a/modules/core/src/stat.hpp b/modules/core/src/stat.hpp index 868548a9d3a4..d2bf843b5ed1 100644 --- a/modules/core/src/stat.hpp +++ b/modules/core/src/stat.hpp @@ -16,7 +16,7 @@ enum { OCL_OP_SUM = 0, OCL_OP_SUM_ABS = 1, OCL_OP_SUM_SQR = 2 }; bool ocl_sum( InputArray _src, Scalar & res, int sum_op, InputArray _mask = noArray(), InputArray _src2 = noArray(), bool calc2 = false, const Scalar & res2 = Scalar() ); bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int* minLoc, int* maxLoc, InputArray _mask, - ElemType ddepth = CV_TYPE_AUTO, bool absValues = false, InputArray _src2 = noArray(), double * maxVal2 = NULL); + ElemDepth ddepth = CV_DEPTH_AUTO, bool absValues = false, InputArray _src2 = noArray(), double * maxVal2 = NULL); template Scalar ocl_part_sum(Mat m) { @@ -36,7 +36,7 @@ template Scalar ocl_part_sum(Mat m) #endif typedef int (*SumFunc)(const uchar*, const uchar* mask, uchar*, int, int); -SumFunc getSumFunc(ElemType depth); +SumFunc getSumFunc(ElemDepth depth); } diff --git a/modules/core/src/sum.cpp b/modules/core/src/sum.cpp index 39427e0d1ee9..fa3228309665 100644 --- a/modules/core/src/sum.cpp +++ b/modules/core/src/sum.cpp @@ -429,7 +429,7 @@ static int sum32f( const float* src, const uchar* mask, double* dst, int len, in static int sum64f( const double* src, const uchar* mask, double* dst, int len, int cn ) { return sum_(src, mask, dst, len, cn); } -SumFunc getSumFunc(ElemType depth) +SumFunc getSumFunc(ElemDepth depth) { static SumFunc sumTab[] = { @@ -455,7 +455,7 @@ bool ocl_sum( InputArray _src, Scalar & res, int sum_op, InputArray _mask, haveMask = _mask.kind() != _InputArray::NONE, haveSrc2 = _src2.kind() != _InputArray::NONE; ElemType type = _src.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type), kercn = cn == 1 && !haveMask ? ocl::predictOptimalVectorWidth(_src, _src2) : 1, mcn = std::max(cn, kercn); @@ -468,7 +468,7 @@ bool ocl_sum( InputArray _src, Scalar & res, int sum_op, InputArray _mask, int ngroups = dev.maxComputeUnits(), dbsize = ngroups * (calc2 ? 2 : 1); size_t wgs = dev.maxWorkGroupSize(); - ElemType ddepth = CV_MAX_DEPTH(sum_op == OCL_OP_SUM_SQR ? (CV_32F) : (CV_32S), depth); + ElemDepth ddepth = CV_MAX_DEPTH(sum_op == OCL_OP_SUM_SQR ? (CV_32F) : (CV_32S), depth); ElemType dtype = CV_MAKE_TYPE(ddepth, cn); CV_Assert(!haveMask || _mask.type() == CV_8UC1); @@ -615,7 +615,7 @@ cv::Scalar cv::sum( InputArray _src ) CV_IPP_RUN(IPP_VERSION_X100 >= 700, ipp_sum(src, _res), _res); int k, cn = src.channels(); - ElemType depth = src.depth(); + ElemDepth depth = src.depth(); SumFunc func = getSumFunc(depth); CV_Assert( cn <= 4 && func != 0 ); diff --git a/modules/core/src/umatrix.cpp b/modules/core/src/umatrix.cpp index a66a737b591a..cc247e85348b 100644 --- a/modules/core/src/umatrix.cpp +++ b/modules/core/src/umatrix.cpp @@ -751,7 +751,7 @@ UMat UMat::diag(const UMat& d) return m; } -int UMat::checkVector(int _elemChannels, ElemType _depth, bool _requireContinuous) const +int UMat::checkVector(int _elemChannels, ElemDepth _depth, bool _requireContinuous) const { return (depth() == _depth || _depth <= CV_8U) && (isContinuous() || !_requireContinuous) && @@ -886,7 +886,7 @@ void UMat::copyTo(OutputArray _dst) const if( _dst.fixedType() && dtype != type() ) { CV_Assert( channels() == CV_MAT_CN(dtype) ); - convertTo( _dst, dtype ); + convertTo(_dst, CV_MAT_DEPTH(dtype)); return; } @@ -936,7 +936,7 @@ void UMat::copyTo(OutputArray _dst, InputArray _mask) const #ifdef HAVE_OPENCL int cn = channels(); ElemType mtype = _mask.type(); - ElemType mdepth = CV_MAT_DEPTH(mtype); + ElemDepth mdepth = CV_MAT_DEPTH(mtype); int mcn = CV_MAT_CN(mtype); CV_Assert( mdepth == CV_8U && (mcn == 1 || mcn == cn) ); @@ -976,7 +976,7 @@ void UMat::copyTo(OutputArray _dst, InputArray _mask) const src.copyTo(_dst, _mask); } -void UMat::convertTo(OutputArray _dst, ElemType ddepth, double alpha, double beta) const +void UMat::convertTo(OutputArray _dst, ElemDepth ddepth, double alpha, double beta) const { CV_INSTRUMENT_REGION(); @@ -984,11 +984,11 @@ void UMat::convertTo(OutputArray _dst, ElemType ddepth, double alpha, double bet ElemType stype = type(); int cn = CV_MAT_CN(stype); - if (ddepth == CV_TYPE_AUTO) + if (ddepth == CV_DEPTH_AUTO) ddepth = _dst.fixedType() ? _dst.depth() : depth(); ddepth = CV_MAT_DEPTH(ddepth); /* backwards compatibility */ - ElemType sdepth = CV_MAT_DEPTH(stype); + ElemDepth sdepth = CV_MAT_DEPTH(stype); if( sdepth == ddepth && noScale ) { copyTo(_dst); @@ -1000,7 +1000,7 @@ void UMat::convertTo(OutputArray _dst, ElemType ddepth, double alpha, double bet if( dims <= 2 && cn && _dst.isUMat() && ocl::useOpenCL() && ((needDouble && doubleSupport) || !needDouble) ) { - ElemType wdepth = CV_MAX_DEPTH(CV_32F, sdepth); + ElemDepth wdepth = CV_MAX_DEPTH(CV_32F, sdepth); int rowsPerWI = 4; char cvt[2][40]; @@ -1050,7 +1050,7 @@ UMat& UMat::setTo(InputArray _value, InputArray _mask) #ifdef HAVE_OPENCL ElemType tp = type(); int cn = CV_MAT_CN(tp); - ElemType d = CV_MAT_DEPTH(tp); + ElemDepth d = CV_MAT_DEPTH(tp); if( dims <= 2 && cn <= 4 && CV_MAT_DEPTH(tp) < CV_64F && ocl::useOpenCL() ) { @@ -1137,7 +1137,7 @@ static bool ocl_dot( InputArray _src1, InputArray _src2, double & res ) UMat src1 = _src1.getUMat().reshape(1), src2 = _src2.getUMat().reshape(1); ElemType type = src1.type(); - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int kercn = ocl::predictOptimalVectorWidth(src1, src2); bool doubleSupport = ocl::Device::getDefault().doubleFPConfig() > 0; @@ -1146,7 +1146,7 @@ static bool ocl_dot( InputArray _src1, InputArray _src2, double & res ) int dbsize = ocl::Device::getDefault().maxComputeUnits(); size_t wgs = ocl::Device::getDefault().maxWorkGroupSize(); - ElemType ddepth = CV_MAX_DEPTH(CV_32F, depth); + ElemDepth ddepth = CV_MAX_DEPTH(CV_32F, depth); int wgs2_aligned = 1; while (wgs2_aligned < (int)wgs) diff --git a/modules/java/generator/gen_java.py b/modules/java/generator/gen_java.py index 0dbd4a5c0784..ff1bf85632ea 100755 --- a/modules/java/generator/gen_java.py +++ b/modules/java/generator/gen_java.py @@ -66,6 +66,7 @@ def checkFileRemap(path): "int64" : { "j_type" : "long", "jn_type" : "long", "jni_type" : "jlong", "suffix" : "J" }, "double[]": { "j_type" : "double[]", "jn_type" : "double[]", "jni_type" : "jdoubleArray", "suffix" : "_3D" }, "ElemType": { "j_type" : "int", "jn_type" : "int", "jni_type" : "jint", "suffix" : "I", "cast_from" : "int", "cast_to" : "ElemType" }, + "ElemDepth": { "j_type" : "int", "jn_type" : "int", "jni_type" : "jint", "suffix" : "I", "cast_from" : "int", "cast_to" : "ElemDepth" }, } # Defines a rule to add extra prefixes for names from specific namespaces. @@ -563,7 +564,7 @@ def gen_func(self, ci, fi, prop_name=''): cpp_code = ci.cpp_code # c_decl - # e.g: void add(Mat src1, Mat src2, Mat dst, Mat mask = Mat(), ElemType ddepth = CV_TYPE_AUTO) + # e.g: void add(Mat src1, Mat src2, Mat dst, Mat mask = Mat(), ElemDepth ddepth = CV_DEPTH_AUTO) if prop_name: c_decl = "%s %s::%s" % (fi.ctype, fi.classname, prop_name) else: @@ -721,7 +722,7 @@ def gen_func(self, ci, fi, prop_name=''): # java part: # private java NATIVE method decl # e.g. - # private static native void add_0(long src1, long src2, long dst, long mask, ElemType ddepth); + # private static native void add_0(long src1, long src2, long dst, long mask, ElemDepth ddepth); jn_code.write( Template(\ " private static native $type $name($args);\n").substitute(\ type = type_dict[fi.ctype].get("jn_type", "double[]"), \ @@ -747,7 +748,7 @@ def gen_func(self, ci, fi, prop_name=''): # public java wrapper method impl (calling native one above) # e.g. - # public static void add( Mat src1, Mat src2, Mat dst, Mat mask, ElemType ddepth ) + # public static void add( Mat src1, Mat src2, Mat dst, Mat mask, ElemDepth ddepth ) # { add_0( src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj, ddepth ); } ret_type = fi.ctype if fi.ctype.endswith('*'): diff --git a/modules/java/generator/src/cpp/Mat.cpp b/modules/java/generator/src/cpp/Mat.cpp index e8fb351e96b0..0512803ada89 100644 --- a/modules/java/generator/src/cpp/Mat.cpp +++ b/modules/java/generator/src/cpp/Mat.cpp @@ -258,7 +258,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1adjustROI // -// void Mat::assignTo(Mat m, ElemType depth = CV_TYPE_AUTO) +// void Mat::assignTo(Mat m, ElemDepth depth = CV_DEPTH_AUTO) // JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJI @@ -271,7 +271,7 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJI try { LOGD("%s", method_name); Mat* me = (Mat*) self; //TODO: check for NULL - me->assignTo((*(Mat*)m_nativeObj), static_cast(depth)); + me->assignTo((*(Mat*)m_nativeObj), static_cast(depth)); } catch(const std::exception &e) { throwJavaException(env, &e, method_name); } catch (...) { @@ -327,7 +327,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1channels // -// int Mat::checkVector(int elemChannels, ElemType depth = -1, bool requireContinuous = true) +// int Mat::checkVector(int elemChannels, ElemDepth depth = -1, bool requireContinuous = true) // JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JIIZ @@ -340,7 +340,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JIIZ try { LOGD("%s", method_name); Mat* me = (Mat*) self; //TODO: check for NULL - return me->checkVector(elemChannels, static_cast(depth), requireContinuous); + return me->checkVector(elemChannels, static_cast(depth), requireContinuous); } catch(const std::exception &e) { throwJavaException(env, &e, method_name); } catch (...) { @@ -362,7 +362,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JII try { LOGD("%s", method_name); Mat* me = (Mat*) self; //TODO: check for NULL - return me->checkVector(elemChannels, static_cast(depth)); + return me->checkVector(elemChannels, static_cast(depth)); } catch(const std::exception &e) { throwJavaException(env, &e, method_name); } catch (...) { @@ -531,7 +531,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1cols // -// void Mat::convertTo(Mat& m, ElemType ddepth, double alpha = 1, double beta = 0) +// void Mat::convertTo(Mat& m, ElemDepth ddepth, double alpha = 1, double beta = 0) // JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJIDD @@ -545,7 +545,7 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJIDD LOGD("%s", method_name); Mat* me = (Mat*) self; //TODO: check for NULL Mat& m = *((Mat*)m_nativeObj); - me->convertTo(m, static_cast(depth), alpha, beta); + me->convertTo(m, static_cast(depth), alpha, beta); } catch(const std::exception &e) { throwJavaException(env, &e, method_name); } catch (...) { @@ -565,7 +565,7 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJID LOGD("%s", method_name); Mat* me = (Mat*) self; //TODO: check for NULL Mat& m = *((Mat*)m_nativeObj); - me->convertTo(m, static_cast(rdepth), alpha); + me->convertTo(m, static_cast(rdepth), alpha); } catch(const std::exception &e) { throwJavaException(env, &e, method_name); } catch (...) { @@ -585,7 +585,7 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJI LOGD("%s", method_name); Mat* me = (Mat*) self; //TODO: check for NULL Mat& m = *((Mat*)m_nativeObj); - me->convertTo( m, static_cast(rtype) ); + me->convertTo( m, static_cast(rtype) ); } catch(const std::exception &e) { throwJavaException(env, &e, method_name); } catch (...) { diff --git a/modules/js/src/core_bindings.cpp b/modules/js/src/core_bindings.cpp index 5f8d9aa91f0f..1bbe527cebda 100644 --- a/modules/js/src/core_bindings.cpp +++ b/modules/js/src/core_bindings.cpp @@ -130,17 +130,17 @@ namespace binding_utils return Mat(cv::Mat::eye(size, type)); } - void convertTo(const Mat& obj, Mat& m, ElemType ddepth, double alpha, double beta) + void convertTo(const Mat& obj, Mat& m, ElemDepth ddepth, double alpha, double beta) { obj.convertTo(m, ddepth, alpha, beta); } - void convertTo(const Mat& obj, Mat& m, ElemType ddepth) + void convertTo(const Mat& obj, Mat& m, ElemDepth ddepth) { obj.convertTo(m, ddepth); } - void convertTo(const Mat& obj, Mat& m, ElemType ddepth, double alpha) + void convertTo(const Mat& obj, Mat& m, ElemDepth ddepth, double alpha) { obj.convertTo(m, ddepth, alpha); } @@ -358,9 +358,9 @@ EMSCRIPTEN_BINDINGS(binding_utils) .function("elemSize", select_overload(&cv::Mat::elemSize)) .function("elemSize1", select_overload(&cv::Mat::elemSize1)) .function("channels", select_overload(&cv::Mat::channels)) - .function("convertTo", select_overload(&binding_utils::convertTo)) - .function("convertTo", select_overload(&binding_utils::convertTo)) - .function("convertTo", select_overload(&binding_utils::convertTo)) + .function("convertTo", select_overload(&binding_utils::convertTo)) + .function("convertTo", select_overload(&binding_utils::convertTo)) + .function("convertTo", select_overload(&binding_utils::convertTo)) .function("total", select_overload(&cv::Mat::total)) .function("row", select_overload(&cv::Mat::row)) .function("create", select_overload(&cv::Mat::create)) @@ -375,7 +375,7 @@ EMSCRIPTEN_BINDINGS(binding_utils) .function("colRange", select_overload(&cv::Mat::colRange)) .function("step1", select_overload(&cv::Mat::step1)) .function("clone", select_overload(&cv::Mat::clone)) - .function("depth", select_overload(&cv::Mat::depth)) + .function("depth", select_overload(&cv::Mat::depth)) .function("col", select_overload(&cv::Mat::col)) .function("dot", select_overload(&binding_utils::matDot)) .function("mul", select_overload(&binding_utils::matMul)) diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index 9905c95b744f..1df682ab8b1e 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -262,7 +262,7 @@ class NumpyAllocator : public MatAllocator } PyEnsureGIL gil; - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type); const int f = (int)(sizeof(size_t)/8); int typenum = depth == CV_8U ? NPY_UBYTE : depth == CV_8S ? NPY_BYTE : @@ -363,14 +363,14 @@ static bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo info) bool needcopy = false, needcast = false; int typenum = PyArray_TYPE(oarr), new_typenum = typenum; - ElemType type = typenum == NPY_UBYTE ? CV_8U : - typenum == NPY_BYTE ? CV_8S : - typenum == NPY_USHORT ? CV_16U : - typenum == NPY_SHORT ? CV_16S : - typenum == NPY_INT ? CV_32S : - typenum == NPY_INT32 ? CV_32S : - typenum == NPY_FLOAT ? CV_32F : - typenum == NPY_DOUBLE ? CV_64F : CV_TYPE_AUTO; + ElemType type = typenum == NPY_UBYTE ? CV_8UC1 : + typenum == NPY_BYTE ? CV_8SC1 : + typenum == NPY_USHORT ? CV_16UC1 : + typenum == NPY_SHORT ? CV_16SC1 : + typenum == NPY_INT ? CV_32SC1 : + typenum == NPY_INT32 ? CV_32SC1 : + typenum == NPY_FLOAT ? CV_32FC1 : + typenum == NPY_DOUBLE ? CV_64FC1 : CV_TYPE_AUTO; if( type == CV_TYPE_AUTO ) { @@ -378,7 +378,7 @@ static bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo info) { needcopy = needcast = true; new_typenum = NPY_INT; - type = CV_32S; + type = CV_32SC1; } else { @@ -1149,7 +1149,7 @@ template struct pyopencvVecConverter value.resize(n); ElemType type = traits::Type<_Tp>::value; - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int channels = CV_MAT_CN(type); PyObject** items = PySequence_Fast_ITEMS(seq); @@ -1177,8 +1177,8 @@ template struct pyopencvVecConverter ((src.cols != 1 || src.rows != channels) && (src.cols != channels || src.rows != 1))) break; - Mat dst(src.rows, src.cols, depth, data); - src.convertTo(dst, type); + Mat dst(src.rows, src.cols, CV_MAKETYPE(depth, 1), data); + src.convertTo(dst, depth); if( dst.data != (uchar*)data ) break; continue; @@ -1233,7 +1233,7 @@ template struct pyopencvVecConverter if(value.empty()) return PyTuple_New(0); int type = traits::Type<_Tp>::value; - ElemType depth = CV_MAT_DEPTH(type); + ElemDepth depth = CV_MAT_DEPTH(type); int channels = CV_MAT_CN(type); Mat src((int)value.size(), channels, CV_MAKETYPE(depth, 1), (uchar*)&value[0]); return pyopencv_from(src); diff --git a/modules/python/src2/gen2.py b/modules/python/src2/gen2.py index c7f5171a32bf..ddc2d4f6b50e 100755 --- a/modules/python/src2/gen2.py +++ b/modules/python/src2/gen2.py @@ -863,7 +863,7 @@ def clear(self): self.classes = {} self.namespaces = {} self.consts = {} - self.enumTypes = ["ElemType", ] + self.enumTypes = ["ElemType", "ElemDepth", ] self.code_include = StringIO() self.code_types = StringIO() self.code_funcs = StringIO()