Permalink
Browse files

Merge release 2.4.4

  • Loading branch information...
2 parents 52a45ed + facab40 commit 9e12b7c3c26ed1b8db7c016cfa46eec2ed78266e @taka-no-me taka-no-me committed Mar 4, 2013
Showing with 11,513 additions and 3,107 deletions.
  1. +1 −1 CMakeLists.txt
  2. +1 −1 android/libinfo/info.c
  3. +2 −2 android/package/AndroidManifest.xml
  4. +15 −5 android/service/engine/jni/NativeService/PackageInfo.cpp
  5. +14 −0 android/service/engine/jni/Tests/PackageInfoTest.cpp
  6. +16 −10 android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java
  7. +1 −1 cmake/OpenCVCompilerOptions.cmake
  8. +11 −11 cmake/OpenCVDetectCXXCompiler.cmake
  9. +10 −3 cmake/OpenCVDetectPython.cmake
  10. +11 −2 cmake/OpenCVGenConfig.cmake
  11. +2 −2 cmake/templates/OpenCV.mk.in
  12. +11 −2 cmake/templates/OpenCVConfig.cmake.in
  13. +8,353 −0 data/haarcascades/haarcascade_smile.xml
  14. +10 −9 doc/tutorials/introduction/android_binary_package/O4A_SDK.rst
  15. +8 −8 doc/tutorials/introduction/android_binary_package/android_dev_intro.rst
  16. BIN doc/tutorials/introduction/android_binary_package/images/eclipse_10_crystal_clean.png
  17. BIN doc/tutorials/introduction/android_binary_package/images/eclipse_7_select_projects.png
  18. BIN doc/tutorials/introduction/android_binary_package/images/eclipse_cdt_cfg4.png
  19. BIN doc/tutorials/introduction/android_binary_package/images/emulator_canny.png
  20. BIN doc/tutorials/introduction/desktop_java/images/eclipse_run.png
  21. +40 −23 doc/tutorials/introduction/desktop_java/java_dev_intro.rst
  22. +83 −136 modules/gpu/perf/perf_calib3d.cpp
  23. +732 −596 modules/gpu/perf/perf_core.cpp
  24. +75 −97 modules/gpu/perf/perf_denoising.cpp
  25. +191 −137 modules/gpu/perf/perf_features2d.cpp
  26. +86 −177 modules/gpu/perf/perf_filters.cpp
  27. +674 −917 modules/gpu/perf/perf_imgproc.cpp
  28. +31 −24 modules/gpu/perf/perf_labeling.cpp
  29. +1 −5 modules/gpu/perf/perf_main.cpp
  30. +64 −95 modules/gpu/perf/perf_matop.cpp
  31. +45 −100 modules/gpu/perf/perf_objdetect.cpp
  32. +300 −354 modules/gpu/perf/perf_video.cpp
  33. +1 −8 modules/gpu/perf/utility.cpp
  34. +14 −35 modules/gpu/perf/utility.hpp
  35. +2 −2 modules/gpu/src/cuda/bgfg_mog.cu
  36. +2 −2 modules/gpu/src/cuda/ccomponetns.cu
  37. +6 −3 modules/gpu/src/cuda/element_operations.cu
  38. +17 −19 modules/gpu/src/element_operations.cpp
  39. +4 −4 modules/gpu/src/graphcuts.cpp
  40. +1 −0 modules/gpu/src/imgproc.cpp
  41. +1 −0 modules/gpu/src/mssegmentation.cpp
  42. +2 −0 modules/gpu/src/pyrlk.cpp
  43. +4 −8 modules/gpu/src/warp.cpp
  44. +22 −9 modules/gpu/test/test_bgfg.cpp
  45. +1 −1 modules/gpu/test/test_core.cpp
  46. +2 −0 modules/gpu/test/test_warp_affine.cpp
  47. +2 −0 modules/gpu/test/test_warp_perspective.cpp
  48. +1 −1 modules/highgui/CMakeLists.txt
  49. +9 −3 modules/java/CMakeLists.txt
  50. +19 −7 modules/java/generator/gen_java.py
  51. +7 −4 modules/ocl/src/arithm.cpp
  52. +1 −1 modules/ocl/src/blend.cpp
  53. +19 −18 modules/ocl/src/brute_force_matcher.cpp
  54. +3 −2 modules/ocl/src/imgproc.cpp
  55. +195 −146 modules/ocl/src/kernels/brute_force_match.cl
  56. +48 −29 modules/ocl/src/kernels/nonfree_surf.cl
  57. +9 −0 modules/ocl/src/kernels/objdetect_hog.cl
  58. +67 −75 modules/ocl/src/surf.cpp
  59. +247 −0 samples/c/smiledetect.cpp
  60. +1 −1 samples/java/ant/build.xml
  61. +3 −1 samples/java/ant/src/SimpleSample.java
  62. +3 −1 samples/java/eclipse/HelloCV/src/Main.java
  63. +4 −1 samples/java/sbt/src/main/scala/Main.scala
  64. +8 −8 samples/ocl/performance.cpp
