Commit 9e12b7c3 authored by Andrey Kamaev's avatar Andrey Kamaev

Merge release 2.4.4

parents 52a45ed1 facab407
...@@ -184,7 +184,7 @@ OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help wi ...@@ -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_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_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_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_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_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)) ) OCV_OPTION(ENABLE_SSE "Enable SSE instructions" ON IF ((MSVC OR CMAKE_COMPILER_IS_GNUCXX) AND (X86 OR X86_64)) )
......
...@@ -7,7 +7,7 @@ const char* GetLibraryList(void); ...@@ -7,7 +7,7 @@ const char* GetLibraryList(void);
JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList(JNIEnv *, jclass); 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_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) const char* GetPackageName(void)
{ {
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.opencv.lib_v@OPENCV_VERSION_MAJOR@@OPENCV_VERSION_MINOR@_@ANDROID_PACKAGE_PLATFORM@" package="org.opencv.lib_v@OPENCV_VERSION_MAJOR@@OPENCV_VERSION_MINOR@_@ANDROID_PACKAGE_PLATFORM@"
android:versionCode="@OPENCV_VERSION_PATCH@@ANDROID_PACKAGE_RELEASE@" android:versionCode="@OPENCV_VERSION_PATCH@@OPENCV_VERSION_TWEAK@@ANDROID_PACKAGE_RELEASE@"
android:versionName="@OPENCV_VERSION_PATCH@.@ANDROID_PACKAGE_RELEASE@" > android:versionName="@OPENCV_VERSION_PATCH@.@OPENCV_VERSION_TWEAK@.@ANDROID_PACKAGE_RELEASE@" >
<uses-sdk android:minSdkVersion="@ANDROID_SDK_VERSION@" /> <uses-sdk android:minSdkVersion="@ANDROID_SDK_VERSION@" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/> <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
......
...@@ -136,8 +136,18 @@ inline int SplitVersion(const vector<string>& features, const string& package_ve ...@@ -136,8 +136,18 @@ inline int SplitVersion(const vector<string>& features, const string& package_ve
// Taking release and build number from package revision // Taking release and build number from package revision
vector<string> tmp2 = SplitStringVector(package_version, '.'); vector<string> tmp2 = SplitStringVector(package_version, '.');
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()); result += atoi(tmp2[0].c_str())*100 + atoi(tmp2[1].c_str());
} }
}
else else
{ {
// TODO: Report package name format error // TODO: Report package name format error
...@@ -194,10 +204,10 @@ inline int SplitPlatfrom(const vector<string>& features) ...@@ -194,10 +204,10 @@ inline int SplitPlatfrom(const vector<string>& features)
* Example: armv7_neon * Example: armv7_neon
*/ */
PackageInfo::PackageInfo(int version, int platform, int cpu_id, std::string install_path): PackageInfo::PackageInfo(int version, int platform, int cpu_id, std::string install_path):
Version(version), Version(version),
Platform(platform), Platform(platform),
CpuID(cpu_id), CpuID(cpu_id),
InstallPath("") InstallPath("")
{ {
#ifndef __SUPPORT_TEGRA3 #ifndef __SUPPORT_TEGRA3
Platform = PLATFORM_UNKNOWN; Platform = PLATFORM_UNKNOWN;
......
...@@ -157,6 +157,20 @@ TEST(PackageInfo, MipsFromFullName) ...@@ -157,6 +157,20 @@ TEST(PackageInfo, MipsFromFullName)
} }
#endif #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) TEST(PackageInfo, Comparator1)
{ {
PackageInfo info1(2040000, PLATFORM_UNKNOWN, ARCH_X86); PackageInfo info1(2040000, PLATFORM_UNKNOWN, ARCH_X86);
......
...@@ -299,10 +299,9 @@ public class ManagerActivity extends Activity ...@@ -299,10 +299,9 @@ public class ManagerActivity extends Activity
else else
NativeLibDir = "/data/data/" + mInstalledPackageInfo[i].packageName + "/lib"; NativeLibDir = "/data/data/" + mInstalledPackageInfo[i].packageName + "/lib";
OpenCVLibraryInfo NativeInfo = new OpenCVLibraryInfo(NativeLibDir);
if (PackageName.equals("org.opencv.engine")) if (PackageName.equals("org.opencv.engine"))
{ {
OpenCVLibraryInfo NativeInfo = new OpenCVLibraryInfo(NativeLibDir);
if (NativeInfo.status()) if (NativeInfo.status())
{ {
PublicName = "Built-in OpenCV library"; PublicName = "Built-in OpenCV library";
...@@ -348,9 +347,7 @@ public class ManagerActivity extends Activity ...@@ -348,9 +347,7 @@ public class ManagerActivity extends Activity
if (null != ActivePackagePath) if (null != ActivePackagePath)
{ {
int start = ActivePackagePath.indexOf(mInstalledPackageInfo[i].packageName); if (ActivePackagePath.equals(NativeLibDir))
int stop = start + mInstalledPackageInfo[i].packageName.length();
if (start >= 0 && ActivePackagePath.charAt(stop) == '/')
{ {
temp.put("Activity", "y"); temp.put("Activity", "y");
Tags = "active"; Tags = "active";
...@@ -405,13 +402,22 @@ public class ManagerActivity extends Activity ...@@ -405,13 +402,22 @@ public class ManagerActivity extends Activity
if (OpenCVersion == null || PackageVersion == null) if (OpenCVersion == null || PackageVersion == null)
return "unknown"; return "unknown";
int dot = PackageVersion.indexOf("."); String[] revisions = PackageVersion.split("\\.");
if (dot == -1 || OpenCVersion.length() == 0)
if (revisions.length <= 1 || OpenCVersion.length() == 0)
return "unknown"; return "unknown";
else else
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) + "." + return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." +
OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." + OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." +
PackageVersion.substring(0, dot) + " rev " + PackageVersion.substring(dot+1); revisions[0] + "." + revisions[1] + " rev " + revisions[2];
} }
protected String ConvertPackageName(String Name, String Version) protected String ConvertPackageName(String Name, String Version)
......
...@@ -91,7 +91,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) ...@@ -91,7 +91,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif() endif()
# We need pthread's # 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) add_extra_compiler_option(-pthread)
endif() endif()
......
...@@ -5,17 +5,17 @@ if(CMAKE_CL_64) ...@@ -5,17 +5,17 @@ if(CMAKE_CL_64)
set(MSVC64 1) set(MSVC64 1)
endif() endif()
if(NOT APPLE) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_COMPILER_IS_GNUCXX 1) set(CMAKE_COMPILER_IS_GNUCXX 1)
set(CMAKE_COMPILER_IS_CLANGCXX 1) set(CMAKE_COMPILER_IS_CLANGCXX 1)
set(ENABLE_PRECOMPILED_HEADERS OFF CACHE BOOL "" FORCE) endif()
endif() if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_COMPILER_IS_GNUCC 1) set(CMAKE_COMPILER_IS_GNUCC 1)
set(CMAKE_COMPILER_IS_CLANGCC 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) set(ENABLE_PRECOMPILED_HEADERS OFF CACHE BOOL "" FORCE)
endif()
endif() endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
......
...@@ -19,18 +19,25 @@ unset(HAVE_SPHINX CACHE) ...@@ -19,18 +19,25 @@ unset(HAVE_SPHINX CACHE)
if(PYTHON_EXECUTABLE) if(PYTHON_EXECUTABLE)
if(PYTHON_VERSION_STRING) if(PYTHON_VERSION_STRING)
set(PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") 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() else()
execute_process(COMMAND ${PYTHON_EXECUTABLE} --version execute_process(COMMAND ${PYTHON_EXECUTABLE} --version
ERROR_VARIABLE PYTHON_VERSION_FULL ERROR_VARIABLE PYTHON_VERSION_FULL
ERROR_STRIP_TRAILING_WHITESPACE) 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]+" 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() endif()
if(NOT ANDROID AND NOT IOS) 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) find_host_package(PythonLibs ${PYTHON_VERSION_FULL} EXACT)
else() else()
find_host_package(PythonLibs ${PYTHON_VERSION_FULL}) find_host_package(PythonLibs ${PYTHON_VERSION_FULL})
......
...@@ -53,6 +53,10 @@ if(OpenCV_LIB_COMPONENTS) ...@@ -53,6 +53,10 @@ if(OpenCV_LIB_COMPONENTS)
list(REMOVE_ITEM OPENCV_MODULES_CONFIGCMAKE ${OpenCV_LIB_COMPONENTS}) list(REMOVE_ITEM OPENCV_MODULES_CONFIGCMAKE ${OpenCV_LIB_COMPONENTS})
endif() 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) macro(ocv_generate_dependencies_map_configcmake suffix configuration)
set(OPENCV_DEPENDENCIES_MAP_${suffix} "") set(OPENCV_DEPENDENCIES_MAP_${suffix} "")
set(OPENCV_PROCESSED_LIBS "") set(OPENCV_PROCESSED_LIBS "")
...@@ -126,8 +130,13 @@ configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake. ...@@ -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(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(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"")
set(OpenCV_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_LIB_INSTALL_PATH}\"") if(ANDROID)
set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_3P_LIB_INSTALL_PATH}\"") 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) if(INSTALL_TO_MANGLED_PATHS)
string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "${OPENCV_3P_LIB_INSTALL_PATH}") 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}\"") set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE}\"")
......
...@@ -92,7 +92,7 @@ define add_opencv_camera_module ...@@ -92,7 +92,7 @@ define add_opencv_camera_module
include $(PREBUILT_SHARED_LIBRARY) include $(PREBUILT_SHARED_LIBRARY)
endef endef
ifeq ($(OPENCV_MK_ALREADY_INCLUDED),) ifeq ($(OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_ALREADY_INCLUDED),)
ifeq ($(OPENCV_INSTALL_MODULES),on) ifeq ($(OPENCV_INSTALL_MODULES),on)
$(foreach module,$(OPENCV_LIBS),$(eval $(call add_opencv_module,$(module)))) $(foreach module,$(OPENCV_LIBS),$(eval $(call add_opencv_module,$(module))))
endif endif
...@@ -105,7 +105,7 @@ ifeq ($(OPENCV_MK_ALREADY_INCLUDED),) ...@@ -105,7 +105,7 @@ ifeq ($(OPENCV_MK_ALREADY_INCLUDED),)
endif endif
#turn off module installation to prevent their redefinition #turn off module installation to prevent their redefinition
OPENCV_MK_ALREADY_INCLUDED:=on OPENCV_MK_$(OPENCV_TARGET_ARCH_ABI)_ALREADY_INCLUDED:=on
endif endif
ifeq ($(OPENCV_LOCAL_CFLAGS),) ifeq ($(OPENCV_LOCAL_CFLAGS),)
......
...@@ -150,6 +150,7 @@ endif() ...@@ -150,6 +150,7 @@ endif()
# ============================================================== # ==============================================================
if(NOT OpenCV_FIND_COMPONENTS) if(NOT OpenCV_FIND_COMPONENTS)
set(OpenCV_FIND_COMPONENTS ${OpenCV_LIB_COMPONENTS}) set(OpenCV_FIND_COMPONENTS ${OpenCV_LIB_COMPONENTS})
list(REMOVE_ITEM OpenCV_FIND_COMPONENTS opencv_java)
if(GTest_FOUND OR GTEST_FOUND) if(GTest_FOUND OR GTEST_FOUND)
list(REMOVE_ITEM OpenCV_FIND_COMPONENTS opencv_ts) list(REMOVE_ITEM OpenCV_FIND_COMPONENTS opencv_ts)
endif() endif()
...@@ -200,7 +201,7 @@ foreach(__opttype OPT DBG) ...@@ -200,7 +201,7 @@ foreach(__opttype OPT DBG)
#indicate that this module is also found #indicate that this module is also found
string(TOUPPER "${__cvdep}" __cvdep) string(TOUPPER "${__cvdep}" __cvdep)
set(${__cvdep}_FOUND 1) 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}}") list(APPEND OpenCV_LIBS_${__opttype} "${OpenCV_3RDPARTY_LIB_DIR_${__opttype}}/${OpenCV_${__cvdep}_LIBNAME_${__opttype}}")
endif() endif()
endforeach() endforeach()
...@@ -220,7 +221,7 @@ foreach(__opttype OPT DBG) ...@@ -220,7 +221,7 @@ foreach(__opttype OPT DBG)
endif() endif()
# CUDA # 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) if(NOT CUDA_FOUND)
find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED) find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
else() else()
...@@ -303,3 +304,11 @@ else() ...@@ -303,3 +304,11 @@ else()
SET(OpenCV_LIB_DIR ${OpenCV_LIB_DIR_OPT} ${OpenCV_3RDPARTY_LIB_DIR_OPT}) SET(OpenCV_LIB_DIR ${OpenCV_LIB_DIR_OPT} ${OpenCV_3RDPARTY_LIB_DIR_OPT})
endif() endif()
set(OpenCV_LIBRARIES ${OpenCV_LIBS}) 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()
This diff is collapsed.
...@@ -159,7 +159,7 @@ Get the OpenCV4Android SDK ...@@ -159,7 +159,7 @@ Get the OpenCV4Android SDK
unzip ~/Downloads/OpenCV-2.4.4-android-sdk.zip 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: 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| .. |opencv_android_bin_pack_url| replace:: |opencv_android_bin_pack|
.. |seven_zip| replace:: 7-Zip .. |seven_zip| replace:: 7-Zip
...@@ -184,7 +184,7 @@ Import OpenCV library and samples to the Eclipse ...@@ -184,7 +184,7 @@ Import OpenCV library and samples to the Eclipse
You can simply reference it in your projects. You can simply reference it in your projects.
Each sample included into the |opencv_android_bin_pack| is a regular Android project that already 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. .. 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 ...@@ -246,8 +246,8 @@ Running OpenCV Samples
---------------------- ----------------------
At this point you should be able to build and run the samples. Keep in mind, that 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 ``face-detection`` and ``Tutorial 2 - Mixed Processing`` include some native code and
require Android NDK and CDT plugin for Eclipse to build working applications. If you haven't 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`. 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 .. 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: ...@@ -295,7 +295,7 @@ Well, running samples from Eclipse is very simple:
.. code-block:: sh .. code-block:: sh
:linenos: :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 .. note:: ``armeabi``, ``armv7a-neon``, ``arm7a-neon-android8``, ``mips`` and ``x86`` stand for
platform targets: platform targets:
...@@ -326,15 +326,16 @@ Well, running samples from Eclipse is very simple: ...@@ -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. 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 .. image:: images/emulator_canny.png
:height: 600px :alt: 'Sample - image-manipulations' running Canny
:alt: Tutorial 1 Basic - 1. Add OpenCV - running Canny
:align: center :align: center
What's next 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,
\ No newline at end of file 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.
...@@ -103,8 +103,8 @@ You need the following software to be installed in order to develop for Android ...@@ -103,8 +103,8 @@ 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. 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 .. 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 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 Android system image for the emulator - this is the best choice for those who is setting up Android
development environment the first time! development environment the first time!
...@@ -148,7 +148,7 @@ You need the following software to be installed in order to develop for Android ...@@ -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>`_ 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. 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. 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/>`_. If you have no Eclipse installed, you can get it from the `official site <http://www.eclipse.org/downloads/>`_.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
Introduction to Java Development 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 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. 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: ...@@ -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, 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. 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. 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 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/>`_. `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 ...@@ -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/>`_), (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. `Apache Ant <http://ant.apache.org/>`_ and `Python` v2.6 or higher to be installed.
Build OpenCV Build
############ #####
Let's build OpenCV: Let's build OpenCV:
...@@ -83,6 +87,16 @@ through the CMake output for any Java-related tools that aren't found and instal ...@@ -83,6 +87,16 @@ through the CMake output for any Java-related tools that aren't found and instal
:alt: CMake output :alt: CMake output
:align: center :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: Now start the build:
.. code-block:: bash .. code-block:: bash
...@@ -95,20 +109,20 @@ or ...@@ -95,20 +109,20 @@ or
msbuild /m OpenCV.sln /t:Build /p:Configuration=Release /v:m 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 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. We'll use these files later.
Create a simple Java sample and an Ant build file for it Java sample with Ant
******************************************************** ********************
.. note:: .. note::
The described sample is provided with OpenCV library in the :file:`opencv/samples/java/ant` folder. 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. * 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 .. code-block:: xml
:linenos: :linenos:
...@@ -135,7 +149,7 @@ Create a simple Java sample and an Ant build file for it ...@@ -135,7 +149,7 @@ Create a simple Java sample and an Ant build file for it
<target name="compile"> <target name="compile">
<mkdir dir="${classes.dir}"/> <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>
<target name="jar" depends="compile"> <target name="jar" depends="compile">
...@@ -181,15 +195,17 @@ Create a simple Java sample and an Ant build file for it ...@@ -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: * Put the following Java code into the :file:`SimpleSample.java` file:
.. code-block:: java .. code-block:: java
import org.opencv.core.Core;
import org.opencv.core.Mat; import org.opencv.core.Mat;
import org.opencv.core.CvType; import org.opencv.core.CvType;
import org.opencv.core.Scalar; import org.opencv.core.Scalar;
class SimpleSample { class SimpleSample {
static{ System.loadLibrary("opencv_java244"); } static{ System.loadLibrary(Core.NATIVE_LIBRARY_NAME); }
public static void main(String[] args) { 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)); Mat m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0));
System.out.println("OpenCV Mat: " + m); System.out.println("OpenCV Mat: " + m);
Mat mr1 = m.row(1); Mat mr1 = m.row(1);
...@@ -219,8 +235,8 @@ Create a simple Java sample and an Ant build file for it ...@@ -219,8 +235,8 @@ Create a simple Java sample and an Ant build file for it
:alt: run app with Ant :alt: run app with Ant
:align: center :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. 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 ...@@ -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.: * Put some simple OpenCV calls there, e.g.:
.. code-block:: java .. code-block:: java
import org.opencv.core.Core;
import org.opencv.core.CvType; import org.opencv.core.CvType;
import org.opencv.core.Mat; import org.opencv.core.Mat;
public class Main { public class Main {
public static void main(String[] args) { 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); Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
System.out.println("m = " + m.dump()); 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 ...@@ -310,8 +327,8 @@ Now let's look at the possiblity of using OpenCV in Java when developing in Ecli
:alt: Eclipse: run :alt: Eclipse: run
:align: center :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 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. 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: ...@@ -409,8 +426,8 @@ You should see something like this:
:alt: SBT run :alt: SBT run
:align: center :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. 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. ...@@ -424,7 +441,7 @@ You can optionally rerun ``sbt eclipse`` to update your Eclipse project.
cp <opencv_dir>/build/bin/opencv_<version>.jar lib/ cp <opencv_dir>/build/bin/opencv_<version>.jar lib/
sbt eclipse 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 .. image:: images/lena.png
:alt: Lena :alt: Lena
...@@ -433,7 +450,7 @@ Next, create the directory src/main/resources and download this Lena image into ...@@ -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"`. Make sure it's called :file:`"lena.png"`.
Items in the resources directory are available to the Java application at runtime. 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: directory:
.. code-block:: bash .. code-block:: bash
...@@ -490,12 +507,12 @@ Now modify src/main/java/HelloOpenCV.java so it contains the following Java code ...@@ -490,12 +507,12 @@ Now modify src/main/java/HelloOpenCV.java so it contains the following Java code
System.out.println("Hello, OpenCV"); System.out.println("Hello, OpenCV");
// Load the native library. // Load the native library.
System.loadLibrary("opencv_java244"); System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
new DetectFaceDemo().run(); 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. 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``. 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. You will also get errors if you try to load OpenCV when it has already been loaded.
......
This diff is collapsed.
This diff is collapsed.
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
using namespace std; using namespace std;
using namespace testing; using namespace testing;
#define GPU_DENOISING_IMAGE_SIZES testing::Values(perf::szVGA, perf::szXGA, perf::sz720p, perf::sz1080p) #define GPU_DENOISING_IMAGE_SIZES testing::Values(perf::szVGA, perf::sz720p)
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// BilateralFilter // BilateralFilter
...@@ -12,96 +11,86 @@ using namespace testing; ...@@ -12,96 +11,86 @@ using namespace testing;
DEF_PARAM_TEST(Sz_Depth_Cn_KernelSz, cv::Size, MatDepth, MatCn, int); DEF_PARAM_TEST(Sz_Depth_Cn_KernelSz, cv::Size, MatDepth, MatCn, int);
PERF_TEST_P(Sz_Depth_Cn_KernelSz, Denoising_BilateralFilter, PERF_TEST_P(Sz_Depth_Cn_KernelSz, Denoising_BilateralFilter,
Combine(GPU_DENOISING_IMAGE_SIZES, Values(CV_8U, CV_32F), GPU_CHANNELS_1_3, Values(3, 5, 9))) Combine(GPU_DENOISING_IMAGE_SIZES,
Values(CV_8U, CV_32F),
GPU_CHANNELS_1_3,
Values(3, 5, 9)))
{ {
declare.time(60.0); declare.time(60.0);
cv::Size size = GET_PARAM(0); const cv::Size size = GET_PARAM(0);
int depth = GET_PARAM(1); const int depth = GET_PARAM(1);
int channels = GET_PARAM(2); const int channels = GET_PARAM(2);
int kernel_size = GET_PARAM(3); const int kernel_size = GET_PARAM(3);
float sigma_color = 7; const float sigma_color = 7;
float sigma_spatial = 5; const float sigma_spatial = 5;
int borderMode = cv::BORDER_REFLECT101; const int borderMode = cv::BORDER_REFLECT101;
int type = CV_MAKE_TYPE(depth, channels); const int type = CV_MAKE_TYPE(depth, channels);
cv::Mat src(size, type); cv::Mat src(size, type);
fillRandom(src); declare.in(src, WARMUP_RNG);
if (PERF_RUN_GPU()) if (PERF_RUN_GPU())
{ {
cv::gpu::GpuMat d_src(src); const cv::gpu::GpuMat d_src(src);
cv::gpu::GpuMat d_dst; cv::gpu::GpuMat dst;
cv::gpu::bilateralFilter(d_src, d_dst, kernel_size, sigma_color, sigma_spatial, borderMode);
TEST_CYCLE() TEST_CYCLE() cv::gpu::bilateralFilter(d_src, dst, kernel_size, sigma_color, sigma_spatial, borderMode);
{
cv::gpu::bilateralFilter(d_src, d_dst, kernel_size, sigma_color, sigma_spatial, borderMode);
}
GPU_SANITY_CHECK(d_dst); GPU_SANITY_CHECK(dst);
} }
else else
{ {
cv::Mat dst; cv::Mat dst;
cv::bilateralFilter(src, dst, kernel_size, sigma_color, sigma_spatial, borderMode); TEST_CYCLE() cv::bilateralFilter(src, dst, kernel_size, sigma_color, sigma_spatial, borderMode);
TEST_CYCLE()
{
cv::bilateralFilter(src, dst, kernel_size, sigma_color, sigma_spatial, borderMode);
}
CPU_SANITY_CHECK(dst); CPU_SANITY_CHECK(dst);
} }
} }
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// nonLocalMeans // nonLocalMeans
DEF_PARAM_TEST(Sz_Depth_Cn_WinSz_BlockSz, cv::Size, MatDepth, MatCn, int, int); DEF_PARAM_TEST(Sz_Depth_Cn_WinSz_BlockSz, cv::Size, MatDepth, MatCn, int, int);
PERF_TEST_P(Sz_Depth_Cn_WinSz_BlockSz, Denoising_NonLocalMeans, PERF_TEST_P(Sz_Depth_Cn_WinSz_BlockSz, Denoising_NonLocalMeans,
Combine(GPU_DENOISING_IMAGE_SIZES, Values<MatDepth>(CV_8U), GPU_CHANNELS_1_3, Values(21), Values(5, 7))) Combine(GPU_DENOISING_IMAGE_SIZES,
Values<MatDepth>(CV_8U),
GPU_CHANNELS_1_3,
Values(21),
Values(5)))
{ {
declare.time(60.0); declare.time(60.0);
cv::Size size = GET_PARAM(0); const cv::Size size = GET_PARAM(0);
int depth = GET_PARAM(1); const int depth = GET_PARAM(1);
int channels = GET_PARAM(2); const int channels = GET_PARAM(2);
const int search_widow_size = GET_PARAM(3);
int search_widow_size = GET_PARAM(3); const int block_size = GET_PARAM(4);
int block_size = GET_PARAM(4);
float h = 10; const float h = 10;
int borderMode = cv::BORDER_REFLECT101; const int borderMode = cv::BORDER_REFLECT101;
int type = CV_MAKE_TYPE(depth, channels); const int type = CV_MAKE_TYPE(depth, channels);
cv::Mat src(size, type); cv::Mat src(size, type);
fillRandom(src); declare.in(src, WARMUP_RNG);
if (PERF_RUN_GPU()) if (PERF_RUN_GPU())
{ {
cv::gpu::GpuMat d_src(src); const cv::gpu::GpuMat d_src(src);
cv::gpu::GpuMat d_dst; cv::gpu::GpuMat dst;
cv::gpu::nonLocalMeans(d_src, d_dst, h, search_widow_size, block_size, borderMode); TEST_CYCLE() cv::gpu::nonLocalMeans(d_src, dst, h, search_widow_size, block_size, borderMode);
TEST_CYCLE()
{
cv::gpu::nonLocalMeans(d_src, d_dst, h, search_widow_size, block_size, borderMode);
}
GPU_SANITY_CHECK(d_dst); GPU_SANITY_CHECK(dst);
} }
else else
{ {
FAIL() << "No such CPU implementation analogy"; FAIL_NO_CPU();
} }
} }
...@@ -112,46 +101,41 @@ PERF_TEST_P(Sz_Depth_Cn_WinSz_BlockSz, Denoising_NonLocalMeans, ...@@ -112,46 +101,41 @@ PERF_TEST_P(Sz_Depth_Cn_WinSz_BlockSz, Denoising_NonLocalMeans,
DEF_PARAM_TEST(Sz_Depth_Cn_WinSz_BlockSz, cv::Size, MatDepth, MatCn, int, int); DEF_PARAM_TEST(Sz_Depth_Cn_WinSz_BlockSz, cv::Size, MatDepth, MatCn, int, int);
PERF_TEST_P(Sz_Depth_Cn_WinSz_BlockSz, Denoising_FastNonLocalMeans, PERF_TEST_P(Sz_Depth_Cn_WinSz_BlockSz, Denoising_FastNonLocalMeans,
Combine(GPU_DENOISING_IMAGE_SIZES, Values<MatDepth>(CV_8U), GPU_CHANNELS_1_3, Values(21), Values(7))) Combine(GPU_DENOISING_IMAGE_SIZES,
Values<MatDepth>(CV_8U),
GPU_CHANNELS_1_3,
Values(21),
Values(7)))
{ {
declare.time(150.0); declare.time(60.0);
cv::Size size = GET_PARAM(0);
int depth = GET_PARAM(1);
int search_widow_size = GET_PARAM(2); const cv::Size size = GET_PARAM(0);
int block_size = GET_PARAM(3); const int depth = GET_PARAM(1);
const int search_widow_size = GET_PARAM(2);
const int block_size = GET_PARAM(3);
float h = 10; const float h = 10;
int type = CV_MAKE_TYPE(depth, 1); const int type = CV_MAKE_TYPE(depth, 1);
cv::Mat src(size, type); cv::Mat src(size, type);
fillRandom(src); declare.in(src, WARMUP_RNG);
if (PERF_RUN_GPU()) if (PERF_RUN_GPU())
{ {
cv::gpu::GpuMat d_src(src);
cv::gpu::GpuMat d_dst;
cv::gpu::FastNonLocalMeansDenoising fnlmd; cv::gpu::FastNonLocalMeansDenoising fnlmd;
fnlmd.simpleMethod(d_src, d_dst, h, search_widow_size, block_size); const cv::gpu::GpuMat d_src(src);
cv::gpu::GpuMat dst;
TEST_CYCLE() TEST_CYCLE() fnlmd.simpleMethod(d_src, dst, h, search_widow_size, block_size);
{
fnlmd.simpleMethod(d_src, d_dst, h, search_widow_size, block_size);
}
GPU_SANITY_CHECK(d_dst); GPU_SANITY_CHECK(dst);
} }
else else
{ {
cv::Mat dst; cv::Mat dst;
cv::fastNlMeansDenoising(src, dst, h, block_size, search_widow_size);
TEST_CYCLE() TEST_CYCLE() cv::fastNlMeansDenoising(src, dst, h, block_size, search_widow_size);
{
cv::fastNlMeansDenoising(src, dst, h, block_size, search_widow_size);
}
CPU_SANITY_CHECK(dst); CPU_SANITY_CHECK(dst);
} }
...@@ -163,46 +147,40 @@ PERF_TEST_P(Sz_Depth_Cn_WinSz_BlockSz, Denoising_FastNonLocalMeans, ...@@ -163,46 +147,40 @@ PERF_TEST_P(Sz_Depth_Cn_WinSz_BlockSz, Denoising_FastNonLocalMeans,
DEF_PARAM_TEST(Sz_Depth_WinSz_BlockSz, cv::Size, MatDepth, int, int); DEF_PARAM_TEST(Sz_Depth_WinSz_BlockSz, cv::Size, MatDepth, int, int);
PERF_TEST_P(Sz_Depth_WinSz_BlockSz, Denoising_FastNonLocalMeansColored, PERF_TEST_P(Sz_Depth_WinSz_BlockSz, Denoising_FastNonLocalMeansColored,
Combine(GPU_DENOISING_IMAGE_SIZES, Values<MatDepth>(CV_8U), Values(21), Values(7))) Combine(GPU_DENOISING_IMAGE_SIZES,
Values<MatDepth>(CV_8U),
Values(21),
Values(7)))
{ {
declare.time(350.0); declare.time(60.0);
cv::Size size = GET_PARAM(0);
int depth = GET_PARAM(1);
int search_widow_size = GET_PARAM(2); const cv::Size size = GET_PARAM(0);
int block_size = GET_PARAM(3); const int depth = GET_PARAM(1);
const int search_widow_size = GET_PARAM(2);
const int block_size = GET_PARAM(3);
float h = 10; const float h = 10;
int type = CV_MAKE_TYPE(depth, 3); const int type = CV_MAKE_TYPE(depth, 3);
cv::Mat src(size, type); cv::Mat src(size, type);
fillRandom(src); declare.in(src, WARMUP_RNG);
if (PERF_RUN_GPU()) if (PERF_RUN_GPU())
{ {
cv::gpu::GpuMat d_src(src);
cv::gpu::GpuMat d_dst;
cv::gpu::FastNonLocalMeansDenoising fnlmd; cv::gpu::FastNonLocalMeansDenoising fnlmd;
fnlmd.labMethod(d_src, d_dst, h, h, search_widow_size, block_size); const cv::gpu::GpuMat d_src(src);
cv::gpu::GpuMat dst;
TEST_CYCLE() TEST_CYCLE() fnlmd.labMethod(d_src, dst, h, h, search_widow_size, block_size);
{
fnlmd.labMethod(d_src, d_dst, h, h, search_widow_size, block_size);
}
GPU_SANITY_CHECK(d_dst); GPU_SANITY_CHECK(dst);
} }
else else
{ {
cv::Mat dst; cv::Mat dst;
cv::fastNlMeansDenoisingColored(src, dst, h, h, block_size, search_widow_size);
TEST_CYCLE() TEST_CYCLE() cv::fastNlMeansDenoisingColored(src, dst, h, h, block_size, search_widow_size);
{
cv::fastNlMeansDenoisingColored(src, dst, h, h, block_size, search_widow_size);
}
CPU_SANITY_CHECK(dst); CPU_SANITY_CHECK(dst);
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
using namespace std; using namespace std;
using namespace testing; using namespace testing;
namespace {
DEF_PARAM_TEST_1(Image, string); DEF_PARAM_TEST_1(Image, string);
struct GreedyLabeling struct GreedyLabeling
...@@ -100,28 +98,45 @@ struct GreedyLabeling ...@@ -100,28 +98,45 @@ struct GreedyLabeling
dot* stack; dot* stack;
}; };
PERF_TEST_P(Image, Labeling_ConnectedComponents, Values<string>("gpu/labeling/aloe-disp.png")) PERF_TEST_P(Image, DISABLED_Labeling_ConnectivityMask,
Values<string>("gpu/labeling/aloe-disp.png"))
{ {
declare.time(1.0); declare.time(1.0);
cv::Mat image = readImage(GetParam(), cv::IMREAD_GRAYSCALE); const cv::Mat image = readImage(GetParam(), cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(image.empty());
if (PERF_RUN_GPU()) if (PERF_RUN_GPU())
{ {
cv::gpu::GpuMat d_image(image);
cv::gpu::GpuMat mask; cv::gpu::GpuMat mask;
mask.create(image.rows, image.cols, CV_8UC1);
cv::gpu::GpuMat components; TEST_CYCLE() cv::gpu::connectivityMask(d_image, mask, cv::Scalar::all(0), cv::Scalar::all(2));
components.create(image.rows, image.cols, CV_32SC1);
cv::gpu::connectivityMask(cv::gpu::GpuMat(image), mask, cv::Scalar::all(0), cv::Scalar::all(2)); GPU_SANITY_CHECK(mask);
}
else
{
FAIL_NO_CPU();
}
}
ASSERT_NO_THROW(cv::gpu::labelComponents(mask, components)); PERF_TEST_P(Image, DISABLED_Labeling_ConnectedComponents,
Values<string>("gpu/labeling/aloe-disp.png"))
{
declare.time(1.0);
TEST_CYCLE() const cv::Mat image = readImage(GetParam(), cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(image.empty());
if (PERF_RUN_GPU())
{ {
cv::gpu::labelComponents(mask, components); cv::gpu::GpuMat d_mask;
} cv::gpu::connectivityMask(cv::gpu::GpuMat(image), d_mask, cv::Scalar::all(0), cv::Scalar::all(2));
cv::gpu::GpuMat components;
TEST_CYCLE() cv::gpu::labelComponents(d_mask, components);
GPU_SANITY_CHECK(components); GPU_SANITY_CHECK(components);
} }
...@@ -129,17 +144,9 @@ PERF_TEST_P(Image, Labeling_ConnectedComponents, Values<string>("gpu/labeling/al ...@@ -129,17 +144,9 @@ PERF_TEST_P(Image, Labeling_ConnectedComponents, Values<string>("gpu/labeling/al
{ {
GreedyLabeling host(image); GreedyLabeling host(image);
host(host._labels); TEST_CYCLE() host(host._labels);
declare.time(1.0);
TEST_CYCLE() cv::Mat components = host._labels;
{ CPU_SANITY_CHECK(components);
host(host._labels);
}
CPU_SANITY_CHECK(host._labels);
} }
} }
} // namespace
#include "perf_precomp.hpp" #include "perf_precomp.hpp"
namespace{
static void printOsInfo() static void printOsInfo()
{ {
#if defined _WIN32 #if defined _WIN32
...@@ -69,6 +67,4 @@ static void printCudaInfo() ...@@ -69,6 +67,4 @@ static void printCudaInfo()
#endif #endif
} }
}
CV_PERF_TEST_MAIN(gpu, printCudaInfo()) CV_PERF_TEST_MAIN(gpu, printCudaInfo())
...@@ -3,137 +3,112 @@ ...@@ -3,137 +3,112 @@
using namespace std; using namespace std;
using namespace testing; using namespace testing;
namespace {
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// SetTo // SetTo
PERF_TEST_P(Sz_Depth_Cn, MatOp_SetTo, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F, CV_64F), GPU_CHANNELS_1_3_4)) PERF_TEST_P(Sz_Depth_Cn, MatOp_SetTo,
Combine(GPU_TYPICAL_MAT_SIZES,
Values(CV_8U, CV_16U, CV_32F, CV_64F),
GPU_CHANNELS_1_3_4))
{ {
cv::Size size = GET_PARAM(0); const cv::Size size = GET_PARAM(0);
int depth = GET_PARAM(1); const int depth = GET_PARAM(1);
int channels = GET_PARAM(2); const int channels = GET_PARAM(2);
int type = CV_MAKE_TYPE(depth, channels); const int type = CV_MAKE_TYPE(depth, channels);
cv::Scalar val(1, 2, 3, 4); const cv::Scalar val(1, 2, 3, 4);
if (PERF_RUN_GPU()) if (PERF_RUN_GPU())
{ {
cv::gpu::GpuMat d_src(size, type); cv::gpu::GpuMat dst(size, type);
d_src.setTo(val);
TEST_CYCLE() TEST_CYCLE() dst.setTo(val);
{
d_src.setTo(val);
}
GPU_SANITY_CHECK(d_src); GPU_SANITY_CHECK(dst);
} }
else else
{ {
cv::Mat src(size, type); cv::Mat dst(size, type);
src.setTo(val);
TEST_CYCLE() TEST_CYCLE() dst.setTo(val);
{
src.setTo(val);
}
CPU_SANITY_CHECK(src); CPU_SANITY_CHECK(dst);
} }
} }
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// SetToMasked // SetToMasked
PERF_TEST_P(Sz_Depth_Cn, MatOp_SetToMasked, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F, CV_64F), GPU_CHANNELS_1_3_4)) PERF_TEST_P(Sz_Depth_Cn, MatOp_SetToMasked,
Combine(GPU_TYPICAL_MAT_SIZES,
Values(CV_8U, CV_16U, CV_32F, CV_64F),
GPU_CHANNELS_1_3_4))
{ {
cv::Size size = GET_PARAM(0); const cv::Size size = GET_PARAM(0);
int depth = GET_PARAM(1); const int depth = GET_PARAM(1);
int channels = GET_PARAM(2); const int channels = GET_PARAM(2);
int type = CV_MAKE_TYPE(depth, channels); const int type = CV_MAKE_TYPE(depth, channels);
cv::Mat src(size, type); cv::Mat src(size, type);
fillRandom(src);
cv::Mat mask(size, CV_8UC1); cv::Mat mask(size, CV_8UC1);
fillRandom(mask, 0, 2); declare.in(src, mask, WARMUP_RNG);
cv::Scalar val(1, 2, 3, 4); const cv::Scalar val(1, 2, 3, 4);
if (PERF_RUN_GPU()) if (PERF_RUN_GPU())
{ {
cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat dst(src);
cv::gpu::GpuMat d_mask(mask); const cv::gpu::GpuMat d_mask(mask);
d_src.setTo(val, d_mask); TEST_CYCLE() dst.setTo(val, d_mask);
TEST_CYCLE()
{
d_src.setTo(val, d_mask);
}
GPU_SANITY_CHECK(d_src); GPU_SANITY_CHECK(dst, 1e-10);
} }
else else
{ {
src.setTo(val, mask); cv::Mat dst = src;
TEST_CYCLE() TEST_CYCLE() dst.setTo(val, mask);
{
src.setTo(val, mask);
}
CPU_SANITY_CHECK(src); CPU_SANITY_CHECK(dst);
} }
} }
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// CopyToMasked // CopyToMasked
PERF_TEST_P(Sz_Depth_Cn, MatOp_CopyToMasked, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F, CV_64F), GPU_CHANNELS_1_3_4)) PERF_TEST_P(Sz_Depth_Cn, MatOp_CopyToMasked,
Combine(GPU_TYPICAL_MAT_SIZES,
Values(CV_8U, CV_16U, CV_32F, CV_64F),
GPU_CHANNELS_1_3_4))
{ {
cv::Size size = GET_PARAM(0); const cv::Size size = GET_PARAM(0);
int depth = GET_PARAM(1); const int depth = GET_PARAM(1);
int channels = GET_PARAM(2); const int channels = GET_PARAM(2);
int type = CV_MAKE_TYPE(depth, channels); const int type = CV_MAKE_TYPE(depth, channels);
cv::Mat src(size, type); cv::Mat src(size, type);
fillRandom(src);
cv::Mat mask(size, CV_8UC1); cv::Mat mask(size, CV_8UC1);
fillRandom(mask, 0, 2); declare.in(src, mask, WARMUP_RNG);
if (PERF_RUN_GPU()) if (PERF_RUN_GPU())
{ {
cv::gpu::GpuMat d_src(src); const cv::gpu::GpuMat d_src(src);
cv::gpu::GpuMat d_mask(mask); const cv::gpu::GpuMat d_mask(mask);
cv::gpu::GpuMat d_dst; cv::gpu::GpuMat dst(d_src.size(), d_src.type(), cv::Scalar::all(0));
d_src.copyTo(d_dst, d_mask);
TEST_CYCLE() TEST_CYCLE() d_src.copyTo(dst, d_mask);
{
d_src.copyTo(d_dst, d_mask);
}
GPU_SANITY_CHECK(d_dst); GPU_SANITY_CHECK(dst, 1e-10);
} }
else else
{ {
cv::Mat dst; cv::Mat dst(src.size(), src.type(), cv::Scalar::all(0));
src.copyTo(dst, mask);
TEST_CYCLE() TEST_CYCLE() src.copyTo(dst, mask);
{
src.copyTo(dst, mask);
}
CPU_SANITY_CHECK(dst); CPU_SANITY_CHECK(dst);
} }
...@@ -144,42 +119,36 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_CopyToMasked, Combine(GPU_TYPICAL_MAT_SIZES, Valu ...@@ -144,42 +119,36 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_CopyToMasked, Combine(GPU_TYPICAL_MAT_SIZES, Valu
DEF_PARAM_TEST(Sz_2Depth, cv::Size, MatDepth, MatDepth); DEF_PARAM_TEST(Sz_2Depth, cv::Size, MatDepth, MatDepth);
PERF_TEST_P(Sz_2Depth, MatOp_ConvertTo, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F, CV_64F), Values(CV_8U, CV_16U, CV_32F, CV_64F))) PERF_TEST_P(Sz_2Depth, MatOp_ConvertTo,
Combine(GPU_TYPICAL_MAT_SIZES,
Values(CV_8U, CV_16U, CV_32F, CV_64F),
Values(CV_8U, CV_16U, CV_32F, CV_64F)))
{ {
cv::Size size = GET_PARAM(0); const cv::Size size = GET_PARAM(0);
int depth1 = GET_PARAM(1); const int depth1 = GET_PARAM(1);
int depth2 = GET_PARAM(2); const int depth2 = GET_PARAM(2);
cv::Mat src(size, depth1); cv::Mat src(size, depth1);
fillRandom(src); declare.in(src, WARMUP_RNG);
const double a = 0.5;
const double b = 1.0;
if (PERF_RUN_GPU()) if (PERF_RUN_GPU())
{ {
cv::gpu::GpuMat d_src(src); const cv::gpu::GpuMat d_src(src);
cv::gpu::GpuMat d_dst; cv::gpu::GpuMat dst;
d_src.convertTo(d_dst, depth2, 0.5, 1.0);
TEST_CYCLE() TEST_CYCLE() d_src.convertTo(dst, depth2, a, b);
{
d_src.convertTo(d_dst, depth2, 0.5, 1.0);
}
GPU_SANITY_CHECK(d_dst); GPU_SANITY_CHECK(dst, 1e-10);
} }
else else
{ {
cv::Mat dst; cv::Mat dst;
src.convertTo(dst, depth2, 0.5, 1.0); TEST_CYCLE() src.convertTo(dst, depth2, a, b);
TEST_CYCLE()
{
src.convertTo(dst, depth2, 0.5, 1.0);
}
CPU_SANITY_CHECK(dst); CPU_SANITY_CHECK(dst);
} }
} }
} // namespace
This diff is collapsed.
This diff is collapsed.
...@@ -2,13 +2,6 @@ ...@@ -2,13 +2,6 @@
using namespace std; using namespace std;
using namespace cv; using namespace cv;
using namespace cv::gpu;
void fillRandom(Mat& m, double a, double b)
{
RNG rng(123456789);
rng.fill(m, RNG::UNIFORM, Scalar::all(a), Scalar::all(b));
}
Mat readImage(const string& fileName, int flags) Mat readImage(const string& fileName, int flags)
{ {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment