Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cv3d committed Sep 21, 2018
1 parent 295b988 commit 17d512c
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 7 deletions.
11 changes: 10 additions & 1 deletion modules/core/include/opencv2/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3037,7 +3037,7 @@ String& operator << (String& out, const Mat& mtx)

class CV_EXPORTS Algorithm;

template<typename _Tp> struct ParamType {};
template<typename _Tp, typename _EnumTp = void> struct ParamType {};


/** @brief This is a base class for all more or less complex algorithms in OpenCV
Expand Down Expand Up @@ -3253,6 +3253,15 @@ template<> struct ParamType<Scalar>
enum { type = Param::SCALAR };
};

template<typename _Tp>
struct ParamType<_Tp, typename std::enable_if< std::is_enum<_Tp>::value >::type>
{
typedef typename std::underlying_type<_Tp>::type const_param_type;
typedef typename std::underlying_type<_Tp>::type member_type;

enum { type = Param::INT };
};

//! @} core_basic

} //namespace cv
Expand Down
2 changes: 1 addition & 1 deletion modules/core/include/opencv2/core/base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ configurations while CV_DbgAssert is only retained in the Debug configuration.
#define CV_Assert_9( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ) CV_Assert_8(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8 ); CV_Assert_1(expr9)
#define CV_Assert_10( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9, expr10 ) CV_Assert_9(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ); CV_Assert_1(expr10)

#define CV_Assert_N(...) do { __CV_CAT(CV_Assert_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__); } while(0)
#define CV_Assert_N(...) do { __CV_EXPAND(__CV_CAT(CV_Assert_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__)); } while(0)

//! @endcond

Expand Down
2 changes: 1 addition & 1 deletion modules/core/include/opencv2/core/cvdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace cv { namespace debug_build_guard { } using namespace debug_build_guard
#endif

#define __CV_VA_NUM_ARGS_HELPER(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
#define __CV_VA_NUM_ARGS(...) __CV_VA_NUM_ARGS_HELPER(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#define __CV_VA_NUM_ARGS(...) __CV_EXPAND(__CV_VA_NUM_ARGS_HELPER(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0))

// undef problematic defines sometimes defined by system headers (windows.h in particular)
#undef small
Expand Down
22 changes: 22 additions & 0 deletions modules/core/include/opencv2/core/hal/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,28 @@ typedef signed char schar;

#define CV_USRTYPE1 (void)"CV_USRTYPE1 support has been dropped in OpenCV 4.0"

//! test: Simplify the reviewer life
//Reduced version of PR #12487
//TODO: Remove these before merege
#define ElemType int
#define ElemDepth int
#define MagicFlag int
#define CV_DEPTH_AUTO -1
#define CV_TYPE_AUTO -1
#define __CV_MAX_DEPTH_0(m, n) (m != 7 || n <= 3 ? m : n) /* CV_16F workaround */
#define __CV_MAX_DEPTH_1(d1, d2) __CV_MAX_DEPTH_0(std::max(d1, d2), std::min(d1, d2))
#define __CV_MAX_DEPTH_2(d1, d2) __CV_MAX_DEPTH_1(static_cast<int>(d1), static_cast<int>(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<ElemDepth>(__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<int>(d1), static_cast<int>(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<ElemDepth>(__CV_CAT(__CV_MIN_DEPTH_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__)))
//end of ! test

#define CV_CN_MAX 512
#define CV_CN_SHIFT 3
#define CV_DEPTH_MAX (1 << CV_CN_SHIFT)
Expand Down
1 change: 1 addition & 0 deletions modules/core/include/opencv2/core/mat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ There are several synonyms for OutputArray that are used to assist automatic Pyt
class CV_EXPORTS _OutputArray : public _InputArray
{
public:
typedef int DepthMask; //TODO: Remove me
enum
{
DEPTH_MASK_8U = 1 << CV_8U,
Expand Down
6 changes: 3 additions & 3 deletions modules/core/test/test_mat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ void Core_ArrayOpTest::run( int /* start_from */)
}


template <class ElemType>
template <class T>
int calcDiffElemCountImpl(const vector<Mat>& mv, const Mat& m)
{
int diffElemCount = 0;
Expand All @@ -955,12 +955,12 @@ int calcDiffElemCountImpl(const vector<Mat>& mv, const Mat& m)
{
for(int x = 0; x < m.cols; x++)
{
const ElemType* mElem = &m.at<ElemType>(y,x*mChannels);
const T* mElem = &m.at<T>(y, x*mChannels);
size_t loc = 0;
for(size_t i = 0; i < mv.size(); i++)
{
const size_t mvChannel = mv[i].channels();
const ElemType* mvElem = &mv[i].at<ElemType>(y,x*(int)mvChannel);
const T* mvElem = &mv[i].at<T>(y, x*(int)mvChannel);
for(size_t li = 0; li < mvChannel; li++)
if(mElem[loc + li] != mvElem[li])
diffElemCount++;
Expand Down
4 changes: 3 additions & 1 deletion modules/java/generator/gen_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def checkFileRemap(path):
"size_t" : { "j_type" : "long", "jn_type" : "long", "jni_type" : "jlong", "suffix" : "J" },
"__int64" : { "j_type" : "long", "jn_type" : "long", "jni_type" : "jlong", "suffix" : "J" },
"int64" : { "j_type" : "long", "jn_type" : "long", "jni_type" : "jlong", "suffix" : "J" },
"double[]": { "j_type" : "double[]", "jn_type" : "double[]", "jni_type" : "jdoubleArray", "suffix" : "_3D" }
"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.
Expand Down

0 comments on commit 17d512c

Please sign in to comment.