Merge remote-tracking branch 'upstream/3.4' into merge-3.4

pull/15385/head
Alexander Alekhin 6 years ago
commit a7b954f655
  1. 6
      3rdparty/libjasper/jasper/jas_config.h
  2. 4
      3rdparty/libpng/CMakeLists.txt
  3. 19
      CMakeLists.txt
  4. 19
      cmake/OpenCVDetectCXXCompiler.cmake
  5. 2
      cmake/OpenCVDetectInferenceEngine.cmake
  6. 24
      cmake/OpenCVUtils.cmake
  7. 12
      cmake/checks/atomic_check.cpp
  8. 2
      doc/py_tutorials/py_core/py_optimization/py_optimization.markdown
  9. 4
      doc/py_tutorials/py_feature2d/py_matcher/py_matcher.markdown
  10. 2
      doc/tutorials/stitching/stitcher/stitcher.markdown
  11. 185
      modules/core/include/opencv2/core/fast_math.hpp
  12. 16
      modules/core/include/opencv2/core/mat.inl.hpp
  13. 2
      modules/core/src/stat.simd.hpp
  14. 13
      modules/dnn/src/tensorflow/tf_importer.cpp
  15. 2
      modules/dnn/test/test_tf_importer.cpp
  16. 6
      modules/imgproc/src/corner.avx.cpp
  17. 19
      modules/objdetect/src/hog.cpp
  18. 1
      modules/photo/src/seamless_cloning.cpp
  19. 9
      modules/photo/test/test_cloning.cpp
  20. 2
      modules/ts/include/opencv2/ts/ts_gtest.h
  21. 25
      platforms/ios/build_framework.py
  22. 15
      platforms/osx/build_framework.py
  23. 2
      samples/python/camshift.py

@ -17,6 +17,12 @@
#if !defined(JAS_WIN_MSVC_BUILD) #if !defined(JAS_WIN_MSVC_BUILD)
/* A configure-based build is being used. */ /* A configure-based build is being used. */
#include <stdio.h>
// uClibc-ng workaround: https://github.com/opencv/opencv/pull/15279
#ifndef L_tmpnam
#define L_tmpnam 20
#endif
/* Extra debugging support */ /* Extra debugging support */

@ -47,7 +47,9 @@ if(";${CPU_BASELINE_FINAL};" MATCHES "SSE2"
endif() endif()
if(PPC64LE OR PPC64) if(PPC64LE OR PPC64)
if(ENABLE_VSX AND NOT PPC64) # VSX3 features are backwards compatible
if(";${CPU_BASELINE_FINAL};" MATCHES "VSX.*"
AND NOT PPC64)
list(APPEND lib_srcs powerpc/powerpc_init.c powerpc/filter_vsx_intrinsics.c) list(APPEND lib_srcs powerpc/powerpc_init.c powerpc/filter_vsx_intrinsics.c)
add_definitions(-DPNG_POWERPC_VSX_OPT=2) add_definitions(-DPNG_POWERPC_VSX_OPT=2)
else() else()

@ -64,6 +64,10 @@ if(POLICY CMP0068)
cmake_policy(SET CMP0068 NEW) # CMake 3.9+: `RPATH` settings on macOS do not affect `install_name`. cmake_policy(SET CMP0068 NEW) # CMake 3.9+: `RPATH` settings on macOS do not affect `install_name`.
endif() endif()
if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW) # CMake 3.12+: Include file check macros honor `CMAKE_REQUIRED_LIBRARIES`
endif()
# #
# Configure OpenCV CMake hooks # Configure OpenCV CMake hooks
@ -1502,19 +1506,22 @@ endif()
if(WITH_INF_ENGINE OR INF_ENGINE_TARGET) if(WITH_INF_ENGINE OR INF_ENGINE_TARGET)
if(INF_ENGINE_TARGET) if(INF_ENGINE_TARGET)
list(GET INF_ENGINE_TARGET 0 ie_target)
set(__msg "YES (${INF_ENGINE_RELEASE} / ${INF_ENGINE_VERSION})") set(__msg "YES (${INF_ENGINE_RELEASE} / ${INF_ENGINE_VERSION})")
get_target_property(_lib ${INF_ENGINE_TARGET} IMPORTED_LOCATION) get_target_property(_lib ${ie_target} IMPORTED_LOCATION)
get_target_property(_lib_imp_rel ${INF_ENGINE_TARGET} IMPORTED_IMPLIB_RELEASE) get_target_property(_lib_imp_rel ${ie_target} IMPORTED_IMPLIB_RELEASE)
get_target_property(_lib_imp_dbg ${INF_ENGINE_TARGET} IMPORTED_IMPLIB_DEBUG) get_target_property(_lib_imp_dbg ${ie_target} IMPORTED_IMPLIB_DEBUG)
get_target_property(_lib_rel ${INF_ENGINE_TARGET} IMPORTED_LOCATION_RELEASE) get_target_property(_lib_rel ${ie_target} IMPORTED_LOCATION_RELEASE)
get_target_property(_lib_dbg ${INF_ENGINE_TARGET} IMPORTED_LOCATION_DEBUG) get_target_property(_lib_dbg ${ie_target} IMPORTED_LOCATION_DEBUG)
ocv_build_features_string(_lib ocv_build_features_string(_lib
IF _lib THEN "${_lib}" IF _lib THEN "${_lib}"
IF _lib_imp_rel AND _lib_imp_dbg THEN "${_lib_imp_rel} / ${_lib_imp_dbg}" IF _lib_imp_rel AND _lib_imp_dbg THEN "${_lib_imp_rel} / ${_lib_imp_dbg}"
IF _lib_rel AND _lib_dbg THEN "${_lib_rel} / ${_lib_dbg}" IF _lib_rel AND _lib_dbg THEN "${_lib_rel} / ${_lib_dbg}"
IF _lib_rel THEN "${_lib_rel}"
IF _lib_dbg THEN "${_lib_dbg}"
ELSE "unknown" ELSE "unknown"
) )
get_target_property(_inc ${INF_ENGINE_TARGET} INTERFACE_INCLUDE_DIRECTORIES) get_target_property(_inc ${ie_target} INTERFACE_INCLUDE_DIRECTORIES)
status(" Inference Engine:" "${__msg}") status(" Inference Engine:" "${__msg}")
status(" libs:" "${_lib}") status(" libs:" "${_lib}")
status(" includes:" "${_inc}") status(" includes:" "${_inc}")

@ -191,6 +191,25 @@ if(NOT HAVE_CXX11)
endif() endif()
endif() endif()
endif() endif()
if(NOT HAVE_CXX11) if(NOT HAVE_CXX11)
message(FATAL_ERROR "OpenCV 4.x requires C++11") message(FATAL_ERROR "OpenCV 4.x requires C++11")
endif() endif()
if((HAVE_CXX11
AND NOT MSVC
AND NOT (X86 OR X86_64)
AND NOT OPENCV_SKIP_LIBATOMIC_COMPILER_CHECK)
OR OPENCV_FORCE_LIBATOMIC_COMPILER_CHECK
)
ocv_check_compiler_flag(CXX "" HAVE_CXX_ATOMICS_WITHOUT_LIB "${OpenCV_SOURCE_DIR}/cmake/checks/atomic_check.cpp")
if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
list(APPEND CMAKE_REQUIRED_LIBRARIES atomic)
ocv_check_compiler_flag(CXX "" HAVE_CXX_ATOMICS_WITH_LIB "${OpenCV_SOURCE_DIR}/cmake/checks/atomic_check.cpp")
if(HAVE_CXX_ATOMICS_WITH_LIB)
list(APPEND OPENCV_LINKER_LIBS atomic)
else()
message(FATAL_ERROR "C++11 compiler must support std::atomic")
endif()
endif()
endif()

@ -45,7 +45,7 @@ endfunction()
find_package(InferenceEngine QUIET) find_package(InferenceEngine QUIET)
if(InferenceEngine_FOUND) if(InferenceEngine_FOUND)
set(INF_ENGINE_TARGET IE::inference_engine) set(INF_ENGINE_TARGET ${InferenceEngine_LIBRARIES})
set(INF_ENGINE_VERSION "${InferenceEngine_VERSION}" CACHE STRING "") set(INF_ENGINE_VERSION "${InferenceEngine_VERSION}" CACHE STRING "")
message(STATUS "Detected InferenceEngine: cmake package") message(STATUS "Detected InferenceEngine: cmake package")
endif() endif()

