Merge pull request #11256 from alalek:prepare_next

pull/11292/head
Alexander Alekhin 7 years ago
commit 10ba6a93a6
  1. 6
      CMakeLists.txt
  2. 11
      cmake/OpenCVDetectCStripes.cmake
  3. 16
      cmake/OpenCVDetectCXXCompiler.cmake
  4. 13
      cmake/OpenCVDetectVTK.cmake
  5. 11
      cmake/OpenCVFindLibsPerf.cmake
  6. 2
      cmake/OpenCVGenAndroidMK.cmake
  7. 2
      cmake/OpenCVMinDepVersions.cmake
  8. 9
      cmake/checks/vtk_test.cpp
  9. 3
      cmake/templates/cvconfig.h.in
  10. 2
      doc/tutorials/dnn/dnn_halide/dnn_halide.markdown
  11. 12
      doc/tutorials/introduction/android_binary_package/O4A_SDK.markdown
  12. 25
      doc/tutorials/introduction/android_binary_package/android_dev_intro.markdown
  13. 4
      doc/tutorials/introduction/android_binary_package/android_ocl_intro.markdown
  14. 21
      modules/calib3d/include/opencv2/calib3d.hpp
  15. 3
      modules/calib3d/misc/java/gen_dict.json
  16. 18
      modules/calib3d/src/calibinit.cpp
  17. 12
      modules/calib3d/src/circlesgrid.cpp
  18. 4
      modules/calib3d/src/circlesgrid.hpp
  19. 4
      modules/calib3d/src/precomp.hpp
  20. 5
      modules/calib3d/test/test_affine3d_estimator.cpp
  21. 4
      modules/core/include/opencv2/core/base.hpp
  22. 5
      modules/core/include/opencv2/core/cuda/functional.hpp
  23. 63
      modules/core/include/opencv2/core/cvdef.h
  24. 7
      modules/core/include/opencv2/core/cvstd.hpp
  25. 10
      modules/core/include/opencv2/core/fast_math.hpp
  26. 14
      modules/core/include/opencv2/core/mat.hpp
  27. 33
      modules/core/include/opencv2/core/mat.inl.hpp
  28. 10
      modules/core/include/opencv2/core/matx.hpp
  29. 9
      modules/core/include/opencv2/core/private.hpp
  30. 4
      modules/core/include/opencv2/core/ptr.inl.hpp
  31. 12
      modules/core/include/opencv2/core/types.hpp
  32. 47
      modules/core/include/opencv2/core/utility.hpp
  33. 8
      modules/core/include/opencv2/core/version.hpp
  34. 53
      modules/core/src/arithm.cpp
  35. 45
      modules/core/src/parallel.cpp
  36. 47
      modules/core/src/parallel_impl.cpp
  37. 10
      modules/core/src/precomp.hpp
  38. 128
      modules/core/src/system.cpp
  39. 10
      modules/core/test/test_mat.cpp
  40. 4
      modules/cudafeatures2d/src/brute_force_matcher.cpp
  41. 4
      modules/features2d/src/fast.cpp
  42. 4
      modules/features2d/src/precomp.hpp
  43. 4
      modules/highgui/include/opencv2/highgui.hpp
  44. 4
      modules/highgui/src/precomp.hpp
  45. 4
      modules/imgproc/include/opencv2/imgproc.hpp
  46. 5
      modules/imgproc/src/canny.cpp
  47. 4
      modules/imgproc/src/corner.cpp
  48. 14
      modules/imgproc/src/deriv.cpp
  49. 4
      modules/imgproc/src/featureselect.cpp
  50. 9
      modules/imgproc/src/generalized_hough.cpp
  51. 4
      modules/imgproc/src/precomp.hpp
  52. 10
      modules/imgproc/src/pyramids.cpp
  53. 5
      modules/imgproc/src/smooth.cpp
  54. 5
      modules/imgproc/src/templmatch.cpp
  55. 17
      modules/imgproc/src/thresh.cpp
  56. 4
      modules/imgproc/test/test_goodfeaturetotrack.cpp
  57. 2
      modules/java/android_sdk/build.gradle.in
  58. 2
      modules/java/generator/android/java/org/opencv/android/AsyncServiceHelper.java
  59. 2
      modules/java/generator/android/java/org/opencv/android/StaticHelper.java
  60. 59
      modules/ml/include/opencv2/ml.hpp
  61. 76
      modules/ml/src/ann_mlp.cpp
  62. 4
      modules/ml/test/test_mltests2.cpp
  63. 4
      modules/objdetect/include/opencv2/objdetect.hpp
  64. 5
      modules/objdetect/include/opencv2/objdetect/detection_based_tracker.hpp
  65. 4
      modules/objdetect/perf/opencl/perf_hogdetect.cpp
  66. 4
      modules/objdetect/src/cascadedetect.cpp
  67. 153
      modules/objdetect/src/detection_based_tracker.cpp
  68. 4
      modules/objdetect/src/precomp.hpp
  69. 4
      modules/photo/include/opencv2/photo.hpp
  70. 5
      modules/photo/src/denoising.cpp
  71. 4
      modules/photo/src/precomp.hpp
  72. 12
      modules/stitching/src/blenders.cpp
  73. 5
      modules/stitching/src/matchers.cpp
  74. 4
      modules/stitching/src/precomp.hpp
  75. 8
      modules/ts/include/opencv2/ts/ts_perf.hpp
  76. 4
      modules/ts/src/cuda_test.cpp
  77. 10
      modules/ts/src/ts_func.cpp
  78. 4
      modules/video/include/opencv2/video.hpp
  79. 10
      modules/video/src/lkpyramid.cpp
  80. 4
      modules/video/src/precomp.hpp
  81. 13
      platforms/android/build-tests/test_cmake_build.py
  82. 2
      platforms/android/build-tests/test_ndk_build.py
  83. 6
      samples/CMakeLists.txt
  84. 2
      samples/android/tutorial-4-opencl/src/org/opencv/samples/tutorial4/NativePart.java
  85. 11
      samples/cpp/example_cmake/CMakeLists.txt

@ -149,7 +149,6 @@ endif()
# ----------------------------------------------------------------------------
# Detect compiler and target platform architecture
# ----------------------------------------------------------------------------
OCV_OPTION(ENABLE_CXX11 "Enable C++11 compilation mode" "${OPENCV_CXX11}")
include(cmake/OpenCVDetectCXXCompiler.cmake)
ocv_cmake_hook(POST_DETECT_COMPILER)
@ -254,7 +253,6 @@ OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O" OFF
OCV_OPTION(WITH_QTKIT "Use QTKit Video I/O backend" OFF IF APPLE )
OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF)
OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF (WIN32 AND NOT WINRT) )
OCV_OPTION(WITH_PTHREADS_PF "Use pthreads-based parallel_for" ON IF (NOT WIN32 OR MINGW) )
OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) )
OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
@ -1018,9 +1016,6 @@ string(STRIP "${OPENCV_COMPILER_STR}" OPENCV_COMPILER_STR)
status("")
status(" C/C++:")
status(" Built as dynamic libs?:" BUILD_SHARED_LIBS THEN YES ELSE NO)
if(ENABLE_CXX11 OR HAVE_CXX11)
status(" C++11:" HAVE_CXX11 THEN YES ELSE NO)
endif()
status(" C++ Compiler:" ${OPENCV_COMPILER_STR})
status(" C++ flags (Release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
status(" C++ flags (Debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
@ -1335,7 +1330,6 @@ endif()
# Order is similar to CV_PARALLEL_FRAMEWORK in core/src/parallel.cpp
ocv_build_features_string(parallel_status EXCLUSIVE
IF HAVE_TBB THEN "TBB (ver ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} interface ${TBB_INTERFACE_VERSION})"
IF HAVE_CSTRIPES THEN "C="
IF HAVE_OPENMP THEN "OpenMP"
IF HAVE_GCD THEN "GCD"
IF WINRT OR HAVE_CONCURRENCY THEN "Concurrency"

@ -1,11 +0,0 @@
if(WIN32)
find_path( CSTRIPES_LIB_DIR
NAMES "C=.lib"
DOC "The path to C= lib and dll")
if(CSTRIPES_LIB_DIR)
ocv_include_directories("${CSTRIPES_LIB_DIR}/..")
link_directories("${CSTRIPES_LIB_DIR}")
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} "C=")
set(HAVE_CSTRIPES 1)
endif()
endif()

@ -166,14 +166,11 @@ if(CMAKE_VERSION VERSION_LESS "3.1")
endforeach()
endif()
if(ENABLE_CXX11)
#cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++11 instead of -std=gnu++11
if(CMAKE_CXX11_COMPILE_FEATURES)
set(HAVE_CXX11 ON)
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++11 instead of -std=gnu++11
if(CMAKE_CXX11_COMPILE_FEATURES)
set(HAVE_CXX11 ON)
endif()
if(NOT HAVE_CXX11)
ocv_check_compiler_flag(CXX "" HAVE_CXX11 "${OpenCV_SOURCE_DIR}/cmake/checks/cxx11.cpp")
@ -185,3 +182,6 @@ if(NOT HAVE_CXX11)
endif()
endif()
endif()
if(NOT HAVE_CXX11)
message(FATAL_ERROR "OpenCV 4.x requires C++11")
endif()

@ -52,5 +52,18 @@ if(HAVE_QT AND ${VTK_VERSION} VERSION_GREATER "6.0.0" AND NOT ${VTK_QT_VERSION}
endif()
endif()
try_compile(VTK_COMPILE_STATUS
"${OpenCV_BINARY_DIR}"
"${OpenCV_SOURCE_DIR}/cmake/checks/vtk_test.cpp"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${VTK_INCLUDE_DIRS}"
LINK_LIBRARIES ${VTK_LIBRARIES}
OUTPUT_VARIABLE OUTPUT
)
if(NOT ${VTK_COMPILE_STATUS})
message(STATUS "VTK support is disabled. Compilation of the sample code has failed.")
return()
endif()
set(HAVE_VTK ON)
message(STATUS "Found VTK ${VTK_VERSION} (${VTK_USE_FILE})")

@ -104,22 +104,15 @@ if(WITH_CLP)
endif()
endif(WITH_CLP)
# --- C= ---
if(WITH_CSTRIPES AND NOT HAVE_TBB)
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectCStripes.cmake")
else()
set(HAVE_CSTRIPES 0)
endif()
# --- GCD ---
if(APPLE AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
if(APPLE AND NOT HAVE_TBB)
set(HAVE_GCD 1)
else()
set(HAVE_GCD 0)
endif()
# --- Concurrency ---
if(MSVC AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
if(MSVC AND NOT HAVE_TBB)
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/concurrencytest.cpp")
file(WRITE "${_fname}" "#if _MSC_VER < 1600\n#error\n#endif\nint main() { return 0; }\n")
try_compile(HAVE_CONCURRENCY "${CMAKE_BINARY_DIR}" "${_fname}")

@ -48,7 +48,7 @@ if(ANDROID)
string(REPLACE "opencv_" "" OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
if(BUILD_FAT_JAVA_LIB)
set(OPENCV_LIBS_CONFIGMAKE java3)
set(OPENCV_LIBS_CONFIGMAKE java4)
else()
set(OPENCV_LIBS_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
endif()

@ -1,4 +1,4 @@
set(MIN_VER_CMAKE 2.8.12.2)
set(MIN_VER_CMAKE 3.5.1)
set(MIN_VER_CUDA 6.5)
set(MIN_VER_PYTHON2 2.6)
set(MIN_VER_PYTHON3 3.2)

@ -0,0 +1,9 @@
#include <vtkSmartPointer.h>
#include <vtkTransform.h>
#include <vtkMath.h>
int main()
{
vtkSmartPointer<vtkTransform> transform = vtkSmartPointer<vtkTransform>::New();
return 0;
}

@ -46,9 +46,6 @@
/* Cocoa API */
#cmakedefine HAVE_COCOA
/* C= */
#cmakedefine HAVE_CSTRIPES
/* NVidia Cuda Basic Linear Algebra Subprograms (BLAS) API*/
#cmakedefine HAVE_CUBLAS

@ -68,8 +68,6 @@ MSBuild.exe /m:4 /t:Build /p:Configuration=Release .\\ALL_BUILD.vcxproj
## Build OpenCV with Halide backend
When you build OpenCV add the following configuration flags:
- `ENABLE_CXX11` - enable C++11 standard
- `WITH_HALIDE` - enable Halide linkage
- `HALIDE_ROOT_DIR` - path to Halide build directory

@ -19,18 +19,6 @@ If you encounter any error after thoroughly following these steps, feel free to
[OpenCV4Android](https://groups.google.com/group/android-opencv/) discussion group or OpenCV [Q&A
forum](http://answers.opencv.org). We'll do our best to help you out.
Tegra Android Development Pack users
------------------------------------
You may have used [Tegra Android Development
Pack](http://developer.nvidia.com/tegra-android-development-pack) (**TADP**) released by **NVIDIA**
for Android development environment setup.
Beside Android development tools the TADP 2.0 includes OpenCV4Android SDK, so it can be already
installed in your system and you can skip to @ref tutorial_O4A_SDK_samples "samples" section of this tutorial.
More details regarding TADP can be found in the @ref tutorial_android_dev_intro guide.
General info
------------

@ -31,31 +31,6 @@ key topis:
-# OpenCV development will certainly require some knowledge of the [Android
Camera](http://developer.android.com/guide/topics/media/camera.html) specifics.
Quick environment setup for Android development
-----------------------------------------------
If you are making a clean environment install, then you can try [Tegra Android Development
Pack](https://developer.nvidia.com/tegra-android-development-pack) (**TADP**) released by
**NVIDIA**.
@note Starting the *version 2.0* the TADP package includes *OpenCV for Tegra* SDK that is a regular
*OpenCV4Android SDK* extended with Tegra-specific stuff. When unpacked, TADP will cover all of the
environment setup automatically and you can skip the rest of the guide.
If you are a beginner in Android development then we also recommend you to start with TADP.
@note *NVIDIA*'s Tegra Android Development Pack includes some special features for *NVIDIA*’s [Tegra
platform](http://www.nvidia.com/object/tegra-3-processor.html)
but its use is not limited to *Tegra* devices only. \* You need at least *1.6 Gb* free
disk space for the install.
- TADP will download Android SDK platforms and Android NDK from Google's server, so Internet
connection is required for the installation.
- TADP may ask you to flash your development kit at the end of installation process. Just skip
this step if you have no [Tegra Development Kit](http://developer.nvidia.com/mobile/tegra-hardware-sales-inquiries).
- (UNIX) TADP will ask you for *root* in the middle of installation, so you need to be a member of
*sudo* group.
Manual environment setup for Android development
------------------------------------------------

@ -144,7 +144,7 @@ Here is a simple Java wrapper for our JNI stuff:
public class NativeGLRenderer {
static
{
System.loadLibrary("opencv_java3"); // comment this when using OpenCV Manager
System.loadLibrary("opencv_java4"); // comment this when using OpenCV Manager
System.loadLibrary("JNIrender");
}
@ -383,7 +383,7 @@ Unfortunately `UMat` keeps OpenCL _buffer_ internally, that can't be wrapped ove
path/to/cmake.exe -GNinja -DCMAKE_MAKE_PROGRAM="path/to/ninja.exe" -DCMAKE_TOOLCHAIN_FILE=path/to/opencv/platforms/android/android.toolchain.cmake -DANDROID_ABI="armeabi-v7a with NEON" -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON path/to/opencv
path/to/ninja.exe install/strip
@endcode
To use your own modified `libopencv_java3.so` you have to keep inside your APK, not to use OpenCV Manager and load it manually via `System.loadLibrary("opencv_java3")`.
To use your own modified `libopencv_java4.so` you have to keep inside your APK, not to use OpenCV Manager and load it manually via `System.loadLibrary("opencv_java4")`.
Performance notes
-----------------

@ -881,16 +881,15 @@ struct CV_EXPORTS_W_SIMPLE CirclesGridFinderParameters
SYMMETRIC_GRID, ASYMMETRIC_GRID
};
GridType gridType;
};
struct CV_EXPORTS_W_SIMPLE CirclesGridFinderParameters2 : public CirclesGridFinderParameters
{
CV_WRAP CirclesGridFinderParameters2();
CV_PROP_RW float squareSize; //!< Distance between two adjacent points. Used by CALIB_CB_CLUSTERING.
CV_PROP_RW float maxRectifiedDistance; //!< Max deviation from predicion. Used by CALIB_CB_CLUSTERING.
};
#ifndef DISABLE_OPENCV_3_COMPATIBILITY
typedef CirclesGridFinderParameters CirclesGridFinderParameters2;
#endif
/** @brief Finds centers in the grid of circles.
@param image grid view of input circles; it must be an 8-bit grayscale or color image.
@ -926,13 +925,7 @@ the board to make the detection more robust in various environments.
CV_EXPORTS_W bool findCirclesGrid( InputArray image, Size patternSize,
OutputArray centers, int flags,
const Ptr<FeatureDetector> &blobDetector,
CirclesGridFinderParameters parameters);
/** @overload */
CV_EXPORTS_W bool findCirclesGrid2( InputArray image, Size patternSize,
OutputArray centers, int flags,
const Ptr<FeatureDetector> &blobDetector,
CirclesGridFinderParameters2 parameters);
const CirclesGridFinderParameters& parameters);
/** @overload */
CV_EXPORTS_W bool findCirclesGrid( InputArray image, Size patternSize,
@ -2426,8 +2419,4 @@ optimization. It stays at the center or at a different location specified when C
} //end namespace cv
#ifndef DISABLE_OPENCV_24_COMPATIBILITY
#include "opencv2/calib3d/calib3d_c.h"
#endif
#endif

@ -1,7 +1,6 @@
{
"class_ignore_list": [
"CirclesGridFinderParameters",
"CirclesGridFinderParameters2"
"CirclesGridFinderParameters"
],
"missing_consts" : {
"Calib3d": {

@ -2094,22 +2094,14 @@ void cv::drawChessboardCorners( InputOutputArray _image, Size patternSize,
nelems, patternWasFound );
}
bool cv::findCirclesGrid( InputArray image, Size patternSize,
OutputArray centers, int flags,
const Ptr<FeatureDetector> &blobDetector,
CirclesGridFinderParameters parameters)
{
CirclesGridFinderParameters2 parameters2;
*((CirclesGridFinderParameters*)&parameters2) = parameters;
return cv::findCirclesGrid2(image, patternSize, centers, flags, blobDetector, parameters2);
}
bool cv::findCirclesGrid2( InputArray _image, Size patternSize,
bool cv::findCirclesGrid( InputArray _image, Size patternSize,
OutputArray _centers, int flags, const Ptr<FeatureDetector> &blobDetector,
CirclesGridFinderParameters2 parameters)
const CirclesGridFinderParameters& parameters_)
{
CV_INSTRUMENT_REGION()
CirclesGridFinderParameters parameters = parameters_; // parameters.gridType is amended below
bool isAsymmetricGrid = (flags & CALIB_CB_ASYMMETRIC_GRID) ? true : false;
bool isSymmetricGrid = (flags & CALIB_CB_SYMMETRIC_GRID ) ? true : false;
CV_Assert(isAsymmetricGrid ^ isSymmetricGrid);
@ -2201,7 +2193,7 @@ bool cv::findCirclesGrid2( InputArray _image, Size patternSize,
bool cv::findCirclesGrid( InputArray _image, Size patternSize,
OutputArray _centers, int flags, const Ptr<FeatureDetector> &blobDetector)
{
return cv::findCirclesGrid2(_image, patternSize, _centers, flags, blobDetector, CirclesGridFinderParameters2());
return cv::findCirclesGrid(_image, patternSize, _centers, flags, blobDetector, CirclesGridFinderParameters());
}
/* End of file. */

@ -69,10 +69,6 @@ void drawPoints(const std::vector<Point2f> &points, Mat &outImage, int radius =
void CirclesGridClusterFinder::hierarchicalClustering(const std::vector<Point2f> &points, const Size &patternSz, std::vector<Point2f> &patternPoints)
{
#ifdef HAVE_TEGRA_OPTIMIZATION
if(tegra::useTegra() && tegra::hierarchicalClustering(points, patternSz, patternPoints))
return;
#endif
int j, n = (int)points.size();
size_t pn = static_cast<size_t>(patternSz.area());
@ -565,13 +561,9 @@ CirclesGridFinderParameters::CirclesGridFinderParameters()
minRNGEdgeSwitchDist = 5.f;
gridType = SYMMETRIC_GRID;
}
CirclesGridFinderParameters2::CirclesGridFinderParameters2()
: CirclesGridFinderParameters()
{
squareSize = 1.0f;
maxRectifiedDistance = squareSize/2.0f;
squareSize = 1.0f;
maxRectifiedDistance = squareSize/2.0f;
}
CirclesGridFinder::CirclesGridFinder(Size _patternSize, const std::vector<Point2f> &testKeypoints,

@ -49,14 +49,12 @@
#include <numeric>
#include <map>
#include "precomp.hpp"
class CirclesGridClusterFinder
{
CirclesGridClusterFinder& operator=(const CirclesGridClusterFinder&);
CirclesGridClusterFinder(const CirclesGridClusterFinder&);
public:
CirclesGridClusterFinder(const cv::CirclesGridFinderParameters2 &parameters)
CirclesGridClusterFinder(const cv::CirclesGridFinderParameters &parameters)
{
isAsymmetricGrid = parameters.gridType == cv::CirclesGridFinderParameters::ASYMMETRIC_GRID;
squareSize = parameters.squareSize;

@ -51,11 +51,7 @@
#include "opencv2/core/ocl.hpp"
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/calib3d/calib3d_tegra.hpp"
#else
#define GET_OPTIMIZED(func) (func)
#endif
namespace cv

@ -138,13 +138,8 @@ bool CV_Affine3D_EstTest::testNPoints()
std::transform(fpts.ptr<Point3f>(), fpts.ptr<Point3f>() + n, tpts.ptr<Point3f>(), WrapAff(aff));
/* adding noise*/
#ifdef CV_CXX11
std::transform(tpts.ptr<Point3f>() + m, tpts.ptr<Point3f>() + n, tpts.ptr<Point3f>() + m,
[=] (const Point3f& pt) -> Point3f { return Noise(noise_level)(pt + shift_outl); });
#else
std::transform(tpts.ptr<Point3f>() + m, tpts.ptr<Point3f>() + n, tpts.ptr<Point3f>() + m, std::bind2nd(std::plus<Point3f>(), shift_outl));
std::transform(tpts.ptr<Point3f>() + m, tpts.ptr<Point3f>() + n, tpts.ptr<Point3f>() + m, Noise(noise_level));
#endif
Mat aff_est;
vector<uchar> outl;

@ -727,11 +727,7 @@ namespace cudev
namespace ipp
{
#if OPENCV_ABI_COMPATIBILITY > 300
CV_EXPORTS unsigned long long getIppFeatures();
#else
CV_EXPORTS int getIppFeatures();
#endif
CV_EXPORTS void setIppStatus(int status, const char * const funcname = NULL, const char * const filename = NULL,
int line = 0);
CV_EXPORTS int getIppStatus();

@ -58,7 +58,6 @@
namespace cv { namespace cuda { namespace device
{
// Function Objects
#ifdef CV_CXX11
template<typename Argument, typename Result> struct unary_function
{
typedef Argument argument_type;
@ -70,10 +69,6 @@ namespace cv { namespace cuda { namespace device
typedef Argument2 second_argument_type;
typedef Result result_type;
};
#else
template<typename Argument, typename Result> struct unary_function : public std::unary_function<Argument, Result> {};
template<typename Argument1, typename Argument2, typename Result> struct binary_function : public std::binary_function<Argument1, Argument2, Result> {};
#endif
// Arithmetic Operations
template <typename T> struct plus : binary_function<T, T, T>

@ -251,10 +251,10 @@ typedef union Cv64suf
}
Cv64suf;
#define OPENCV_ABI_COMPATIBILITY 300
#define OPENCV_ABI_COMPATIBILITY 400
#ifdef __OPENCV_BUILD
# define DISABLE_OPENCV_24_COMPATIBILITY
# define DISABLE_OPENCV_3_COMPATIBILITY
#endif
#ifdef CVAPI_EXPORTS
@ -417,64 +417,19 @@ Cv64suf;
# undef CV_CXX11
# endif
#endif
/****************************************************************************************\
* C++ Move semantics *
\****************************************************************************************/
#ifndef CV_CXX_MOVE_SEMANTICS
# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(_MSC_VER) && _MSC_VER >= 1600)
# define CV_CXX_MOVE_SEMANTICS 1
# elif defined(__clang)
# if __has_feature(cxx_rvalue_references)
# define CV_CXX_MOVE_SEMANTICS 1
# endif
# endif
#else
# if CV_CXX_MOVE_SEMANTICS == 0
# undef CV_CXX_MOVE_SEMANTICS
# endif
#endif
/****************************************************************************************\
* C++11 std::array *
\****************************************************************************************/
#ifndef CV_CXX_STD_ARRAY
# if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900/*MSVS 2015*/)
# define CV_CXX_STD_ARRAY 1
# include <array>
# endif
#else
# if CV_CXX_STD_ARRAY == 0
# undef CV_CXX_STD_ARRAY
# endif
#ifndef CV_CXX11
# error "OpenCV 4.x+ requires enabled C++11 support"
#endif
/****************************************************************************************\
* C++11 override / final *
\****************************************************************************************/
#define CV_CXX_MOVE_SEMANTICS 1
#define CV_CXX_STD_ARRAY 1
#include <array>
#ifndef CV_OVERRIDE
# ifdef CV_CXX11
# define CV_OVERRIDE override
# endif
# define CV_OVERRIDE override
#endif
#ifndef CV_OVERRIDE
# define CV_OVERRIDE
#endif
#ifndef CV_FINAL
# ifdef CV_CXX11
# define CV_FINAL final
# endif
# define CV_FINAL final
#endif
#ifndef CV_FINAL
# define CV_FINAL
#endif
// Integer types portatibility

@ -281,10 +281,7 @@ struct Ptr
@note It is often easier to use makePtr instead.
*/
template<typename Y>
#ifdef DISABLE_OPENCV_24_COMPATIBILITY
explicit
#endif
Ptr(Y* p);
explicit Ptr(Y* p);
/** @overload
@param d Deleter to use for the owned pointer.
@ -389,10 +386,8 @@ struct Ptr
template<typename Y>
Ptr<Y> dynamicCast() const;
#ifdef CV_CXX_MOVE_SEMANTICS
Ptr(Ptr&& o);
Ptr& operator = (Ptr&& o);
#endif
private:
detail::PtrOwner* owner;

@ -70,10 +70,6 @@
# endif
#endif
#ifdef HAVE_TEGRA_OPTIMIZATION
# include "tegra_round.hpp"
#endif
#if defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__ || defined __ARM_NEON__) && !defined __SOFTFP__ && !defined(__CUDACC__)
// 1. general scheme
#define ARM_ROUND(_value, _asm_string) \
@ -112,9 +108,6 @@ cvRound( double value )
fistp t;
}
return t;
#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \
defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION
TEGRA_ROUND_DBL(value);
#elif defined CV_ICC || defined __GNUC__
# if defined ARM_ROUND_DBL
ARM_ROUND_DBL(value);
@ -200,9 +193,6 @@ CV_INLINE int cvRound(float value)
fistp t;
}
return t;
#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \
defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION
TEGRA_ROUND_FLT(value);
#elif defined CV_ICC || defined __GNUC__
# if defined ARM_ROUND_FLT
ARM_ROUND_FLT(value);

@ -53,9 +53,7 @@
#include "opencv2/core/bufferpool.hpp"
#ifdef CV_CXX11
#include <type_traits>
#endif
namespace cv
{
@ -198,10 +196,8 @@ public:
_InputArray(const UMat& um);
_InputArray(const std::vector<UMat>& umv);
#ifdef CV_CXX_STD_ARRAY
template<typename _Tp, std::size_t _Nm> _InputArray(const std::array<_Tp, _Nm>& arr);
template<std::size_t _Nm> _InputArray(const std::array<Mat, _Nm>& arr);
#endif
Mat getMat(int idx=-1) const;
Mat getMat_(int idx=-1) const;
@ -984,7 +980,6 @@ public:
*/
template<typename _Tp> explicit Mat(const std::vector<_Tp>& vec, bool copyData=false);
#ifdef CV_CXX11
/** @overload
*/
template<typename _Tp, typename = typename std::enable_if<std::is_arithmetic<_Tp>::value>::type>
@ -993,7 +988,6 @@ public:
/** @overload
*/
template<typename _Tp> explicit Mat(const std::initializer_list<int> sizes, const std::initializer_list<_Tp> list);
#endif
#ifdef CV_CXX_STD_ARRAY
/** @overload
@ -2056,10 +2050,8 @@ public:
/** @overload */
template<typename _Tp, typename Functor> void forEach(const Functor& operation) const;
#ifdef CV_CXX_MOVE_SEMANTICS
Mat(Mat&& m);
Mat& operator = (Mat&& m);
#endif
enum { MAGIC_VAL = 0x42FF0000, AUTO_STEP = 0, CONTINUOUS_FLAG = CV_MAT_CONT_FLAG, SUBMATRIX_FLAG = CV_SUBMAT_FLAG };
enum { MAGIC_MASK = 0xFFFF0000, TYPE_MASK = 0x00000FFF, DEPTH_MASK = 7 };
@ -2210,10 +2202,8 @@ public:
explicit Mat_(const Point3_<typename DataType<_Tp>::channel_type>& pt, bool copyData=true);
explicit Mat_(const MatCommaInitializer_<_Tp>& commaInitializer);
#ifdef CV_CXX11
Mat_(std::initializer_list<_Tp> values);
explicit Mat_(const std::initializer_list<int> sizes, const std::initializer_list<_Tp> values);
#endif
#ifdef CV_CXX_STD_ARRAY
template <std::size_t _Nm> explicit Mat_(const std::array<_Tp, _Nm>& arr, bool copyData=false);
@ -2325,7 +2315,6 @@ public:
//! conversion to Matx
template<int m, int n> operator Matx<typename DataType<_Tp>::channel_type, m, n>() const;
#ifdef CV_CXX_MOVE_SEMANTICS
Mat_(Mat_&& m);
Mat_& operator = (Mat_&& m);
@ -2333,7 +2322,6 @@ public:
Mat_& operator = (Mat&& m);
Mat_(MatExpr&& e);
#endif
};
typedef Mat_<uchar> Mat1b;
@ -2530,10 +2518,8 @@ public:
//! 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, int depth=-1, bool requireContinuous=true) const;
#ifdef CV_CXX_MOVE_SEMANTICS
UMat(UMat&& m);
UMat& operator = (UMat&& m);
#endif
/*! Returns the OpenCL buffer handle on which UMat operates on.
The UMat instance should be kept alive during the use of the handle to prevent the buffer to be

@ -84,7 +84,6 @@ template<typename _Tp> inline
_InputArray::_InputArray(const std::vector<_Tp>& vec)
{ init(FIXED_TYPE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_READ, &vec); }
#ifdef CV_CXX_STD_ARRAY
template<typename _Tp, std::size_t _Nm> inline
_InputArray::_InputArray(const std::array<_Tp, _Nm>& arr)
{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_READ, arr.data(), Size(1, _Nm)); }
@ -92,7 +91,6 @@ _InputArray::_InputArray(const std::array<_Tp, _Nm>& arr)
template<std::size_t _Nm> inline
_InputArray::_InputArray(const std::array<Mat, _Nm>& arr)
{ init(STD_ARRAY_MAT + ACCESS_READ, arr.data(), Size(1, _Nm)); }
#endif
inline
_InputArray::_InputArray(const std::vector<bool>& vec)
@ -172,7 +170,6 @@ template<typename _Tp> inline
_OutputArray::_OutputArray(std::vector<_Tp>& vec)
{ init(FIXED_TYPE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_WRITE, &vec); }
#ifdef CV_CXX_STD_ARRAY
template<typename _Tp, std::size_t _Nm> inline
_OutputArray::_OutputArray(std::array<_Tp, _Nm>& arr)
{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_WRITE, arr.data(), Size(1, _Nm)); }
@ -180,7 +177,6 @@ _OutputArray::_OutputArray(std::array<_Tp, _Nm>& arr)
template<std::size_t _Nm> inline
_OutputArray::_OutputArray(std::array<Mat, _Nm>& arr)
{ init(STD_ARRAY_MAT + ACCESS_WRITE, arr.data(), Size(1, _Nm)); }
#endif
inline
_OutputArray::_OutputArray(std::vector<bool>&)
@ -214,7 +210,6 @@ template<typename _Tp> inline
_OutputArray::_OutputArray(const std::vector<_Tp>& vec)
{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_WRITE, &vec); }
#ifdef CV_CXX_STD_ARRAY
template<typename _Tp, std::size_t _Nm> inline
_OutputArray::_OutputArray(const std::array<_Tp, _Nm>& arr)
{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_WRITE, arr.data(), Size(1, _Nm)); }
@ -222,7 +217,6 @@ _OutputArray::_OutputArray(const std::array<_Tp, _Nm>& arr)
template<std::size_t _Nm> inline
_OutputArray::_OutputArray(const std::array<Mat, _Nm>& arr)
{ init(FIXED_SIZE + STD_ARRAY_MAT + ACCESS_WRITE, arr.data(), Size(1, _Nm)); }
#endif
template<typename _Tp> inline
_OutputArray::_OutputArray(const std::vector<std::vector<_Tp> >& vec)
@ -291,7 +285,6 @@ template<typename _Tp> inline
_InputOutputArray::_InputOutputArray(std::vector<_Tp>& vec)
{ init(FIXED_TYPE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_RW, &vec); }
#ifdef CV_CXX_STD_ARRAY
template<typename _Tp, std::size_t _Nm> inline
_InputOutputArray::_InputOutputArray(std::array<_Tp, _Nm>& arr)
{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_RW, arr.data(), Size(1, _Nm)); }
@ -299,7 +292,6 @@ _InputOutputArray::_InputOutputArray(std::array<_Tp, _Nm>& arr)
template<std::size_t _Nm> inline
_InputOutputArray::_InputOutputArray(std::array<Mat, _Nm>& arr)
{ init(STD_ARRAY_MAT + ACCESS_RW, arr.data(), Size(1, _Nm)); }
#endif
inline _InputOutputArray::_InputOutputArray(std::vector<bool>&)
{ CV_Error(Error::StsUnsupportedFormat, "std::vector<bool> cannot be an input/output array\n"); }
@ -328,7 +320,6 @@ template<typename _Tp> inline
_InputOutputArray::_InputOutputArray(const std::vector<_Tp>& vec)
{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR + traits::Type<_Tp>::value + ACCESS_RW, &vec); }
#ifdef CV_CXX_STD_ARRAY
template<typename _Tp, std::size_t _Nm> inline
_InputOutputArray::_InputOutputArray(const std::array<_Tp, _Nm>& arr)
{ init(FIXED_TYPE + FIXED_SIZE + STD_ARRAY + traits::Type<_Tp>::value + ACCESS_RW, arr.data(), Size(1, _Nm)); }
@ -336,7 +327,6 @@ _InputOutputArray::_InputOutputArray(const std::array<_Tp, _Nm>& arr)
template<std::size_t _Nm> inline
_InputOutputArray::_InputOutputArray(const std::array<Mat, _Nm>& arr)
{ init(FIXED_SIZE + STD_ARRAY_MAT + ACCESS_RW, arr.data(), Size(1, _Nm)); }
#endif
template<typename _Tp> inline
_InputOutputArray::_InputOutputArray(const std::vector<std::vector<_Tp> >& vec)
@ -574,7 +564,6 @@ Mat::Mat(const std::vector<_Tp>& vec, bool copyData)
Mat((int)vec.size(), 1, traits::Type<_Tp>::value, (uchar*)&vec[0]).copyTo(*this);
}
#ifdef CV_CXX11
template<typename _Tp, typename> inline
Mat::Mat(const std::initializer_list<_Tp> list)
: Mat()
@ -594,9 +583,7 @@ Mat::Mat(const std::initializer_list<int> sizes, const std::initializer_list<_Tp
CV_Assert(size_total == list.size());
Mat((int)sizes.size(), (int*)sizes.begin(), traits::Type<_Tp>::value, (uchar*)list.begin()).copyTo(*this);
}
#endif
#ifdef CV_CXX_STD_ARRAY
template<typename _Tp, std::size_t _Nm> inline
Mat::Mat(const std::array<_Tp, _Nm>& arr, bool copyData)
: flags(MAGIC_VAL | traits::Type<_Tp>::value | CV_MAT_CONT_FLAG), dims(2), rows((int)arr.size()),
@ -613,7 +600,6 @@ Mat::Mat(const std::array<_Tp, _Nm>& arr, bool copyData)
else
Mat((int)arr.size(), 1, traits::Type<_Tp>::value, (uchar*)arr.data()).copyTo(*this);
}
#endif
template<typename _Tp, int n> inline
Mat::Mat(const Vec<_Tp, n>& vec, bool copyData)
@ -1263,7 +1249,6 @@ Mat::operator std::vector<_Tp>() const
return v;
}
#ifdef CV_CXX_STD_ARRAY
template<typename _Tp, std::size_t _Nm> inline
Mat::operator std::array<_Tp, _Nm>() const
{
@ -1271,7 +1256,6 @@ Mat::operator std::array<_Tp, _Nm>() const
copyTo(v);
return v;
}
#endif
template<typename _Tp, int n> inline
Mat::operator Vec<_Tp, n>() const
@ -1339,8 +1323,6 @@ void Mat::push_back(const std::vector<_Tp>& v)
push_back(Mat(v));
}
#ifdef CV_CXX_MOVE_SEMANTICS
inline
Mat::Mat(Mat&& m)
: flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), data(m.data),
@ -1402,8 +1384,6 @@ Mat& Mat::operator = (Mat&& m)
return *this;
}
#endif
///////////////////////////// MatSize ////////////////////////////
@ -1634,7 +1614,6 @@ Mat_<_Tp>::Mat_(const std::vector<_Tp>& vec, bool copyData)
: Mat(vec, copyData)
{}
#ifdef CV_CXX11
template<typename _Tp> inline
Mat_<_Tp>::Mat_(std::initializer_list<_Tp> list)
: Mat(list)
@ -1644,14 +1623,11 @@ template<typename _Tp> inline
Mat_<_Tp>::Mat_(const std::initializer_list<int> sizes, std::initializer_list<_Tp> list)
: Mat(sizes, list)
{}
#endif
#ifdef CV_CXX_STD_ARRAY
template<typename _Tp> template<std::size_t _Nm> inline
Mat_<_Tp>::Mat_(const std::array<_Tp, _Nm>& arr, bool copyData)
: Mat(arr, copyData)
{}
#endif
template<typename _Tp> inline
Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat& m)
@ -1939,7 +1915,6 @@ Mat_<_Tp>::operator std::vector<_Tp>() const
return v;
}
#ifdef CV_CXX_STD_ARRAY
template<typename _Tp> template<std::size_t _Nm> inline
Mat_<_Tp>::operator std::array<_Tp, _Nm>() const
{
@ -1947,7 +1922,6 @@ Mat_<_Tp>::operator std::array<_Tp, _Nm>() const
copyTo(a);
return a;
}
#endif
template<typename _Tp> template<int n> inline
Mat_<_Tp>::operator Vec<typename DataType<_Tp>::channel_type, n>() const
@ -2011,8 +1985,6 @@ void Mat_<_Tp>::forEach(const Functor& operation) const {
Mat::forEach<_Tp, Functor>(operation);
}
#ifdef CV_CXX_MOVE_SEMANTICS
template<typename _Tp> inline
Mat_<_Tp>::Mat_(Mat_&& m)
: Mat(m)
@ -2060,7 +2032,6 @@ Mat_<_Tp>::Mat_(MatExpr&& e)
*this = Mat(e);
}
#endif
///////////////////////////// SparseMat /////////////////////////////
@ -3831,8 +3802,6 @@ size_t UMat::total() const
return p;
}
#ifdef CV_CXX_MOVE_SEMANTICS
inline
UMat::UMat(UMat&& m)
: flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), allocator(m.allocator),
@ -3893,8 +3862,6 @@ UMat& UMat::operator = (UMat&& m)
return *this;
}
#endif
inline bool UMatData::hostCopyObsolete() const { return (flags & HOST_COPY_OBSOLETE) != 0; }
inline bool UMatData::deviceCopyObsolete() const { return (flags & DEVICE_COPY_OBSOLETE) != 0; }

@ -53,9 +53,7 @@
#include "opencv2/core/traits.hpp"
#include "opencv2/core/saturate.hpp"
#ifdef CV_CXX11
#include <initializer_list>
#endif
namespace cv
{
@ -141,9 +139,7 @@ public:
_Tp v12, _Tp v13, _Tp v14, _Tp v15); //!< 1x16, 4x4 or 16x1 matrix
explicit Matx(const _Tp* vals); //!< initialize from a plain array
#ifdef CV_CXX11
Matx(std::initializer_list<_Tp>); //!< initialize from an initializer list
#endif
static Matx all(_Tp alpha);
static Matx zeros();
@ -361,9 +357,7 @@ public:
Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13); //!< 14-element vector constructor
explicit Vec(const _Tp* values);
#ifdef CV_CXX11
Vec(std::initializer_list<_Tp>);
#endif
Vec(const Vec<_Tp, cn>& v);
@ -665,7 +659,6 @@ Matx<_Tp, m, n>::Matx(const _Tp* values)
for( int i = 0; i < channels; i++ ) val[i] = values[i];
}
#ifdef CV_CXX11
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n>::Matx(std::initializer_list<_Tp> list)
{
@ -676,7 +669,6 @@ Matx<_Tp, m, n>::Matx(std::initializer_list<_Tp> list)
val[i++] = elem;
}
}
#endif
template<typename _Tp, int m, int n> inline
Matx<_Tp, m, n> Matx<_Tp, m, n>::all(_Tp alpha)
@ -1019,11 +1011,9 @@ template<typename _Tp, int cn> inline
Vec<_Tp, cn>::Vec(const _Tp* values)
: Matx<_Tp, cn, 1>(values) {}
#ifdef CV_CXX11
template<typename _Tp, int cn> inline
Vec<_Tp, cn>::Vec(std::initializer_list<_Tp> list)
: Matx<_Tp, cn, 1>(list) {}
#endif
template<typename _Tp, int cn> inline
Vec<_Tp, cn>::Vec(const Vec<_Tp, cn>& m)

@ -622,15 +622,6 @@ typedef enum CvStatus
}
CvStatus;
#ifdef HAVE_TEGRA_OPTIMIZATION
namespace tegra {
CV_EXPORTS bool useTegra();
CV_EXPORTS void setUseTegra(bool flag);
}
#endif
#ifdef ENABLE_INSTRUMENTATION
namespace cv
{

@ -252,8 +252,6 @@ Ptr<Y> Ptr<T>::dynamicCast() const
return Ptr<Y>(*this, dynamic_cast<Y*>(stored));
}
#ifdef CV_CXX_MOVE_SEMANTICS
template<typename T>
Ptr<T>::Ptr(Ptr&& o) : owner(o.owner), stored(o.stored)
{
@ -275,8 +273,6 @@ Ptr<T>& Ptr<T>::operator = (Ptr<T>&& o)
return *this;
}
#endif
template<typename T>
void swap(Ptr<T>& ptr1, Ptr<T>& ptr2){

@ -250,11 +250,7 @@ public:
//! conversion to another data type
template<typename _Tp2> operator Point3_<_Tp2>() const;
//! conversion to cv::Vec<>
#if OPENCV_ABI_COMPATIBILITY > 300
template<typename _Tp2> operator Vec<_Tp2, 3>() const;
#else
operator Vec<_Tp, 3>() const;
#endif
//! dot product
_Tp dot(const Point3_& pt) const;
@ -1405,19 +1401,11 @@ Point3_<_Tp>::operator Point3_<_Tp2>() const
return Point3_<_Tp2>(saturate_cast<_Tp2>(x), saturate_cast<_Tp2>(y), saturate_cast<_Tp2>(z));
}
#if OPENCV_ABI_COMPATIBILITY > 300
template<typename _Tp> template<typename _Tp2> inline
Point3_<_Tp>::operator Vec<_Tp2, 3>() const
{
return Vec<_Tp2, 3>(x, y, z);
}
#else
template<typename _Tp> inline
Point3_<_Tp>::operator Vec<_Tp, 3>() const
{
return Vec<_Tp, 3>(x, y, z);
}
#endif
template<typename _Tp> inline
Point3_<_Tp>& Point3_<_Tp>::operator = (const Point3_& pt)

@ -56,9 +56,9 @@
#include "opencv2/core.hpp"
#include <ostream>
#ifdef CV_CXX11
#include <functional>
#endif
#include <mutex> // std::mutex, std::lock_guard
namespace cv
{
@ -531,7 +531,6 @@ public:
*/
CV_EXPORTS void parallel_for_(const Range& range, const ParallelLoopBody& body, double nstripes=-1.);
#ifdef CV_CXX11
class ParallelLoopBodyLambdaWrapper : public ParallelLoopBody
{
private:
@ -551,7 +550,6 @@ inline void parallel_for_(const Range& range, std::function<void(const Range&)>
{
parallel_for_(range, ParallelLoopBodyLambdaWrapper(functor), nstripes);
}
#endif
/////////////////////////////// forEach method of cv::Mat ////////////////////////////
template<typename _Tp, typename Functor> inline
@ -652,34 +650,8 @@ void Mat::forEach_impl(const Functor& operation) {
/////////////////////////// Synchronization Primitives ///////////////////////////////
class CV_EXPORTS Mutex
{
public:
Mutex();
~Mutex();
Mutex(const Mutex& m);
Mutex& operator = (const Mutex& m);
void lock();
bool trylock();
void unlock();
struct Impl;
protected:
Impl* impl;
};
class CV_EXPORTS AutoLock
{
public:
AutoLock(Mutex& m) : mutex(&m) { mutex->lock(); }
~AutoLock() { mutex->unlock(); }
protected:
Mutex* mutex;
private:
AutoLock(const AutoLock&);
AutoLock& operator = (const AutoLock&);
};
typedef std::recursive_mutex Mutex;
typedef std::lock_guard<cv::Mutex> AutoLock;
// TLS interface
class CV_EXPORTS TLSDataContainer
@ -689,17 +661,10 @@ protected:
virtual ~TLSDataContainer();
void gatherData(std::vector<void*> &data) const;
#if OPENCV_ABI_COMPATIBILITY > 300
void* getData() const;
void release();
private:
#else
void release();
public:
void* getData() const;
#endif
virtual void* createDataInstance() const = 0;
virtual void deleteDataInstance(void* pData) const = 0;
@ -1251,8 +1216,4 @@ CV_EXPORTS int getThreadID();
} //namespace cv
#ifndef DISABLE_OPENCV_24_COMPATIBILITY
#include "opencv2/core/core_c.h"
#endif
#endif //OPENCV_CORE_UTILITY_H

@ -5,10 +5,10 @@
#ifndef OPENCV_VERSION_HPP
#define OPENCV_VERSION_HPP
#define CV_VERSION_MAJOR 3
#define CV_VERSION_MINOR 4
#define CV_VERSION_REVISION 1
#define CV_VERSION_STATUS "-dev"
#define CV_VERSION_MAJOR 4
#define CV_VERSION_MINOR 0
#define CV_VERSION_REVISION 0
#define CV_VERSION_STATUS "-pre"
#define CVAUX_STR_EXP(__A) #__A
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)

@ -931,59 +931,6 @@ void cv::subtract( InputArray _src1, InputArray _src2, OutputArray _dst,
{
CV_INSTRUMENT_REGION()
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra())
{
int kind1 = _src1.kind(), kind2 = _src2.kind();
Mat src1 = _src1.getMat(), src2 = _src2.getMat();
bool src1Scalar = checkScalar(src1, _src2.type(), kind1, kind2);
bool src2Scalar = checkScalar(src2, _src1.type(), kind2, kind1);
if (!src1Scalar && !src2Scalar &&
src1.depth() == CV_8U && src2.type() == src1.type() &&
src1.dims == 2 && src2.size() == src1.size() &&
mask.empty())
{
if (dtype < 0)
{
if (_dst.fixedType())
{
dtype = _dst.depth();
}
else
{
dtype = src1.depth();
}
}
dtype = CV_MAT_DEPTH(dtype);
if (!_dst.fixedType() || dtype == _dst.depth())
{
_dst.create(src1.size(), CV_MAKE_TYPE(dtype, src1.channels()));
if (dtype == CV_16S)
{
Mat dst = _dst.getMat();
if(tegra::subtract_8u8u16s(src1, src2, dst))
return;
}
else if (dtype == CV_32F)
{
Mat dst = _dst.getMat();
if(tegra::subtract_8u8u32f(src1, src2, dst))
return;
}
else if (dtype == CV_8S)
{
Mat dst = _dst.getMat();
if(tegra::subtract_8u8u8s(src1, src2, dst))
return;
}
}
}
}
#endif
arithm_op(_src1, _src2, _dst, mask, dtype, getSubTab(), false, 0, OCL_OP_SUB );
}

@ -78,13 +78,12 @@
#endif
/* IMPORTANT: always use the same order of defines
1. HAVE_TBB - 3rdparty library, should be explicitly enabled
2. HAVE_CSTRIPES - 3rdparty library, should be explicitly enabled
3. HAVE_OPENMP - integrated to compiler, should be explicitly enabled
4. HAVE_GCD - system wide, used automatically (APPLE only)
5. WINRT - system wide, used automatically (Windows RT only)
6. HAVE_CONCURRENCY - part of runtime, used automatically (Windows only - MSVS 10, MSVS 11)
7. HAVE_PTHREADS_PF - pthreads if available
- HAVE_TBB - 3rdparty library, should be explicitly enabled
- HAVE_OPENMP - integrated to compiler, should be explicitly enabled
- HAVE_GCD - system wide, used automatically (APPLE only)
- WINRT - system wide, used automatically (Windows RT only)
- HAVE_CONCURRENCY - part of runtime, used automatically (Windows only - MSVS 10, MSVS 11)
- HAVE_PTHREADS_PF - pthreads if available
*/
#if defined HAVE_TBB
@ -96,9 +95,6 @@
#endif
#undef min
#undef max
#elif defined HAVE_CSTRIPES
#include "C=.h"
#undef shared
#elif defined HAVE_OPENMP
#include <omp.h>
#elif defined HAVE_GCD
@ -113,8 +109,6 @@
#if defined HAVE_TBB
# define CV_PARALLEL_FRAMEWORK "tbb"
#elif defined HAVE_CSTRIPES
# define CV_PARALLEL_FRAMEWORK "cstripes"
#elif defined HAVE_OPENMP
# define CV_PARALLEL_FRAMEWORK "openmp"
#elif defined HAVE_GCD
@ -385,8 +379,6 @@ namespace
tbb::parallel_for(tbb::blocked_range<int>(range.start, range.end), *this);
}
};
#elif defined HAVE_CSTRIPES || defined HAVE_OPENMP
typedef ParallelLoopBodyWrapper ProxyLoopBody;
#elif defined HAVE_GCD
typedef ParallelLoopBodyWrapper ProxyLoopBody;
static void block_function(void* context, size_t index)
@ -419,8 +411,6 @@ static int numThreads = -1;
#else
static tbb::task_scheduler_init tbbScheduler(tbb::task_scheduler_init::deferred);
#endif
#elif defined HAVE_CSTRIPES
// nothing for C=
#elif defined HAVE_OPENMP
static int numThreadsMax = omp_get_max_threads();
#elif defined HAVE_GCD
@ -520,17 +510,6 @@ static void parallel_for_impl(const cv::Range& range, const cv::ParallelLoopBody
pbody();
#endif
#elif defined HAVE_CSTRIPES
parallel(MAX(0, numThreads))
{
int offset = stripeRange.start;
int len = stripeRange.end - offset;
Range r(offset + CPX_RANGE_START(len), offset + CPX_RANGE_END(len));
pbody(r);
barrier();
}
#elif defined HAVE_OPENMP
#pragma omp parallel for schedule(dynamic) num_threads(numThreads > 0 ? numThreads : numThreadsMax)
@ -602,12 +581,6 @@ int cv::getNumThreads(void)
: tbb::task_scheduler_init::default_num_threads();
#endif
#elif defined HAVE_CSTRIPES
return numThreads > 0
? numThreads
: cv::getNumberOfCPUs();
#elif defined HAVE_OPENMP
return numThreads > 0
@ -682,10 +655,6 @@ void cv::setNumThreads( int threads_ )
if(threads > 0) tbbScheduler.initialize(threads);
#endif
#elif defined HAVE_CSTRIPES
return; // nothing needed
#elif defined HAVE_OPENMP
return; // nothing needed as num_threads clause is used in #pragma omp parallel for
@ -735,8 +704,6 @@ int cv::getThreadNum(void)
#else
return 0;
#endif
#elif defined HAVE_CSTRIPES
return pix();
#elif defined HAVE_OPENMP
return omp_get_thread_num();
#elif defined HAVE_GCD

@ -21,27 +21,15 @@
//#define CV_USE_GLOBAL_WORKERS_COND_VAR // not effective on many-core systems (10+)
#ifdef CV_CXX11
#include <atomic>
#else
#include <unistd.h> // _POSIX_PRIORITY_SCHEDULING
#endif
// Spin lock's OS-level yield
#ifdef DECLARE_CV_YIELD
DECLARE_CV_YIELD
#endif
#ifndef CV_YIELD
# ifdef CV_CXX11
# include <thread>
# define CV_YIELD() std::this_thread::yield()
# elif defined(_POSIX_PRIORITY_SCHEDULING)
# include <sched.h>
# define CV_YIELD() sched_yield()
# else
# warning "Can't detect sched_yield() on the target platform. Specify CV_YIELD() definition via compiler flags."
# define CV_YIELD() /* no-op: works, but not effective */
# endif
# include <thread>
# define CV_YIELD() std::this_thread::yield()
#endif // CV_YIELD
// Spin lock's CPU-level yield (required for Hyper-Threading)
@ -290,15 +278,9 @@ public:
is_completed(false)
{
CV_LOG_VERBOSE(NULL, 5, "ParallelJob::ParallelJob(" << (void*)this << ")");
#ifdef CV_CXX11
current_task.store(0, std::memory_order_relaxed);
active_thread_count.store(0, std::memory_order_relaxed);
completed_thread_count.store(0, std::memory_order_relaxed);
#else
current_task = 0;
active_thread_count = 0;
completed_thread_count = 0;
#endif
dummy0_[0] = 0, dummy1_[0] = 0, dummy2_[0] = 0; // compiler warning
}
@ -319,11 +301,7 @@ public:
for (;;)
{
int chunk_size = std::max(1, (task_count - current_task) / remaining_multiplier);
#ifdef CV_CXX11
int id = current_task.fetch_add(chunk_size, std::memory_order_seq_cst);
#else
int id = (int)CV_XADD(&current_task, chunk_size);
#endif
if (id >= task_count)
break; // no more free tasks
@ -349,7 +327,7 @@ public:
const ParallelLoopBody& body;
const Range range;
const unsigned nstripes;
#ifdef CV_CXX11
std::atomic<int> current_task; // next free part of job
int64 dummy0_[8]; // avoid cache-line reusing for the same atomics
@ -358,16 +336,6 @@ public:
std::atomic<int> completed_thread_count; // number of threads completed any activities on this job
int64 dummy2_[8]; // avoid cache-line reusing for the same atomics
#else
/*CV_DECL_ALIGNED(64)*/ volatile int current_task; // next free part of job
int64 dummy0_[8]; // avoid cache-line reusing for the same atomics
/*CV_DECL_ALIGNED(64)*/ volatile int active_thread_count; // number of threads worked on this job
int64 dummy1_[8]; // avoid cache-line reusing for the same atomics
/*CV_DECL_ALIGNED(64)*/ volatile int completed_thread_count; // number of threads completed any activities on this job
int64 dummy2_[8]; // avoid cache-line reusing for the same atomics
#endif
volatile bool is_completed; // std::atomic_flag ?
@ -437,11 +405,7 @@ void WorkerThread::thread_body()
CV_LOG_VERBOSE(NULL, 5, "Thread: job size=" << j->range.size() << " done=" << j->current_task);
if (j->current_task < j->range.size())
{
#ifdef CV_CXX11
int other = j->active_thread_count.fetch_add(1, std::memory_order_seq_cst);
#else
int other = CV_XADD(&j->active_thread_count, 1);
#endif
CV_LOG_VERBOSE(NULL, 5, "Thread: processing new job (with " << other << " other threads)"); CV_UNUSED(other);
#ifdef CV_PROFILE_THREADS
stat.threadExecuteStart = getTickCount();
@ -450,13 +414,8 @@ void WorkerThread::thread_body()
#else
j->execute(true);
#endif
#ifdef CV_CXX11
int completed = j->completed_thread_count.fetch_add(1, std::memory_order_seq_cst) + 1;
int active = j->active_thread_count.load(std::memory_order_acquire);
#else
int completed = (int)CV_XADD(&j->completed_thread_count, 1) + 1;
int active = j->active_thread_count;
#endif
if (CV_WORKER_ACTIVE_WAIT_THREADS_LIMIT > 0)
{
allow_active_wait = true;

@ -89,11 +89,7 @@
#include "arithm_core.hpp"
#include "hal_replacement.hpp"
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/core/core_tegra.hpp"
#else
#define GET_OPTIMIZED(func) (func)
#endif
namespace cv
{
@ -269,9 +265,6 @@ struct CoreTLSData
//#endif
useIPP(-1),
useIPP_NE(-1)
#ifdef HAVE_TEGRA_OPTIMIZATION
,useTegra(-1)
#endif
#ifdef HAVE_OPENVX
,useOpenVX(-1)
#endif
@ -285,9 +278,6 @@ struct CoreTLSData
//#endif
int useIPP; // 1 - use, 0 - do not use, -1 - auto/not initialized
int useIPP_NE; // 1 - use, 0 - do not use, -1 - auto/not initialized
#ifdef HAVE_TEGRA_OPTIMIZATION
int useTegra; // 1 - use, 0 - do not use, -1 - auto/not initialized
#endif
#ifdef HAVE_OPENVX
int useOpenVX; // 1 - use, 0 - do not use, -1 - auto/not initialized
#endif

@ -619,9 +619,6 @@ void setUseOptimized( bool flag )
#ifdef HAVE_OPENCL
ocl::setUseOpenCL(flag);
#endif
#ifdef HAVE_TEGRA_OPTIMIZATION
::tegra::setUseTegra(flag);
#endif
}
bool useOptimized(void)
@ -1104,93 +1101,6 @@ cvErrorFromIppStatus( int status )
namespace cv {
bool __termination = false;
}
namespace cv
{
#if defined _WIN32 || defined WINCE
struct Mutex::Impl
{
Impl()
{
#if (_WIN32_WINNT >= 0x0600)
::InitializeCriticalSectionEx(&cs, 1000, 0);
#else
::InitializeCriticalSection(&cs);
#endif
refcount = 1;
}
~Impl() { DeleteCriticalSection(&cs); }
void lock() { EnterCriticalSection(&cs); }
bool trylock() { return TryEnterCriticalSection(&cs) != 0; }
void unlock() { LeaveCriticalSection(&cs); }
CRITICAL_SECTION cs;
int refcount;
};
#else
struct Mutex::Impl
{
Impl()
{
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&mt, &attr);
pthread_mutexattr_destroy(&attr);
refcount = 1;
}
~Impl() { pthread_mutex_destroy(&mt); }
void lock() { pthread_mutex_lock(&mt); }
bool trylock() { return pthread_mutex_trylock(&mt) == 0; }
void unlock() { pthread_mutex_unlock(&mt); }
pthread_mutex_t mt;
int refcount;
};
#endif
Mutex::Mutex()
{
impl = new Mutex::Impl;
}
Mutex::~Mutex()
{
if( CV_XADD(&impl->refcount, -1) == 1 )
delete impl;
impl = 0;
}
Mutex::Mutex(const Mutex& m)
{
impl = m.impl;
CV_XADD(&impl->refcount, 1);
}
Mutex& Mutex::operator = (const Mutex& m)
{
if (this != &m)
{
CV_XADD(&m.impl->refcount, 1);
if( CV_XADD(&impl->refcount, -1) == 1 )
delete impl;
impl = m.impl;
}
return *this;
}
void Mutex::lock() { impl->lock(); }
void Mutex::unlock() { impl->unlock(); }
bool Mutex::trylock() { return impl->trylock(); }
//////////////////////////////// thread-local storage ////////////////////////////////
@ -2023,18 +1933,10 @@ static IPPInitSingleton& getIPPSingleton()
}
#endif
#if OPENCV_ABI_COMPATIBILITY > 300
unsigned long long getIppFeatures()
#else
int getIppFeatures()
#endif
{
#ifdef HAVE_IPP
#if OPENCV_ABI_COMPATIBILITY > 300
return getIPPSingleton().ippFeatures;
#else
return (int)getIPPSingleton().ippFeatures;
#endif
#else
return 0;
#endif
@ -2148,34 +2050,4 @@ void setUseIPP_NE(bool flag)
} // namespace cv
#ifdef HAVE_TEGRA_OPTIMIZATION
namespace tegra {
bool useTegra()
{
cv::CoreTLSData* data = cv::getCoreTlsData().get();
if (data->useTegra < 0)
{
const char* pTegraEnv = getenv("OPENCV_TEGRA");
if (pTegraEnv && (cv::String(pTegraEnv) == "disabled"))
data->useTegra = false;
else
data->useTegra = true;
}
return (data->useTegra > 0);
}
void setUseTegra(bool flag)
{
cv::CoreTLSData* data = cv::getCoreTlsData().get();
data->useTegra = flag;
}
} // namespace tegra
#endif
/* End of file. */

@ -1344,8 +1344,6 @@ TEST(Core_Matx, fromMat_)
ASSERT_EQ( cvtest::norm(a, b, NORM_INF), 0.);
}
#ifdef CV_CXX11
TEST(Core_Matx, from_initializer_list)
{
Mat_<double> a = (Mat_<double>(2,2) << 10, 11, 12, 13);
@ -1360,8 +1358,6 @@ TEST(Core_Mat, regression_9507)
EXPECT_EQ(25u, m2.total());
}
#endif // CXX11
TEST(Core_InputArray, empty)
{
vector<vector<Point> > data;
@ -1612,7 +1608,6 @@ TEST(Mat, regression_7873_mat_vector_initialize)
ASSERT_EQ(2, sub_mat.size[2]);
}
#ifdef CV_CXX_STD_ARRAY
TEST(Core_Mat_array, outputArray_create_getMat)
{
cv::Mat_<uchar> src_base(5, 1);
@ -1701,7 +1696,6 @@ TEST(Core_Mat_array, SplitMerge)
EXPECT_EQ(0, cvtest::norm(src[i], dst[i], NORM_INF));
}
}
#endif
TEST(Mat, regression_8680)
{
@ -1711,8 +1705,6 @@ TEST(Mat, regression_8680)
ASSERT_EQ(mat.channels(), 2);
}
#ifdef CV_CXX11
TEST(Mat_, range_based_for)
{
Mat_<uchar> img = Mat_<uchar>::zeros(3, 3);
@ -1774,6 +1766,4 @@ TEST(Mat_, template_based_ptr)
ASSERT_FLOAT_EQ(66.0f, *(mat.ptr<float>(idx)));
}
#endif
}} // namespace

@ -564,12 +564,8 @@ namespace
if (compactResult)
{
#ifdef CV_CXX11
std::vector< std::vector<DMatch> >::iterator new_end = std::remove_if(matches.begin(), matches.end(),
[](const std::vector<DMatch>& e)->bool { return e.empty(); });
#else
std::vector< std::vector<DMatch> >::iterator new_end = std::remove_if(matches.begin(), matches.end(), std::mem_fun_ref(&std::vector<DMatch>::empty));
#endif
matches.erase(new_end, matches.end());
}
}

@ -497,10 +497,6 @@ void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool
FAST_t<12>(_img, keypoints, threshold, nonmax_suppression);
break;
case FastFeatureDetector::TYPE_9_16:
#ifdef HAVE_TEGRA_OPTIMIZATION
if(tegra::useTegra() && tegra::FAST(_img, keypoints, threshold, nonmax_suppression))
break;
#endif
FAST_t<16>(_img, keypoints, threshold, nonmax_suppression);
break;
}

@ -53,8 +53,4 @@
#include <algorithm>
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/features2d/features2d_tegra.hpp"
#endif
#endif

@ -837,8 +837,4 @@ CV_EXPORTS int createButton( const String& bar_name, ButtonCallback on_change,
} // cv
#ifndef DISABLE_OPENCV_24_COMPATIBILITY
#include "opencv2/highgui/highgui_c.h"
#endif
#endif

@ -68,10 +68,6 @@
#undef abs
#endif
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/highgui/highgui_tegra.hpp"
#endif
/* Errors */
#define HG_OK 0 /* Don't bet on it! */
#define HG_BADNAME -1 /* Bad window or file name */

@ -4907,8 +4907,4 @@ Point LineIterator::pos() const
} // cv
#ifndef DISABLE_OPENCV_24_COMPATIBILITY
#include "opencv2/imgproc/imgproc_c.h"
#endif
#endif

@ -996,11 +996,6 @@ void Canny( InputArray _src, OutputArray _dst,
aperture_size,
L2gradient ) )
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra() && tegra::canny(src, dst, low_thresh, high_thresh, aperture_size, L2gradient))
return;
#endif
CV_IPP_RUN_FAST(ipp_Canny(src, Mat(), Mat(), dst, (float)low_thresh, (float)high_thresh, L2gradient, aperture_size))
if (L2gradient)

@ -247,10 +247,6 @@ cornerEigenValsVecs( const Mat& src, Mat& eigenv, int block_size,
int aperture_size, int op_type, double k=0.,
int borderType=BORDER_DEFAULT )
{
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra() && tegra::cornerEigenValsVecs(src, eigenv, block_size, aperture_size, op_type, k, borderType))
return;
#endif
#if CV_TRY_AVX
bool haveAvx = CV_CPU_HAS_SUPPORT_AVX;
#endif

@ -808,20 +808,6 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
CV_IPP_RUN(!(cv::ocl::isOpenCLActivated() && _dst.isUMat()), ipp_Laplacian(_src, _dst, ksize, scale, delta, borderType));
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra() && scale == 1.0 && delta == 0)
{
Mat src = _src.getMat(), dst = _dst.getMat();
if (ksize == 1 && tegra::laplace1(src, dst, borderType))
return;
if (ksize == 3 && tegra::laplace3(src, dst, borderType))
return;
if (ksize == 5 && tegra::laplace5(src, dst, borderType))
return;
}
#endif
if( ksize == 1 || ksize == 3 )
{
float K[2][9] =

@ -52,11 +52,7 @@
namespace cv
{
#ifdef CV_CXX11
struct greaterThanPtr
#else
struct greaterThanPtr : public std::binary_function<const float *, const float *, bool>
#endif
{
bool operator () (const float * a, const float * b) const
// Ensure a fully deterministic result of the sort

@ -385,11 +385,7 @@ namespace
const double thetaScale = levels_ / 360.0;
r_table_.resize(levels_ + 1);
#ifdef CV_CXX11
std::for_each(r_table_.begin(), r_table_.end(), [](std::vector<Point>& e)->void { e.clear(); });
#else
std::for_each(r_table_.begin(), r_table_.end(), std::mem_fun_ref(&std::vector<Point>::clear));
#endif
for (int y = 0; y < templSize_.height; ++y)
{
@ -696,12 +692,7 @@ namespace
getContourPoints(edges, dx, dy, points);
features.resize(levels_ + 1);
#ifdef CV_CXX11
std::for_each(features.begin(), features.end(), [=](std::vector<Feature>& e) { e.clear(); e.reserve(maxBufferSize_); });
#else
std::for_each(features.begin(), features.end(), std::mem_fun_ref(&std::vector<Feature>::clear));
std::for_each(features.begin(), features.end(), std::bind2nd(std::mem_fun_ref(&std::vector<Feature>::reserve), maxBufferSize_));
#endif
for (size_t i = 0; i < points.size(); ++i)
{

@ -61,11 +61,7 @@
#include <limits.h>
#include <float.h>
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/imgproc/imgproc_tegra.hpp"
#else
#define GET_OPTIMIZED(func) (func)
#endif
/* helper tables */
extern const uchar icvSaturate8u_cv[];

@ -1355,11 +1355,6 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz, int borde
CALL_HAL(pyrDown, cv_hal_pyrdown, src.data, src.step, src.cols, src.rows, dst.data, dst.step, dst.cols, dst.rows, depth, src.channels(), borderType);
#ifdef HAVE_TEGRA_OPTIMIZATION
if(borderType == BORDER_DEFAULT && tegra::useTegra() && tegra::pyrDown(src, dst))
return;
#endif
#ifdef HAVE_IPP
bool isolated = (borderType & BORDER_ISOLATED) != 0;
int borderTypeNI = borderType & ~BORDER_ISOLATED;
@ -1463,11 +1458,6 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz, int borderT
Mat dst = _dst.getMat();
int depth = src.depth();
#ifdef HAVE_TEGRA_OPTIMIZATION
if(borderType == BORDER_DEFAULT && tegra::useTegra() && tegra::pyrUp(src, dst))
return;
#endif
#ifdef HAVE_IPP
bool isolated = (borderType & BORDER_ISOLATED) != 0;
int borderTypeNI = borderType & ~BORDER_ISOLATED;

@ -4566,11 +4566,6 @@ void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize )
CV_IPP_RUN_FAST(ipp_medianFilter(src0, dst, ksize));
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra() && tegra::medianBlur(src0, dst, ksize))
return;
#endif
bool useSortNet = ksize == 3 || (ksize == 5
#if !(CV_SIMD128)
&& ( src0.depth() > CV_8U || src0.channels() == 2 || src0.channels() > 4 )

@ -1118,11 +1118,6 @@ void cv::matchTemplate( InputArray _img, InputArray _templ, OutputArray _result,
_result.create(corrSize, CV_32F);
Mat result = _result.getMat();
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra() && tegra::matchTemplate(img, templ, result, method))
return;
#endif
CV_IPP_RUN_FAST(ipp_matchTemplate(img, templ, result, method))
crossCorr( img, templ, result, result.size(), result.type(), Point(0,0), 0, 0);

@ -136,11 +136,6 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
src_step = dst_step = roi.width;
}
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra() && tegra::thresh_8u(_src, _dst, roi.width, roi.height, thresh, maxval, type))
return;
#endif
#if defined(HAVE_IPP)
CV_IPP_CHECK()
{
@ -356,8 +351,6 @@ thresh_16u(const Mat& _src, Mat& _dst, ushort thresh, ushort maxval, int type)
src_step = dst_step = roi.width;
}
// HAVE_TEGRA_OPTIMIZATION not supported
// HAVE_IPP not supported
const ushort* src = _src.ptr<ushort>();
@ -500,11 +493,6 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type )
src_step = dst_step = roi.width;
}
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra() && tegra::thresh_16s(_src, _dst, roi.width, roi.height, thresh, maxval, type))
return;
#endif
#if defined(HAVE_IPP)
CV_IPP_CHECK()
{
@ -697,11 +685,6 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type )
roi.height = 1;
}
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra() && tegra::thresh_32f(_src, _dst, roi.width, roi.height, thresh, maxval, type))
return;
#endif
#if defined(HAVE_IPP)
CV_IPP_CHECK()
{

@ -56,11 +56,7 @@ enum { MINEIGENVAL=0, HARRIS=1, EIGENVALSVECS=2 };
/////////////////////ref//////////////////////
#ifdef CV_CXX11
struct greaterThanPtr
#else
struct greaterThanPtr : public std::binary_function<const float *, const float *, bool>
#endif
{
bool operator () (const float * a, const float * b) const
{ return *a > *b; }

@ -49,7 +49,7 @@
// - avoid using of "OpenCVLoader.initAsync()" approach - it is deprecated
// It may load library with different version (from OpenCV Android Manager, which is installed separatelly on device)
//
// - use "System.loadLibrary("opencv_java3")" or "OpenCVLoader.initDebug()"
// - use "System.loadLibrary("opencv_java4")" or "OpenCVLoader.initDebug()"
// TODO: Add accurate API to load OpenCV native library
//
//

@ -376,7 +376,7 @@ class AsyncServiceHelper
else
{
// If the dependencies list is not defined or empty.
String AbsLibraryPath = Path + File.separator + "libopencv_java3.so";
String AbsLibraryPath = Path + File.separator + "libopencv_java4.so";
result = loadLibrary(AbsLibraryPath);
}

@ -92,7 +92,7 @@ class StaticHelper {
else
{
// If dependencies list is not defined or empty.
result = loadLibrary("opencv_java3");
result = loadLibrary("opencv_java4");
}
return result;

@ -1503,33 +1503,33 @@ public:
/** ANNEAL: Update initial temperature.
It must be \>=0. Default value is 10.*/
/** @see setAnnealInitialT */
CV_WRAP double getAnnealInitialT() const;
CV_WRAP virtual double getAnnealInitialT() const = 0;
/** @copybrief getAnnealInitialT @see getAnnealInitialT */
CV_WRAP void setAnnealInitialT(double val);
CV_WRAP virtual void setAnnealInitialT(double val) = 0;
/** ANNEAL: Update final temperature.
It must be \>=0 and less than initialT. Default value is 0.1.*/
/** @see setAnnealFinalT */
CV_WRAP double getAnnealFinalT() const;
CV_WRAP virtual double getAnnealFinalT() const = 0;
/** @copybrief getAnnealFinalT @see getAnnealFinalT */
CV_WRAP void setAnnealFinalT(double val);
CV_WRAP virtual void setAnnealFinalT(double val) = 0;
/** ANNEAL: Update cooling ratio.
It must be \>0 and less than 1. Default value is 0.95.*/
/** @see setAnnealCoolingRatio */
CV_WRAP double getAnnealCoolingRatio() const;
CV_WRAP virtual double getAnnealCoolingRatio() const = 0;
/** @copybrief getAnnealCoolingRatio @see getAnnealCoolingRatio */
CV_WRAP void setAnnealCoolingRatio(double val);
CV_WRAP virtual void setAnnealCoolingRatio(double val) = 0;
/** ANNEAL: Update iteration per step.
It must be \>0 . Default value is 10.*/
/** @see setAnnealItePerStep */
CV_WRAP int getAnnealItePerStep() const;
CV_WRAP virtual int getAnnealItePerStep() const = 0;
/** @copybrief getAnnealItePerStep @see getAnnealItePerStep */
CV_WRAP void setAnnealItePerStep(int val);
CV_WRAP virtual void setAnnealItePerStep(int val) = 0;
/** @brief Set/initialize anneal RNG */
void setAnnealEnergyRNG(const RNG& rng);
virtual void setAnnealEnergyRNG(const RNG& rng) = 0;
/** possible activation functions */
enum ActivationFunctions {
@ -1586,6 +1586,10 @@ public:
};
#ifndef DISABLE_OPENCV_3_COMPATIBILITY
typedef ANN_MLP ANN_MLP_ANNEAL;
#endif
/****************************************************************************************\
* Logistic Regression *
\****************************************************************************************/
@ -1870,43 +1874,6 @@ CV_EXPORTS void randMVNormal( InputArray mean, InputArray cov, int nsamples, Out
CV_EXPORTS void createConcentricSpheresTestSet( int nsamples, int nfeatures, int nclasses,
OutputArray samples, OutputArray responses);
/** @brief Artificial Neural Networks - Multi-Layer Perceptrons.
@sa @ref ml_intro_ann
*/
class CV_EXPORTS_W ANN_MLP_ANNEAL : public ANN_MLP
{
public:
/** @see setAnnealInitialT */
CV_WRAP virtual double getAnnealInitialT() const = 0;
/** @copybrief getAnnealInitialT @see getAnnealInitialT */
CV_WRAP virtual void setAnnealInitialT(double val) = 0;
/** ANNEAL: Update final temperature.
It must be \>=0 and less than initialT. Default value is 0.1.*/
/** @see setAnnealFinalT */
CV_WRAP virtual double getAnnealFinalT() const = 0;
/** @copybrief getAnnealFinalT @see getAnnealFinalT */
CV_WRAP virtual void setAnnealFinalT(double val) = 0;
/** ANNEAL: Update cooling ratio.
It must be \>0 and less than 1. Default value is 0.95.*/
/** @see setAnnealCoolingRatio */
CV_WRAP virtual double getAnnealCoolingRatio() const = 0;
/** @copybrief getAnnealCoolingRatio @see getAnnealCoolingRatio */
CV_WRAP virtual void setAnnealCoolingRatio(double val) = 0;
/** ANNEAL: Update iteration per step.
It must be \>0 . Default value is 10.*/
/** @see setAnnealItePerStep */
CV_WRAP virtual int getAnnealItePerStep() const = 0;
/** @copybrief getAnnealItePerStep @see getAnnealItePerStep */
CV_WRAP virtual void setAnnealItePerStep(int val) = 0;
/** @brief Set/initialize anneal RNG */
virtual void setAnnealEnergyRNG(const RNG& rng) = 0;
};
/****************************************************************************************\
* Simulated annealing solver *

@ -141,79 +141,7 @@ protected:
};
double ANN_MLP::getAnnealInitialT() const
{
const ANN_MLP_ANNEAL* this_ = dynamic_cast<const ANN_MLP_ANNEAL*>(this);
if (!this_)
CV_Error(Error::StsNotImplemented, "the class is not ANN_MLP_ANNEAL");
return this_->getAnnealInitialT();
}
void ANN_MLP::setAnnealInitialT(double val)
{
ANN_MLP_ANNEAL* this_ = dynamic_cast<ANN_MLP_ANNEAL*>(this);
if (!this_)
CV_Error(Error::StsNotImplemented, "the class is not ANN_MLP_ANNEAL");
this_->setAnnealInitialT(val);
}
double ANN_MLP::getAnnealFinalT() const
{
const ANN_MLP_ANNEAL* this_ = dynamic_cast<const ANN_MLP_ANNEAL*>(this);
if (!this_)
CV_Error(Error::StsNotImplemented, "the class is not ANN_MLP_ANNEAL");
return this_->getAnnealFinalT();
}
void ANN_MLP::setAnnealFinalT(double val)
{
ANN_MLP_ANNEAL* this_ = dynamic_cast<ANN_MLP_ANNEAL*>(this);
if (!this_)
CV_Error(Error::StsNotImplemented, "the class is not ANN_MLP_ANNEAL");
this_->setAnnealFinalT(val);
}
double ANN_MLP::getAnnealCoolingRatio() const
{
const ANN_MLP_ANNEAL* this_ = dynamic_cast<const ANN_MLP_ANNEAL*>(this);
if (!this_)
CV_Error(Error::StsNotImplemented, "the class is not ANN_MLP_ANNEAL");
return this_->getAnnealCoolingRatio();
}
void ANN_MLP::setAnnealCoolingRatio(double val)
{
ANN_MLP_ANNEAL* this_ = dynamic_cast<ANN_MLP_ANNEAL*>(this);
if (!this_)
CV_Error(Error::StsNotImplemented, "the class is not ANN_MLP_ANNEAL");
this_->setAnnealCoolingRatio(val);
}
int ANN_MLP::getAnnealItePerStep() const
{
const ANN_MLP_ANNEAL* this_ = dynamic_cast<const ANN_MLP_ANNEAL*>(this);
if (!this_)
CV_Error(Error::StsNotImplemented, "the class is not ANN_MLP_ANNEAL");
return this_->getAnnealItePerStep();
}
void ANN_MLP::setAnnealItePerStep(int val)
{
ANN_MLP_ANNEAL* this_ = dynamic_cast<ANN_MLP_ANNEAL*>(this);
if (!this_)
CV_Error(Error::StsNotImplemented, "the class is not ANN_MLP_ANNEAL");
this_->setAnnealItePerStep(val);
}
void ANN_MLP::setAnnealEnergyRNG(const RNG& rng)
{
ANN_MLP_ANNEAL* this_ = dynamic_cast<ANN_MLP_ANNEAL*>(this);
if (!this_)
CV_Error(Error::StsNotImplemented, "the class is not ANN_MLP_ANNEAL");
this_->setAnnealEnergyRNG(rng);
}
class ANN_MLPImpl CV_FINAL : public ANN_MLP_ANNEAL
class ANN_MLPImpl CV_FINAL : public ANN_MLP
{
public:
ANN_MLPImpl()
@ -224,7 +152,7 @@ public:
setTrainMethod(ANN_MLP::RPROP, 0.1, FLT_EPSILON);
}
virtual ~ANN_MLPImpl() {}
virtual ~ANN_MLPImpl() CV_OVERRIDE {}
inline TermCriteria getTermCriteria() const CV_OVERRIDE { return params.termCrit; }
inline void setTermCriteria(TermCriteria val) CV_OVERRIDE { params.termCrit = val; }

@ -283,7 +283,7 @@ TEST_P(ML_ANN_METHOD, Test)
#ifdef GENERATE_TESTDATA
{
Ptr<ml::ANN_MLP> xx = ml::ANN_MLP_ANNEAL::create();
Ptr<ml::ANN_MLP> xx = ml::ANN_MLP::create();
Mat_<int> layerSizesXX(1, 4);
layerSizesXX(0, 0) = tdata->getNVars();
layerSizesXX(0, 1) = 30;
@ -303,7 +303,7 @@ TEST_P(ML_ANN_METHOD, Test)
{
FileStorage fs;
fs.open(dataname + "_init_weight.yml.gz", FileStorage::READ);
Ptr<ml::ANN_MLP> x = ml::ANN_MLP_ANNEAL::create();
Ptr<ml::ANN_MLP> x = ml::ANN_MLP::create();
x->read(fs.root());
x->setTrainMethod(methodType);
if (methodType == ml::ANN_MLP::ANNEAL)

@ -676,8 +676,4 @@ public:
#include "opencv2/objdetect/detection_based_tracker.hpp"
#ifndef DISABLE_OPENCV_24_COMPATIBILITY
#include "opencv2/objdetect/objdetect_c.h"
#endif
#endif

@ -46,10 +46,6 @@
#include <opencv2/core.hpp>
// After this condition removal update blacklist for bindings: modules/python/common.cmake
#if defined(__linux__) || defined(LINUX) || defined(__APPLE__) || defined(__ANDROID__) || \
defined(CV_CXX11)
#include <vector>
namespace cv
@ -222,6 +218,5 @@ class CV_EXPORTS DetectionBasedTracker
//! @} objdetect
} //end of cv namespace
#endif
#endif

@ -53,11 +53,7 @@ namespace opencv_test {
namespace ocl {
///////////// HOG////////////////////////
#ifdef CV_CXX11
struct RectLess
#else
struct RectLess : public std::binary_function<cv::Rect, cv::Rect, bool>
#endif
{
bool operator()(const cv::Rect& a,
const cv::Rect& b) const

@ -969,10 +969,6 @@ Ptr<CascadeClassifierImpl::MaskGenerator> CascadeClassifierImpl::getMaskGenerato
Ptr<BaseCascadeClassifier::MaskGenerator> createFaceDetectionMaskGenerator()
{
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra())
return tegra::getCascadeClassifierMaskGenerator();
#endif
return Ptr<BaseCascadeClassifier::MaskGenerator>();
}

@ -42,23 +42,12 @@
//M*/
#include "precomp.hpp"
#include <cassert>
#ifdef CV_CXX11
#define USE_STD_THREADS
#endif
#if defined(__linux__) || defined(LINUX) || defined(__APPLE__) || defined(__ANDROID__) || defined(USE_STD_THREADS)
#include "opencv2/core/utility.hpp"
#ifdef USE_STD_THREADS
#include <thread>
#include <mutex>
#include <condition_variable>
#else //USE_STD_THREADS
#include <pthread.h>
#endif //USE_STD_THREADS
#if defined(DEBUG) || defined(_DEBUG)
#undef DEBUGLOGS
@ -139,49 +128,26 @@ class cv::DetectionBasedTracker::SeparateDetectionWork
}
void setParameters(const cv::DetectionBasedTracker::Parameters& params)
{
#ifdef USE_STD_THREADS
std::unique_lock<std::mutex> mtx_lock(mtx);
#else
pthread_mutex_lock(&mutex);
#endif
parameters = params;
#ifndef USE_STD_THREADS
pthread_mutex_unlock(&mutex);
#endif
}
inline void init()
{
#ifdef USE_STD_THREADS
std::unique_lock<std::mutex> mtx_lock(mtx);
#else
pthread_mutex_lock(&mutex);
#endif
stateThread = STATE_THREAD_STOPPED;
isObjectDetectingReady = false;
shouldObjectDetectingResultsBeForgot = false;
#ifdef USE_STD_THREADS
objectDetectorThreadStartStop.notify_one();
#else
pthread_cond_signal(&(objectDetectorThreadStartStop));
pthread_mutex_unlock(&mutex);
#endif
}
protected:
DetectionBasedTracker& detectionBasedTracker;
cv::Ptr<DetectionBasedTracker::IDetector> cascadeInThread;
#ifdef USE_STD_THREADS
std::thread second_workthread;
std::mutex mtx;
std::condition_variable objectDetectorRun;
std::condition_variable objectDetectorThreadStartStop;
#else
pthread_t second_workthread;
pthread_mutex_t mutex;
pthread_cond_t objectDetectorRun;
pthread_cond_t objectDetectorThreadStartStop;
#endif
std::vector<cv::Rect> resultDetect;
volatile bool isObjectDetectingReady;
volatile bool shouldObjectDetectingResultsBeForgot;
@ -217,28 +183,6 @@ cv::DetectionBasedTracker::SeparateDetectionWork::SeparateDetectionWork(Detectio
CV_Assert(_detector);
cascadeInThread = _detector;
#ifndef USE_STD_THREADS
second_workthread = 0;
int res=0;
res=pthread_mutex_init(&mutex, NULL);//TODO: should be attributes?
if (res) {
LOGE("ERROR in DetectionBasedTracker::SeparateDetectionWork::SeparateDetectionWork in pthread_mutex_init(&mutex, NULL) is %d", res);
throw(std::exception());
}
res=pthread_cond_init (&objectDetectorRun, NULL);
if (res) {
LOGE("ERROR in DetectionBasedTracker::SeparateDetectionWork::SeparateDetectionWork in pthread_cond_init(&objectDetectorRun,, NULL) is %d", res);
pthread_mutex_destroy(&mutex);
throw(std::exception());
}
res=pthread_cond_init (&objectDetectorThreadStartStop, NULL);
if (res) {
LOGE("ERROR in DetectionBasedTracker::SeparateDetectionWork::SeparateDetectionWork in pthread_cond_init(&objectDetectorThreadStartStop,, NULL) is %d", res);
pthread_cond_destroy(&objectDetectorRun);
pthread_mutex_destroy(&mutex);
throw(std::exception());
}
#endif
}
cv::DetectionBasedTracker::SeparateDetectionWork::~SeparateDetectionWork()
@ -246,39 +190,20 @@ cv::DetectionBasedTracker::SeparateDetectionWork::~SeparateDetectionWork()
if(stateThread!=STATE_THREAD_STOPPED) {
LOGE("\n\n\nATTENTION!!! dangerous algorithm error: destructor DetectionBasedTracker::DetectionBasedTracker::~SeparateDetectionWork is called before stopping the workthread");
}
#ifndef USE_STD_THREADS
pthread_cond_destroy(&objectDetectorThreadStartStop);
pthread_cond_destroy(&objectDetectorRun);
pthread_mutex_destroy(&mutex);
#else
second_workthread.join();
#endif
}
bool cv::DetectionBasedTracker::SeparateDetectionWork::run()
{
LOGD("DetectionBasedTracker::SeparateDetectionWork::run() --- start");
#ifdef USE_STD_THREADS
std::unique_lock<std::mutex> mtx_lock(mtx);
// unlocked when leaving scope
#else
pthread_mutex_lock(&mutex);
#endif
if (stateThread != STATE_THREAD_STOPPED) {
LOGE("DetectionBasedTracker::SeparateDetectionWork::run is called while the previous run is not stopped");
#ifndef USE_STD_THREADS
pthread_mutex_unlock(&mutex);
#endif
return false;
}
stateThread=STATE_THREAD_WORKING_SLEEPING;
#ifdef USE_STD_THREADS
second_workthread = std::thread(workcycleObjectDetectorFunction, (void*)this); //TODO: add attributes?
objectDetectorThreadStartStop.wait(mtx_lock);
#else
pthread_create(&second_workthread, NULL, workcycleObjectDetectorFunction, (void*)this); //TODO: add attributes?
pthread_cond_wait(&objectDetectorThreadStartStop, &mutex);
pthread_mutex_unlock(&mutex);
#endif
LOGD("DetectionBasedTracker::SeparateDetectionWork::run --- end");
return true;
}
@ -313,34 +238,18 @@ void cv::DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector()
std::vector<Rect> objects;
CV_Assert(stateThread==STATE_THREAD_WORKING_SLEEPING);
#ifdef USE_STD_THREADS
std::unique_lock<std::mutex> mtx_lock(mtx);
#else
pthread_mutex_lock(&mutex);
#endif
{
#ifdef USE_STD_THREADS
objectDetectorThreadStartStop.notify_one();
#else
pthread_cond_signal(&objectDetectorThreadStartStop);
#endif
LOGD("DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector() --- before waiting");
CV_Assert(stateThread==STATE_THREAD_WORKING_SLEEPING);
#ifdef USE_STD_THREADS
objectDetectorRun.wait(mtx_lock);
#else
pthread_cond_wait(&objectDetectorRun, &mutex);
#endif
if (isWorking()) {
stateThread=STATE_THREAD_WORKING_WITH_IMAGE;
}
LOGD("DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector() --- after waiting");
}
#ifdef USE_STD_THREADS
mtx_lock.unlock();
#else
pthread_mutex_unlock(&mutex);
#endif
bool isFirstStep=true;
@ -353,34 +262,18 @@ void cv::DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector()
if (! isFirstStep) {
LOGD("DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector() --- before waiting");
CV_Assert(stateThread==STATE_THREAD_WORKING_SLEEPING);
#ifdef USE_STD_THREADS
mtx_lock.lock();
#else
pthread_mutex_lock(&mutex);
#endif
if (!isWorking()) {//it is a rare case, but may cause a crash
LOGD("DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector() --- go out from the workcycle from inner part of lock just before waiting");
#ifdef USE_STD_THREADS
mtx_lock.unlock();
#else
pthread_mutex_unlock(&mutex);
#endif
break;
}
CV_Assert(stateThread==STATE_THREAD_WORKING_SLEEPING);
#ifdef USE_STD_THREADS
objectDetectorRun.wait(mtx_lock);
#else
pthread_cond_wait(&objectDetectorRun, &mutex);
#endif
if (isWorking()) {
stateThread=STATE_THREAD_WORKING_WITH_IMAGE;
}
#ifdef USE_STD_THREADS
mtx_lock.unlock();
#else
pthread_mutex_unlock(&mutex);
#endif
LOGD("DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector() --- after waiting");
} else {
@ -427,11 +320,7 @@ void cv::DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector()
(void)(dt_detect_ms);
LOGI("DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector() --- objects num==%d, t_ms=%.4f", (int)objects.size(), dt_detect_ms);
#ifdef USE_STD_THREADS
mtx_lock.lock();
#else
pthread_mutex_lock(&mutex);
#endif
if (!shouldObjectDetectingResultsBeForgot) {
resultDetect=objects;
isObjectDetectingReady=true;
@ -443,11 +332,7 @@ void cv::DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector()
if(isWorking()) {
stateThread=STATE_THREAD_WORKING_SLEEPING;
}
#ifdef USE_STD_THREADS
mtx_lock.unlock();
#else
pthread_mutex_unlock(&mutex);
#endif
objects.clear();
}// while(isWorking())
@ -458,44 +343,25 @@ void cv::DetectionBasedTracker::SeparateDetectionWork::workcycleObjectDetector()
void cv::DetectionBasedTracker::SeparateDetectionWork::stop()
{
//FIXME: TODO: should add quickStop functionality
#ifdef USE_STD_THREADS
std::unique_lock<std::mutex> mtx_lock(mtx);
#else
pthread_mutex_lock(&mutex);
#endif
if (!isWorking()) {
#ifdef USE_STD_THREADS
mtx_lock.unlock();
#else
pthread_mutex_unlock(&mutex);
#endif
LOGE("SimpleHighguiDemoCore::stop is called but the SimpleHighguiDemoCore pthread is not active");
stateThread = STATE_THREAD_STOPPING;
return;
}
stateThread=STATE_THREAD_STOPPING;
LOGD("DetectionBasedTracker::SeparateDetectionWork::stop: before going to sleep to wait for the signal from the workthread");
#ifdef USE_STD_THREADS
objectDetectorRun.notify_one();
objectDetectorThreadStartStop.wait(mtx_lock);
LOGD("DetectionBasedTracker::SeparateDetectionWork::stop: after receiving the signal from the workthread, stateThread=%d", (int)stateThread);
mtx_lock.unlock();
#else
pthread_cond_signal(&objectDetectorRun);
pthread_cond_wait(&objectDetectorThreadStartStop, &mutex);
LOGD("DetectionBasedTracker::SeparateDetectionWork::stop: after receiving the signal from the workthread, stateThread=%d", (int)stateThread);
pthread_mutex_unlock(&mutex);
#endif
}
void cv::DetectionBasedTracker::SeparateDetectionWork::resetTracking()
{
LOGD("DetectionBasedTracker::SeparateDetectionWork::resetTracking");
#ifdef USE_STD_THREADS
std::unique_lock<std::mutex> mtx_lock(mtx);
#else
pthread_mutex_lock(&mutex);
#endif
if (stateThread == STATE_THREAD_WORKING_WITH_IMAGE) {
LOGD("DetectionBasedTracker::SeparateDetectionWork::resetTracking: since workthread is detecting objects at the moment, we should make cascadeInThread stop detecting and forget the detecting results");
@ -508,12 +374,7 @@ void cv::DetectionBasedTracker::SeparateDetectionWork::resetTracking()
resultDetect.clear();
isObjectDetectingReady=false;
#ifdef USE_STD_THREADS
mtx_lock.unlock();
#else
pthread_mutex_unlock(&mutex);
#endif
}
bool cv::DetectionBasedTracker::SeparateDetectionWork::communicateWithDetectingThread(const Mat& imageGray, std::vector<Rect>& rectsWhereRegions)
@ -529,11 +390,7 @@ bool cv::DetectionBasedTracker::SeparateDetectionWork::communicateWithDetectingT
bool shouldHandleResult = false;
#ifdef USE_STD_THREADS
std::unique_lock<std::mutex> mtx_lock(mtx);
#else
pthread_mutex_lock(&mutex);
#endif
if (isObjectDetectingReady) {
shouldHandleResult=true;
@ -562,18 +419,10 @@ bool cv::DetectionBasedTracker::SeparateDetectionWork::communicateWithDetectingT
timeWhenDetectingThreadStartedWork = getTickCount() ;
#ifdef USE_STD_THREADS
objectDetectorRun.notify_one();
#else
pthread_cond_signal(&objectDetectorRun);
#endif
}
#ifdef USE_STD_THREADS
mtx_lock.unlock();
#else
pthread_mutex_unlock(&mutex);
#endif
LOGD("DetectionBasedTracker::SeparateDetectionWork::communicateWithDetectingThread: result: shouldHandleResult=%d", (shouldHandleResult?1:0));
return shouldHandleResult;
@ -1034,5 +883,3 @@ const cv::DetectionBasedTracker::Parameters& DetectionBasedTracker::getParameter
{
return parameters;
}
#endif //defined(__linux__) || defined(LINUX) || defined(__APPLE__) || defined(__ANDROID__) || defined(USE_STD_THREADS)

@ -50,8 +50,4 @@
#include "opencv2/core/ocl.hpp"
#include "opencv2/core/private.hpp"
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/objdetect/objdetect_tegra.hpp"
#endif
#endif

@ -869,8 +869,4 @@ CV_EXPORTS_W void stylization(InputArray src, OutputArray dst, float sigma_s = 6
} // cv
#ifndef DISABLE_OPENCV_24_COMPATIBILITY
#include "opencv2/photo/photo_c.h"
#endif
#endif

@ -131,11 +131,6 @@ void cv::fastNlMeansDenoising( InputArray _src, OutputArray _dst, const std::vec
switch (normType) {
case NORM_L2:
#ifdef HAVE_TEGRA_OPTIMIZATION
if(hn == 1 && tegra::useTegra() &&
tegra::fastNlMeansDenoising(src, dst, h[0], templateWindowSize, searchWindowSize))
return;
#endif
switch (depth) {
case CV_8U:
fastNlMeansDenoising_<uchar, int, unsigned, DistSquared>(src, dst, h,

@ -49,8 +49,4 @@
#include "opencv2/core/ocl.hpp"
#include "opencv2/imgproc.hpp"
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/photo/photo_tegra.hpp"
#endif
#endif

@ -625,12 +625,6 @@ void normalizeUsingWeightMap(InputArray _weight, InputOutputArray _src)
{
Mat src;
Mat weight;
#ifdef HAVE_TEGRA_OPTIMIZATION
src = _src.getMat();
weight = _weight.getMat();
if(tegra::useTegra() && tegra::normalizeUsingWeightMap(weight, src))
return;
#endif
#ifdef HAVE_OPENCL
if ( !cv::ocl::isOpenCLActivated() ||
@ -697,12 +691,6 @@ void createWeightMap(InputArray mask, float sharpness, InputOutputArray weight)
void createLaplacePyr(InputArray img, int num_levels, std::vector<UMat> &pyr)
{
#ifdef HAVE_TEGRA_OPTIMIZATION
cv::Mat imgMat = img.getMat();
if(tegra::useTegra() && tegra::createLaplacePyr(imgMat, num_levels, pyr))
return;
#endif
pyr.resize(num_levels + 1);
if(img.depth() == CV_8U)

@ -187,11 +187,6 @@ void CpuMatcher::match(const ImageFeatures &features1, const ImageFeatures &feat
CV_Assert(features1.descriptors.type() == features2.descriptors.type());
CV_Assert(features2.descriptors.depth() == CV_8U || features2.descriptors.depth() == CV_32F);
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra() && tegra::match2nearest(features1, features2, matches_info, match_conf_))
return;
#endif
matches_info.matches.clear();
Ptr<cv::DescriptorMatcher> matcher;

@ -95,10 +95,6 @@
#include "opencv2/core/private.hpp"
#ifdef HAVE_TEGRA_OPTIMIZATION
# include "opencv2/stitching/stitching_tegra.hpp"
#endif
#include "util_log.hpp"
#endif

@ -706,11 +706,7 @@ namespace comparators
{
template<typename T>
#ifdef CV_CXX11
struct RectLess_
#else
struct RectLess_ : public std::binary_function<cv::Rect_<T>, cv::Rect_<T>, bool>
#endif
{
bool operator()(const cv::Rect_<T>& r1, const cv::Rect_<T>& r2) const
{
@ -723,11 +719,7 @@ struct RectLess_ : public std::binary_function<cv::Rect_<T>, cv::Rect_<T>, bool>
typedef RectLess_<int> RectLess;
#ifdef CV_CXX11
struct KeypointGreater
#else
struct KeypointGreater : public std::binary_function<cv::KeyPoint, cv::KeyPoint, bool>
#endif
{
bool operator()(const cv::KeyPoint& kp1, const cv::KeyPoint& kp2) const
{

@ -462,11 +462,7 @@ namespace cvtest
return false;
}
#ifdef CV_CXX11
struct KeyPointLess
#else
struct KeyPointLess : std::binary_function<cv::KeyPoint, cv::KeyPoint, bool>
#endif
{
bool operator()(const cv::KeyPoint& kp1, const cv::KeyPoint& kp2) const
{

@ -3,10 +3,6 @@
#include <limits.h>
#include "opencv2/imgproc/types_c.h"
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "tegra.hpp"
#endif
using namespace cv;
namespace cvtest
@ -3101,12 +3097,6 @@ void printVersionInfo(bool useStdOut)
::testing::Test::RecordProperty("cv_cpu_features", cpu_features);
if (useStdOut) std::cout << "CPU features: " << cpu_features << std::endl;
#ifdef HAVE_TEGRA_OPTIMIZATION
const char * tegra_optimization = tegra::useTegra() && tegra::isDeviceSupported() ? "enabled" : "disabled";
::testing::Test::RecordProperty("cv_tegra_optimization", tegra_optimization);
if (useStdOut) std::cout << "Tegra optimization: " << tegra_optimization << std::endl;
#endif
#ifdef HAVE_IPP
const char * ipp_optimization = cv::ipp::useIPP()? "enabled" : "disabled";
::testing::Test::RecordProperty("cv_ipp_optimization", ipp_optimization);

@ -56,8 +56,4 @@
#include "opencv2/video/tracking.hpp"
#include "opencv2/video/background_segm.hpp"
#ifndef DISABLE_OPENCV_24_COMPATIBILITY
#include "opencv2/video/tracking_c.h"
#endif
#endif //OPENCV_VIDEO_HPP

@ -60,11 +60,6 @@ static void calcSharrDeriv(const cv::Mat& src, cv::Mat& dst)
CV_Assert(depth == CV_8U);
dst.create(rows, cols, CV_MAKETYPE(DataType<deriv_type>::depth, cn*2));
#ifdef HAVE_TEGRA_OPTIMIZATION
if (tegra::useTegra() && tegra::calcSharrDeriv(src, dst))
return;
#endif
int x, y, delta = (int)alignSize((cols + 2)*cn, 16);
AutoBuffer<deriv_type> _tempBuf(delta*2 + 64);
deriv_type *trow0 = alignPtr(_tempBuf + cn, 16), *trow1 = alignPtr(trow0 + delta, 16);
@ -1378,12 +1373,7 @@ void SparsePyrLKOpticalFlowImpl::calc( InputArray _prevImg, InputArray _nextImg,
CV_Assert(prevPyr[level * lvlStep1].size() == nextPyr[level * lvlStep2].size());
CV_Assert(prevPyr[level * lvlStep1].type() == nextPyr[level * lvlStep2].type());
#ifdef HAVE_TEGRA_OPTIMIZATION
typedef tegra::LKTrackerInvoker<cv::detail::LKTrackerInvoker> LKTrackerInvoker;
#else
typedef cv::detail::LKTrackerInvoker LKTrackerInvoker;
#endif
parallel_for_(Range(0, npoints), LKTrackerInvoker(prevPyr[level * lvlStep1], derivI,
nextPyr[level * lvlStep2], prevPts, nextPts,
status, err,

@ -49,8 +49,4 @@
#include "opencv2/core/ocl.hpp"
#include "opencv2/core.hpp"
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/video/video_tegra.hpp"
#endif
#endif

@ -8,12 +8,17 @@ log.basicConfig(format='%(message)s', level=log.DEBUG)
CMAKE_TEMPLATE='''\
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
SET(PROJECT_NAME hello-android)
PROJECT(${PROJECT_NAME})
FIND_PACKAGE(OpenCV REQUIRED %(libset)s)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
FILE(GLOB srcs "*.cpp")
ADD_EXECUTABLE(${PROJECT_NAME} ${srcs})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OpenCV_LIBS} dl z)
'''
@ -28,9 +33,9 @@ int main(int argc, char* argv[])
{
(void)argc; (void)argv;
printf("%s\\n", message);
Size textsize = getTextSize(message, CV_FONT_HERSHEY_COMPLEX, 3, 5, 0);
Size textsize = getTextSize(message, FONT_HERSHEY_COMPLEX, 3, 5, 0);
Mat img(textsize.height + 20, textsize.width + 20, CV_32FC1, Scalar(230,230,230));
putText(img, message, Point(10, img.rows - 10), CV_FONT_HERSHEY_COMPLEX, 3, Scalar(0, 0, 0), 5);
putText(img, message, Point(10, img.rows - 10), FONT_HERSHEY_COMPLEX, 3, Scalar(0, 0, 0), 5);
imwrite("/mnt/sdcard/HelloAndroid.png", img);
return 0;
}

@ -22,7 +22,7 @@ include $(BUILD_SHARED_LIBRARY)
TEMPLATE_APPLICATION_MK = '''\
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_CPPFLAGS := -frtti -fexceptions -std=c++11
APP_ABI := {abi}
APP_PLATFORM := android-9
'''

@ -81,7 +81,11 @@ else()
# Standalone mode
#
#===================================================================================================
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.1)
# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
project(samples C CXX)
option(BUILD_EXAMPLES "Build samples" ON)

@ -3,7 +3,7 @@ package org.opencv.samples.tutorial4;
public class NativePart {
static
{
System.loadLibrary("opencv_java3");
System.loadLibrary("opencv_java4");
System.loadLibrary("JNIpart");
}

@ -1,5 +1,9 @@
# cmake needs this line
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.1)
# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
# Define project name
project(opencv_example_project)
@ -18,11 +22,6 @@ message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " libraries: ${OpenCV_LIBS}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
if(CMAKE_VERSION VERSION_LESS "2.8.11")
# Add OpenCV headers location to your include paths
include_directories(${OpenCV_INCLUDE_DIRS})
endif()
# Declare the executable target built from your sources
add_executable(opencv_example example.cpp)

Loading…
Cancel
Save