View
2 CMakeLists.txt
@@ -184,7 +184,7 @@ OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help wi
OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS) )
OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CMAKE_COMPILER_IS_GNUCXX )
-OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CMAKE_COMPILER_IS_GNUCXX )
+OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CMAKE_COMPILER_IS_GNUCXX AND NOT (APPLE AND CMAKE_COMPILER_IS_CLANGCXX) )
OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )
OCV_OPTION(ENABLE_FAST_MATH "Enable -ffast-math (not recommended for GCC 4.6.x)" OFF IF (CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
OCV_OPTION(ENABLE_SSE "Enable SSE instructions" ON IF ((MSVC OR CMAKE_COMPILER_IS_GNUCXX) AND (X86 OR X86_64)) )
View
2 android/libinfo/info.c
@@ -7,7 +7,7 @@ const char* GetLibraryList(void);
JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList(JNIEnv *, jclass);
#define PACKAGE_NAME "org.opencv.lib_v" CVAUX_STR(CV_VERSION_EPOCH) CVAUX_STR(CV_VERSION_MAJOR) "_" ANDROID_PACKAGE_PLATFORM
-#define PACKAGE_REVISION CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(ANDROID_PACKAGE_RELEASE)
+#define PACKAGE_REVISION CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) "." CVAUX_STR(ANDROID_PACKAGE_RELEASE)
const char* GetPackageName(void)
{
View
4 android/package/AndroidManifest.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.opencv.lib_v@OPENCV_VERSION_MAJOR@@OPENCV_VERSION_MINOR@_@ANDROID_PACKAGE_PLATFORM@"
- android:versionCode="@OPENCV_VERSION_PATCH@@ANDROID_PACKAGE_RELEASE@"
- android:versionName="@OPENCV_VERSION_PATCH@.@ANDROID_PACKAGE_RELEASE@" >
+ android:versionCode="@OPENCV_VERSION_PATCH@@OPENCV_VERSION_TWEAK@@ANDROID_PACKAGE_RELEASE@"
+ android:versionName="@OPENCV_VERSION_PATCH@.@OPENCV_VERSION_TWEAK@.@ANDROID_PACKAGE_RELEASE@" >
<uses-sdk android:minSdkVersion="@ANDROID_SDK_VERSION@" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
View
20 android/service/engine/jni/NativeService/PackageInfo.cpp
@@ -136,7 +136,17 @@ inline int SplitVersion(const vector<string>& features, const string& package_ve
// Taking release and build number from package revision
vector<string> tmp2 = SplitStringVector(package_version, '.');
- result += atoi(tmp2[0].c_str())*100 + atoi(tmp2[1].c_str());
+ if (tmp2.size() == 2)
+ {
+ // the 2nd digit is revision
+ result += atoi(tmp2[0].c_str())*100 + 00;
+ }
+ else
+ {
+ // the 2nd digit is part of library version
+ // the 3rd digit is revision
+ result += atoi(tmp2[0].c_str())*100 + atoi(tmp2[1].c_str());
+ }
}
else
{
@@ -194,10 +204,10 @@ inline int SplitPlatfrom(const vector<string>& features)
* Example: armv7_neon
*/
PackageInfo::PackageInfo(int version, int platform, int cpu_id, std::string install_path):
-Version(version),
-Platform(platform),
-CpuID(cpu_id),
-InstallPath("")
+ Version(version),
+ Platform(platform),
+ CpuID(cpu_id),
+ InstallPath("")
{
#ifndef __SUPPORT_TEGRA3
Platform = PLATFORM_UNKNOWN;
View
14 android/service/engine/jni/Tests/PackageInfoTest.cpp
@@ -157,6 +157,20 @@ TEST(PackageInfo, MipsFromFullName)
}
#endif
+TEST(PackageInfo, Check2DigitRevision)
+{
+ PackageInfo info("org.opencv.lib_v23_armv7a_neon", "/data/data/org.opencv.lib_v23_armv7_neon", "4.1");
+ EXPECT_EQ(2030400, info.GetVersion());
+ EXPECT_EQ(ARCH_ARMv7 | FEATURES_HAS_NEON, info.GetCpuID());
+}
+
+TEST(PackageInfo, Check3DigitRevision)
+{
+ PackageInfo info("org.opencv.lib_v23_armv7a_neon", "/data/data/org.opencv.lib_v23_armv7_neon", "4.1.5");
+ EXPECT_EQ(2030401, info.GetVersion());
+ EXPECT_EQ(ARCH_ARMv7 | FEATURES_HAS_NEON, info.GetCpuID());
+}
+
TEST(PackageInfo, Comparator1)
{
PackageInfo info1(2040000, PLATFORM_UNKNOWN, ARCH_X86);
View
26 android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java
@@ -299,10 +299,9 @@ synchronized protected void FillPackageList()
else
NativeLibDir = "/data/data/" + mInstalledPackageInfo[i].packageName + "/lib";
- OpenCVLibraryInfo NativeInfo = new OpenCVLibraryInfo(NativeLibDir);
-
if (PackageName.equals("org.opencv.engine"))
{
+ OpenCVLibraryInfo NativeInfo = new OpenCVLibraryInfo(NativeLibDir);
if (NativeInfo.status())
{
PublicName = "Built-in OpenCV library";
@@ -348,9 +347,7 @@ else if (idx >= 2)
if (null != ActivePackagePath)
{
- int start = ActivePackagePath.indexOf(mInstalledPackageInfo[i].packageName);
- int stop = start + mInstalledPackageInfo[i].packageName.length();
- if (start >= 0 && ActivePackagePath.charAt(stop) == '/')
+ if (ActivePackagePath.equals(NativeLibDir))
{
temp.put("Activity", "y");
Tags = "active";
@@ -405,13 +402,22 @@ protected String NormalizeVersion(String OpenCVersion, String PackageVersion)
if (OpenCVersion == null || PackageVersion == null)
return "unknown";
- int dot = PackageVersion.indexOf(".");
- if (dot == -1 || OpenCVersion.length() == 0)
+ String[] revisions = PackageVersion.split("\\.");
+
+ if (revisions.length <= 1 || OpenCVersion.length() == 0)
return "unknown";
else
- return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." +
- OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." +
- PackageVersion.substring(0, dot) + " rev " + PackageVersion.substring(dot+1);
+ if (revisions.length == 2)
+ // the 2nd digit is revision
+ return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." +
+ OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." +
+ revisions[0] + " rev " + revisions[1];
+ else
+ // the 2nd digit is part of library version
+ // the 3rd digit is revision
+ return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." +
+ OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." +
+ revisions[0] + "." + revisions[1] + " rev " + revisions[2];
}
protected String ConvertPackageName(String Name, String Version)
View
2 cmake/OpenCVCompilerOptions.cmake
@@ -91,7 +91,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()
# We need pthread's
- if(UNIX AND NOT ANDROID)
+ if(UNIX AND NOT ANDROID AND NOT (APPLE AND CMAKE_COMPILER_IS_CLANGCXX))
add_extra_compiler_option(-pthread)
endif()
View
22 cmake/OpenCVDetectCXXCompiler.cmake
@@ -5,17 +5,17 @@ if(CMAKE_CL_64)
set(MSVC64 1)
endif()
-if(NOT APPLE)
- if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
- set(CMAKE_COMPILER_IS_GNUCXX 1)
- set(CMAKE_COMPILER_IS_CLANGCXX 1)
- set(ENABLE_PRECOMPILED_HEADERS OFF CACHE BOOL "" FORCE)
- endif()
- if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
- set(CMAKE_COMPILER_IS_GNUCC 1)
- set(CMAKE_COMPILER_IS_CLANGCC 1)
- set(ENABLE_PRECOMPILED_HEADERS OFF CACHE BOOL "" FORCE)
- endif()
+if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ set(CMAKE_COMPILER_IS_GNUCXX 1)
+ set(CMAKE_COMPILER_IS_CLANGCXX 1)
+endif()
+if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ set(CMAKE_COMPILER_IS_GNUCC 1)
+ set(CMAKE_COMPILER_IS_CLANGCC 1)
+endif()
+
+if((CMAKE_COMPILER_IS_CLANGCXX OR CMAKE_COMPILER_IS_CLANGCC) AND NOT CMAKE_GENERATOR MATCHES "Xcode")
+ set(ENABLE_PRECOMPILED_HEADERS OFF CACHE BOOL "" FORCE)
endif()
# ----------------------------------------------------------------------------
View
13 cmake/OpenCVDetectPython.cmake
@@ -19,18 +19,25 @@ unset(HAVE_SPHINX CACHE)
if(PYTHON_EXECUTABLE)
if(PYTHON_VERSION_STRING)
set(PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
- string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" PYTHON_VERSION_FULL "${PYTHON_VERSION_STRING}")
+ set(PYTHON_VERSION_FULL "${PYTHON_VERSION_STRING}")
else()
execute_process(COMMAND ${PYTHON_EXECUTABLE} --version
ERROR_VARIABLE PYTHON_VERSION_FULL
ERROR_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH "[0-9]+.[0-9]+" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}")
- string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" PYTHON_VERSION_FULL "${PYTHON_VERSION_FULL}")
+ endif()
+
+ if("${PYTHON_VERSION_FULL}" MATCHES "[0-9]+.[0-9]+.[0-9]+")
+ set(PYTHON_VERSION_FULL "${CMAKE_MATCH_0}")
+ elseif("${PYTHON_VERSION_FULL}" MATCHES "[0-9]+.[0-9]+")
+ set(PYTHON_VERSION_FULL "${CMAKE_MATCH_0}")
+ else()
+ unset(PYTHON_VERSION_FULL)
endif()
if(NOT ANDROID AND NOT IOS)
- if(CMAKE_VERSION VERSION_GREATER 2.8.8)
+ if(CMAKE_VERSION VERSION_GREATER 2.8.8 AND PYTHON_VERSION_FULL)
find_host_package(PythonLibs ${PYTHON_VERSION_FULL} EXACT)
else()
find_host_package(PythonLibs ${PYTHON_VERSION_FULL})
View
13 cmake/OpenCVGenConfig.cmake
@@ -53,6 +53,10 @@ if(OpenCV_LIB_COMPONENTS)
list(REMOVE_ITEM OPENCV_MODULES_CONFIGCMAKE ${OpenCV_LIB_COMPONENTS})
endif()
+if(BUILD_FAT_JAVA_LIB AND HAVE_opencv_java)
+ list(APPEND OPENCV_MODULES_CONFIGCMAKE opencv_java)
+endif()
+
macro(ocv_generate_dependencies_map_configcmake suffix configuration)
set(OPENCV_DEPENDENCIES_MAP_${suffix} "")
set(OPENCV_PROCESSED_LIBS "")
@@ -126,8 +130,13 @@ configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}/opencv" "\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}\"")
set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"")
-set(OpenCV_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_LIB_INSTALL_PATH}\"")
-set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_3P_LIB_INSTALL_PATH}\"")
+if(ANDROID)
+ set(OpenCV_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/sdk/native/libs/\${ANDROID_NDK_ABI_NAME}\"")
+ set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/sdk/native/3rdparty/libs/\${ANDROID_NDK_ABI_NAME}\"")
+else()
+ set(OpenCV_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_LIB_INSTALL_PATH}\"")
+ set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_3P_LIB_INSTALL_PATH}\"")
+endif()
if(INSTALL_TO_MANGLED_PATHS)
string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "${OPENCV_3P_LIB_INSTALL_PATH}")
set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE}\"")
View
4 cmake/templates/OpenCV.mk.in
@@ -92,7 +92,7 @@ define add_opencv_camera_module
include $(PREBUILT_SHARED_LIBRARY)
endef
-ifeq ($(OPENCV_MK_ALREADY_INCLUDED),)
+ifeq ($(OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_ALREADY_INCLUDED),)
ifeq ($(OPENCV_INSTALL_MODULES),on)
$(foreach module,$(OPENCV_LIBS),$(eval $(call add_opencv_module,$(module))))
endif
@@ -105,7 +105,7 @@ ifeq ($(OPENCV_MK_ALREADY_INCLUDED),)
endif
#turn off module installation to prevent their redefinition
- OPENCV_MK_ALREADY_INCLUDED:=on
+ OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_ALREADY_INCLUDED:=on
endif
ifeq ($(OPENCV_LOCAL_CFLAGS),)
View
13 cmake/templates/OpenCVConfig.cmake.in
@@ -150,6 +150,7 @@ endif()
# ==============================================================
if(NOT OpenCV_FIND_COMPONENTS)
set(OpenCV_FIND_COMPONENTS ${OpenCV_LIB_COMPONENTS})
+ list(REMOVE_ITEM OpenCV_FIND_COMPONENTS opencv_java)
if(GTest_FOUND OR GTEST_FOUND)
list(REMOVE_ITEM OpenCV_FIND_COMPONENTS opencv_ts)
endif()
@@ -200,7 +201,7 @@ foreach(__opttype OPT DBG)
#indicate that this module is also found
string(TOUPPER "${__cvdep}" __cvdep)
set(${__cvdep}_FOUND 1)
- else()
+ elseif(EXISTS "${OpenCV_3RDPARTY_LIB_DIR_${__opttype}}/${OpenCV_${__cvdep}_LIBNAME_${__opttype}}")
list(APPEND OpenCV_LIBS_${__opttype} "${OpenCV_3RDPARTY_LIB_DIR_${__opttype}}/${OpenCV_${__cvdep}_LIBNAME_${__opttype}}")
endif()
endforeach()
@@ -220,7 +221,7 @@ foreach(__opttype OPT DBG)
endif()
# CUDA
- if(OpenCV_CUDA_VERSION AND WIN32 AND NOT OpenCV_SHARED)
+ if(OpenCV_CUDA_VERSION AND (CMAKE_CROSSCOMPILING OR (WIN32 AND NOT OpenCV_SHARED)))
if(NOT CUDA_FOUND)
find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
else()
@@ -303,3 +304,11 @@ else()
SET(OpenCV_LIB_DIR ${OpenCV_LIB_DIR_OPT} ${OpenCV_3RDPARTY_LIB_DIR_OPT})
endif()
set(OpenCV_LIBRARIES ${OpenCV_LIBS})
+
+if(CMAKE_CROSSCOMPILING AND OpenCV_SHARED AND (CMAKE_SYSTEM_NAME MATCHES "Linux"))
+ foreach(dir ${OpenCV_LIB_DIR})
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
+ endforeach()
+endif()
View
8,353 data/haarcascades/haarcascade_smile.xml
8,353 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
19 doc/tutorials/introduction/android_binary_package/O4A_SDK.rst
@@ -159,7 +159,7 @@ Get the OpenCV4Android SDK
unzip ~/Downloads/OpenCV-2.4.4-android-sdk.zip
-.. |opencv_android_bin_pack| replace:: OpenCV-2.4.4-android-sdk.zip
+.. |opencv_android_bin_pack| replace:: :file:`OpenCV-2.4.4-android-sdk.zip`
.. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.4/OpenCV-2.4.4-android-sdk.zip/download
.. |opencv_android_bin_pack_url| replace:: |opencv_android_bin_pack|
.. |seven_zip| replace:: 7-Zip
@@ -184,7 +184,7 @@ Import OpenCV library and samples to the Eclipse
You can simply reference it in your projects.
Each sample included into the |opencv_android_bin_pack| is a regular Android project that already
- references OpenCV library.Follow the steps below to import OpenCV and samples into the workspace:
+ references OpenCV library. Follow the steps below to import OpenCV and samples into the workspace:
.. note:: OpenCV samples are indeed **dependent** on OpenCV library project so don't forget to import it to your workspace as well.
@@ -246,8 +246,8 @@ Running OpenCV Samples
----------------------
At this point you should be able to build and run the samples. Keep in mind, that
-``face-detection``, ``Tutorial 3` and ``Tutorial 4`` include some native code and
-require Android NDK and CDT plugin for Eclipse to build working applications. If you haven't
+``face-detection`` and ``Tutorial 2 - Mixed Processing`` include some native code and
+require Android NDK and NDK/CDT plugin for Eclipse to build working applications. If you haven't
installed these tools, see the corresponding section of :ref:`Android_Dev_Intro`.
.. warning:: Please consider that some samples use Android Java Camera API, which is accessible
@@ -295,7 +295,7 @@ Well, running samples from Eclipse is very simple:
.. code-block:: sh
:linenos:
- <Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.4_Manager_armv7a-neon.apk
+ <Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.4_Manager_2.6_armv7a-neon.apk
.. note:: ``armeabi``, ``armv7a-neon``, ``arm7a-neon-android8``, ``mips`` and ``x86`` stand for
platform targets:
@@ -326,15 +326,16 @@ Well, running samples from Eclipse is very simple:
When done, you will be able to run OpenCV samples on your device/emulator seamlessly.
-* Here is ``Tutorial 2 - Use OpenCV Camera`` sample, running on top of stock camera-preview of the emulator.
+* Here is ``Sample - image-manipulations`` sample, running on top of stock camera-preview of the emulator.
.. image:: images/emulator_canny.png
- :height: 600px
- :alt: Tutorial 1 Basic - 1. Add OpenCV - running Canny
+ :alt: 'Sample - image-manipulations' running Canny
:align: center
What's next
===========
-Now, when you have your instance of OpenCV4Adroid SDK set up and configured, you may want to proceed to using OpenCV in your own application. You can learn how to do that in a separate :ref:`dev_with_OCV_on_Android` tutorial.
+Now, when you have your instance of OpenCV4Adroid SDK set up and configured,
+you may want to proceed to using OpenCV in your own application.
+You can learn how to do that in a separate :ref:`dev_with_OCV_on_Android` tutorial.
View
16 doc/tutorials/introduction/android_binary_package/android_dev_intro.rst
@@ -103,24 +103,24 @@ You need the following software to be installed in order to develop for Android
Here is Google's `install guide <http://developer.android.com/sdk/installing.html>`_ for the SDK.
- .. note:: You can choose downloading ``ADT Bundle package`` that in addition to Android SDK Tools includes
- Eclipse + ADT + CDT plugins, Android Platform-tools, the latest Android platform and the latest
+ .. note:: You can choose downloading **ADT Bundle package** that in addition to Android SDK Tools includes
+ Eclipse + ADT + NDK/CDT plugins, Android Platform-tools, the latest Android platform and the latest
Android system image for the emulator - this is the best choice for those who is setting up Android
development environment the first time!
.. note:: If you are running x64 version of Ubuntu Linux, then you need ia32 shared libraries
for use on amd64 and ia64 systems to be installed. You can install them with the
following command:
- .. code-block:: bash
+ .. code-block:: bash
- sudo apt-get install ia32-libs
+ sudo apt-get install ia32-libs
- For Red Hat based systems the following command might be helpful:
+ For Red Hat based systems the following command might be helpful:
- .. code-block:: bash
+ .. code-block:: bash
- sudo yum install libXtst.i386
+ sudo yum install libXtst.i386
#. **Android SDK components**
@@ -148,7 +148,7 @@ You need the following software to be installed in order to develop for Android
Check the `Android SDK System Requirements <http://developer.android.com/sdk/requirements.html>`_
document for a list of Eclipse versions that are compatible with the Android SDK.
- For OpenCV 2.4.x we recommend **Eclipse 3.7 (Indigo)** or later versions. They work well for
+ For OpenCV 2.4.x we recommend **Eclipse 3.7 (Indigo)** or **Eclipse 4.2 (Juno)**. They work well for
OpenCV under both Windows and Linux.
If you have no Eclipse installed, you can get it from the `official site <http://www.eclipse.org/downloads/>`_.
View
BIN doc/tutorials/introduction/android_binary_package/images/eclipse_10_crystal_clean.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN doc/tutorials/introduction/android_binary_package/images/eclipse_7_select_projects.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN doc/tutorials/introduction/android_binary_package/images/eclipse_cdt_cfg4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN doc/tutorials/introduction/android_binary_package/images/emulator_canny.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN doc/tutorials/introduction/desktop_java/images/eclipse_run.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
63 doc/tutorials/introduction/desktop_java/java_dev_intro.rst
@@ -5,7 +5,7 @@
Introduction to Java Development
********************************
-Last updated: 12 February, 2013.
+Last updated: 28 February, 2013.
As of OpenCV 2.4.4, OpenCV supports desktop Java development using nearly the same interface as for
Android development. This guide will help you to create your first Java (or Scala) application using OpenCV.
@@ -28,10 +28,14 @@ In this guide, we will:
The same process was used to create the samples in the :file:`samples/java` folder of the OpenCV repository,
so consult those files if you get lost.
-Get OpenCV with desktop Java support
-************************************
+Get proper OpenCV
+*****************
Starting from version 2.4.4 OpenCV includes desktop Java bindings.
+
+Download
+########
+
The most simple way to get it is downloading the appropriate package of **version 2.4.4 or higher** from the
`OpenCV SourceForge repository <http://sourceforge.net/projects/opencvlibrary/files/>`_.
@@ -45,8 +49,8 @@ In order to build OpenCV with Java bindings you need :abbr:`JDK (Java Developmen
(we recommend `Oracle/Sun JDK 6 or 7 <http://www.oracle.com/technetwork/java/javase/downloads/>`_),
`Apache Ant <http://ant.apache.org/>`_ and `Python` v2.6 or higher to be installed.
-Build OpenCV
-############
+Build
+#####
Let's build OpenCV:
@@ -83,6 +87,16 @@ through the CMake output for any Java-related tools that aren't found and instal
:alt: CMake output
:align: center
+.. note:: If ``CMake`` can't find Java in your system set the ``JAVA_HOME``
+ environment variable with the path to installed JDK
+ before running it. E.g.:
+
+ .. code-block:: bash
+
+ export JAVA_HOME=/usr/lib/jvm/java-6-oracle
+ cmake -DBUILD_SHARED_LIBS=OFF ..
+
+
Now start the build:
.. code-block:: bash
@@ -95,20 +109,20 @@ or
msbuild /m OpenCV.sln /t:Build /p:Configuration=Release /v:m
-Besides all this will create a ``jar`` containing the Java interface (:file:`bin/opencv_2.4.4.jar`)
+Besides all this will create a ``jar`` containing the Java interface (:file:`bin/opencv-244.jar`)
and a native dynamic library containing Java bindings and all the OpenCV stuff
-(:file:`bin/Release/opencv_java244.dll` or :file:`bin/libopencv_java244.so` respectively).
+(:file:`bin/Release/opencv_java244.dll` or :file:`lib/libopencv_java244.so` respectively).
We'll use these files later.
-Create a simple Java sample and an Ant build file for it
-********************************************************
+Java sample with Ant
+********************
.. note::
The described sample is provided with OpenCV library in the :file:`opencv/samples/java/ant` folder.
* Create a folder where you'll develop this sample application.
-* In this folder create an XML file with the following content using any text editor:
+* In this folder create the :file:`build.xml` file with the following content using any text editor:
.. code-block:: xml
:linenos:
@@ -135,7 +149,7 @@ Create a simple Java sample and an Ant build file for it
<target name="compile">
<mkdir dir="${classes.dir}"/>
- <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
+ <javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
</target>
<target name="jar" depends="compile">
@@ -181,15 +195,17 @@ Create a simple Java sample and an Ant build file for it
* Put the following Java code into the :file:`SimpleSample.java` file:
.. code-block:: java
+ import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.CvType;
import org.opencv.core.Scalar;
class SimpleSample {
- static{ System.loadLibrary("opencv_java244"); }
+ static{ System.loadLibrary(Core.NATIVE_LIBRARY_NAME); }
public static void main(String[] args) {
+ System.out.println("Welcome to OpenCV " + Core.VERSION);
Mat m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0));
System.out.println("OpenCV Mat: " + m);
Mat mr1 = m.row(1);
@@ -219,8 +235,8 @@ Create a simple Java sample and an Ant build file for it
:alt: run app with Ant
:align: center
-Create a simple Java project in Eclipse
-***************************************
+Java project in Eclipse
+***********************
Now let's look at the possiblity of using OpenCV in Java when developing in Eclipse IDE.
@@ -293,12 +309,13 @@ Now let's look at the possiblity of using OpenCV in Java when developing in Ecli
* Put some simple OpenCV calls there, e.g.:
.. code-block:: java
+ import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
public class Main {
public static void main(String[] args) {
- System.loadLibrary("opencv_java244");
+ System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
System.out.println("m = " + m.dump());
}
@@ -310,8 +327,8 @@ Now let's look at the possiblity of using OpenCV in Java when developing in Ecli
:alt: Eclipse: run
:align: center
-Create an SBT project and samples in Java and Scala
-***************************************************
+SBT project for Java and Scala
+******************************
Now we'll create a simple Java application using SBT. This serves as a brief introduction to
those unfamiliar with this build tool. We're using SBT because it is particularly easy and powerful.
@@ -409,8 +426,8 @@ You should see something like this:
:alt: SBT run
:align: center
-Copy the OpenCV jar and write a simple application
-********************************************************
+Running SBT samples
+###################
Now we'll create a simple face detection application using OpenCV.
@@ -424,7 +441,7 @@ You can optionally rerun ``sbt eclipse`` to update your Eclipse project.
cp <opencv_dir>/build/bin/opencv_<version>.jar lib/
sbt eclipse
-Next, create the directory src/main/resources and download this Lena image into it:
+Next, create the directory :file:`src/main/resources` and download this Lena image into it:
.. image:: images/lena.png
:alt: Lena
@@ -433,7 +450,7 @@ Next, create the directory src/main/resources and download this Lena image into
Make sure it's called :file:`"lena.png"`.
Items in the resources directory are available to the Java application at runtime.
-Next, copy :file:`lbpcascade_frontalface.xml` from :file:`opencv/data/` into the :file:`resources`
+Next, copy :file:`lbpcascade_frontalface.xml` from :file:`opencv/data/lbpcascades/` into the :file:`resources`
directory:
.. code-block:: bash
@@ -490,12 +507,12 @@ Now modify src/main/java/HelloOpenCV.java so it contains the following Java code
System.out.println("Hello, OpenCV");
// Load the native library.
- System.loadLibrary("opencv_java244");
+ System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
new DetectFaceDemo().run();
}
}
-Note the call to ``System.loadLibrary("opencv_java244")``.
+Note the call to ``System.loadLibrary(Core.NATIVE_LIBRARY_NAME)``.
This command must be executed exactly once per Java process prior to using any native OpenCV methods.
If you don't call it, you will get ``UnsatisfiedLink errors``.
You will also get errors if you try to load OpenCV when it has already been loaded.
View
219 modules/gpu/perf/perf_calib3d.cpp
@@ -3,15 +3,14 @@
using namespace std;
using namespace testing;
-namespace {
-
//////////////////////////////////////////////////////////////////////
// StereoBM
typedef std::tr1::tuple<string, string> pair_string;
DEF_PARAM_TEST_1(ImagePair, pair_string);
-PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(pair_string("gpu/perf/aloe.png", "gpu/perf/aloeR.png")))
+PERF_TEST_P(ImagePair, Calib3D_StereoBM,
+ Values(pair_string("gpu/perf/aloe.png", "gpu/perf/aloeR.png")))
{
declare.time(5.0);
@@ -28,31 +27,21 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(pair_string("gpu/perf/aloe.png",
{
cv::gpu::StereoBM_GPU d_bm(preset, ndisp);
- cv::gpu::GpuMat d_imgLeft(imgLeft);
- cv::gpu::GpuMat d_imgRight(imgRight);
- cv::gpu::GpuMat d_dst;
-
- d_bm(d_imgLeft, d_imgRight, d_dst);
+ const cv::gpu::GpuMat d_imgLeft(imgLeft);
+ const cv::gpu::GpuMat d_imgRight(imgRight);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE()
- {
- d_bm(d_imgLeft, d_imgRight, d_dst);
- }
+ TEST_CYCLE() d_bm(d_imgLeft, d_imgRight, dst);
- GPU_SANITY_CHECK(d_dst);
+ GPU_SANITY_CHECK(dst);
}
else
{
cv::StereoBM bm(preset, ndisp);
cv::Mat dst;
- bm(imgLeft, imgRight, dst);
-
- TEST_CYCLE()
- {
- bm(imgLeft, imgRight, dst);
- }
+ TEST_CYCLE() bm(imgLeft, imgRight, dst);
CPU_SANITY_CHECK(dst);
}
@@ -61,7 +50,8 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(pair_string("gpu/perf/aloe.png",
//////////////////////////////////////////////////////////////////////
// StereoBeliefPropagation
-PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, Values(pair_string("gpu/stereobp/aloe-L.png", "gpu/stereobp/aloe-R.png")))
+PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation,
+ Values(pair_string("gpu/stereobp/aloe-L.png", "gpu/stereobp/aloe-R.png")))
{
declare.time(10.0);
@@ -77,29 +67,25 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, Values(pair_string("gpu/
{
cv::gpu::StereoBeliefPropagation d_bp(ndisp);
- cv::gpu::GpuMat d_imgLeft(imgLeft);
- cv::gpu::GpuMat d_imgRight(imgRight);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_imgLeft(imgLeft);
+ const cv::gpu::GpuMat d_imgRight(imgRight);
+ cv::gpu::GpuMat dst;
- d_bp(d_imgLeft, d_imgRight, d_dst);
+ TEST_CYCLE() d_bp(d_imgLeft, d_imgRight, dst);
- TEST_CYCLE()
- {
- d_bp(d_imgLeft, d_imgRight, d_dst);
- }
-
- GPU_SANITY_CHECK(d_dst);
+ GPU_SANITY_CHECK(dst);
}
else
{
- FAIL() << "No such CPU implementation analogy.";
+ FAIL_NO_CPU();
}
}
//////////////////////////////////////////////////////////////////////
// StereoConstantSpaceBP
-PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP, Values(pair_string("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-R.png")))
+PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP,
+ Values(pair_string("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-R.png")))
{
declare.time(10.0);
@@ -115,29 +101,25 @@ PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP, Values(pair_string("gpu/st
{
cv::gpu::StereoConstantSpaceBP d_csbp(ndisp);
- cv::gpu::GpuMat d_imgLeft(imgLeft);
- cv::gpu::GpuMat d_imgRight(imgRight);
- cv::gpu::GpuMat d_dst;
-
- d_csbp(d_imgLeft, d_imgRight, d_dst);
+ const cv::gpu::GpuMat d_imgLeft(imgLeft);
+ const cv::gpu::GpuMat d_imgRight(imgRight);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE()
- {
- d_csbp(d_imgLeft, d_imgRight, d_dst);
- }
+ TEST_CYCLE() d_csbp(d_imgLeft, d_imgRight, dst);
- GPU_SANITY_CHECK(d_dst);
+ GPU_SANITY_CHECK(dst);
}
else
{
- FAIL() << "No such CPU implementation analogy.";
+ FAIL_NO_CPU();
}
}
//////////////////////////////////////////////////////////////////////
// DisparityBilateralFilter
-PERF_TEST_P(ImagePair, Calib3D_DisparityBilateralFilter, Values(pair_string("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-disp.png")))
+PERF_TEST_P(ImagePair, Calib3D_DisparityBilateralFilter,
+ Values(pair_string("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-disp.png")))
{
const cv::Mat img = readImage(GET_PARAM(0), cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(img.empty());
@@ -151,22 +133,17 @@ PERF_TEST_P(ImagePair, Calib3D_DisparityBilateralFilter, Values(pair_string("gpu
{
cv::gpu::DisparityBilateralFilter d_filter(ndisp);
- cv::gpu::GpuMat d_img(img);
- cv::gpu::GpuMat d_disp(disp);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_img(img);
+ const cv::gpu::GpuMat d_disp(disp);
+ cv::gpu::GpuMat dst;
- d_filter(d_disp, d_img, d_dst);
+ TEST_CYCLE() d_filter(d_disp, d_img, dst);
- TEST_CYCLE()
- {
- d_filter(d_disp, d_img, d_dst);
- }
-
- GPU_SANITY_CHECK(d_dst);
+ GPU_SANITY_CHECK(dst);
}
else
{
- FAIL() << "No such CPU implementation analogy.";
+ FAIL_NO_CPU();
}
}
@@ -175,74 +152,61 @@ PERF_TEST_P(ImagePair, Calib3D_DisparityBilateralFilter, Values(pair_string("gpu
DEF_PARAM_TEST_1(Count, int);
-PERF_TEST_P(Count, Calib3D_TransformPoints, Values(5000, 10000, 20000))
+PERF_TEST_P(Count, Calib3D_TransformPoints,
+ Values(5000, 10000, 20000))
{
const int count = GetParam();
cv::Mat src(1, count, CV_32FC3);
- fillRandom(src, -100, 100);
+ declare.in(src, WARMUP_RNG);
const cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);
const cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
-
- cv::gpu::transformPoints(d_src, rvec, tvec, d_dst);
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE()
- {
- cv::gpu::transformPoints(d_src, rvec, tvec, d_dst);
- }
+ TEST_CYCLE() cv::gpu::transformPoints(d_src, rvec, tvec, dst);
- GPU_SANITY_CHECK(d_dst);
+ GPU_SANITY_CHECK(dst);
}
else
{
- FAIL() << "No such CPU implementation analogy.";
+ FAIL_NO_CPU();
}
}
//////////////////////////////////////////////////////////////////////
// ProjectPoints
-PERF_TEST_P(Count, Calib3D_ProjectPoints, Values(5000, 10000, 20000))
+PERF_TEST_P(Count, Calib3D_ProjectPoints,
+ Values(5000, 10000, 20000))
{
const int count = GetParam();
cv::Mat src(1, count, CV_32FC3);
- fillRandom(src, -100, 100);
+ declare.in(src, WARMUP_RNG);
const cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);
const cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);
const cv::Mat camera_mat = cv::Mat::ones(3, 3, CV_32FC1);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- cv::gpu::projectPoints(d_src, rvec, tvec, camera_mat, cv::Mat(), d_dst);
+ TEST_CYCLE() cv::gpu::projectPoints(d_src, rvec, tvec, camera_mat, cv::Mat(), dst);
- TEST_CYCLE()
- {
- cv::gpu::projectPoints(d_src, rvec, tvec, camera_mat, cv::Mat(), d_dst);
- }
-
- GPU_SANITY_CHECK(d_dst);
+ GPU_SANITY_CHECK(dst);
}
else
{
cv::Mat dst;
- cv::projectPoints(src, rvec, tvec, camera_mat, cv::noArray(), dst);
-
- TEST_CYCLE()
- {
- cv::projectPoints(src, rvec, tvec, camera_mat, cv::noArray(), dst);
- }
+ TEST_CYCLE() cv::projectPoints(src, rvec, tvec, camera_mat, cv::noArray(), dst);
CPU_SANITY_CHECK(dst);
}
@@ -251,97 +215,85 @@ PERF_TEST_P(Count, Calib3D_ProjectPoints, Values(5000, 10000, 20000))
//////////////////////////////////////////////////////////////////////
// SolvePnPRansac
-PERF_TEST_P(Count, Calib3D_SolvePnPRansac, Values(5000, 10000, 20000))
+PERF_TEST_P(Count, Calib3D_SolvePnPRansac,
+ Values(5000, 10000, 20000))
{
declare.time(10.0);
const int count = GetParam();
cv::Mat object(1, count, CV_32FC3);
- fillRandom(object, -100, 100);
+ declare.in(object, WARMUP_RNG);
cv::Mat camera_mat(3, 3, CV_32FC1);
- fillRandom(camera_mat, 0.5, 1);
+ cv::randu(camera_mat, 0.5, 1);
camera_mat.at<float>(0, 1) = 0.f;
camera_mat.at<float>(1, 0) = 0.f;
camera_mat.at<float>(2, 0) = 0.f;
camera_mat.at<float>(2, 1) = 0.f;
const cv::Mat dist_coef(1, 8, CV_32F, cv::Scalar::all(0));
- std::vector<cv::Point2f> image_vec;
cv::Mat rvec_gold(1, 3, CV_32FC1);
- fillRandom(rvec_gold, 0, 1);
+ cv::randu(rvec_gold, 0, 1);
+
cv::Mat tvec_gold(1, 3, CV_32FC1);
- fillRandom(tvec_gold, 0, 1);
+ cv::randu(tvec_gold, 0, 1);
+
+ std::vector<cv::Point2f> image_vec;
cv::projectPoints(object, rvec_gold, tvec_gold, camera_mat, dist_coef, image_vec);
- cv::Mat image(1, count, CV_32FC2, &image_vec[0]);
+ const cv::Mat image(1, count, CV_32FC2, &image_vec[0]);
cv::Mat rvec;
cv::Mat tvec;
if (PERF_RUN_GPU())
{
- cv::gpu::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
+ TEST_CYCLE() cv::gpu::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
- TEST_CYCLE()
- {
- cv::gpu::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
- }
+ GPU_SANITY_CHECK(rvec, 1e-3);
+ GPU_SANITY_CHECK(tvec, 1e-3);
}
else
{
- cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
+ TEST_CYCLE() cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
- TEST_CYCLE()
- {
- cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
- }
+ CPU_SANITY_CHECK(rvec, 1e-6);
+ CPU_SANITY_CHECK(tvec, 1e-6);
}
-
- CPU_SANITY_CHECK(rvec);
- CPU_SANITY_CHECK(tvec);
}
//////////////////////////////////////////////////////////////////////
// ReprojectImageTo3D
-PERF_TEST_P(Sz_Depth, Calib3D_ReprojectImageTo3D, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S)))
+PERF_TEST_P(Sz_Depth, Calib3D_ReprojectImageTo3D,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16S)))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src, 5.0, 30.0);
+ declare.in(src, WARMUP_RNG);
cv::Mat Q(4, 4, CV_32FC1);
- fillRandom(Q, 0.1, 1.0);
+ cv::randu(Q, 0.1, 1.0);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- cv::gpu::reprojectImageTo3D(d_src, d_dst, Q);
+ TEST_CYCLE() cv::gpu::reprojectImageTo3D(d_src, dst, Q);
- TEST_CYCLE()
- {
- cv::gpu::reprojectImageTo3D(d_src, d_dst, Q);
- }
-
- GPU_SANITY_CHECK(d_dst);
+ GPU_SANITY_CHECK(dst);
}
else
{
cv::Mat dst;
- cv::reprojectImageTo3D(src, dst, Q);
-
- TEST_CYCLE()
- {
- cv::reprojectImageTo3D(src, dst, Q);
- }
+ TEST_CYCLE() cv::reprojectImageTo3D(src, dst, Q);
CPU_SANITY_CHECK(dst);
}
@@ -350,32 +302,27 @@ PERF_TEST_P(Sz_Depth, Calib3D_ReprojectImageTo3D, Combine(GPU_TYPICAL_MAT_SIZES,
//////////////////////////////////////////////////////////////////////
// DrawColorDisp
-PERF_TEST_P(Sz_Depth, Calib3D_DrawColorDisp, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S)))
+PERF_TEST_P(Sz_Depth, Calib3D_DrawColorDisp,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16S)))
{
const cv::Size size = GET_PARAM(0);
const int type = GET_PARAM(1);
cv::Mat src(size, type);
- fillRandom(src, 0, 255);
+ declare.in(src, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- cv::gpu::drawColorDisp(d_src, d_dst, 255);
+ TEST_CYCLE() cv::gpu::drawColorDisp(d_src, dst, 255);
- TEST_CYCLE()
- {
- cv::gpu::drawColorDisp(d_src, d_dst, 255);
- }
-
- GPU_SANITY_CHECK(d_dst);
+ GPU_SANITY_CHECK(dst);
}
else
{
- FAIL() << "No such CPU implementation analogy.";
+ FAIL_NO_CPU();
}
}
-
-} // namespace
View
1,328 modules/gpu/perf/perf_core.cpp
@@ -2,575 +2,632 @@
using namespace std;
using namespace testing;
-
-namespace {
+using namespace perf;
#define ARITHM_MAT_DEPTH Values(CV_8U, CV_16U, CV_32F, CV_64F)
//////////////////////////////////////////////////////////////////////
// Merge
-PERF_TEST_P(Sz_Depth_Cn, Core_Merge, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, Values(2, 3, 4)))
+PERF_TEST_P(Sz_Depth_Cn, Core_Merge,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH,
+ Values(2, 3, 4)))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
const int channels = GET_PARAM(2);
std::vector<cv::Mat> src(channels);
for (int i = 0; i < channels; ++i)
- src[i] = cv::Mat(size, depth, cv::Scalar::all(i));
+ {
+ src[i].create(size, depth);
+ declare.in(src[i], WARMUP_RNG);
+ }
if (PERF_RUN_GPU())
{
std::vector<cv::gpu::GpuMat> d_src(channels);
for (int i = 0; i < channels; ++i)
d_src[i].upload(src[i]);
- cv::gpu::GpuMat d_dst;
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::merge(d_src, d_dst);
+ TEST_CYCLE() cv::gpu::merge(d_src, dst);
- GPU_SANITY_CHECK(d_dst, 1e-12);
+ GPU_SANITY_CHECK(dst, 1e-10);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::merge(src, dst);
- CPU_SANITY_CHECK(dst, 1e-12);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// Split
-PERF_TEST_P(Sz_Depth_Cn, Core_Split, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, Values(2, 3, 4)))
+PERF_TEST_P(Sz_Depth_Cn, Core_Split,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH,
+ Values(2, 3, 4)))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
const int channels = GET_PARAM(2);
- cv::Mat src(size, CV_MAKE_TYPE(depth, channels), cv::Scalar(1, 2, 3, 4));
+ cv::Mat src(size, CV_MAKE_TYPE(depth, channels));
+ declare.in(src, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
+ const cv::gpu::GpuMat d_src(src);
+ std::vector<cv::gpu::GpuMat> dst;
- std::vector<cv::gpu::GpuMat> d_dst;
+ TEST_CYCLE() cv::gpu::split(d_src, dst);
- TEST_CYCLE() cv::gpu::split(d_src, d_dst);
+ const cv::gpu::GpuMat& dst0 = dst[0];
+ const cv::gpu::GpuMat& dst1 = dst[1];
- cv::gpu::GpuMat first = d_dst[0];
- GPU_SANITY_CHECK(first, 1e-12);
+ GPU_SANITY_CHECK(dst0, 1e-10);
+ GPU_SANITY_CHECK(dst1, 1e-10);
}
else
{
std::vector<cv::Mat> dst;
TEST_CYCLE() cv::split(src, dst);
- CPU_SANITY_CHECK(dst, 1e-12);
+ const cv::Mat& dst0 = dst[0];
+ const cv::Mat& dst1 = dst[1];
+
+ CPU_SANITY_CHECK(dst0);
+ CPU_SANITY_CHECK(dst1);
}
}
//////////////////////////////////////////////////////////////////////
// AddMat
-PERF_TEST_P(Sz_Depth, Core_AddMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
+PERF_TEST_P(Sz_Depth, Core_AddMat,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src1(size, depth);
- fillRandom(src1);
+ declare.in(src1, WARMUP_RNG);
cv::Mat src2(size, depth);
- fillRandom(src2);
+ declare.in(src2, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src1(src1);
- cv::gpu::GpuMat d_src2(src2);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src1(src1);
+ const cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::add(d_src1, d_src2, d_dst);
+ TEST_CYCLE() cv::gpu::add(d_src1, d_src2, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst, 1e-10);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::add(src1, src2, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// AddScalar
-PERF_TEST_P(Sz_Depth, Core_AddScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
+PERF_TEST_P(Sz_Depth, Core_AddScalar,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src);
+ declare.in(src, WARMUP_RNG);
- cv::Scalar s(1, 2, 3, 4);
+ cv::Scalar s;
+ declare.in(s, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::add(d_src, s, d_dst);
+ TEST_CYCLE() cv::gpu::add(d_src, s, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst, 1e-10);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::add(src, s, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// SubtractMat
-PERF_TEST_P(Sz_Depth, Core_SubtractMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
+PERF_TEST_P(Sz_Depth, Core_SubtractMat,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src1(size, depth);
- fillRandom(src1);
+ declare.in(src1, WARMUP_RNG);
cv::Mat src2(size, depth);
- fillRandom(src2);
+ declare.in(src2, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src1(src1);
- cv::gpu::GpuMat d_src2(src2);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src1(src1);
+ const cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::subtract(d_src1, d_src2, d_dst);
+ TEST_CYCLE() cv::gpu::subtract(d_src1, d_src2, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst, 1e-10);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::subtract(src1, src2, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// SubtractScalar
-PERF_TEST_P(Sz_Depth, Core_SubtractScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
+PERF_TEST_P(Sz_Depth, Core_SubtractScalar,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src);
+ declare.in(src, WARMUP_RNG);
- cv::Scalar s(1, 2, 3, 4);
+ cv::Scalar s;
+ declare.in(s, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::subtract(d_src, s, d_dst);
+ TEST_CYCLE() cv::gpu::subtract(d_src, s, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst, 1e-10);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::subtract(src, s, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// MultiplyMat
-PERF_TEST_P(Sz_Depth, Core_MultiplyMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
+PERF_TEST_P(Sz_Depth, Core_MultiplyMat,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src1(size, depth);
- fillRandom(src1);
+ declare.in(src1, WARMUP_RNG);
cv::Mat src2(size, depth);
- fillRandom(src2);
+ declare.in(src2, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src1(src1);
- cv::gpu::GpuMat d_src2(src2);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src1(src1);
+ const cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::multiply(d_src1, d_src2, d_dst);
+ TEST_CYCLE() cv::gpu::multiply(d_src1, d_src2, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst, 1e-6);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::multiply(src1, src2, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// MultiplyScalar
-PERF_TEST_P(Sz_Depth, Core_MultiplyScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
+PERF_TEST_P(Sz_Depth, Core_MultiplyScalar,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src);
+ declare.in(src, WARMUP_RNG);
- cv::Scalar s(1, 2, 3, 4);
+ cv::Scalar s;
+ declare.in(s, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- cv::gpu::multiply(d_src, s, d_dst);
+ TEST_CYCLE() cv::gpu::multiply(d_src, s, dst);
- TEST_CYCLE() cv::gpu::multiply(d_src, s, d_dst);
-
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst, 1e-6);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::multiply(src, s, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// DivideMat
-PERF_TEST_P(Sz_Depth, Core_DivideMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
+PERF_TEST_P(Sz_Depth, Core_DivideMat,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src1(size, depth);
- fillRandom(src1);
+ declare.in(src1, WARMUP_RNG);
cv::Mat src2(size, depth);
- fillRandom(src2);
+ declare.in(src2, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src1(src1);
- cv::gpu::GpuMat d_src2(src2);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src1(src1);
+ const cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::divide(d_src1, d_src2, d_dst);
+ TEST_CYCLE() cv::gpu::divide(d_src1, d_src2, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst, 1e-6);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::divide(src1, src2, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// DivideScalar
-PERF_TEST_P(Sz_Depth, Core_DivideScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
+PERF_TEST_P(Sz_Depth, Core_DivideScalar,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src);
+ declare.in(src, WARMUP_RNG);
- cv::Scalar s(1, 2, 3, 4);
+ cv::Scalar s;
+ declare.in(s, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::divide(d_src, s, d_dst);
+ TEST_CYCLE() cv::gpu::divide(d_src, s, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst, 1e-6);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::divide(src, s, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// DivideScalarInv
-PERF_TEST_P(Sz_Depth, Core_DivideScalarInv, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
+PERF_TEST_P(Sz_Depth, Core_DivideScalarInv,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src);
+ declare.in(src, WARMUP_RNG);
- double s = 100.0;
+ cv::Scalar s;
+ declare.in(s, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::divide(s, d_src, d_dst);
+ TEST_CYCLE() cv::gpu::divide(s[0], d_src, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst, 1e-6);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::divide(s, src, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// AbsDiffMat
-PERF_TEST_P(Sz_Depth, Core_AbsDiffMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
+PERF_TEST_P(Sz_Depth, Core_AbsDiffMat,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src1(size, depth);
- fillRandom(src1);
+ declare.in(src1, WARMUP_RNG);
cv::Mat src2(size, depth);
- fillRandom(src2);
+ declare.in(src2, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src1(src1);
- cv::gpu::GpuMat d_src2(src2);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src1(src1);
+ const cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::absdiff(d_src1, d_src2, d_dst);
+ TEST_CYCLE() cv::gpu::absdiff(d_src1, d_src2, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst, 1e-10);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::absdiff(src1, src2, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// AbsDiffScalar
-PERF_TEST_P(Sz_Depth, Core_AbsDiffScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
+PERF_TEST_P(Sz_Depth, Core_AbsDiffScalar,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src);
+ declare.in(src, WARMUP_RNG);
- cv::Scalar s(1, 2, 3, 4);
+ cv::Scalar s;
+ declare.in(s, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::absdiff(d_src, s, d_dst);
+ TEST_CYCLE() cv::gpu::absdiff(d_src, s, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst, 1e-10);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::absdiff(src, s, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// Abs
-PERF_TEST_P(Sz_Depth, Core_Abs, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_16S, CV_32F)))
+PERF_TEST_P(Sz_Depth, Core_Abs,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ Values(CV_16S, CV_32F)))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src);
+ declare.in(src, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::abs(d_src, d_dst);
+ TEST_CYCLE() cv::gpu::abs(d_src, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst);
+ }
+ else
+ {
+ FAIL_NO_CPU();
}
- else FAIL_NO_CPU();
}
//////////////////////////////////////////////////////////////////////
// Sqr
-PERF_TEST_P(Sz_Depth, Core_Sqr, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F)))
+PERF_TEST_P(Sz_Depth, Core_Sqr,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16S, CV_32F)))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src);
+ declare.in(src, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::sqr(d_src, d_dst);
+ TEST_CYCLE() cv::gpu::sqr(d_src, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst);
+ }
+ else
+ {
+ FAIL_NO_CPU();
}
- else FAIL_NO_CPU();
}
//////////////////////////////////////////////////////////////////////
// Sqrt
-PERF_TEST_P(Sz_Depth, Core_Sqrt, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F)))
+PERF_TEST_P(Sz_Depth, Core_Sqrt,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16S, CV_32F)))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src);
+ cv::randu(src, 0, 100000);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::sqrt(d_src, d_dst);
+ TEST_CYCLE() cv::gpu::sqrt(d_src, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::sqrt(src, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// Log
-PERF_TEST_P(Sz_Depth, Core_Log, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F)))
+PERF_TEST_P(Sz_Depth, Core_Log,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16S, CV_32F)))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src, 1.0, 255.0);
+ cv::randu(src, 0, 100000);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::log(d_src, d_dst);
+ TEST_CYCLE() cv::gpu::log(d_src, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst);
}
else
{
cv::Mat dst;
TEST_CYCLE() cv::log(src, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
//////////////////////////////////////////////////////////////////////
// Exp
-PERF_TEST_P(Sz_Depth, Core_Exp, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F)))
+PERF_TEST_P(Sz_Depth, Core_Exp,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16S, CV_32F)))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src, 1.0, 10.0);
+ cv::randu(src, 0, 10);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::exp(d_src, d_dst);
+ TEST_CYCLE() cv::gpu::exp(d_src, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst);
}
else
{
cv::Mat dst;
- TEST_CYCLE() TEST_CYCLE() cv::exp(src, dst);
+ TEST_CYCLE() cv::exp(src, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
@@ -579,31 +636,34 @@ PERF_TEST_P(Sz_Depth, Core_Exp, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_
DEF_PARAM_TEST(Sz_Depth_Power, cv::Size, MatDepth, double);
-PERF_TEST_P(Sz_Depth_Power, Core_Pow, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F), Values(0.3, 2.0, 2.4)))
+PERF_TEST_P(Sz_Depth_Power, Core_Pow,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16S, CV_32F),
+ Values(0.3, 2.0, 2.4)))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
const double power = GET_PARAM(2);
cv::Mat src(size, depth);
- fillRandom(src, 1.0, 10.0);
+ declare.in(src, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::pow(d_src, power, d_dst);
+ TEST_CYCLE() cv::gpu::pow(d_src, power, dst);
- GPU_SANITY_CHECK(d_dst, 1e-8);
+ GPU_SANITY_CHECK(dst);
}
else
{
cv::Mat dst;
- TEST_CYCLE() cv::pow(src, power,dst);
+ TEST_CYCLE() cv::pow(src, power, dst);
- CPU_SANITY_CHECK(dst, 1e-8);
+ CPU_SANITY_CHECK(dst);
}
}
@@ -615,27 +675,30 @@ CV_ENUM(CmpCode, cv::CMP_EQ, cv::CMP_GT, cv::CMP_GE, cv::CMP_LT, cv::CMP_LE, cv:
DEF_PARAM_TEST(Sz_Depth_Code, cv::Size, MatDepth, CmpCode);
-PERF_TEST_P(Sz_Depth_Code, Core_CompareMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, ALL_CMP_CODES))
+PERF_TEST_P(Sz_Depth_Code, Core_CompareMat,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH,
+ ALL_CMP_CODES))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
const int cmp_code = GET_PARAM(2);
cv::Mat src1(size, depth);
- fillRandom(src1);
+ declare.in(src1, WARMUP_RNG);
cv::Mat src2(size, depth);
- fillRandom(src2);
+ declare.in(src2, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src1(src1);
- cv::gpu::GpuMat d_src2(src2);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src1(src1);
+ const cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::compare(d_src1, d_src2, d_dst, cmp_code);
+ TEST_CYCLE() cv::gpu::compare(d_src1, d_src2, dst, cmp_code);
- GPU_SANITY_CHECK(d_dst);
+ GPU_SANITY_CHECK(dst);
}
else
{
@@ -650,25 +713,29 @@ PERF_TEST_P(Sz_Depth_Code, Core_CompareMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITH
//////////////////////////////////////////////////////////////////////
// CompareScalar
-PERF_TEST_P(Sz_Depth_Code, Core_CompareScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, ALL_CMP_CODES))
+PERF_TEST_P(Sz_Depth_Code, Core_CompareScalar,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ ARITHM_MAT_DEPTH,
+ ALL_CMP_CODES))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
const int cmp_code = GET_PARAM(2);
cv::Mat src(size, depth);
- fillRandom(src);
+ declare.in(src, WARMUP_RNG);
- cv::Scalar s = cv::Scalar::all(100);
+ cv::Scalar s;
+ declare.in(s, WARMUP_RNG);
if (PERF_RUN_GPU())
{
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_dst;
+ const cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat dst;
- TEST_CYCLE() cv::gpu::compare(d_src, s, d_dst, cmp_code);
+ TEST_CYCLE() cv::gpu::compare(d_src, s, dst, cmp_code);
- GPU_SANITY_CHECK(d_dst);
+ GPU_SANITY_CHECK(dst);
}
else
{
@@ -683,28 +750,30 @@ PERF_TEST_P(Sz_Depth_Code, Core_CompareScalar, Combine(GPU_TYPICAL_MAT_SIZES, AR
//////////////////////////////////////////////////////////////////////
// BitwiseNot
-PERF_TEST_P(Sz_Depth, Core_BitwiseNot, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S)))
+PERF_TEST_P(Sz_Depth, Core_BitwiseNot,
+ Combine(GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32S)))
{
const cv::Size size = GET_PARAM(0);
const int depth = GET_PARAM(1);
cv::Mat src(size, depth);
- fillRandom(src);
+ declare.in(src, WARMUP_RNG);