@ -415,12 +415,34 @@ MACRO(ocv_check_compiler_flag LANG FLAG RESULT)
else() else()
set(__msg "") set(__msg "")
endif() endif()
if(CMAKE_REQUIRED_LIBRARIES)
set(__link_libs LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
else()
set(__link_libs)
endif()
set(__cmake_flags "")
if(CMAKE_EXE_LINKER_FLAGS) # CMP0056 do this on new CMake
list(APPEND __cmake_flags "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}")
endif()
# CMP0067 do this on new CMake
if(DEFINED CMAKE_CXX_STANDARD)
list(APPEND __cmake_flags "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}")
endif()
if(DEFINED CMAKE_CXX_STANDARD_REQUIRED)
list(APPEND __cmake_flags "-DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}")
endif()
if(DEFINED CMAKE_CXX_EXTENSIONS)
list(APPEND __cmake_flags "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}")
endif()
MESSAGE(STATUS "Performing Test ${RESULT}${__msg}") MESSAGE(STATUS "Performing Test ${RESULT}${__msg}")
TRY_COMPILE(${RESULT} TRY_COMPILE(${RESULT}
"${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}"
"${_fname}" "${_fname}"
CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}" # CMP0056 do this on new CMake CMAKE_FLAGS ${__cmake_flags}
COMPILE_DEFINITIONS "${FLAG}" COMPILE_DEFINITIONS "${FLAG}"
${__link_libs}
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
if(${RESULT}) if(${RESULT})

@ -0,0 +1,12 @@
#include <atomic>
static int test()
{
std::atomic<int> x;
return x;
}
int main()
{
return test();
}

@ -40,7 +40,7 @@ goal):
img1 = cv.imread('messi5.jpg') img1 = cv.imread('messi5.jpg')
e1 = cv.getTickCount() e1 = cv.getTickCount()
for i in xrange(5,49,2): for i in range(5,49,2):
img1 = cv.medianBlur(img1,i) img1 = cv.medianBlur(img1,i)
e2 = cv.getTickCount() e2 = cv.getTickCount()
t = (e2 - e1)/cv.getTickFrequency() t = (e2 - e1)/cv.getTickFrequency()

@ -38,13 +38,13 @@ best matches. There is also **cv.drawMatchesKnn** which draws all the k best mat
will draw two match-lines for each keypoint. So we have to pass a mask if we want to selectively will draw two match-lines for each keypoint. So we have to pass a mask if we want to selectively
draw it. draw it.
Let's see one example for each of SURF and ORB (Both use different distance measurements). Let's see one example for each of SIFT and ORB (Both use different distance measurements).
### Brute-Force Matching with ORB Descriptors ### Brute-Force Matching with ORB Descriptors
Here, we will see a simple example on how to match features between two images. In this case, I have Here, we will see a simple example on how to match features between two images. In this case, I have
a queryImage and a trainImage. We will try to find the queryImage in trainImage using feature a queryImage and a trainImage. We will try to find the queryImage in trainImage using feature
matching. ( The images are /samples/c/box.png and /samples/c/box_in_scene.png) matching. ( The images are /samples/data/box.png and /samples/data/box_in_scene.png)
We are using ORB descriptors to match features. So let's start with loading images, finding We are using ORB descriptors to match features. So let's start with loading images, finding
descriptors etc. descriptors etc.

@ -15,7 +15,7 @@ Code
---- ----
This tutorial code's is shown lines below. You can also download it from This tutorial code's is shown lines below. You can also download it from
[here](https://github.com/opencv/opencv/tree/master/samples/cpp/samples/cpp/stitching.cpp). [here](https://github.com/opencv/opencv/tree/master/samples/cpp/stitching.cpp).
@include samples/cpp/stitching.cpp @include samples/cpp/stitching.cpp

@ -47,12 +47,6 @@
#include "opencv2/core/cvdef.h" #include "opencv2/core/cvdef.h"
#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \
&& defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__)
#include <emmintrin.h>
#endif
//! @addtogroup core_utils //! @addtogroup core_utils
//! @{ //! @{
@ -70,14 +64,24 @@
# endif # endif
#endif #endif
#if defined __PPC64__ && defined __GNUC__ && defined _ARCH_PWR8 && !defined (__CUDACC__) #if defined(__CUDACC__)
# include <altivec.h> // nothing, intrinsics/asm code is not supported
#endif #else
#if ((defined _MSC_VER && defined _M_X64) \
#if defined(CV_INLINE_ROUND_FLT) || (defined __GNUC__ && defined __x86_64__ && defined __SSE2__)) \
&& !defined(OPENCV_SKIP_INCLUDE_EMMINTRIN_H)
#include <emmintrin.h>
#endif
#if defined __PPC64__ && defined __GNUC__ && defined _ARCH_PWR8 \
&& !defined(OPENCV_SKIP_INCLUDE_ALTIVEC_H)
#include <altivec.h>
#endif
#if defined(CV_INLINE_ROUND_FLT)
// user-specified version // user-specified version
// CV_INLINE_ROUND_DBL should be defined too // CV_INLINE_ROUND_DBL should be defined too
#elif defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__ || defined __ARM_NEON__) && !defined __SOFTFP__ && !defined(__CUDACC__) #elif defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__ || defined __ARM_NEON__) && !defined __SOFTFP__
// 1. general scheme // 1. general scheme
#define ARM_ROUND(_value, _asm_string) \ #define ARM_ROUND(_value, _asm_string) \
int res; \ int res; \
@ -93,7 +97,7 @@
#endif #endif
// 3. version for float // 3. version for float
#define CV_INLINE_ROUND_FLT(value) ARM_ROUND(value, "vcvtr.s32.f32 %[temp], %[value]\n vmov %[res], %[temp]") #define CV_INLINE_ROUND_FLT(value) ARM_ROUND(value, "vcvtr.s32.f32 %[temp], %[value]\n vmov %[res], %[temp]")
#elif defined __PPC64__ && defined __GNUC__ && defined _ARCH_PWR8 && !defined (__CUDACC__) #elif defined __PPC64__ && defined __GNUC__ && defined _ARCH_PWR8
// P8 and newer machines can convert fp32/64 to int quickly. // P8 and newer machines can convert fp32/64 to int quickly.
#define CV_INLINE_ROUND_DBL(value) \ #define CV_INLINE_ROUND_DBL(value) \
int out; \ int out; \
@ -103,40 +107,86 @@
// FP32 also works with FP64 routine above // FP32 also works with FP64 routine above
#define CV_INLINE_ROUND_FLT(value) CV_INLINE_ROUND_DBL(value) #define CV_INLINE_ROUND_FLT(value) CV_INLINE_ROUND_DBL(value)
#endif
#ifdef _ARCH_PWR9 #ifdef CV_INLINE_ISINF_FLT
#define CV_INLINE_ISINF_DBL(value) return scalar_test_data_class(value, 0x30); // user-specified version
#define CV_INLINE_ISNAN_DBL(value) return scalar_test_data_class(value, 0x40); // CV_INLINE_ISINF_DBL should be defined too
#define CV_INLINE_ISINF_FLT(value) CV_INLINE_ISINF_DBL(value) #elif defined __PPC64__ && defined _ARCH_PWR9 && defined(scalar_test_data_class)
#define CV_INLINE_ISNAN_FLT(value) CV_INLINE_ISNAN_DBL(value) #define CV_INLINE_ISINF_DBL(value) return scalar_test_data_class(value, 0x30);
#endif #define CV_INLINE_ISINF_FLT(value) CV_INLINE_ISINF_DBL(value)
#elif defined CV_ICC || defined __GNUC__ #endif
#define CV_INLINE_ROUND_DBL(value) return (int)(lrint(value));
#define CV_INLINE_ROUND_FLT(value) return (int)(lrintf(value));
#endif
#if defined __PPC64__ && !defined OPENCV_USE_FASTMATH_GCC_BUILTINS
/* Let GCC inline C math functions when available. Dedicated hardware is available to
round and covert FP values. */
#define OPENCV_USE_FASTMATH_GCC_BUILTINS
#endif
/* Enable GCC builtin math functions if possible, desired, and available.
Note, not all math functions inline equally. E.g lrint will not inline
without the -fno-math-errno option. */
#if defined OPENCV_USE_FASTMATH_GCC_BUILTINS && defined __GNUC__ && !defined __clang__ && !defined (__CUDACC__)
#define _OPENCV_FASTMATH_ENABLE_GCC_MATH_BUILTINS
#endif
/* Allow overrides for some functions which may benefit from tuning. Likewise, #ifdef CV_INLINE_ISNAN_FLT
note that isinf is not used as the return value is signed. */ // user-specified version
#if defined _OPENCV_FASTMATH_ENABLE_GCC_MATH_BUILTINS && !defined CV_INLINE_ISNAN_DBL // CV_INLINE_ISNAN_DBL should be defined too
#define CV_INLINE_ISNAN_DBL(value) return __builtin_isnan(value); #elif defined __PPC64__ && defined _ARCH_PWR9 && defined(scalar_test_data_class)
#endif #define CV_INLINE_ISNAN_DBL(value) return scalar_test_data_class(value, 0x40);
#define CV_INLINE_ISNAN_FLT(value) CV_INLINE_ISNAN_DBL(value)
#endif
#if !defined(OPENCV_USE_FASTMATH_BUILTINS) \
&& ( \
defined(__x86_64__) || defined(__i686__) \
|| defined(__arm__) \
|| defined(__PPC64__) \
)
/* Let builtin C math functions when available. Dedicated hardware is available to
round and convert FP values. */
#define OPENCV_USE_FASTMATH_BUILTINS 1
#endif
/* Enable builtin math functions if possible, desired, and available.
Note, not all math functions inline equally. E.g lrint will not inline
without the -fno-math-errno option. */
#if defined(CV_ICC)
// nothing
#elif defined(OPENCV_USE_FASTMATH_BUILTINS) && OPENCV_USE_FASTMATH_BUILTINS
#if defined(__clang__)
#define CV__FASTMATH_ENABLE_CLANG_MATH_BUILTINS
#if !defined(CV_INLINE_ISNAN_DBL) && __has_builtin(__builtin_isnan)
#define CV_INLINE_ISNAN_DBL(value) return __builtin_isnan(value);
#endif
#if !defined(CV_INLINE_ISNAN_FLT) && __has_builtin(__builtin_isnan)
#define CV_INLINE_ISNAN_FLT(value) return __builtin_isnan(value);
#endif
#if !defined(CV_INLINE_ISINF_DBL) && __has_builtin(__builtin_isinf)
#define CV_INLINE_ISINF_DBL(value) return __builtin_isinf(value);
#endif
#if !defined(CV_INLINE_ISINF_FLT) && __has_builtin(__builtin_isinf)
#define CV_INLINE_ISINF_FLT(value) return __builtin_isinf(value);
#endif
#elif defined(__GNUC__)
#define CV__FASTMATH_ENABLE_GCC_MATH_BUILTINS
#if !defined(CV_INLINE_ISNAN_DBL)
#define CV_INLINE_ISNAN_DBL(value) return __builtin_isnan(value);
#endif
#if !defined(CV_INLINE_ISNAN_FLT)
#define CV_INLINE_ISNAN_FLT(value) return __builtin_isnanf(value);
#endif
#if !defined(CV_INLINE_ISINF_DBL)
#define CV_INLINE_ISINF_DBL(value) return __builtin_isinf(value);
#endif
#if !defined(CV_INLINE_ISINF_FLT)
#define CV_INLINE_ISINF_FLT(value) return __builtin_isinff(value);
#endif
#elif defined(_MSC_VER)
#if !defined(CV_INLINE_ISNAN_DBL)
#define CV_INLINE_ISNAN_DBL(value) return isnan(value);
#endif
#if !defined(CV_INLINE_ISNAN_FLT)
#define CV_INLINE_ISNAN_FLT(value) return isnan(value);
#endif
#if !defined(CV_INLINE_ISINF_DBL)
#define CV_INLINE_ISINF_DBL(value) return isinf(value);
#endif
#if !defined(CV_INLINE_ISINF_FLT)
#define CV_INLINE_ISINF_FLT(value) return isinf(value);
#endif
#endif
#endif
#if defined _OPENCV_FASTMATH_ENABLE_GCC_MATH_BUILTINS && !defined CV_INLINE_ISNAN_FLT #endif // defined(__CUDACC__)
#define CV_INLINE_ISNAN_FLT(value) return __builtin_isnanf(value);
#endif
/** @brief Rounds floating-point number to the nearest integer /** @brief Rounds floating-point number to the nearest integer
@ -146,8 +196,11 @@
CV_INLINE int CV_INLINE int
cvRound( double value ) cvRound( double value )
{ {
#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \ #if defined CV_INLINE_ROUND_DBL
&& defined __SSE2__ && !defined __APPLE__) || CV_SSE2) && !defined(__CUDACC__) CV_INLINE_ROUND_DBL(value);
#elif ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \
&& defined __SSE2__ && !defined __APPLE__) || CV_SSE2) \
&& !defined(__CUDACC__)
__m128d t = _mm_set_sd( value ); __m128d t = _mm_set_sd( value );
return _mm_cvtsd_si32(t); return _mm_cvtsd_si32(t);
#elif defined _MSC_VER && defined _M_IX86 #elif defined _MSC_VER && defined _M_IX86
@ -158,10 +211,8 @@ cvRound( double value )
fistp t; fistp t;
} }
return t; return t;
#elif defined CV_INLINE_ROUND_DBL
CV_INLINE_ROUND_DBL(value);
#elif defined CV_ICC || defined __GNUC__ #elif defined CV_ICC || defined __GNUC__
return (int)lrint(value); return (int)(lrint(value));
#else #else
/* it's ok if round does not comply with IEEE754 standard; /* it's ok if round does not comply with IEEE754 standard;
the tests should allow +/-1 difference when the tested functions use round */ the tests should allow +/-1 difference when the tested functions use round */
@ -179,7 +230,10 @@ cvRound( double value )
*/ */
CV_INLINE int cvFloor( double value ) CV_INLINE int cvFloor( double value )
{ {
#if defined _OPENCV_FASTMATH_ENABLE_GCC_MATH_BUILTINS #if (defined CV__FASTMATH_ENABLE_GCC_MATH_BUILTINS || defined CV__FASTMATH_ENABLE_CLANG_MATH_BUILTINS) \
&& ( \
defined(__PPC64__) \
)
return __builtin_floor(value); return __builtin_floor(value);
#else #else
int i = (int)value; int i = (int)value;
@ -196,7 +250,10 @@ CV_INLINE int cvFloor( double value )
*/ */
CV_INLINE int cvCeil( double value ) CV_INLINE int cvCeil( double value )
{ {
#if defined _OPENCV_FASTMATH_ENABLE_GCC_MATH_BUILTINS #if (defined CV__FASTMATH_ENABLE_GCC_MATH_BUILTINS || defined CV__FASTMATH_ENABLE_CLANG_MATH_BUILTINS) \
&& ( \
defined(__PPC64__) \
)
return __builtin_ceil(value); return __builtin_ceil(value);
#else #else
int i = (int)value; int i = (int)value;
@ -232,6 +289,11 @@ CV_INLINE int cvIsInf( double value )
{ {
#if defined CV_INLINE_ISINF_DBL #if defined CV_INLINE_ISINF_DBL
CV_INLINE_ISINF_DBL(value); CV_INLINE_ISINF_DBL(value);
#elif defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(__PPC64__)
Cv64suf ieee754;
ieee754.f = value;
return (ieee754.u & 0x7fffffff00000000) ==
0x7ff0000000000000;
#else #else
Cv64suf ieee754; Cv64suf ieee754;
ieee754.f = value; ieee754.f = value;
@ -245,8 +307,11 @@ CV_INLINE int cvIsInf( double value )
/** @overload */ /** @overload */
CV_INLINE int cvRound(float value) CV_INLINE int cvRound(float value)
{ {
#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \ #if defined CV_INLINE_ROUND_FLT
&& defined __SSE2__ && !defined __APPLE__) || CV_SSE2) && !defined(__CUDACC__) CV_INLINE_ROUND_FLT(value);
#elif ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \
&& defined __SSE2__ && !defined __APPLE__) || CV_SSE2) \
&& !defined(__CUDACC__)
__m128 t = _mm_set_ss( value ); __m128 t = _mm_set_ss( value );
return _mm_cvtss_si32(t); return _mm_cvtss_si32(t);
#elif defined _MSC_VER && defined _M_IX86 #elif defined _MSC_VER && defined _M_IX86
@ -257,10 +322,8 @@ CV_INLINE int cvRound(float value)
fistp t; fistp t;
} }
return t; return t;
#elif defined CV_INLINE_ROUND_FLT
CV_INLINE_ROUND_FLT(value);
#elif defined CV_ICC || defined __GNUC__ #elif defined CV_ICC || defined __GNUC__
return (int)lrintf(value); return (int)(lrintf(value));
#else #else
/* it's ok if round does not comply with IEEE754 standard; /* it's ok if round does not comply with IEEE754 standard;
the tests should allow +/-1 difference when the tested functions use round */ the tests should allow +/-1 difference when the tested functions use round */
@ -277,7 +340,10 @@ CV_INLINE int cvRound( int value )
/** @overload */ /** @overload */
CV_INLINE int cvFloor( float value ) CV_INLINE int cvFloor( float value )
{ {
#if defined _OPENCV_FASTMATH_ENABLE_GCC_MATH_BUILTINS #if (defined CV__FASTMATH_ENABLE_GCC_MATH_BUILTINS || defined CV__FASTMATH_ENABLE_CLANG_MATH_BUILTINS) \
&& ( \
defined(__PPC64__) \
)
return __builtin_floorf(value); return __builtin_floorf(value);
#else #else
int i = (int)value; int i = (int)value;
@ -294,7 +360,10 @@ CV_INLINE int cvFloor( int value )
/** @overload */ /** @overload */
CV_INLINE int cvCeil( float value ) CV_INLINE int cvCeil( float value )
{ {
#if defined _OPENCV_FASTMATH_ENABLE_GCC_MATH_BUILTINS #if (defined CV__FASTMATH_ENABLE_GCC_MATH_BUILTINS || defined CV__FASTMATH_ENABLE_CLANG_MATH_BUILTINS) \
&& ( \
defined(__PPC64__) \
)
return __builtin_ceilf(value); return __builtin_ceilf(value);
#else #else
int i = (int)value; int i = (int)value;

@ -1699,6 +1699,11 @@ Mat_<_Tp>::Mat_(const std::array<_Tp, _Nm>& arr, bool copyData)
template<typename _Tp> inline template<typename _Tp> inline
Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat& m) Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat& m)
{ {
if (m.empty())
{
release();
return *this;
}
if( traits::Type<_Tp>::value == m.type() ) if( traits::Type<_Tp>::value == m.type() )
{ {
Mat::operator = (m); Mat::operator = (m);
@ -1764,7 +1769,7 @@ Mat_<_Tp> Mat_<_Tp>::cross(const Mat_& m) const
template<typename _Tp> template<typename T2> inline template<typename _Tp> template<typename T2> inline
Mat_<_Tp>::operator Mat_<T2>() const Mat_<_Tp>::operator Mat_<T2>() const
{ {
return Mat_<T2>(*this); return Mat_<T2>(static_cast<const Mat&>(*this));
} }
template<typename _Tp> inline template<typename _Tp> inline
@ -2054,7 +2059,7 @@ void Mat_<_Tp>::forEach(const Functor& operation) const {
template<typename _Tp> inline template<typename _Tp> inline
Mat_<_Tp>::Mat_(Mat_&& m) Mat_<_Tp>::Mat_(Mat_&& m)
: Mat(m) : Mat(std::move(m))
{ {
} }
@ -2070,12 +2075,17 @@ Mat_<_Tp>::Mat_(Mat&& m)
: Mat() : Mat()
{ {
flags = (flags & ~CV_MAT_TYPE_MASK) + traits::Type<_Tp>::value; flags = (flags & ~CV_MAT_TYPE_MASK) + traits::Type<_Tp>::value;
*this = m; *this = std::move(m);
} }
template<typename _Tp> inline template<typename _Tp> inline
Mat_<_Tp>& Mat_<_Tp>::operator = (Mat&& m) Mat_<_Tp>& Mat_<_Tp>::operator = (Mat&& m)
{ {
if (m.empty())
{
release();
return *this;
}
if( traits::Type<_Tp>::value == m.type() ) if( traits::Type<_Tp>::value == m.type() )
{ {
Mat::operator = ((Mat&&)m); Mat::operator = ((Mat&&)m);

@ -110,7 +110,7 @@ int normHamming(const uchar* a, const uchar* b, int n)
{ {
v_uint64x2 t = v_setzero_u64(); v_uint64x2 t = v_setzero_u64();
for(; i <= n - v_uint8x16::nlanes; i += v_uint8x16::nlanes) for(; i <= n - v_uint8x16::nlanes; i += v_uint8x16::nlanes)
t += v_popcount(v_reinterpret_as_u64(vx_load(a + i) ^ vx_load(b + i))); t += v_popcount(v_reinterpret_as_u64(v_load(a + i) ^ v_load(b + i)));
result += (int)v_reduce_sum(t); result += (int)v_reduce_sum(t);
} }
#endif #endif

@ -1129,15 +1129,14 @@ void TFImporter::populateNet(Net dstNet)
if (value_id.find(layer.input(1)) != value_id.end()) if (value_id.find(layer.input(1)) != value_id.end())
{ {
Mat newShape = getTensorContent(getConstBlob(layer, value_id, 1)); Mat newShape = getTensorContent(getConstBlob(layer, value_id, 1));
if (newShape.total() == 4)
{
// NHWC->NCHW
std::swap(*newShape.ptr<int32_t>(0, 2), *newShape.ptr<int32_t>(0, 3));
std::swap(*newShape.ptr<int32_t>(0, 1), *newShape.ptr<int32_t>(0, 2));
}
if (inpLayout == DATA_LAYOUT_NHWC) if (inpLayout == DATA_LAYOUT_NHWC)
{ {
if (newShape.total() == 4)
{
// NHWC->NCHW
std::swap(*newShape.ptr<int32_t>(0, 2), *newShape.ptr<int32_t>(0, 3));
std::swap(*newShape.ptr<int32_t>(0, 1), *newShape.ptr<int32_t>(0, 2));
}
if (newShape.total() != 4 || newShape.at<int>(1) == 1) if (newShape.total() != 4 || newShape.at<int>(1) == 1)
{ {
LayerParams permLP; LayerParams permLP;

@ -279,7 +279,7 @@ TEST_P(Test_TensorFlow_layers, matmul)
// Reference output values are in range [-5.688, 4.484] // Reference output values are in range [-5.688, 4.484]
double l1 = target == DNN_TARGET_MYRIAD ? 6.1e-3 : default_l1; double l1 = target == DNN_TARGET_MYRIAD ? 6.1e-3 : default_l1;
runTensorFlowNet("nhwc_reshape_matmul", false, l1); runTensorFlowNet("nhwc_reshape_matmul", false, l1);
runTensorFlowNet("matmul_layout");
} }
TEST_P(Test_TensorFlow_layers, reshape) TEST_P(Test_TensorFlow_layers, reshape)

@ -113,9 +113,9 @@ static void store_interleave(float* ptr, const __m256& a, const __m256& b, const
v_pack4x3to3x4(u0.val, u1.val, u2.val, u3.val, a1, b1, c1); v_pack4x3to3x4(u0.val, u1.val, u2.val, u3.val, a1, b1, c1);
#if !defined(__GNUC__) || defined(__INTEL_COMPILER) #if !defined(__GNUC__) || defined(__INTEL_COMPILER)
_mm256_storeu_ps(ptr, _mm256_setr_m128(_mm_castsi128_ps(a0), _mm_castsi128_ps(b0))); _mm256_storeu_ps(ptr, _mm256_castsi256_ps(_mm256_setr_m128i(a0, b0)));
_mm256_storeu_ps(ptr + 8, _mm256_setr_m128(_mm_castsi128_ps(c0), _mm_castsi128_ps(a1))); _mm256_storeu_ps(ptr + 8, _mm256_castsi256_ps(_mm256_setr_m128i(c0, a1)));
_mm256_storeu_ps(ptr + 16, _mm256_setr_m128(_mm_castsi128_ps(b1), _mm_castsi128_ps(c1))); _mm256_storeu_ps(ptr + 16, _mm256_castsi256_ps(_mm256_setr_m128i(b1, c1)));
#else #else
// GCC: workaround for missing AVX intrinsic: "_mm256_setr_m128()" // GCC: workaround for missing AVX intrinsic: "_mm256_setr_m128()"
_mm256_storeu_ps(ptr, _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_castsi128_ps(a0)), _mm_castsi128_ps(b0), 1)); _mm256_storeu_ps(ptr, _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_castsi128_ps(a0)), _mm_castsi128_ps(b0), 1));

@ -66,6 +66,7 @@ namespace cv
static int numPartsWithin(int size, int part_size, int stride) static int numPartsWithin(int size, int part_size, int stride)
{ {
CV_Assert(stride != 0);
return (size - part_size + stride) / stride; return (size - part_size + stride) / stride;
} }
@ -78,13 +79,17 @@ static Size numPartsWithin(cv::Size size, cv::Size part_size,
static size_t getBlockHistogramSize(Size block_size, Size cell_size, int nbins) static size_t getBlockHistogramSize(Size block_size, Size cell_size, int nbins)
{ {
CV_Assert(!cell_size.empty());
Size cells_per_block = Size(block_size.width / cell_size.width, Size cells_per_block = Size(block_size.width / cell_size.width,
block_size.height / cell_size.height); block_size.height / cell_size.height);
return (size_t)(nbins * cells_per_block.area()); return (size_t)(nbins * cells_per_block.area());
} }
size_t HOGDescriptor::getDescriptorSize() const size_t HOGDescriptor::getDescriptorSize() const
{ {
CV_Assert(!cellSize.empty());
CV_Assert(!blockStride.empty());
CV_Assert(blockSize.width % cellSize.width == 0 && CV_Assert(blockSize.width % cellSize.width == 0 &&
blockSize.height % cellSize.height == 0); blockSize.height % cellSize.height == 0);
CV_Assert((winSize.width - blockSize.width) % blockStride.width == 0 && CV_Assert((winSize.width - blockSize.width) % blockStride.width == 0 &&
@ -142,20 +147,20 @@ bool HOGDescriptor::read(FileNode& obj)
if( !obj.isMap() ) if( !obj.isMap() )
return false; return false;
FileNodeIterator it = obj["winSize"].begin(); FileNodeIterator it = obj["winSize"].begin();
it >> winSize.width >> winSize.height; it >> winSize.width >> winSize.height; CV_Assert(!winSize.empty());
it = obj["blockSize"].begin(); it = obj["blockSize"].begin();
it >> blockSize.width >> blockSize.height; it >> blockSize.width >> blockSize.height; CV_Assert(!blockSize.empty());
it = obj["blockStride"].begin(); it = obj["blockStride"].begin();
it >> blockStride.width >> blockStride.height; it >> blockStride.width >> blockStride.height; CV_Assert(!blockStride.empty());
it = obj["cellSize"].begin(); it = obj["cellSize"].begin();
it >> cellSize.width >> cellSize.height; it >> cellSize.width >> cellSize.height; CV_Assert(!cellSize.empty());
obj["nbins"] >> nbins; obj["nbins"] >> nbins; CV_Assert(nbins > 0);
obj["derivAperture"] >> derivAperture; obj["derivAperture"] >> derivAperture;
obj["winSigma"] >> winSigma; obj["winSigma"] >> winSigma;
obj["histogramNormType"] >> histogramNormType; obj["histogramNormType"] >> histogramNormType;
obj["L2HysThreshold"] >> L2HysThreshold; obj["L2HysThreshold"] >> L2HysThreshold;
obj["gammaCorrection"] >> gammaCorrection; obj["gammaCorrection"] >> gammaCorrection;
obj["nlevels"] >> nlevels; obj["nlevels"] >> nlevels; CV_Assert(nlevels > 0);
if (obj["signedGradient"].empty()) if (obj["signedGradient"].empty())
signedGradient = false; signedGradient = false;
else else

@ -78,6 +78,7 @@ void cv::seamlessClone(InputArray _src, InputArray _dst, InputArray _mask, Point
copyMakeBorder(mask_inner, mask, 1, 1, 1, 1, BORDER_ISOLATED | BORDER_CONSTANT, Scalar(0)); copyMakeBorder(mask_inner, mask, 1, 1, 1, 1, BORDER_ISOLATED | BORDER_CONSTANT, Scalar(0));
Rect roi_s = boundingRect(mask); Rect roi_s = boundingRect(mask);
if (roi_s.empty()) return;
Rect roi_d(p.x - roi_s.width / 2, p.y - roi_s.height / 2, roi_s.width, roi_s.height); Rect roi_d(p.x - roi_s.width / 2, p.y - roi_s.height / 2, roi_s.width, roi_s.height);
Mat destinationROI = dest(roi_d).clone(); Mat destinationROI = dest(roi_d).clone();

@ -86,6 +86,15 @@ TEST(Photo_SeamlessClone_normal, regression)
EXPECT_LE(errorINF, 1); EXPECT_LE(errorINF, 1);
double errorL1 = cvtest::norm(reference, result, NORM_L1); double errorL1 = cvtest::norm(reference, result, NORM_L1);
EXPECT_LE(errorL1, reference.total() * numerical_precision) << "size=" << reference.size(); EXPECT_LE(errorL1, reference.total() * numerical_precision) << "size=" << reference.size();
mask = Scalar(0, 0, 0);
seamlessClone(source, destination, mask, p, result, 1);
reference = destination;
errorINF = cvtest::norm(reference, result, NORM_INF);
EXPECT_LE(errorINF, 1);
errorL1 = cvtest::norm(reference, result, NORM_L1);
EXPECT_LE(errorL1, reference.total() * numerical_precision) << "size=" << reference.size();
} }
TEST(Photo_SeamlessClone_mixed, regression) TEST(Photo_SeamlessClone_mixed, regression)

@ -21691,7 +21691,9 @@ class WithParamInterface {
return *GetParameterPtrRef_(); return *GetParameterPtrRef_();
} }
#ifndef __INTEL_COMPILER // compilation workaround, templated friend is not handled properly by ICC (perhaps due using of anonymous namespaces)
private: private:
#endif
// Sets parameter value. The caller is responsible for making sure the value // Sets parameter value. The caller is responsible for making sure the value
// remains alive and unchanged throughout the current test. // remains alive and unchanged throughout the current test.
static void SetParam(const ParamType* parameter) { static void SetParam(const ParamType* parameter) {

@ -49,7 +49,7 @@ def getXCodeMajor():
raise Exception("Failed to parse Xcode version") raise Exception("Failed to parse Xcode version")
class Builder: class Builder:
def __init__(self, opencv, contrib, dynamic, bitcodedisabled, exclude, enablenonfree, targets): def __init__(self, opencv, contrib, dynamic, bitcodedisabled, exclude, enablenonfree, targets, debug, debug_info):
self.opencv = os.path.abspath(opencv) self.opencv = os.path.abspath(opencv)
self.contrib = None self.contrib = None
if contrib: if contrib:
@ -63,6 +63,8 @@ class Builder:
self.exclude = exclude self.exclude = exclude
self.enablenonfree = enablenonfree self.enablenonfree = enablenonfree
self.targets = targets self.targets = targets
self.debug = debug
self.debug_info = debug_info
def getBD(self, parent, t): def getBD(self, parent, t):
@ -125,6 +127,9 @@ class Builder:
def getToolchain(self, arch, target): def getToolchain(self, arch, target):
return None return None
def getConfiguration(self):
return "Debug" if self.debug else "Release"
def getCMakeArgs(self, arch, target): def getCMakeArgs(self, arch, target):
args = [ args = [
@ -132,7 +137,7 @@ class Builder:
"-GXcode", "-GXcode",
"-DAPPLE_FRAMEWORK=ON", "-DAPPLE_FRAMEWORK=ON",
"-DCMAKE_INSTALL_PREFIX=install", "-DCMAKE_INSTALL_PREFIX=install",
"-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_BUILD_TYPE=%s" % self.getConfiguration(),
"-DOPENCV_INCLUDE_INSTALL_PATH=include", "-DOPENCV_INCLUDE_INSTALL_PATH=include",
"-DOPENCV_3P_LIB_INSTALL_PATH=lib/3rdparty" "-DOPENCV_3P_LIB_INSTALL_PATH=lib/3rdparty"
] + ([ ] + ([
@ -141,7 +146,9 @@ class Builder:
"-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=NO", "-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=NO",
] if self.dynamic else []) + ([ ] if self.dynamic else []) + ([
"-DOPENCV_ENABLE_NONFREE=ON" "-DOPENCV_ENABLE_NONFREE=ON"
] if self.enablenonfree else []) ] if self.enablenonfree else []) + ([
"-DBUILD_WITH_DEBUG_INFO=ON"
] if self.debug_info else [])
if len(self.exclude) > 0: if len(self.exclude) > 0:
args += ["-DBUILD_opencv_world=OFF"] if not self.dynamic else [] args += ["-DBUILD_opencv_world=OFF"] if not self.dynamic else []
@ -176,7 +183,7 @@ class Builder:
buildcmd += [ buildcmd += [
"-sdk", target.lower(), "-sdk", target.lower(),
"-configuration", "Release", "-configuration", self.getConfiguration(),
"-parallelizeTargets", "-parallelizeTargets",
"-jobs", str(multiprocessing.cpu_count()), "-jobs", str(multiprocessing.cpu_count()),
] + (["-target","ALL_BUILD"] if self.dynamic else []) ] + (["-target","ALL_BUILD"] if self.dynamic else [])
@ -203,10 +210,10 @@ class Builder:
shutil.rmtree(clean_dir) shutil.rmtree(clean_dir)
buildcmd = self.getBuildCommand(arch, target) buildcmd = self.getBuildCommand(arch, target)
execute(buildcmd + ["-target", "ALL_BUILD", "build"], cwd = builddir) execute(buildcmd + ["-target", "ALL_BUILD", "build"], cwd = builddir)
execute(["cmake", "-P", "cmake_install.cmake"], cwd = builddir) execute(["cmake", "-DBUILD_TYPE=%s" % self.getConfiguration(), "-P", "cmake_install.cmake"], cwd = builddir)
def mergeLibs(self, builddir): def mergeLibs(self, builddir):
res = os.path.join(builddir, "lib", "Release", "libopencv_merged.a") res = os.path.join(builddir, "lib", self.getConfiguration(), "libopencv_merged.a")
libs = glob.glob(os.path.join(builddir, "install", "lib", "*.a")) libs = glob.glob(os.path.join(builddir, "install", "lib", "*.a"))
libs3 = glob.glob(os.path.join(builddir, "install", "lib", "3rdparty", "*.a")) libs3 = glob.glob(os.path.join(builddir, "install", "lib", "3rdparty", "*.a"))
print("Merging libraries:\n\t%s" % "\n\t".join(libs + libs3), file=sys.stderr) print("Merging libraries:\n\t%s" % "\n\t".join(libs + libs3), file=sys.stderr)
@ -232,7 +239,7 @@ class Builder:
shutil.copytree(os.path.join(builddirs[0], "install", "include", "opencv2"), os.path.join(dstdir, "Headers")) shutil.copytree(os.path.join(builddirs[0], "install", "include", "opencv2"), os.path.join(dstdir, "Headers"))
# make universal static lib # make universal static lib
libs = [os.path.join(d, "lib", "Release", libname) for d in builddirs] libs = [os.path.join(d, "lib", self.getConfiguration(), libname) for d in builddirs]
lipocmd = ["lipo", "-create"] lipocmd = ["lipo", "-create"]
lipocmd.extend(libs) lipocmd.extend(libs)
lipocmd.extend(["-o", os.path.join(dstdir, name)]) lipocmd.extend(["-o", os.path.join(dstdir, name)])
@ -290,6 +297,8 @@ if __name__ == "__main__":
parser.add_argument('--iphoneos_archs', default='armv7,armv7s,arm64', help='select iPhoneOS target ARCHS') parser.add_argument('--iphoneos_archs', default='armv7,armv7s,arm64', help='select iPhoneOS target ARCHS')
parser.add_argument('--iphonesimulator_archs', default='i386,x86_64', help='select iPhoneSimulator target ARCHS') parser.add_argument('--iphonesimulator_archs', default='i386,x86_64', help='select iPhoneSimulator target ARCHS')
parser.add_argument('--enable_nonfree', default=False, dest='enablenonfree', action='store_true', help='enable non-free modules (disabled by default)') parser.add_argument('--enable_nonfree', default=False, dest='enablenonfree', action='store_true', help='enable non-free modules (disabled by default)')
parser.add_argument('--debug', default=False, dest='debug', action='store_true', help='Build "Debug" binaries (disabled by default)')
parser.add_argument('--debug_info', default=False, dest='debug_info', action='store_true', help='Build with debug information (useful for Release mode: BUILD_WITH_DEBUG_INFO=ON)')
args = parser.parse_args() args = parser.parse_args()
os.environ['IPHONEOS_DEPLOYMENT_TARGET'] = args.iphoneos_deployment_target os.environ['IPHONEOS_DEPLOYMENT_TARGET'] = args.iphoneos_deployment_target
@ -306,5 +315,5 @@ if __name__ == "__main__":
[ [
(iphoneos_archs, "iPhoneOS"), (iphoneos_archs, "iPhoneOS"),
(iphonesimulator_archs, "iPhoneSimulator"), (iphonesimulator_archs, "iPhoneSimulator"),
]) ], args.debug, args.debug_info)
b.build(args.out) b.build(args.out)

@ -10,6 +10,8 @@ import os, os.path, sys, argparse, traceback, multiprocessing
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios')) sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_framework import Builder from build_framework import Builder
MACOSX_DEPLOYMENT_TARGET='10.12' # default, can be changed via command line options or environment variable
class OSXBuilder(Builder): class OSXBuilder(Builder):
def getToolchain(self, arch, target): def getToolchain(self, arch, target):
@ -18,10 +20,10 @@ class OSXBuilder(Builder):
def getBuildCommand(self, archs, target): def getBuildCommand(self, archs, target):
buildcmd = [ buildcmd = [
"xcodebuild", "xcodebuild",
"MACOSX_DEPLOYMENT_TARGET=10.9", "MACOSX_DEPLOYMENT_TARGET=" + os.environ['MACOSX_DEPLOYMENT_TARGET'],
"ARCHS=%s" % archs[0], "ARCHS=%s" % archs[0],
"-sdk", target.lower(), "-sdk", target.lower(),
"-configuration", "Release", "-configuration", "Debug" if self.debug else "Release",
"-parallelizeTargets", "-parallelizeTargets",
"-jobs", str(multiprocessing.cpu_count()) "-jobs", str(multiprocessing.cpu_count())
] ]
@ -39,10 +41,17 @@ if __name__ == "__main__":
parser.add_argument('--contrib', metavar='DIR', default=None, help='folder with opencv_contrib repository (default is "None" - build only main framework)') parser.add_argument('--contrib', metavar='DIR', default=None, help='folder with opencv_contrib repository (default is "None" - build only main framework)')
parser.add_argument('--without', metavar='MODULE', default=[], action='append', help='OpenCV modules to exclude from the framework') parser.add_argument('--without', metavar='MODULE', default=[], action='append', help='OpenCV modules to exclude from the framework')
parser.add_argument('--enable_nonfree', default=False, dest='enablenonfree', action='store_true', help='enable non-free modules (disabled by default)') parser.add_argument('--enable_nonfree', default=False, dest='enablenonfree', action='store_true', help='enable non-free modules (disabled by default)')
parser.add_argument('--macosx_deployment_target', default=os.environ.get('MACOSX_DEPLOYMENT_TARGET', MACOSX_DEPLOYMENT_TARGET), help='specify MACOSX_DEPLOYMENT_TARGET')
parser.add_argument('--debug', action='store_true', help='Build "Debug" binaries (CMAKE_BUILD_TYPE=Debug)')
parser.add_argument('--debug_info', action='store_true', help='Build with debug information (useful for Release mode: BUILD_WITH_DEBUG_INFO=ON)')
args = parser.parse_args() args = parser.parse_args()
os.environ['MACOSX_DEPLOYMENT_TARGET'] = args.macosx_deployment_target
print('Using MACOSX_DEPLOYMENT_TARGET=' + os.environ['MACOSX_DEPLOYMENT_TARGET'])
b = OSXBuilder(args.opencv, args.contrib, False, False, args.without, args.enablenonfree, b = OSXBuilder(args.opencv, args.contrib, False, False, args.without, args.enablenonfree,
[ [
(["x86_64"], "MacOSX") (["x86_64"], "MacOSX")
]) ], args.debug, args.debug_info)
b.build(args.out) b.build(args.out)

@ -8,7 +8,7 @@ This is a demo that shows mean-shift based tracking
You select a color objects such as your face and it tracks it. You select a color objects such as your face and it tracks it.
This reads from video camera (0 by default, or the camera number the user enters) This reads from video camera (0 by default, or the camera number the user enters)
http://www.robinhewitt.com/research/track/camshift.html [1] http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.14.7673
Usage: Usage:
------ ------

Loading…
Cancel
Save