diff --git a/CMakeLists.txt b/CMakeLists.txt index 99215d5900..68da8be695 100644 --- a/CMakeLists.txt +++ b/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)) ) diff --git a/android/libinfo/info.c b/android/libinfo/info.c index 225cc10c1a..cfdc881c51 100644 --- a/android/libinfo/info.c +++ b/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) { diff --git a/android/package/AndroidManifest.xml b/android/package/AndroidManifest.xml index 3b6bc7d047..8997b161bc 100644 --- a/android/package/AndroidManifest.xml +++ b/android/package/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="@OPENCV_VERSION_PATCH@@OPENCV_VERSION_TWEAK@@ANDROID_PACKAGE_RELEASE@" + android:versionName="@OPENCV_VERSION_PATCH@.@OPENCV_VERSION_TWEAK@.@ANDROID_PACKAGE_RELEASE@" > diff --git a/android/service/engine/jni/NativeService/PackageInfo.cpp b/android/service/engine/jni/NativeService/PackageInfo.cpp index 7428de01b0..2eb8230739 100644 --- a/android/service/engine/jni/NativeService/PackageInfo.cpp +++ b/android/service/engine/jni/NativeService/PackageInfo.cpp @@ -136,7 +136,17 @@ inline int SplitVersion(const vector& features, const string& package_ve // Taking release and build number from package revision vector 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& 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; diff --git a/android/service/engine/jni/Tests/PackageInfoTest.cpp b/android/service/engine/jni/Tests/PackageInfoTest.cpp index 2e747c305d..6bc84856ce 100644 --- a/android/service/engine/jni/Tests/PackageInfoTest.cpp +++ b/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); diff --git a/android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java b/android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java index 6f604fb875..fad2797727 100644 --- a/android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java +++ b/android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java @@ -299,10 +299,9 @@ public class ManagerActivity extends Activity 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 @@ public class ManagerActivity extends Activity 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 @@ public class ManagerActivity extends Activity 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) diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index f75afced28..a9baa9780d 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/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() diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake index 7b6ff5e5bc..6e02780009 100644 --- a/cmake/OpenCVDetectCXXCompiler.cmake +++ b/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() # ---------------------------------------------------------------------------- diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake index 6b98bc0974..73143b7341 100644 --- a/cmake/OpenCVDetectPython.cmake +++ b/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}) diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake index f8d9e27db4..705ccc8df1 100644 --- a/cmake/OpenCVGenConfig.cmake +++ b/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}\"") diff --git a/cmake/templates/OpenCV.mk.in b/cmake/templates/OpenCV.mk.in index 9054fe990c..078e02039f 100644 --- a/cmake/templates/OpenCV.mk.in +++ b/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),) diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in index c69088b213..2ba5a50697 100644 --- a/cmake/templates/OpenCVConfig.cmake.in +++ b/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() diff --git a/data/haarcascades/haarcascade_smile.xml b/data/haarcascades/haarcascade_smile.xml new file mode 100644 index 0000000000..b002bf9d3a --- /dev/null +++ b/data/haarcascades/haarcascade_smile.xml @@ -0,0 +1,8353 @@ + + + + + + + 36 18 + + <_> + + + <_> + + <_> + + + + <_> + 0 0 2 4 -1. + <_> + 0 2 2 2 2. + 0 + -4.8783610691316426e-004 + 0.5921934843063355 + -0.4416360855102539 + <_> + + <_> + + + + <_> + 34 10 2 8 -1. + <_> + 34 14 2 4 2. + 0 + -4.2209611274302006e-004 + 0.3031865060329437 + -0.3291291892528534 + <_> + + <_> + + + + <_> + 0 10 2 8 -1. + <_> + 0 14 2 4 2. + 0 + -4.9940118333324790e-004 + 0.4856331050395966 + -0.4292306005954742 + <_> + + <_> + + + + <_> + 15 0 18 10 -1. + <_> + 24 0 9 5 2. + <_> + 15 5 9 5 2. + 0 + 0.0372891984879971 + -0.2866730093955994 + 0.5997999906539917 + <_> + + <_> + + + + <_> + 7 0 4 4 -1. + <_> + 7 0 2 4 2. + 1 + 1.4334049774333835e-003 + -0.3489313125610352 + 0.4048275053501129 + <_> + + <_> + + + + <_> + 15 5 6 4 -1. + <_> + 15 6 6 2 2. + 0 + -7.7213020995259285e-003 + 0.7571418881416321 + -0.1222594976425171 + <_> + + <_> + + + + <_> + 13 6 8 3 -1. + <_> + 13 7 8 1 3. + 0 + 8.1067271530628204e-003 + -0.1665772050619125 + 0.7509614825248718 + <_> + + <_> + + + + <_> + 14 6 8 4 -1. + <_> + 14 7 8 2 2. + 0 + -7.7238711528480053e-003 + 0.6266279220581055 + -0.1912745982408524 + <_> + + <_> + + + + <_> + 0 10 2 8 -1. + <_> + 0 14 2 4 2. + 0 + 4.4225031160749495e-004 + -0.2394447028636932 + 0.4484061896800995 + <_> + + <_> + + + + <_> + 34 0 2 16 -1. + <_> + 35 0 1 8 2. + <_> + 34 8 1 8 2. + 0 + -1.6867710510268807e-003 + -0.1843906939029694 + 0.0917824134230614 + <_> + + <_> + + + + <_> + 1 0 4 7 -1. + <_> + 3 0 2 7 2. + 0 + 0.0146256200969219 + 0.1616805940866470 + -0.8150117993354797 + -1.2678639888763428 + -1 + -1 + <_> + + + <_> + + <_> + + + + <_> + 4 7 28 3 -1. + <_> + 11 7 14 3 2. + 0 + 0.0381411388516426 + -0.3327588140964508 + 0.7783334255218506 + <_> + + <_> + + + + <_> + 34 0 2 2 -1. + <_> + 34 1 2 1 2. + 0 + -1.3136120105627924e-004 + 0.3635309040546417 + -0.3204346895217896 + <_> + + <_> + + + + <_> + 0 12 4 6 -1. + <_> + 0 15 4 3 2. + 0 + -3.8757019210606813e-003 + 0.7135239243507385 + -0.3518598973751068 + <_> + + <_> + + + + <_> + 34 0 2 2 -1. + <_> + 34 1 2 1 2. + 0 + 1.4266290236264467e-003 + 0.0681008473038673 + -0.6172732710838318 + <_> + + <_> + + + + <_> + 0 0 2 2 -1. + <_> + 0 1 2 1 2. + 0 + -2.4605958606116474e-004 + 0.5727149844169617 + -0.3786099851131439 + <_> + + <_> + + + + <_> + 17 5 9 12 -1. + <_> + 20 5 3 12 3. + 0 + -0.0318226404488087 + -0.6348456144332886 + 0.1164183989167213 + <_> + + <_> + + + + <_> + 10 5 9 12 -1. + <_> + 13 5 3 12 3. + 0 + -0.0171309504657984 + -0.6279314756393433 + 0.3247947096824646 + <_> + + <_> + + + + <_> + 4 0 32 1 -1. + <_> + 4 0 16 1 2. + 0 + -9.3903783708810806e-003 + -0.2757895886898041 + 0.2233072966337204 + <_> + + <_> + + + + <_> + 0 0 3 3 -1. + <_> + 1 0 1 3 3. + 0 + 2.2802520543336868e-003 + 0.1897764056921005 + -0.6881762146949768 + <_> + + <_> + + + + <_> + 32 7 4 7 -1. + <_> + 33 8 2 7 2. + 1 + 2.6840099599212408e-003 + -0.2235050052404404 + 0.1372579932212830 + <_> + + <_> + + + + <_> + 7 0 8 6 -1. + <_> + 7 0 4 3 2. + <_> + 11 3 4 3 2. + 0 + 0.0106046395376325 + -0.2142623066902161 + 0.5620787143707275 + -1.5844069719314575 + 0 + -1 + <_> + + + <_> + + <_> + + + + <_> + 0 0 2 2 -1. + <_> + 0 1 2 1 2. + 0 + -3.1677199876867235e-004 + 0.4659548103809357 + -0.3742581903934479 + <_> + + <_> + + + + <_> + 27 1 8 9 -1. + <_> + 29 3 4 9 2. + 1 + -0.0551206283271313 + 0.5417978763580322 + -0.2265765070915222 + <_> + + <_> + + + + <_> + 1 10 1 8 -1. + <_> + 1 14 1 4 2. + 0 + -6.4742640824988484e-004 + 0.3770307004451752 + -0.3348644077777863 + <_> + + <_> + + + + <_> + 3 6 30 9 -1. + <_> + 13 9 10 3 9. + 0 + 0.3950783908367157 + -0.1814441978931427 + 0.8132591843605042 + <_> + + <_> + + + + <_> + 12 5 8 6 -1. + <_> + 12 7 8 2 3. + 0 + 0.0405094102025032 + -0.0953694134950638 + 0.8059561848640442 + <_> + + <_> + + + + <_> + 16 4 6 3 -1. + <_> + 16 5 6 1 3. + 0 + 4.8735421150922775e-003 + -0.1402366012334824 + 0.6164302825927734 + <_> + + <_> + + + + <_> + 0 0 2 18 -1. + <_> + 0 0 1 9 2. + <_> + 1 9 1 9 2. + 0 + 0.0105780400335789 + 0.1293267011642456 + -0.7482334971427918 + <_> + + <_> + + + + <_> + 34 2 2 14 -1. + <_> + 35 2 1 7 2. + <_> + 34 9 1 7 2. + 0 + 9.2986393719911575e-003 + 0.0589406006038189 + -0.4410730004310608 + <_> + + <_> + + + + <_> + 0 2 2 14 -1. + <_> + 0 2 1 7 2. + <_> + 1 9 1 7 2. + 0 + -5.0301607698202133e-003 + -0.6630973219871521 + 0.1810476928949356 + <_> + + <_> + + + + <_> + 35 0 1 4 -1. + <_> + 35 2 1 2 2. + 0 + -1.0947990085696802e-004 + 0.2211259007453919 + -0.2730903923511505 + <_> + + <_> + + + + <_> + 5 0 24 18 -1. + <_> + 5 0 12 9 2. + <_> + 17 9 12 9 2. + 0 + -0.1168550997972488 + -0.7720596790313721 + 0.1248165965080261 + <_> + + <_> + + + + <_> + 35 16 1 2 -1. + <_> + 35 17 1 1 2. + 0 + -4.3603649828583002e-005 + 0.1367060989141464 + -0.1612793952226639 + <_> + + <_> + + + + <_> + 0 16 1 2 -1. + <_> + 0 17 1 1 2. + 0 + -1.5056360280141234e-004 + 0.4486046135425568 + -0.2171128988265991 + <_> + + <_> + + + + <_> + 17 6 8 12 -1. + <_> + 19 6 4 12 2. + 0 + -0.0163946095854044 + -0.6582735180854797 + 0.1674550026655197 + <_> + + <_> + + + + <_> + 11 5 8 13 -1. + <_> + 13 5 4 13 2. + 0 + -0.0144828604534268 + -0.6834514737129211 + 0.1345615983009338 + <_> + + <_> + + + + <_> + 35 16 1 2 -1. + <_> + 35 17 1 1 2. + 0 + 3.9269471017178148e-005 + -0.1499813944101334 + 0.1601772010326386 + <_> + + <_> + + + + <_> + 10 9 12 3 -1. + <_> + 10 10 12 1 3. + 0 + 7.4323131702840328e-003 + -0.1684845983982086 + 0.5396398901939392 + -1.3820559978485107 + 1 + -1 + <_> + + + <_> + + <_> + + + + <_> + 0 10 1 8 -1. + <_> + 0 14 1 4 2. + 0 + -4.3472499237395823e-004 + 0.4394924044609070 + -0.4224875867366791 + <_> + + <_> + + + + <_> + 20 0 10 10 -1. + <_> + 25 0 5 5 2. + <_> + 20 5 5 5 2. + 0 + 0.0329953208565712 + -0.1979825049638748 + 0.5953487157821655 + <_> + + <_> + + + + <_> + 0 0 1 4 -1. + <_> + 0 2 1 2 2. + 0 + -4.1011828579939902e-004 + 0.4440306127071381 + -0.3074846863746643 + <_> + + <_> + + + + <_> + 19 0 13 18 -1. + <_> + 19 9 13 9 2. + 0 + -0.0819697380065918 + -0.5333436727523804 + 0.1671810001134872 + <_> + + <_> + + + + <_> + 4 0 14 6 -1. + <_> + 4 0 7 3 2. + <_> + 11 3 7 3 2. + 0 + 0.0177787002176046 + -0.2045017927885056 + 0.5144413113594055 + <_> + + <_> + + + + <_> + 16 5 6 6 -1. + <_> + 16 7 6 2 3. + 0 + 0.0228346996009350 + -0.1484607011079788 + 0.5624278783798218 + <_> + + <_> + + + + <_> + 13 7 7 8 -1. + <_> + 13 9 7 4 2. + 0 + 0.0386043414473534 + -0.1273147016763687 + 0.8149448037147522 + <_> + + <_> + + + + <_> + 33 0 3 1 -1. + <_> + 34 0 1 1 3. + 0 + -7.3286908445879817e-004 + -0.3719344139099121 + 0.0676164999604225 + <_> + + <_> + + + + <_> + 7 1 10 4 -1. + <_> + 6 2 10 2 2. + 1 + -0.0232290402054787 + 0.7123206257820129 + -0.1158939003944397 + <_> + + <_> + + + + <_> + 15 2 6 16 -1. + <_> + 18 2 3 8 2. + <_> + 15 10 3 8 2. + 0 + -0.0195753592997789 + -0.6899073123931885 + 0.1399950981140137 + <_> + + <_> + + + + <_> + 0 10 1 8 -1. + <_> + 0 14 1 4 2. + 0 + 4.1991271427832544e-004 + -0.1835464984178543 + 0.4943555891513825 + <_> + + <_> + + + + <_> + 27 4 6 6 -1. + <_> + 29 6 2 6 3. + 1 + -0.0570897497236729 + 0.6260784864425659 + -0.0785768479108810 + <_> + + <_> + + + + <_> + 14 5 8 8 -1. + <_> + 16 5 4 8 2. + 0 + 0.0256996992975473 + 0.1155714020133019 + -0.8193519115447998 + <_> + + <_> + + + + <_> + 27 5 6 6 -1. + <_> + 29 7 2 6 3. + 1 + 0.0325796194374561 + -0.1176773980259895 + 0.4277622103691101 + <_> + + <_> + + + + <_> + 9 5 6 6 -1. + <_> + 7 7 6 2 3. + 1 + -0.0205922499299049 + 0.4868524074554443 + -0.2131853997707367 + <_> + + <_> + + + + <_> + 12 5 12 9 -1. + <_> + 15 5 6 9 2. + 0 + -0.0174852795898914 + -0.5228734016418457 + 0.1339704990386963 + <_> + + <_> + + + + <_> + 0 0 3 1 -1. + <_> + 1 0 1 1 3. + 0 + 8.9153228327631950e-004 + 0.0963044911623001 + -0.6886307001113892 + <_> + + <_> + + + + <_> + 15 4 18 6 -1. + <_> + 15 6 18 2 3. + 0 + 0.0575339011847973 + -0.0870805233716965 + 0.4048064947128296 + -1.3879380226135254 + 2 + -1 + <_> + + + <_> + + <_> + + + + <_> + 0 10 1 6 -1. + <_> + 0 13 1 3 2. + 0 + -4.6606198884546757e-004 + 0.4277374148368835 + -0.3542076945304871 + <_> + + <_> + + + + <_> + 3 6 30 6 -1. + <_> + 13 8 10 2 9. + 0 + 0.3055455982685089 + -0.1639281064271927 + 0.8606523275375366 + <_> + + <_> + + + + <_> + 11 7 12 4 -1. + <_> + 11 8 12 2 2. + 0 + -0.0114494003355503 + 0.5972732901573181 + -0.2323434054851532 + <_> + + <_> + + + + <_> + 14 8 9 3 -1. + <_> + 14 9 9 1 3. + 0 + 6.3891541212797165e-003 + -0.1291541010141373 + 0.6105204224586487 + <_> + + <_> + + + + <_> + 14 8 7 4 -1. + <_> + 14 9 7 2 2. + 0 + -8.4334248676896095e-003 + 0.4792853891849518 + -0.1900272965431213 + <_> + + <_> + + + + <_> + 12 7 18 6 -1. + <_> + 12 9 18 2 3. + 0 + 0.0538089312613010 + -0.1149377003312111 + 0.5339453816413879 + <_> + + <_> + + + + <_> + 7 8 3 10 -1. + <_> + 7 13 3 5 2. + 0 + -4.7580219688825309e-004 + -0.3459854125976563 + 0.2548804879188538 + <_> + + <_> + + + + <_> + 35 10 1 6 -1. + <_> + 35 13 1 3 2. + 0 + -1.3450840197037905e-004 + 0.2241459041833878 + -0.1955007016658783 + <_> + + <_> + + + + <_> + 0 10 1 6 -1. + <_> + 0 13 1 3 2. + 0 + 5.0016911700367928e-004 + -0.1972054988145828 + 0.4967764019966126 + <_> + + <_> + + + + <_> + 18 13 9 5 -1. + <_> + 21 13 3 5 3. + 0 + 0.0150632699951530 + 0.1063077002763748 + -0.4113821089267731 + <_> + + <_> + + + + <_> + 15 9 6 4 -1. + <_> + 15 10 6 2 2. + 0 + 7.7588870190083981e-003 + -0.1537311971187592 + 0.4893161952495575 + <_> + + <_> + + + + <_> + 16 4 18 8 -1. + <_> + 16 6 18 4 2. + 0 + 0.0454101189970970 + -0.0735593065619469 + 0.2773792147636414 + <_> + + <_> + + + + <_> + 9 14 9 3 -1. + <_> + 12 14 3 3 3. + 0 + -0.0145996697247028 + -0.7096682786941528 + 0.0975155606865883 + <_> + + <_> + + + + <_> + 32 0 4 6 -1. + <_> + 32 0 2 6 2. + 0 + 0.0172360707074404 + 0.0168695393949747 + -0.5738832950592041 + <_> + + <_> + + + + <_> + 0 0 4 6 -1. + <_> + 2 0 2 6 2. + 0 + 0.0142307104542851 + 0.0947145000100136 + -0.7839525938034058 + <_> + + <_> + + + + <_> + 27 0 6 7 -1. + <_> + 29 2 2 7 3. + 1 + -0.0437068603932858 + 0.6097965240478516 + -0.1560188978910446 + <_> + + <_> + + + + <_> + 0 0 1 4 -1. + <_> + 0 2 1 2 2. + 0 + -6.2343222089111805e-004 + 0.3485119044780731 + -0.2170491069555283 + <_> + + <_> + + + + <_> + 27 8 6 4 -1. + <_> + 29 10 2 4 3. + 1 + 0.0192450508475304 + -0.1171097978949547 + 0.3070116043090820 + <_> + + <_> + + + + <_> + 4 9 27 6 -1. + <_> + 13 11 9 2 9. + 0 + 0.2703577876091003 + -0.0900964364409447 + 0.7665696144104004 + <_> + + <_> + + + + <_> + 31 14 2 3 -1. + <_> + 31 14 1 3 2. + 0 + -3.5394480801187456e-004 + -0.2002478986978531 + 0.1249336004257202 + <_> + + <_> + + + + <_> + 10 0 5 6 -1. + <_> + 8 2 5 2 3. + 1 + -0.0360139608383179 + 0.6702855825424194 + -0.1057187989354134 + <_> + + <_> + + + + <_> + 14 7 11 3 -1. + <_> + 14 8 11 1 3. + 0 + 9.2952791601419449e-003 + -0.1057471036911011 + 0.4509387910366058 + <_> + + <_> + + + + <_> + 0 12 2 6 -1. + <_> + 0 15 2 3 2. + 0 + -3.3304709359072149e-004 + 0.2793382108211517 + -0.2457676976919174 + <_> + + <_> + + + + <_> + 34 13 2 4 -1. + <_> + 34 15 2 2 2. + 0 + -2.9147620807634667e-005 + 0.0858138129115105 + -0.0954695865511894 + <_> + + <_> + + + + <_> + 0 13 2 4 -1. + <_> + 0 15 2 2 2. + 0 + 4.4382669148035347e-004 + -0.2022008001804352 + 0.5454357862472534 + -1.3538850545883179 + 3 + -1 + <_> + + + <_> + + <_> + + + + <_> + 3 6 4 12 -1. + <_> + 3 10 4 4 3. + 0 + 7.9610757529735565e-003 + -0.3672207891941071 + 0.4315434992313385 + <_> + + <_> + + + + <_> + 14 0 22 12 -1. + <_> + 25 0 11 6 2. + <_> + 14 6 11 6 2. + 0 + 0.0633948296308517 + -0.2073971033096314 + 0.5742601752281189 + <_> + + <_> + + + + <_> + 8 1 7 6 -1. + <_> + 6 3 7 2 3. + 1 + -0.0531933493912220 + 0.7255092263221741 + -0.1434202045202255 + <_> + + <_> + + + + <_> + 12 5 14 3 -1. + <_> + 12 6 14 1 3. + 0 + 0.0154607696458697 + -0.0960538163781166 + 0.7578523755073547 + <_> + + <_> + + + + <_> + 7 6 7 4 -1. + <_> + 6 7 7 2 2. + 1 + -0.0176431406289339 + 0.6681562066078186 + -0.1417672932147980 + <_> + + <_> + + + + <_> + 18 3 6 4 -1. + <_> + 18 4 6 2 2. + 0 + 9.5065636560320854e-003 + -0.0962597429752350 + 0.4699633121490479 + <_> + + <_> + + + + <_> + 4 5 5 6 -1. + <_> + 4 7 5 2 3. + 0 + 4.0446049533784389e-003 + -0.1973251998424530 + 0.4283801019191742 + <_> + + <_> + + + + <_> + 33 0 3 4 -1. + <_> + 34 0 1 4 3. + 0 + 3.2312041148543358e-003 + 0.1186169013381004 + -0.6103963255882263 + <_> + + <_> + + + + <_> + 9 0 6 18 -1. + <_> + 9 9 6 9 2. + 0 + -0.0401590503752232 + -0.4166434109210968 + 0.2167232930660248 + <_> + + <_> + + + + <_> + 6 6 24 6 -1. + <_> + 14 8 8 2 9. + 0 + 0.2852425873279572 + -0.1043575033545494 + 0.8573396801948547 + <_> + + <_> + + + + <_> + 16 8 4 4 -1. + <_> + 16 9 4 2 2. + 0 + -4.9264221452176571e-003 + 0.4706046879291534 + -0.1399745941162109 + <_> + + <_> + + + + <_> + 13 8 13 4 -1. + <_> + 13 9 13 2 2. + 0 + 0.0137817002832890 + -0.1271356940269470 + 0.4461891949176788 + <_> + + <_> + + + + <_> + 0 16 2 2 -1. + <_> + 0 17 2 1 2. + 0 + -4.9873598618432879e-004 + 0.4702663123607636 + -0.1548373997211456 + <_> + + <_> + + + + <_> + 35 14 1 4 -1. + <_> + 35 15 1 2 2. + 0 + -1.5621389320585877e-004 + 0.1885481029748917 + -0.0778397768735886 + <_> + + <_> + + + + <_> + 0 14 1 4 -1. + <_> + 0 15 1 2 2. + 0 + -3.7597760092467070e-004 + 0.5769770145416260 + -0.1335622072219849 + <_> + + <_> + + + + <_> + 15 6 9 7 -1. + <_> + 18 6 3 7 3. + 0 + -0.0106659103184938 + -0.4106529951095581 + 0.1556212007999420 + <_> + + <_> + + + + <_> + 0 0 3 4 -1. + <_> + 1 0 1 4 3. + 0 + -3.4135230816900730e-003 + -0.7636343240737915 + 0.1020964980125427 + <_> + + <_> + + + + <_> + 34 16 2 2 -1. + <_> + 35 16 1 1 2. + <_> + 34 17 1 1 2. + 0 + 5.6471868447260931e-005 + -0.1644393056631088 + 0.2290841937065125 + <_> + + <_> + + + + <_> + 0 16 2 2 -1. + <_> + 0 16 1 1 2. + <_> + 1 17 1 1 2. + 0 + 2.1611599368043244e-004 + -0.1629032939672470 + 0.4575636088848114 + <_> + + <_> + + + + <_> + 22 0 10 4 -1. + <_> + 22 0 5 4 2. + 1 + -0.0108227198943496 + -0.2446253001689911 + 0.1388894021511078 + <_> + + <_> + + + + <_> + 15 4 6 14 -1. + <_> + 15 4 3 7 2. + <_> + 18 11 3 7 2. + 0 + -0.0150849102064967 + -0.5781347751617432 + 0.1156411990523338 + <_> + + <_> + + + + <_> + 15 3 8 10 -1. + <_> + 17 3 4 10 2. + 0 + 0.0257159601897001 + 0.0396311990916729 + -0.6527001261711121 + <_> + + <_> + + + + <_> + 0 0 2 5 -1. + <_> + 1 0 1 5 2. + 0 + 2.6093570049852133e-003 + 0.1142188981175423 + -0.5680108070373535 + -1.3707510232925415 + 4 + -1 + <_> + + + <_> + + <_> + + + + <_> + 7 1 8 6 -1. + <_> + 5 3 8 2 3. + 1 + -0.0518619008362293 + 0.7043117284774780 + -0.2214370071887970 + <_> + + <_> + + + + <_> + 19 0 11 18 -1. + <_> + 19 9 11 9 2. + 0 + -0.0503416284918785 + -0.4639782905578613 + 0.2804746031761169 + <_> + + <_> + + + + <_> + 6 8 24 6 -1. + <_> + 14 10 8 2 9. + 0 + 0.2570973038673401 + -0.1312427967786789 + 0.8239594101905823 + <_> + + <_> + + + + <_> + 14 6 10 3 -1. + <_> + 14 7 10 1 3. + 0 + 0.0110318996012211 + -0.1425814032554627 + 0.6382390260696411 + <_> + + <_> + + + + <_> + 12 7 11 4 -1. + <_> + 12 8 11 2 2. + 0 + 0.0185650903731585 + -0.1512387990951538 + 0.5988119244575501 + <_> + + <_> + + + + <_> + 18 0 16 6 -1. + <_> + 26 0 8 3 2. + <_> + 18 3 8 3 2. + 0 + 0.0175023507326841 + -0.1261979937553406 + 0.3817803859710693 + <_> + + <_> + + + + <_> + 5 3 7 3 -1. + <_> + 4 4 7 1 3. + 1 + 7.2723729535937309e-003 + -0.1510328948497772 + 0.5812842249870300 + <_> + + <_> + + + + <_> + 18 4 4 4 -1. + <_> + 18 5 4 2 2. + 0 + 8.1504750996828079e-003 + -0.0654647573828697 + 0.5639755129814148 + <_> + + <_> + + + + <_> + 5 3 10 4 -1. + <_> + 4 4 10 2 2. + 1 + -0.0185527391731739 + 0.5315709710121155 + -0.1252657026052475 + <_> + + <_> + + + + <_> + 14 8 8 10 -1. + <_> + 18 8 4 5 2. + <_> + 14 13 4 5 2. + 0 + -0.0231014806777239 + -0.6794939041137695 + 0.1104625985026360 + <_> + + <_> + + + + <_> + 3 0 4 1 -1. + <_> + 5 0 2 1 2. + 0 + -1.8539339362177998e-004 + 0.3010003864765167 + -0.2120669931173325 + <_> + + <_> + + + + <_> + 20 0 10 8 -1. + <_> + 25 0 5 4 2. + <_> + 20 4 5 4 2. + 0 + 0.0173191204667091 + -0.0937381312251091 + 0.2100856006145477 + <_> + + <_> + + + + <_> + 13 0 10 8 -1. + <_> + 13 0 5 4 2. + <_> + 18 4 5 4 2. + 0 + 0.0143056204542518 + 0.1800594925880432 + -0.3977671861648560 + <_> + + <_> + + + + <_> + 21 5 6 13 -1. + <_> + 23 5 2 13 3. + 0 + 0.0257633402943611 + 8.7056998163461685e-003 + -0.6289495229721069 + <_> + + <_> + + + + <_> + 9 5 6 13 -1. + <_> + 11 5 2 13 3. + 0 + -0.0153833404183388 + -0.5341547131538391 + 0.1038073003292084 + <_> + + <_> + + + + <_> + 27 5 5 3 -1. + <_> + 27 6 5 1 3. + 0 + 1.0605469578877091e-003 + -0.0901285186409950 + 0.1679212003946304 + <_> + + <_> + + + + <_> + 10 0 3 6 -1. + <_> + 10 2 3 2 3. + 0 + 3.5230729263275862e-003 + -0.1711069047451019 + 0.3259654045104981 + <_> + + <_> + + + + <_> + 26 6 3 6 -1. + <_> + 26 8 3 2 3. + 0 + -0.0107892798259854 + 0.3610992133617401 + -0.0663391500711441 + <_> + + <_> + + + + <_> + 0 11 36 7 -1. + <_> + 18 11 18 7 2. + 0 + 0.2795093953609467 + -0.0746058970689774 + 0.7336987853050232 + <_> + + <_> + + + + <_> + 27 5 5 3 -1. + <_> + 27 6 5 1 3. + 0 + 3.8369540125131607e-003 + 0.0448735393583775 + -0.1860270053148270 + <_> + + <_> + + + + <_> + 4 5 5 3 -1. + <_> + 4 6 5 1 3. + 0 + 1.6195949865505099e-003 + -0.1392249017953873 + 0.4343700110912323 + <_> + + <_> + + + + <_> + 28 6 4 4 -1. + <_> + 29 7 2 4 2. + 1 + 0.0116479499265552 + -0.0743575915694237 + 0.5420144200325012 + <_> + + <_> + + + + <_> + 14 15 8 2 -1. + <_> + 16 15 4 2 2. + 0 + -5.9066400863230228e-003 + -0.7055758833885193 + 0.0864336192607880 + <_> + + <_> + + + + <_> + 3 5 30 6 -1. + <_> + 13 7 10 2 9. + 0 + 0.3968684077262878 + -0.0748983696103096 + 0.9406285881996155 + <_> + + <_> + + + + <_> + 6 7 16 6 -1. + <_> + 6 9 16 2 3. + 0 + 0.0576637797057629 + -0.0965584069490433 + 0.5418242812156677 + <_> + + <_> + + + + <_> + 14 10 12 6 -1. + <_> + 14 12 12 2 3. + 0 + 0.0603195689618587 + -0.0665010735392571 + 0.6402354836463928 + -1.3303329944610596 + 5 + -1 + <_> + + + <_> + + <_> + + + + <_> + 6 0 12 10 -1. + <_> + 6 0 6 5 2. + <_> + 12 5 6 5 2. + 0 + 0.0190502498298883 + -0.4443340897560120 + 0.4394856989383698 + <_> + + <_> + + + + <_> + 25 2 7 16 -1. + <_> + 25 10 7 8 2. + 0 + -0.0201983004808426 + -0.3170621991157532 + 0.1043293029069901 + <_> + + <_> + + + + <_> + 9 6 18 7 -1. + <_> + 15 6 6 7 3. + 0 + 0.0214780308306217 + -0.3502483963966370 + 0.2635537087917328 + <_> + + <_> + + + + <_> + 5 0 26 18 -1. + <_> + 18 0 13 9 2. + <_> + 5 9 13 9 2. + 0 + -0.1018775999546051 + -0.5988957881927490 + 0.1768579930067062 + <_> + + <_> + + + + <_> + 10 6 10 3 -1. + <_> + 10 7 10 1 3. + 0 + 0.0109741603955626 + -0.1489523947238922 + 0.6011521816253662 + <_> + + <_> + + + + <_> + 17 6 6 4 -1. + <_> + 17 7 6 2 2. + 0 + -0.0114767104387283 + 0.4066570997238159 + -0.1240468993782997 + <_> + + <_> + + + + <_> + 15 6 6 7 -1. + <_> + 18 6 3 7 2. + 0 + -0.0234311502426863 + -0.7148783206939697 + 0.1427811980247498 + <_> + + <_> + + + + <_> + 26 6 5 4 -1. + <_> + 26 7 5 2 2. + 0 + 1.4963559806346893e-003 + -0.1704585999250412 + 0.1719308048486710 + <_> + + <_> + + + + <_> + 0 12 1 6 -1. + <_> + 0 15 1 3 2. + 0 + -5.4855772759765387e-004 + 0.3155323863029480 + -0.2144445031881332 + <_> + + <_> + + + + <_> + 9 4 18 14 -1. + <_> + 18 4 9 7 2. + <_> + 9 11 9 7 2. + 0 + 0.0749126300215721 + 0.0912405624985695 + -0.6395121216773987 + <_> + + <_> + + + + <_> + 7 5 6 3 -1. + <_> + 6 6 6 1 3. + 1 + 6.8816398270428181e-003 + -0.1490440964698792 + 0.4795236885547638 + <_> + + <_> + + + + <_> + 27 5 6 3 -1. + <_> + 29 7 2 3 3. + 1 + -0.0382125787436962 + 0.5288773775100708 + -0.0618947297334671 + <_> + + <_> + + + + <_> + 7 8 3 3 -1. + <_> + 6 9 3 1 3. + 1 + 4.4051730073988438e-003 + -0.1193412989377976 + 0.5061342120170593 + <_> + + <_> + + + + <_> + 28 5 6 5 -1. + <_> + 30 7 2 5 3. + 1 + 0.0239668991416693 + -0.0897205099463463 + 0.3315277993679047 + <_> + + <_> + + + + <_> + 8 5 5 6 -1. + <_> + 6 7 5 2 3. + 1 + -0.0341629907488823 + 0.5313478112220764 + -0.1466650068759918 + <_> + + <_> + + + + <_> + 31 0 4 1 -1. + <_> + 31 0 2 1 2. + 0 + 1.9642219413071871e-003 + 0.0907835885882378 + -0.4303255975246429 + <_> + + <_> + + + + <_> + 1 0 4 1 -1. + <_> + 3 0 2 1 2. + 0 + 9.6757910796441138e-005 + 0.2255253940820694 + -0.2822071015834808 + <_> + + <_> + + + + <_> + 17 11 4 3 -1. + <_> + 17 12 4 1 3. + 0 + -3.2862399239093065e-003 + 0.4051502048969269 + -0.1177619993686676 + <_> + + <_> + + + + <_> + 12 3 7 4 -1. + <_> + 12 4 7 2 2. + 0 + 0.0116883097216487 + -0.0918571278452873 + 0.6283488869667053 + <_> + + <_> + + + + <_> + 14 9 9 3 -1. + <_> + 14 10 9 1 3. + 0 + -6.0287420637905598e-003 + 0.3926180899143219 + -0.1228715032339096 + <_> + + <_> + + + + <_> + 1 17 21 1 -1. + <_> + 8 17 7 1 3. + 0 + -0.0137213403359056 + -0.5529879927635193 + 0.0910412818193436 + <_> + + <_> + + + + <_> + 12 9 20 4 -1. + <_> + 12 9 10 4 2. + 0 + 0.0756266415119171 + -0.0449295900762081 + 0.1744275987148285 + <_> + + <_> + + + + <_> + 3 9 22 4 -1. + <_> + 14 9 11 4 2. + 0 + 0.0934344828128815 + -0.0845939517021179 + 0.6013116240501404 + <_> + + <_> + + + + <_> + 25 0 3 3 -1. + <_> + 26 1 1 3 3. + 1 + 5.8748829178512096e-003 + -0.0441314987838268 + 0.3956570923328400 + <_> + + <_> + + + + <_> + 14 9 4 3 -1. + <_> + 14 10 4 1 3. + 0 + 4.0064537897706032e-003 + -0.1141439974308014 + 0.3792538046836853 + <_> + + <_> + + + + <_> + 19 4 9 3 -1. + <_> + 22 4 3 3 3. + 0 + 0.0229454599320889 + 0.0246731899678707 + -0.4152199923992157 + <_> + + <_> + + + + <_> + 8 4 9 3 -1. + <_> + 11 4 3 3 3. + 0 + -0.0128104602918029 + -0.5155742764472961 + 0.0913196131587029 + <_> + + <_> + + + + <_> + 0 15 36 3 -1. + <_> + 12 16 12 1 9. + 0 + 0.2042552977800369 + -0.0659275427460670 + 0.7594249248504639 + <_> + + <_> + + + + <_> + 2 0 4 2 -1. + <_> + 2 0 4 1 2. + 1 + 4.9796327948570251e-003 + 0.1080627962946892 + -0.5001627206802368 + <_> + + <_> + + + + <_> + 19 9 2 9 -1. + <_> + 19 12 2 3 3. + 0 + 0.0283976309001446 + -0.0371529608964920 + 0.5401064753532410 + <_> + + <_> + + + + <_> + 13 7 8 3 -1. + <_> + 13 8 8 1 3. + 0 + 6.0867150314152241e-003 + -0.1197860985994339 + 0.3569226861000061 + <_> + + <_> + + + + <_> + 30 4 2 2 -1. + <_> + 31 4 1 1 2. + <_> + 30 5 1 1 2. + 0 + -2.1456899412441999e-004 + 0.1874015033245087 + -0.0884172022342682 + <_> + + <_> + + + + <_> + 4 4 2 2 -1. + <_> + 4 4 1 1 2. + <_> + 5 5 1 1 2. + 0 + 2.8941858909092844e-004 + -0.1259797960519791 + 0.3998227119445801 + <_> + + <_> + + + + <_> + 18 7 4 3 -1. + <_> + 18 8 4 1 3. + 0 + -1.3047619722783566e-003 + 0.1549997031688690 + -0.0753860473632813 + <_> + + <_> + + + + <_> + 9 0 1 8 -1. + <_> + 9 0 1 4 2. + 1 + -0.0129750100895762 + -0.5534411072731018 + 0.0823542475700378 + <_> + + <_> + + + + <_> + 25 6 10 3 -1. + <_> + 25 7 10 1 3. + 0 + 7.7442410401999950e-003 + 0.0276998002082109 + -0.3483599126338959 + <_> + + <_> + + + + <_> + 1 6 10 3 -1. + <_> + 1 7 10 1 3. + 0 + 2.4850629270076752e-003 + -0.1297612935304642 + 0.3790883123874664 + -1.5300060510635376 + 6 + -1 + <_> + + + <_> + + <_> + + + + <_> + 6 6 14 12 -1. + <_> + 6 6 7 6 2. + <_> + 13 12 7 6 2. + 0 + -0.0403868816792965 + 0.5960354804992676 + -0.3574176132678986 + <_> + + <_> + + + + <_> + 31 14 3 4 -1. + <_> + 31 16 3 2 2. + 0 + -6.6068649175576866e-005 + 0.4462898075580597 + -0.3595947027206421 + <_> + + <_> + + + + <_> + 1 12 2 4 -1. + <_> + 1 14 2 2 2. + 0 + 3.7622239906340837e-003 + 0.1794701963663101 + -0.7563151121139526 + <_> + + <_> + + + + <_> + 15 0 12 5 -1. + <_> + 19 0 4 5 3. + 0 + -0.0309677198529243 + -0.2884705066680908 + 0.0768705308437347 + <_> + + <_> + + + + <_> + 10 0 8 14 -1. + <_> + 12 0 4 14 2. + 0 + 0.0305665601044893 + 0.1400360018014908 + -0.7175536751747131 + <_> + + <_> + + + + <_> + 28 1 8 7 -1. + <_> + 30 3 4 7 2. + 1 + 9.9054910242557526e-004 + 0.0829155892133713 + -0.2919717133045197 + <_> + + <_> + + + + <_> + 8 14 20 4 -1. + <_> + 8 14 10 2 2. + <_> + 18 16 10 2 2. + 0 + 0.0125777004286647 + 0.1538071930408478 + -0.4688293039798737 + <_> + + <_> + + + + <_> + 6 11 24 3 -1. + <_> + 14 12 8 1 9. + 0 + 0.1239292025566101 + -0.0908238589763641 + 0.7383757233619690 + <_> + + <_> + + + + <_> + 4 5 27 6 -1. + <_> + 13 7 9 2 9. + 0 + 0.3773748874664307 + -0.0542329512536526 + 0.9229121804237366 + <_> + + <_> + + + + <_> + 7 0 22 18 -1. + <_> + 18 0 11 9 2. + <_> + 7 9 11 9 2. + 0 + 0.1099637001752853 + 0.0915962681174278 + -0.6597716808319092 + <_> + + <_> + + + + <_> + 16 0 3 2 -1. + <_> + 16 1 3 1 2. + 0 + -1.2721329694613814e-003 + 0.3347575068473816 + -0.1829068958759308 + <_> + + <_> + + + + <_> + 0 17 36 1 -1. + <_> + 9 17 18 1 2. + 0 + 0.0469062514603138 + -0.0839710533618927 + 0.6984758973121643 + <_> + + <_> + + + + <_> + 5 5 12 1 -1. + <_> + 5 5 6 1 2. + 1 + 3.2869930146262050e-004 + 0.1879463046789169 + -0.2929005920886993 + <_> + + <_> + + + + <_> + 34 15 2 1 -1. + <_> + 34 15 1 1 2. + 1 + 1.7333080177195370e-004 + -0.2696416079998016 + 0.3494757115840912 + <_> + + <_> + + + + <_> + 7 8 16 4 -1. + <_> + 7 9 16 2 2. + 0 + 0.0198009591549635 + -0.1467922925949097 + 0.4399561882019043 + <_> + + <_> + + + + <_> + 35 10 1 6 -1. + <_> + 35 12 1 2 3. + 0 + 2.0056760695297271e-004 + -0.1372741013765335 + 0.2221331000328064 + <_> + + <_> + + + + <_> + 13 8 3 4 -1. + <_> + 13 9 3 2 2. + 0 + -1.4923149719834328e-003 + 0.3473525941371918 + -0.1594821065664291 + <_> + + <_> + + + + <_> + 35 10 1 6 -1. + <_> + 35 12 1 2 3. + 0 + -4.2736999603221193e-005 + 0.3152787089347839 + -0.2306694984436035 + <_> + + <_> + + + + <_> + 12 0 1 4 -1. + <_> + 11 1 1 2 2. + 1 + 6.6625140607357025e-004 + -0.2013110071420670 + 0.2869189083576202 + <_> + + <_> + + + + <_> + 35 10 1 6 -1. + <_> + 35 12 1 2 3. + 0 + 1.3850460163666867e-005 + -0.2021923959255219 + 0.2307330965995789 + <_> + + <_> + + + + <_> + 18 0 1 14 -1. + <_> + 18 0 1 7 2. + 1 + 0.0409726314246655 + 0.0795431807637215 + -0.8079563975334168 + -1.4114329814910889 + 7 + -1 + <_> + + + <_> + + <_> + + + + <_> + 5 6 16 12 -1. + <_> + 5 6 8 6 2. + <_> + 13 12 8 6 2. + 0 + -0.0469829291105270 + 0.7082253098487854 + -0.3703424036502838 + <_> + + <_> + + + + <_> + 18 1 7 8 -1. + <_> + 16 3 7 4 2. + 1 + -7.5753079727292061e-004 + -0.1255030930042267 + 0.1394442021846771 + <_> + + <_> + + + + <_> + 14 4 8 10 -1. + <_> + 14 4 4 5 2. + <_> + 18 9 4 5 2. + 0 + 0.0153272999450564 + 0.2161353975534439 + -0.5629395246505737 + <_> + + <_> + + + + <_> + 22 0 9 3 -1. + <_> + 25 0 3 3 3. + 0 + 0.0181470401585102 + -0.0320796482264996 + 0.3234755992889404 + <_> + + <_> + + + + <_> + 0 10 26 8 -1. + <_> + 0 10 13 4 2. + <_> + 13 14 13 4 2. + 0 + 0.0473471917212009 + -0.1738158017396927 + 0.5758044719696045 + <_> + + <_> + + + + <_> + 15 10 16 8 -1. + <_> + 23 10 8 4 2. + <_> + 15 14 8 4 2. + 0 + -0.0598379410803318 + 0.4779787063598633 + -0.1026028022170067 + <_> + + <_> + + + + <_> + 6 0 24 18 -1. + <_> + 6 0 12 9 2. + <_> + 18 9 12 9 2. + 0 + -0.0527967996895313 + -0.4798848927021027 + 0.1878775954246521 + <_> + + <_> + + + + <_> + 18 0 9 6 -1. + <_> + 21 0 3 6 3. + 0 + -0.0243854299187660 + -0.3084166944026947 + 8.7605630978941917e-003 + <_> + + <_> + + + + <_> + 9 0 9 6 -1. + <_> + 12 0 3 6 3. + 0 + 0.0252883005887270 + 0.1391403973102570 + -0.7109494209289551 + <_> + + <_> + + + + <_> + 30 1 5 14 -1. + <_> + 30 8 5 7 2. + 0 + -0.0216124504804611 + -0.2328253984451294 + 0.0809946805238724 + <_> + + <_> + + + + <_> + 1 1 5 14 -1. + <_> + 1 8 5 7 2. + 0 + 3.4023479092866182e-003 + -0.2298990041017532 + 0.3788951039314270 + <_> + + <_> + + + + <_> + 10 8 26 6 -1. + <_> + 23 8 13 3 2. + <_> + 10 11 13 3 2. + 0 + 0.1127460002899170 + -0.0154747096821666 + 0.5703054070472717 + <_> + + <_> + + + + <_> + 0 8 28 6 -1. + <_> + 0 8 14 3 2. + <_> + 14 11 14 3 2. + 0 + 0.0345168709754944 + -0.1230008006095886 + 0.5677536725997925 + <_> + + <_> + + + + <_> + 12 0 24 12 -1. + <_> + 24 0 12 6 2. + <_> + 12 6 12 6 2. + 0 + 0.0789848119020462 + -0.1424216926097870 + 0.4694185853004456 + <_> + + <_> + + + + <_> + 3 1 14 2 -1. + <_> + 3 1 14 1 2. + 1 + -0.0153778595849872 + 0.6394686102867127 + -0.1123619005084038 + <_> + + <_> + + + + <_> + 33 16 3 2 -1. + <_> + 33 17 3 1 2. + 0 + -2.2373620595317334e-004 + 0.5558329820632935 + -0.2724758088588715 + <_> + + <_> + + + + <_> + 12 0 9 14 -1. + <_> + 15 0 3 14 3. + 0 + -0.0247623901814222 + -0.5040485858917236 + 0.1407779008150101 + <_> + + <_> + + + + <_> + 28 16 8 2 -1. + <_> + 32 16 4 1 2. + <_> + 28 17 4 1 2. + 0 + -9.4061157142277807e-005 + 0.3719528019428253 + -0.2250299006700516 + <_> + + <_> + + + + <_> + 15 8 6 6 -1. + <_> + 15 10 6 2 3. + 0 + -0.0202563591301441 + 0.5105100870132446 + -0.1429875940084457 + <_> + + <_> + + + + <_> + 13 6 22 6 -1. + <_> + 24 6 11 3 2. + <_> + 13 9 11 3 2. + 0 + 0.0481228791177273 + -0.0669795125722885 + 0.3662230968475342 + <_> + + <_> + + + + <_> + 0 10 26 4 -1. + <_> + 0 10 13 2 2. + <_> + 13 12 13 2 2. + 0 + -0.0237878002226353 + 0.5081325173377991 + -0.1290815025568008 + <_> + + <_> + + + + <_> + 24 16 4 2 -1. + <_> + 24 17 4 1 2. + 0 + -1.0520319920033216e-003 + -0.1560467034578323 + 0.0662133172154427 + <_> + + <_> + + + + <_> + 9 16 3 2 -1. + <_> + 9 17 3 1 2. + 0 + -2.6640200521796942e-003 + -0.7254558205604553 + 0.0823654532432556 + -1.3777890205383301 + 8 + -1 + <_> + + + <_> + + <_> + + + + <_> + 3 7 18 8 -1. + <_> + 3 7 9 4 2. + <_> + 12 11 9 4 2. + 0 + -0.0502246208488941 + 0.7084565758705139 + -0.2558549940586090 + <_> + + <_> + + + + <_> + 23 0 8 4 -1. + <_> + 23 0 4 4 2. + 0 + 0.0140728699043393 + 0.0630331784486771 + -0.0598385296761990 + <_> + + <_> + + + + <_> + 5 0 8 4 -1. + <_> + 9 0 4 4 2. + 0 + 0.0178040098398924 + 0.1941471993923187 + -0.5844426751136780 + <_> + + <_> + + + + <_> + 6 10 24 3 -1. + <_> + 14 11 8 1 9. + 0 + 0.1304673999547958 + -0.1151698008179665 + 0.8504030108451843 + <_> + + <_> + + + + <_> + 7 5 5 6 -1. + <_> + 5 7 5 2 3. + 1 + 0.0175068005919456 + -0.2071896940469742 + 0.4643828868865967 + <_> + + <_> + + + + <_> + 5 16 26 2 -1. + <_> + 18 16 13 1 2. + <_> + 5 17 13 1 2. + 0 + -7.4240020476281643e-003 + -0.6656516790390015 + 0.1403498947620392 + <_> + + <_> + + + + <_> + 0 7 24 4 -1. + <_> + 0 7 12 2 2. + <_> + 12 9 12 2 2. + 0 + -0.0345711186528206 + 0.6511297821998596 + -0.1490191966295242 + <_> + + <_> + + + + <_> + 23 14 13 4 -1. + <_> + 23 15 13 2 2. + 0 + 4.2270249687135220e-003 + -1.6027219826355577e-003 + 0.3895606100559235 + <_> + + <_> + + + + <_> + 2 10 18 8 -1. + <_> + 2 10 9 4 2. + <_> + 11 14 9 4 2. + 0 + -0.0506620407104492 + 0.5803576707839966 + -0.1514143943786621 + <_> + + <_> + + + + <_> + 15 10 6 4 -1. + <_> + 15 11 6 2 2. + 0 + -7.0715770125389099e-003 + 0.5300896763801575 + -0.1449830979108810 + <_> + + <_> + + + + <_> + 0 6 24 2 -1. + <_> + 0 6 12 1 2. + <_> + 12 7 12 1 2. + 0 + -0.0118635101243854 + 0.6729742288589478 + -0.1106354966759682 + <_> + + <_> + + + + <_> + 17 0 18 18 -1. + <_> + 17 9 18 9 2. + 0 + -0.0605200305581093 + -0.3316448926925659 + 0.2119556069374085 + <_> + + <_> + + + + <_> + 1 0 11 2 -1. + <_> + 1 1 11 1 2. + 0 + -7.7340779826045036e-003 + -0.6941440105438232 + 0.0727053135633469 + <_> + + <_> + + + + <_> + 15 6 8 12 -1. + <_> + 19 6 4 6 2. + <_> + 15 12 4 6 2. + 0 + -0.0324861407279968 + -0.5185081958770752 + 0.0592126213014126 + <_> + + <_> + + + + <_> + 2 1 32 12 -1. + <_> + 2 1 16 6 2. + <_> + 18 7 16 6 2. + 0 + 0.0832797065377235 + 0.1206794008612633 + -0.5309563279151917 + <_> + + <_> + + + + <_> + 29 10 7 8 -1. + <_> + 29 12 7 4 2. + 0 + 7.8782817581668496e-004 + -0.2737655937671661 + 0.2716251909732819 + <_> + + <_> + + + + <_> + 12 2 8 10 -1. + <_> + 12 2 4 5 2. + <_> + 16 7 4 5 2. + 0 + -0.0175391808152199 + -0.5690230131149292 + 0.1228737011551857 + <_> + + <_> + + + + <_> + 15 12 6 4 -1. + <_> + 15 13 6 2 2. + 0 + -5.8226347900927067e-003 + 0.4386585950851440 + -0.1493742018938065 + <_> + + <_> + + + + <_> + 0 12 8 6 -1. + <_> + 0 14 8 2 3. + 0 + -0.0100575601682067 + -0.6616886258125305 + 0.1144542992115021 + <_> + + <_> + + + + <_> + 10 9 26 8 -1. + <_> + 23 9 13 4 2. + <_> + 10 13 13 4 2. + 0 + 0.0903454273939133 + -0.0666652470827103 + 0.2870647907257080 + <_> + + <_> + + + + <_> + 7 8 22 10 -1. + <_> + 7 8 11 5 2. + <_> + 18 13 11 5 2. + 0 + -0.0675872936844826 + -0.5363761186599731 + 0.1123751997947693 + <_> + + <_> + + + + <_> + 14 9 8 3 -1. + <_> + 14 10 8 1 3. + 0 + -8.1747528165578842e-003 + 0.4434241950511932 + -0.1297765970230103 + <_> + + <_> + + + + <_> + 11 3 4 9 -1. + <_> + 11 6 4 3 3. + 0 + -0.0115505503490567 + 0.3273158073425293 + -0.1700761020183563 + <_> + + <_> + + + + <_> + 29 14 2 2 -1. + <_> + 29 14 2 1 2. + 1 + -1.7406829283572733e-004 + 0.1327867954969406 + -0.1081293970346451 + <_> + + <_> + + + + <_> + 14 13 8 3 -1. + <_> + 14 14 8 1 3. + 0 + 4.6040047891438007e-003 + -0.1226582005620003 + 0.4412580132484436 + -1.3266400098800659 + 9 + -1 + <_> + + + <_> + + <_> + + + + <_> + 11 3 7 8 -1. + <_> + 9 5 7 4 2. + 1 + -0.0469432808458805 + 0.6094344258308411 + -0.2637800872325897 + <_> + + <_> + + + + <_> + 28 13 1 4 -1. + <_> + 28 13 1 2 2. + 1 + -1.6899159527383745e-004 + 0.1665875017642975 + -0.1254196017980576 + <_> + + <_> + + + + <_> + 8 13 4 1 -1. + <_> + 8 13 2 1 2. + 1 + 2.7983370237052441e-003 + 0.1905744969844818 + -0.6568077206611633 + <_> + + <_> + + + + <_> + 16 9 4 3 -1. + <_> + 16 10 4 1 3. + 0 + 4.0413960814476013e-003 + -0.1731746941804886 + 0.6362075209617615 + <_> + + <_> + + + + <_> + 13 8 10 4 -1. + <_> + 13 9 10 2 2. + 0 + -8.6033362895250320e-003 + 0.6025841832160950 + -0.2316936999559403 + <_> + + <_> + + + + <_> + 14 8 8 3 -1. + <_> + 14 9 8 1 3. + 0 + 8.8247945532202721e-003 + -0.1756583005189896 + 0.7104166746139526 + <_> + + <_> + + + + <_> + 2 10 6 2 -1. + <_> + 4 12 2 2 3. + 1 + -9.2786159366369247e-003 + -0.6890857219696045 + 0.1789650022983551 + <_> + + <_> + + + + <_> + 16 10 6 3 -1. + <_> + 16 11 6 1 3. + 0 + 6.0826768167316914e-003 + -0.1706372052431107 + 0.5375748276710510 + <_> + + <_> + + + + <_> + 8 5 8 13 -1. + <_> + 12 5 4 13 2. + 0 + -0.0390073694288731 + -0.6834635734558106 + 0.1441708058118820 + <_> + + <_> + + + + <_> + 0 0 36 8 -1. + <_> + 18 0 18 4 2. + <_> + 0 4 18 4 2. + 0 + -0.0703379511833191 + -0.6508566737174988 + 0.1008547991514206 + <_> + + <_> + + + + <_> + 1 5 8 12 -1. + <_> + 1 5 4 6 2. + <_> + 5 11 4 6 2. + 0 + 0.0331666991114616 + -0.1932571977376938 + 0.4779865145683289 + <_> + + <_> + + + + <_> + 18 8 18 10 -1. + <_> + 27 8 9 5 2. + <_> + 18 13 9 5 2. + 0 + 0.0752889066934586 + -0.0695677325129509 + 0.4125064909458160 + <_> + + <_> + + + + <_> + 0 8 18 10 -1. + <_> + 0 8 9 5 2. + <_> + 9 13 9 5 2. + 0 + -0.0705017298460007 + 0.7157300710678101 + -0.1022270023822784 + <_> + + <_> + + + + <_> + 11 5 14 3 -1. + <_> + 11 6 14 1 3. + 0 + 0.0122494902461767 + -0.1061242967844009 + 0.6295958161354065 + <_> + + <_> + + + + <_> + 10 6 16 6 -1. + <_> + 10 8 16 2 3. + 0 + 0.0706446766853333 + -0.0973746329545975 + 0.6762204170227051 + <_> + + <_> + + + + <_> + 7 2 24 16 -1. + <_> + 19 2 12 8 2. + <_> + 7 10 12 8 2. + 0 + 0.1624888032674789 + 0.0527133606374264 + -0.8494657278060913 + <_> + + <_> + + + + <_> + 0 1 18 15 -1. + <_> + 6 6 6 5 9. + 0 + 0.1380825042724609 + 0.1406479030847549 + -0.4764721095561981 + -1.4497200250625610 + 10 + -1 + <_> + + + <_> + + <_> + + + + <_> + 4 5 16 6 -1. + <_> + 12 5 8 6 2. + 0 + -0.0418823398649693 + -0.8077452778816223 + 0.2640967071056366 + <_> + + <_> + + + + <_> + 29 0 6 11 -1. + <_> + 31 2 2 11 3. + 1 + -0.0536229908466339 + 0.5580704212188721 + -0.2498968988656998 + <_> + + <_> + + + + <_> + 2 8 9 1 -1. + <_> + 5 11 3 1 3. + 1 + 9.3709938228130341e-003 + 0.2650170028209686 + -0.5990694761276245 + <_> + + <_> + + + + <_> + 10 6 17 3 -1. + <_> + 10 7 17 1 3. + 0 + 0.0139097301289439 + -0.1470918059349060 + 0.7354667186737061 + <_> + + <_> + + + + <_> + 18 6 6 2 -1. + <_> + 20 8 2 2 3. + 1 + 0.0190035700798035 + -0.1887511014938355 + 0.7487422227859497 + <_> + + <_> + + + + <_> + 13 11 12 3 -1. + <_> + 13 12 12 1 3. + 0 + 5.9199850074946880e-003 + -0.1599563956260681 + 0.5673577785491943 + <_> + + <_> + + + + <_> + 2 3 8 8 -1. + <_> + 2 3 4 4 2. + <_> + 6 7 4 4 2. + 0 + -0.0247051399201155 + 0.7556992173194885 + -0.1235088035464287 + <_> + + <_> + + + + <_> + 18 12 18 4 -1. + <_> + 27 12 9 2 2. + <_> + 18 14 9 2 2. + 0 + 0.0160583592951298 + -0.1282460987567902 + 0.5129454731941223 + <_> + + <_> + + + + <_> + 11 5 11 3 -1. + <_> + 11 6 11 1 3. + 0 + 8.8288700208067894e-003 + -0.1686663925647736 + 0.6152185201644898 + <_> + + <_> + + + + <_> + 14 7 14 4 -1. + <_> + 14 8 14 2 2. + 0 + 0.0175563395023346 + -0.1090169996023178 + 0.5803176164627075 + <_> + + <_> + + + + <_> + 9 8 16 10 -1. + <_> + 9 8 8 5 2. + <_> + 17 13 8 5 2. + 0 + 0.0421881191432476 + 0.1486624032258987 + -0.6922233104705811 + <_> + + <_> + + + + <_> + 18 17 2 1 -1. + <_> + 18 17 1 1 2. + 0 + 5.0687207840383053e-004 + 0.0315808691084385 + -0.3700995147228241 + <_> + + <_> + + + + <_> + 13 10 5 3 -1. + <_> + 13 11 5 1 3. + 0 + 2.7651190757751465e-003 + -0.2133754044771195 + 0.4704301059246063 + <_> + + <_> + + + + <_> + 18 17 2 1 -1. + <_> + 18 17 1 1 2. + 0 + -1.2231520377099514e-003 + -0.7818967103958130 + 0.0209542606025934 + <_> + + <_> + + + + <_> + 7 5 8 3 -1. + <_> + 6 6 8 1 3. + 1 + 8.5432287305593491e-003 + -0.1455352008342743 + 0.6789504289627075 + <_> + + <_> + + + + <_> + 18 17 2 1 -1. + <_> + 18 17 1 1 2. + 0 + -2.0657219283748418e-004 + 0.2437624037265778 + -0.0675588026642799 + <_> + + <_> + + + + <_> + 10 5 5 3 -1. + <_> + 10 6 5 1 3. + 0 + -4.6798270195722580e-003 + 0.6684169769287109 + -0.1388788074254990 + <_> + + <_> + + + + <_> + 2 5 34 10 -1. + <_> + 19 5 17 5 2. + <_> + 2 10 17 5 2. + 0 + 0.1220175996422768 + 0.1102816015481949 + -0.7530742287635803 + <_> + + <_> + + + + <_> + 3 2 12 3 -1. + <_> + 6 5 6 3 2. + 1 + 0.0204043406993151 + 0.1645383983850479 + -0.5223162174224854 + <_> + + <_> + + + + <_> + 35 6 1 6 -1. + <_> + 35 8 1 2 3. + 0 + 8.0343370791524649e-004 + -0.1301285028457642 + 0.2635852992534638 + -1.4622910022735596 + 11 + -1 + <_> + + + <_> + + <_> + + + + <_> + 10 6 13 6 -1. + <_> + 10 8 13 2 3. + 0 + 0.0727917104959488 + -0.1372790038585663 + 0.8291574716567993 + <_> + + <_> + + + + <_> + 15 5 6 4 -1. + <_> + 15 6 6 2 2. + 0 + 7.5939209200441837e-003 + -0.1678012013435364 + 0.5683972239494324 + <_> + + <_> + + + + <_> + 5 2 11 4 -1. + <_> + 4 3 11 2 2. + 1 + -0.0235623903572559 + 0.6500560045242310 + -0.1424535065889359 + <_> + + <_> + + + + <_> + 26 6 10 6 -1. + <_> + 31 6 5 3 2. + <_> + 26 9 5 3 2. + 0 + 0.0173929501324892 + -0.1529144942760468 + 0.3425354063510895 + <_> + + <_> + + + + <_> + 10 7 11 8 -1. + <_> + 10 9 11 4 2. + 0 + 0.0718258023262024 + -0.0991311371326447 + 0.8279678821563721 + <_> + + <_> + + + + <_> + 28 2 4 9 -1. + <_> + 29 3 2 9 2. + 1 + 0.0136738000437617 + -0.0417872704565525 + 0.5078148245811462 + <_> + + <_> + + + + <_> + 8 2 10 4 -1. + <_> + 7 3 10 2 2. + 1 + -0.0285859592258930 + 0.7011532187461853 + -0.1314471065998077 + <_> + + <_> + + + + <_> + 31 0 5 2 -1. + <_> + 31 1 5 1 2. + 0 + -4.1845720261335373e-004 + 0.2845467031002045 + -0.3123202919960022 + <_> + + <_> + + + + <_> + 10 6 16 12 -1. + <_> + 10 10 16 4 3. + 0 + -0.0520956814289093 + 0.4181294143199921 + -0.1699313074350357 + <_> + + <_> + + + + <_> + 18 4 4 3 -1. + <_> + 18 5 4 1 3. + 0 + 3.2256329432129860e-003 + -0.0904662087559700 + 0.3008623123168945 + <_> + + <_> + + + + <_> + 11 10 6 6 -1. + <_> + 11 12 6 2 3. + 0 + 0.0347716398537159 + -0.0842167884111404 + 0.7801663875579834 + <_> + + <_> + + + + <_> + 35 8 1 10 -1. + <_> + 35 13 1 5 2. + 0 + -1.3356630224734545e-003 + 0.3316453099250794 + -0.1696092039346695 + <_> + + <_> + + + + <_> + 0 10 36 8 -1. + <_> + 18 10 18 8 2. + 0 + 0.2510198056697846 + -0.1392046958208084 + 0.6633893251419067 + <_> + + <_> + + + + <_> + 16 7 6 8 -1. + <_> + 19 7 3 4 2. + <_> + 16 11 3 4 2. + 0 + -9.9689997732639313e-003 + -0.3713817000389099 + 0.1290012001991272 + <_> + + <_> + + + + <_> + 7 6 8 4 -1. + <_> + 7 6 4 4 2. + 1 + 0.0143037298694253 + 0.1572919934988022 + -0.5093821287155151 + <_> + + <_> + + + + <_> + 21 11 4 3 -1. + <_> + 21 12 4 1 3. + 0 + -7.0856059901416302e-003 + 0.4656791090965271 + -0.0662708207964897 + <_> + + <_> + + + + <_> + 0 9 1 8 -1. + <_> + 0 13 1 4 2. + 0 + -4.6260809176601470e-004 + 0.2933731079101563 + -0.2333986014127731 + <_> + + <_> + + + + <_> + 27 7 6 4 -1. + <_> + 29 9 2 4 3. + 1 + -0.0344354808330536 + 0.7002474069595337 + -0.1013351008296013 + <_> + + <_> + + + + <_> + 10 14 8 4 -1. + <_> + 12 14 4 4 2. + 0 + -7.2570890188217163e-003 + -0.5628641247749329 + 0.1314862072467804 + <_> + + <_> + + + + <_> + 18 17 2 1 -1. + <_> + 18 17 1 1 2. + 0 + 4.8352940939366817e-004 + 0.0262274891138077 + -0.2605080008506775 + <_> + + <_> + + + + <_> + 10 4 11 4 -1. + <_> + 10 5 11 2 2. + 0 + -0.0129999397322536 + 0.5311700105667114 + -0.1202305033802986 + <_> + + <_> + + + + <_> + 17 12 2 4 -1. + <_> + 17 13 2 2 2. + 0 + -1.0009329998865724e-003 + 0.3964129984378815 + -0.1599515974521637 + <_> + + <_> + + + + <_> + 13 4 5 3 -1. + <_> + 13 5 5 1 3. + 0 + 4.1314200498163700e-003 + -0.1492992043495178 + 0.4295912086963654 + <_> + + <_> + + + + <_> + 13 12 11 2 -1. + <_> + 13 13 11 1 2. + 0 + 8.7364455685019493e-003 + -0.1127102002501488 + 0.4945647120475769 + <_> + + <_> + + + + <_> + 1 16 2 2 -1. + <_> + 1 16 1 1 2. + <_> + 2 17 1 1 2. + 0 + 2.6352869463153183e-004 + -0.1212491989135742 + 0.4943937957286835 + <_> + + <_> + + + + <_> + 27 7 6 4 -1. + <_> + 29 9 2 4 3. + 1 + -0.0538859590888023 + 0.7035598754882813 + -0.0132305501028895 + <_> + + <_> + + + + <_> + 4 7 6 6 -1. + <_> + 4 9 6 2 3. + 0 + 4.2885672301054001e-003 + -0.1754055023193359 + 0.3567946851253510 + <_> + + <_> + + + + <_> + 30 6 4 5 -1. + <_> + 31 7 2 5 2. + 1 + 7.9539399594068527e-003 + -0.0998840034008026 + 0.3137167096138001 + -1.3885619640350342 + 12 + -1 + <_> + + + <_> + + <_> + + + + <_> + 8 5 20 7 -1. + <_> + 13 5 10 7 2. + 0 + 0.0567523688077927 + -0.3257648050785065 + 0.3737593889236450 + <_> + + <_> + + + + <_> + 30 2 3 12 -1. + <_> + 30 8 3 6 2. + 0 + 7.0906039327383041e-003 + -0.1391862928867340 + 0.1503984034061432 + <_> + + <_> + + + + <_> + 4 2 12 4 -1. + <_> + 4 2 12 2 2. + 1 + -0.0412988215684891 + 0.4702607989311218 + -0.1617936044931412 + <_> + + <_> + + + + <_> + 0 8 36 6 -1. + <_> + 12 10 12 2 9. + 0 + 0.4775018990039825 + -0.1006157994270325 + 0.7635074257850647 + <_> + + <_> + + + + <_> + 3 5 30 6 -1. + <_> + 13 7 10 2 9. + 0 + 0.4226649105548859 + -0.0351909101009369 + 0.8303126096725464 + <_> + + <_> + + + + <_> + 14 4 12 9 -1. + <_> + 18 4 4 9 3. + 0 + -0.0330318994820118 + -0.3750554919242859 + 0.0489026196300983 + <_> + + <_> + + + + <_> + 0 17 6 1 -1. + <_> + 3 17 3 1 2. + 0 + 1.1923770216526464e-004 + -0.2661466896533966 + 0.2234652042388916 + <_> + + <_> + + + + <_> + 34 0 1 2 -1. + <_> + 34 0 1 1 2. + 1 + 4.2101400904357433e-003 + 8.7575968354940414e-003 + -0.5938351750373840 + <_> + + <_> + + + + <_> + 2 0 2 1 -1. + <_> + 2 0 1 1 2. + 1 + 3.3337279455736279e-004 + -0.2122765928506851 + 0.2473503947257996 + <_> + + <_> + + + + <_> + 31 3 3 8 -1. + <_> + 32 4 1 8 3. + 1 + 0.0117938900366426 + -0.0689979493618011 + 0.5898082852363586 + <_> + + <_> + + + + <_> + 5 6 26 12 -1. + <_> + 5 6 13 6 2. + <_> + 18 12 13 6 2. + 0 + -0.1143207997083664 + -0.7733368277549744 + 0.0628622919321060 + <_> + + <_> + + + + <_> + 14 4 12 9 -1. + <_> + 18 4 4 9 3. + 0 + 0.0824010074138641 + 0.0168252792209387 + -0.6170011758804321 + <_> + + <_> + + + + <_> + 13 7 10 10 -1. + <_> + 13 7 5 5 2. + <_> + 18 12 5 5 2. + 0 + 0.0181261505931616 + 0.0995334684848785 + -0.3830915987491608 + <_> + + <_> + + + + <_> + 30 5 4 6 -1. + <_> + 31 6 2 6 2. + 1 + 8.9282449334859848e-003 + -0.1010973975062370 + 0.2948305010795593 + <_> + + <_> + + + + <_> + 6 5 6 4 -1. + <_> + 5 6 6 2 2. + 1 + -0.0174371004104614 + 0.4614987075328827 + -0.1050636023283005 + <_> + + <_> + + + + <_> + 29 5 4 5 -1. + <_> + 30 6 2 5 2. + 1 + -0.0112803103402257 + 0.4561164975166321 + -0.1013116016983986 + <_> + + <_> + + + + <_> + 7 5 5 4 -1. + <_> + 6 6 5 2 2. + 1 + 7.0190089754760265e-003 + -0.1368626952171326 + 0.4173265993595123 + <_> + + <_> + + + + <_> + 0 0 36 1 -1. + <_> + 12 0 12 1 3. + 0 + -3.2439709175378084e-003 + 0.2321648001670837 + -0.1791536957025528 + <_> + + <_> + + + + <_> + 6 3 24 6 -1. + <_> + 14 5 8 2 9. + 0 + 0.3561589121818543 + -0.0486268103122711 + 0.9537345767021179 + <_> + + <_> + + + + <_> + 15 12 6 3 -1. + <_> + 15 13 6 1 3. + 0 + 3.8440749049186707e-003 + -0.1028828024864197 + 0.3671778142452240 + <_> + + <_> + + + + <_> + 11 1 9 17 -1. + <_> + 14 1 3 17 3. + 0 + 0.0609500296413898 + 0.0561417415738106 + -0.6458569765090942 + <_> + + <_> + + + + <_> + 18 1 18 10 -1. + <_> + 18 1 9 10 2. + 0 + 0.1814922988414764 + 0.0308063905686140 + -0.4604896008968353 + <_> + + <_> + + + + <_> + 0 1 18 10 -1. + <_> + 9 1 9 10 2. + 0 + -0.0923592597246170 + -0.4524821043014526 + 0.0881522372364998 + <_> + + <_> + + + + <_> + 30 7 4 5 -1. + <_> + 31 8 2 5 2. + 1 + 7.6072998344898224e-003 + -0.0971223264932632 + 0.2155224978923798 + <_> + + <_> + + + + <_> + 0 10 1 3 -1. + <_> + 0 11 1 1 3. + 0 + -4.6946710790507495e-004 + -0.4089371860027313 + 0.0800421908497810 + <_> + + <_> + + + + <_> + 33 16 2 2 -1. + <_> + 34 16 1 1 2. + <_> + 33 17 1 1 2. + 0 + 1.0301820293534547e-004 + -0.1153035983443260 + 0.2795535027980804 + <_> + + <_> + + + + <_> + 1 16 2 2 -1. + <_> + 1 16 1 1 2. + <_> + 2 17 1 1 2. + 0 + 2.7936851256527007e-004 + -0.1139610037207604 + 0.2931660115718842 + <_> + + <_> + + + + <_> + 0 8 36 3 -1. + <_> + 12 9 12 1 9. + 0 + 0.2467595934867859 + -0.0385956317186356 + 0.8264998197555542 + <_> + + <_> + + + + <_> + 14 7 8 4 -1. + <_> + 14 8 8 2 2. + 0 + -8.4232958033680916e-003 + 0.3299596905708313 + -0.1164536997675896 + <_> + + <_> + + + + <_> + 17 9 5 3 -1. + <_> + 17 10 5 1 3. + 0 + -4.2311567813158035e-003 + 0.2714211940765381 + -0.1081148013472557 + <_> + + <_> + + + + <_> + 4 0 1 2 -1. + <_> + 4 0 1 1 2. + 1 + 1.5653009759262204e-003 + 0.0782537832856178 + -0.5209766030311585 + <_> + + <_> + + + + <_> + 31 0 3 2 -1. + <_> + 31 0 3 1 2. + 1 + -5.0341398455202579e-003 + 0.2948805987834930 + -0.0469605103135109 + <_> + + <_> + + + + <_> + 5 0 2 3 -1. + <_> + 5 0 1 3 2. + 1 + 1.4283140189945698e-003 + -0.1379459947347641 + 0.2432370930910111 + <_> + + <_> + + + + <_> + 0 13 36 5 -1. + <_> + 0 13 18 5 2. + 0 + 0.1903136968612671 + -0.0520935095846653 + 0.6870803236961365 + <_> + + <_> + + + + <_> + 6 3 4 3 -1. + <_> + 5 4 4 1 3. + 1 + 8.1368777900934219e-003 + -0.0533115193247795 + 0.5827271938323975 + <_> + + <_> + + + + <_> + 28 7 6 3 -1. + <_> + 30 9 2 3 3. + 1 + -0.0467283688485622 + 0.3552536070346832 + -0.0178062599152327 + <_> + + <_> + + + + <_> + 8 7 3 6 -1. + <_> + 6 9 3 2 3. + 1 + 0.0143171697854996 + -0.1262664049863815 + 0.2696101069450378 + <_> + + <_> + + + + <_> + 14 5 18 10 -1. + <_> + 23 5 9 5 2. + <_> + 14 10 9 5 2. + 0 + -0.0961097329854965 + 0.3411748111248016 + -0.0392176099121571 + <_> + + <_> + + + + <_> + 4 5 18 10 -1. + <_> + 4 5 9 5 2. + <_> + 13 10 9 5 2. + 0 + 0.0748788118362427 + -0.0648199021816254 + 0.5671138167381287 + <_> + + <_> + + + + <_> + 32 17 3 1 -1. + <_> + 33 17 1 1 3. + 0 + -5.1972299843328074e-005 + 0.2874209880828857 + -0.1642889976501465 + <_> + + <_> + + + + <_> + 1 17 3 1 -1. + <_> + 2 17 1 1 3. + 0 + -2.0099039829801768e-004 + 0.2659021019935608 + -0.1299035996198654 + <_> + + <_> + + + + <_> + 5 0 26 2 -1. + <_> + 18 0 13 1 2. + <_> + 5 1 13 1 2. + 0 + 0.0155834900215268 + 0.0363226197659969 + -0.8874331712722778 + <_> + + <_> + + + + <_> + 0 3 27 9 -1. + <_> + 9 6 9 3 9. + 0 + 6.7313341423869133e-003 + 0.1628185957670212 + -0.1971620023250580 + <_> + + <_> + + + + <_> + 13 0 18 12 -1. + <_> + 13 6 18 6 2. + 0 + -0.0452514104545116 + -0.2031500935554504 + 0.1573408991098404 + <_> + + <_> + + + + <_> + 0 17 4 1 -1. + <_> + 1 17 2 1 2. + 0 + 2.8729529003612697e-004 + -0.1244959011673927 + 0.2565822899341583 + <_> + + <_> + + + + <_> + 29 13 1 3 -1. + <_> + 28 14 1 1 3. + 1 + -2.1028579212725163e-003 + -0.5088729262351990 + 0.0340831801295280 + <_> + + <_> + + + + <_> + 0 12 8 6 -1. + <_> + 0 14 8 2 3. + 0 + -3.9328099228441715e-003 + -0.3393375873565674 + 0.0930555686354637 + <_> + + <_> + + + + <_> + 23 7 3 3 -1. + <_> + 24 7 1 3 3. + 0 + 3.1205590348690748e-003 + -0.0227940604090691 + 0.2379353046417236 + <_> + + <_> + + + + <_> + 11 1 12 6 -1. + <_> + 11 3 12 2 3. + 0 + 0.0780286788940430 + -0.0445036217570305 + 0.6776394248008728 + <_> + + <_> + + + + <_> + 5 10 26 8 -1. + <_> + 18 10 13 4 2. + <_> + 5 14 13 4 2. + 0 + 0.0424769781529903 + 0.0925821065902710 + -0.3536301851272583 + <_> + + <_> + + + + <_> + 11 12 9 6 -1. + <_> + 14 12 3 6 3. + 0 + -0.0257683005183935 + -0.9091991186141968 + 0.0266928393393755 + <_> + + <_> + + + + <_> + 14 12 12 3 -1. + <_> + 18 13 4 1 9. + 0 + 0.0614446699619293 + -0.0249543990939856 + 0.7212049961090088 + <_> + + <_> + + + + <_> + 10 12 12 3 -1. + <_> + 14 13 4 1 9. + 0 + 3.5776318982243538e-003 + 0.1772899031639099 + -0.1972344964742661 + -1.2766569852828979 + 13 + -1 + <_> + + + <_> + + <_> + + + + <_> + 4 6 27 6 -1. + <_> + 13 8 9 2 9. + 0 + 0.2858596146106720 + -0.1539604961872101 + 0.6624677181243897 + <_> + + <_> + + + + <_> + 17 9 5 4 -1. + <_> + 17 10 5 2 2. + 0 + 9.2271259054541588e-003 + -0.1074633970856667 + 0.4311806857585907 + <_> + + <_> + + + + <_> + 0 0 16 2 -1. + <_> + 0 0 8 1 2. + <_> + 8 1 8 1 2. + 0 + 2.2924109362065792e-003 + -0.1983013004064560 + 0.3842228949069977 + <_> + + <_> + + + + <_> + 22 0 8 8 -1. + <_> + 26 0 4 4 2. + <_> + 22 4 4 4 2. + 0 + 0.0140045098960400 + -0.1924948990345001 + 0.3442491888999939 + <_> + + <_> + + + + <_> + 1 0 32 12 -1. + <_> + 1 0 16 6 2. + <_> + 17 6 16 6 2. + 0 + 0.0960232019424438 + 0.1299059987068176 + -0.6065304875373840 + <_> + + <_> + + + + <_> + 28 7 6 10 -1. + <_> + 31 7 3 5 2. + <_> + 28 12 3 5 2. + 0 + 6.1803720891475677e-003 + -0.1904646009206772 + 0.1891862004995346 + <_> + + <_> + + + + <_> + 2 7 6 10 -1. + <_> + 2 7 3 5 2. + <_> + 5 12 3 5 2. + 0 + 8.2172285765409470e-003 + -0.2518267929553986 + 0.2664459049701691 + <_> + + <_> + + + + <_> + 20 10 3 3 -1. + <_> + 20 11 3 1 3. + 0 + -1.4542760327458382e-003 + 0.2710269093513489 + -0.1204148977994919 + <_> + + <_> + + + + <_> + 13 10 3 3 -1. + <_> + 13 11 3 1 3. + 0 + 3.0185449868440628e-003 + -0.1353860944509506 + 0.4733603000640869 + <_> + + <_> + + + + <_> + 17 16 6 2 -1. + <_> + 19 16 2 2 3. + 0 + -3.4214779734611511e-003 + -0.5049971938133240 + 0.1042480990290642 + <_> + + <_> + + + + <_> + 13 11 7 3 -1. + <_> + 13 12 7 1 3. + 0 + 9.5980763435363770e-003 + -0.1034729033708572 + 0.5837283730506897 + <_> + + <_> + + + + <_> + 25 13 3 2 -1. + <_> + 25 13 3 1 2. + 1 + 4.1849957779049873e-003 + 0.0588967092335224 + -0.4623228907585144 + <_> + + <_> + + + + <_> + 13 10 4 4 -1. + <_> + 13 11 4 2 2. + 0 + -4.6107750385999680e-003 + 0.3783561885356903 + -0.1259022951126099 + <_> + + <_> + + + + <_> + 17 16 18 2 -1. + <_> + 26 16 9 1 2. + <_> + 17 17 9 1 2. + 0 + 2.8978679329156876e-003 + -0.1369954943656921 + 0.2595148086547852 + <_> + + <_> + + + + <_> + 9 13 4 1 -1. + <_> + 9 13 2 1 2. + 1 + 4.2606070637702942e-003 + 0.0882339626550674 + -0.6390284895896912 + <_> + + <_> + + + + <_> + 34 1 2 1 -1. + <_> + 34 1 1 1 2. + 1 + -4.2996238917112350e-003 + -0.7953972816467285 + 0.0170935597270727 + <_> + + <_> + + + + <_> + 5 4 24 6 -1. + <_> + 13 6 8 2 9. + 0 + 0.3542361855506897 + -0.0593450404703617 + 0.8557919859886169 + <_> + + <_> + + + + <_> + 33 16 3 2 -1. + <_> + 33 17 3 1 2. + 0 + -3.0245838570408523e-004 + 0.3147065043449402 + -0.1448609977960587 + <_> + + <_> + + + + <_> + 0 17 36 1 -1. + <_> + 18 17 18 1 2. + 0 + 0.0271694902330637 + -0.1249295026063919 + 0.4280903935432434 + <_> + + <_> + + + + <_> + 34 1 2 1 -1. + <_> + 34 1 1 1 2. + 1 + 3.4571529831737280e-003 + 0.0397093296051025 + -0.7089157104492188 + <_> + + <_> + + + + <_> + 2 1 1 2 -1. + <_> + 2 1 1 1 2. + 1 + 2.1742798853665590e-003 + 0.0658724531531334 + -0.6949694156646729 + <_> + + <_> + + + + <_> + 22 0 8 10 -1. + <_> + 24 2 4 10 2. + 1 + 0.0252638105303049 + -0.1169395968317986 + 0.1904976963996887 + <_> + + <_> + + + + <_> + 12 4 8 12 -1. + <_> + 12 4 4 6 2. + <_> + 16 10 4 6 2. + 0 + -0.0247209891676903 + -0.4965795874595642 + 0.1017538011074066 + <_> + + <_> + + + + <_> + 26 6 6 6 -1. + <_> + 29 6 3 3 2. + <_> + 26 9 3 3 2. + 0 + 0.0103848800063133 + -0.1148673966526985 + 0.3374153077602387 + <_> + + <_> + + + + <_> + 5 6 4 6 -1. + <_> + 5 6 2 3 2. + <_> + 7 9 2 3 2. + 0 + 5.0045028328895569e-003 + -0.1096355020999908 + 0.3925519883632660 + <_> + + <_> + + + + <_> + 29 5 2 4 -1. + <_> + 29 5 1 4 2. + 1 + 7.1279620751738548e-003 + -0.0649081915616989 + 0.4042040109634399 + <_> + + <_> + + + + <_> + 7 4 18 3 -1. + <_> + 7 5 18 1 3. + 0 + 0.0197004191577435 + -0.0793758779764175 + 0.5308234095573425 + <_> + + <_> + + + + <_> + 29 13 2 3 -1. + <_> + 28 14 2 1 3. + 1 + 4.2097331024706364e-003 + 0.0407970212399960 + -0.6044098734855652 + <_> + + <_> + + + + <_> + 9 5 3 3 -1. + <_> + 8 6 3 1 3. + 1 + 4.4459570199251175e-003 + -0.1038623005151749 + 0.4093598127365112 + <_> + + <_> + + + + <_> + 7 16 22 2 -1. + <_> + 18 16 11 1 2. + <_> + 7 17 11 1 2. + 0 + -5.9610428288578987e-003 + -0.5291494727134705 + 0.0805394500494003 + <_> + + <_> + + + + <_> + 0 2 1 3 -1. + <_> + 0 3 1 1 3. + 0 + 5.7519221445545554e-004 + 0.0638044029474258 + -0.5863661766052246 + <_> + + <_> + + + + <_> + 16 3 20 6 -1. + <_> + 26 3 10 3 2. + <_> + 16 6 10 3 2. + 0 + 0.0605248510837555 + -0.0337128005921841 + 0.2631115913391113 + <_> + + <_> + + + + <_> + 10 5 8 6 -1. + <_> + 12 5 4 6 2. + 0 + -0.0103538101539016 + -0.4792002141475678 + 0.0800439566373825 + <_> + + <_> + + + + <_> + 1 8 34 8 -1. + <_> + 18 8 17 4 2. + <_> + 1 12 17 4 2. + 0 + -0.0227775108069181 + -0.3116275072097778 + 0.1189998015761375 + <_> + + <_> + + + + <_> + 14 9 8 8 -1. + <_> + 14 9 4 4 2. + <_> + 18 13 4 4 2. + 0 + -0.0224688798189163 + -0.6608346104621887 + 0.0522344894707203 + <_> + + <_> + + + + <_> + 35 0 1 3 -1. + <_> + 35 1 1 1 3. + 0 + 5.8432162040844560e-004 + 0.0546303391456604 + -0.4639565944671631 + <_> + + <_> + + + + <_> + 15 8 3 5 -1. + <_> + 16 8 1 5 3. + 0 + -3.6177870351821184e-003 + 0.6744704246520996 + -0.0587895289063454 + <_> + + <_> + + + + <_> + 19 0 10 1 -1. + <_> + 19 0 5 1 2. + 1 + 0.0300888605415821 + 0.0331335216760635 + -0.4646137058734894 + -1.4061349630355835 + 14 + -1 + <_> + + + <_> + + <_> + + + + <_> + 9 3 9 6 -1. + <_> + 7 5 9 2 3. + 1 + -0.0726009905338287 + 0.6390709280967712 + -0.1512455046176910 + <_> + + <_> + + + + <_> + 6 6 24 6 -1. + <_> + 14 8 8 2 9. + 0 + 0.3471255898475647 + -0.0790246576070786 + 0.7955042123794556 + <_> + + <_> + + + + <_> + 4 8 27 6 -1. + <_> + 13 10 9 2 9. + 0 + 0.3429723083972931 + -0.1230095997452736 + 0.6572809815406799 + <_> + + <_> + + + + <_> + 5 4 27 6 -1. + <_> + 14 6 9 2 9. + 0 + 0.3561694025993347 + -0.0537334382534027 + 0.8285108208656311 + <_> + + <_> + + + + <_> + 5 6 5 6 -1. + <_> + 5 8 5 2 3. + 0 + 6.0840700753033161e-003 + -0.1284721046686173 + 0.3382267951965332 + <_> + + <_> + + + + <_> + 35 0 1 2 -1. + <_> + 35 1 1 1 2. + 0 + -1.6281309945043176e-004 + 0.3035660982131958 + -0.2518202960491180 + <_> + + <_> + + + + <_> + 4 3 10 3 -1. + <_> + 3 4 10 1 3. + 1 + 0.0112819001078606 + -0.0839143469929695 + 0.4347592890262604 + <_> + + <_> + + + + <_> + 29 5 2 4 -1. + <_> + 29 5 1 4 2. + 1 + 7.4357059784233570e-003 + -0.0670880377292633 + 0.3722797930240631 + <_> + + <_> + + + + <_> + 3 0 28 16 -1. + <_> + 3 0 14 8 2. + <_> + 17 8 14 8 2. + 0 + -0.0905762165784836 + -0.5831961035728455 + 0.0801467597484589 + <_> + + <_> + + + + <_> + 31 0 4 2 -1. + <_> + 31 0 2 2 2. + 1 + 8.8247694075107574e-003 + 0.1290193051099777 + -0.4760313034057617 + <_> + + <_> + + + + <_> + 4 9 3 9 -1. + <_> + 4 12 3 3 3. + 0 + -2.6147770695388317e-003 + -0.4000220894813538 + 0.1124631017446518 + <_> + + <_> + + + + <_> + 32 16 4 2 -1. + <_> + 32 17 4 1 2. + 0 + -2.5541300419718027e-004 + 0.3238615989685059 + -0.2333187013864517 + <_> + + <_> + + + + <_> + 17 0 1 10 -1. + <_> + 17 0 1 5 2. + 1 + 0.0265476293861866 + 0.0723338723182678 + -0.5837839841842651 + <_> + + <_> + + + + <_> + 17 4 14 8 -1. + <_> + 17 4 7 8 2. + 0 + -0.0513831414282322 + -0.2244618982076645 + 0.0409497395157814 + <_> + + <_> + + + + <_> + 6 0 11 4 -1. + <_> + 6 2 11 2 2. + 0 + 3.3701129723340273e-003 + -0.1671708971261978 + 0.2552697062492371 + <_> + + <_> + + + + <_> + 35 0 1 2 -1. + <_> + 35 1 1 1 2. + 0 + -2.2581920493394136e-003 + -0.9207922816276550 + 3.4371060319244862e-003 + <_> + + <_> + + + + <_> + 0 0 1 2 -1. + <_> + 0 1 1 1 2. + 0 + -1.3282749569043517e-004 + 0.1857322007417679 + -0.2249896973371506 + <_> + + <_> + + + + <_> + 33 0 2 1 -1. + <_> + 33 0 1 1 2. + 1 + -2.8032590635120869e-003 + -0.8589754104614258 + 0.0463845208287239 + <_> + + <_> + + + + <_> + 3 0 1 2 -1. + <_> + 3 0 1 1 2. + 1 + 1.3141379458829761e-003 + 0.0796270668506622 + -0.4610596895217896 + <_> + + <_> + + + + <_> + 0 17 36 1 -1. + <_> + 9 17 18 1 2. + 0 + 0.0638845413923264 + -0.0534401498734951 + 0.8104500174522400 + <_> + + <_> + + + + <_> + 7 13 3 1 -1. + <_> + 8 14 1 1 3. + 1 + -1.9811019301414490e-003 + -0.6382514834403992 + 0.0766435563564301 + <_> + + <_> + + + + <_> + 17 4 14 8 -1. + <_> + 17 4 7 8 2. + 0 + 0.0133598595857620 + -0.0950375497341156 + 0.0625333487987518 + <_> + + <_> + + + + <_> + 0 16 4 2 -1. + <_> + 0 17 4 1 2. + 0 + -1.0935300088021904e-004 + 0.1747954040765762 + -0.2287603020668030 + <_> + + <_> + + + + <_> + 13 12 10 3 -1. + <_> + 13 13 10 1 3. + 0 + 0.0119106303900480 + -0.0770419836044312 + 0.5045837759971619 + <_> + + <_> + + + + <_> + 0 12 36 6 -1. + <_> + 18 12 18 6 2. + 0 + 0.2395170032978058 + -0.0651228874921799 + 0.5042074918746948 + <_> + + <_> + + + + <_> + 5 3 27 6 -1. + <_> + 14 5 9 2 9. + 0 + 0.3983140885829926 + -0.0299998205155134 + 0.7968547940254211 + <_> + + <_> + + + + <_> + 9 5 5 3 -1. + <_> + 8 6 5 1 3. + 1 + 6.1875800602138042e-003 + -0.0853391736745834 + 0.3945176899433136 + <_> + + <_> + + + + <_> + 12 7 12 4 -1. + <_> + 15 7 6 4 2. + 0 + -9.4047123566269875e-003 + -0.4344133138656616 + 0.0826191008090973 + <_> + + <_> + + + + <_> + 13 5 8 4 -1. + <_> + 15 5 4 4 2. + 0 + 0.0117366304621100 + 0.0694831609725952 + -0.4870649874210358 + <_> + + <_> + + + + <_> + 16 14 6 4 -1. + <_> + 16 14 3 4 2. + 0 + -0.0151767702773213 + -0.5854120850563049 + 0.0328795611858368 + <_> + + <_> + + + + <_> + 14 10 5 3 -1. + <_> + 14 11 5 1 3. + 0 + 3.0744259711354971e-003 + -0.1314608007669449 + 0.2546674013137817 + <_> + + <_> + + + + <_> + 25 3 6 4 -1. + <_> + 25 4 6 2 2. + 0 + 2.9391339048743248e-003 + -0.1086023002862930 + 0.2783496081829071 + <_> + + <_> + + + + <_> + 3 6 6 8 -1. + <_> + 3 8 6 4 2. + 0 + 2.1510310471057892e-003 + -0.1575057953596115 + 0.2087786048650742 + <_> + + <_> + + + + <_> + 27 4 5 6 -1. + <_> + 27 6 5 2 3. + 0 + 5.3775361739099026e-003 + -0.1320703029632568 + 0.3767293989658356 + <_> + + <_> + + + + <_> + 4 1 6 9 -1. + <_> + 4 4 6 3 3. + 0 + 0.0221741795539856 + -0.0901802927255630 + 0.4157527089118958 + <_> + + <_> + + + + <_> + 21 9 2 4 -1. + <_> + 21 10 2 2 2. + 0 + -1.9948610570281744e-003 + 0.2560858130455017 + -0.0990849286317825 + <_> + + <_> + + + + <_> + 1 10 34 4 -1. + <_> + 1 10 17 2 2. + <_> + 18 12 17 2 2. + 0 + 0.0315575599670410 + 0.0741889998316765 + -0.5494022965431213 + <_> + + <_> + + + + <_> + 34 15 2 3 -1. + <_> + 34 16 2 1 3. + 0 + -4.3111158447572961e-005 + 0.3032462894916534 + -0.1778181046247482 + <_> + + <_> + + + + <_> + 3 0 2 2 -1. + <_> + 3 0 2 1 2. + 1 + -3.2675920519977808e-003 + -0.6721243262290955 + 0.0591883286833763 + <_> + + <_> + + + + <_> + 33 0 1 2 -1. + <_> + 33 0 1 1 2. + 1 + 4.2293380829505622e-004 + -0.1103409975767136 + 0.1257317960262299 + -1.3384460210800171 + 15 + -1 + <_> + + + <_> + + <_> + + + + <_> + 8 0 10 8 -1. + <_> + 6 2 10 4 2. + 1 + -0.0425620190799236 + 0.3334665894508362 + -0.2986198067665100 + <_> + + <_> + + + + <_> + 3 6 30 6 -1. + <_> + 13 8 10 2 9. + 0 + 0.4182719886302948 + -0.0951386988162994 + 0.7570992112159729 + <_> + + <_> + + + + <_> + 13 7 10 4 -1. + <_> + 13 8 10 2 2. + 0 + -0.0202563796192408 + 0.4778389036655426 + -0.1459210067987442 + <_> + + <_> + + + + <_> + 16 5 6 12 -1. + <_> + 19 5 3 6 2. + <_> + 16 11 3 6 2. + 0 + -0.0189483091235161 + -0.3872750103473663 + 0.0524798892438412 + <_> + + <_> + + + + <_> + 10 1 4 6 -1. + <_> + 8 3 4 2 3. + 1 + -0.0405505895614624 + 0.5464624762535095 + -0.0813998579978943 + <_> + + <_> + + + + <_> + 2 7 33 6 -1. + <_> + 13 9 11 2 9. + 0 + 0.5187274813652039 + -0.0279305391013622 + 0.8458098173141480 + <_> + + <_> + + + + <_> + 3 6 30 3 -1. + <_> + 13 7 10 1 9. + 0 + 0.2071361988782883 + -0.0588508695363998 + 0.7960156202316284 + <_> + + <_> + + + + <_> + 15 11 6 3 -1. + <_> + 15 12 6 1 3. + 0 + 8.1972572952508926e-003 + -0.0999663695693016 + 0.4983156025409699 + <_> + + <_> + + + + <_> + 14 5 6 12 -1. + <_> + 14 5 3 6 2. + <_> + 17 11 3 6 2. + 0 + 0.0174453891813755 + 0.0680409595370293 + -0.5669981837272644 + <_> + + <_> + + + + <_> + 5 12 26 6 -1. + <_> + 18 12 13 3 2. + <_> + 5 15 13 3 2. + 0 + -0.0563102811574936 + -0.6862804293632507 + 0.0742225572466850 + <_> + + <_> + + + + <_> + 4 12 27 3 -1. + <_> + 13 13 9 1 9. + 0 + 0.1809556037187576 + -0.0528081282973289 + 0.8448318243026733 + <_> + + <_> + + + + <_> + 16 11 4 3 -1. + <_> + 16 12 4 1 3. + 0 + -2.3450690787285566e-003 + 0.2839694023132324 + -0.1112336963415146 + <_> + + <_> + + + + <_> + 5 12 4 2 -1. + <_> + 6 13 2 2 2. + 1 + 3.8937770295888186e-003 + 0.0654993131756783 + -0.5792096257209778 + <_> + + <_> + + + + <_> + 34 17 2 1 -1. + <_> + 34 17 1 1 2. + 0 + 3.9383721741614863e-005 + -0.3093047142028809 + 0.4223710894584656 + <_> + + <_> + + + + <_> + 16 0 1 12 -1. + <_> + 16 0 1 6 2. + 1 + 0.0338991582393646 + 0.0307075399905443 + -0.7229980826377869 + <_> + + <_> + + + + <_> + 2 17 34 1 -1. + <_> + 2 17 17 1 2. + 0 + -0.0336443893611431 + 0.4266444146633148 + -0.0720057785511017 + <_> + + <_> + + + + <_> + 5 3 18 4 -1. + <_> + 5 4 18 2 2. + 0 + 0.0388077609241009 + -0.0417135208845139 + 0.6599556803703308 + <_> + + <_> + + + + <_> + 34 17 2 1 -1. + <_> + 34 17 1 1 2. + 0 + -3.9149548683781177e-005 + 0.4933550059795380 + -0.2426010966300964 + <_> + + <_> + + + + <_> + 0 0 2 2 -1. + <_> + 0 1 2 1 2. + 0 + -2.7580570895224810e-004 + 0.1791010946035385 + -0.2192519009113312 + <_> + + <_> + + + + <_> + 15 5 16 3 -1. + <_> + 15 6 16 1 3. + 0 + 0.0126366596668959 + -0.0712336227297783 + 0.2534261941909790 + <_> + + <_> + + + + <_> + 13 9 3 3 -1. + <_> + 13 10 3 1 3. + 0 + -3.3681739587336779e-003 + 0.3310086131095886 + -0.1020777970552445 + <_> + + <_> + + + + <_> + 20 4 8 14 -1. + <_> + 22 4 4 14 2. + 0 + -0.0411845296621323 + -0.4787198901176453 + 0.0274448096752167 + <_> + + <_> + + + + <_> + 7 5 20 6 -1. + <_> + 12 5 10 6 2. + 0 + 0.0172852799296379 + -0.2373382002115250 + 0.1541430056095123 + <_> + + <_> + + + + <_> + 26 3 6 6 -1. + <_> + 28 5 2 6 3. + 1 + -0.0583733208477497 + 0.3635525107383728 + -0.0629119277000427 + <_> + + <_> + + + + <_> + 10 3 6 6 -1. + <_> + 8 5 6 2 3. + 1 + 0.0252293199300766 + -0.0943458229303360 + 0.4322442114353180 + <_> + + <_> + + + + <_> + 34 0 2 3 -1. + <_> + 34 0 1 3 2. + 1 + 4.7925519756972790e-003 + 0.0486642718315125 + -0.4704689085483551 + <_> + + <_> + + + + <_> + 0 16 2 2 -1. + <_> + 0 17 2 1 2. + 0 + -1.3549529830925167e-004 + 0.1936188042163849 + -0.1933847069740295 + <_> + + <_> + + + + <_> + 30 6 4 8 -1. + <_> + 31 7 2 8 2. + 1 + -0.0179694108664989 + 0.2900086045265198 + -0.0545452795922756 + <_> + + <_> + + + + <_> + 6 6 7 4 -1. + <_> + 5 7 7 2 2. + 1 + 0.0111410403624177 + -0.1080225035548210 + 0.3332796096801758 + <_> + + <_> + + + + <_> + 20 4 8 14 -1. + <_> + 22 4 4 14 2. + 0 + 0.0397595092654228 + 0.0192408692091703 + -0.4889996051788330 + <_> + + <_> + + + + <_> + 8 4 8 14 -1. + <_> + 10 4 4 14 2. + 0 + -0.0226527098566294 + -0.5036928057670593 + 0.0807737335562706 + <_> + + <_> + + + + <_> + 17 17 6 1 -1. + <_> + 19 17 2 1 3. + 0 + 1.0915650054812431e-003 + 0.0655540525913239 + -0.2444387972354889 + <_> + + <_> + + + + <_> + 0 0 20 6 -1. + <_> + 10 0 10 6 2. + 0 + 0.0687547475099564 + 0.0891968086361885 + -0.3565390110015869 + <_> + + <_> + + + + <_> + 8 0 22 18 -1. + <_> + 8 0 11 18 2. + 0 + -0.3307105898857117 + 0.4649569988250732 + -0.0581836998462677 + <_> + + <_> + + + + <_> + 13 2 8 12 -1. + <_> + 13 2 4 6 2. + <_> + 17 8 4 6 2. + 0 + -0.0193072296679020 + -0.4415718019008637 + 0.0830501168966293 + <_> + + <_> + + + + <_> + 11 10 14 8 -1. + <_> + 18 10 7 4 2. + <_> + 11 14 7 4 2. + 0 + 0.0348087586462498 + 0.0534805804491043 + -0.5037739872932434 + <_> + + <_> + + + + <_> + 1 16 2 2 -1. + <_> + 1 16 1 1 2. + <_> + 2 17 1 1 2. + 0 + -3.8908151327632368e-004 + 0.3427126109600067 + -0.0899231806397438 + <_> + + <_> + + + + <_> + 34 0 2 1 -1. + <_> + 34 0 1 1 2. + 1 + -2.1421869751065969e-003 + -0.6064280271530151 + 0.0555892400443554 + <_> + + <_> + + + + <_> + 6 3 24 4 -1. + <_> + 12 3 12 4 2. + 0 + 0.1101581007242203 + -0.0547747202217579 + 0.6878091096878052 + <_> + + <_> + + + + <_> + 19 1 2 3 -1. + <_> + 19 2 2 1 3. + 0 + 3.0875208904035389e-004 + -0.0558342188596725 + 0.0931682363152504 + <_> + + <_> + + + + <_> + 2 0 1 2 -1. + <_> + 2 0 1 1 2. + 1 + 2.1960400044918060e-003 + 0.0539557486772537 + -0.6050305962562561 + <_> + + <_> + + + + <_> + 15 3 6 8 -1. + <_> + 18 3 3 4 2. + <_> + 15 7 3 4 2. + 0 + -0.0126062501221895 + -0.4686402976512909 + 0.0599438697099686 + <_> + + <_> + + + + <_> + 14 5 4 2 -1. + <_> + 14 6 4 1 2. + 0 + -2.7497899718582630e-003 + 0.2894253134727478 + -0.1129785031080246 + <_> + + <_> + + + + <_> + 3 7 30 9 -1. + <_> + 13 10 10 3 9. + 0 + 0.6096264123916626 + -0.0478859916329384 + 0.5946549177169800 + <_> + + <_> + + + + <_> + 9 8 12 9 -1. + <_> + 12 8 6 9 2. + 0 + 0.0450232513248920 + 0.0638310685753822 + -0.5295680165290833 + -1.2722699642181396 + 16 + -1 + <_> + + + <_> + + <_> + + + + <_> + 10 8 16 5 -1. + <_> + 14 8 8 5 2. + 0 + 0.0159072801470757 + -0.3819232881069183 + 0.2941176891326904 + <_> + + <_> + + + + <_> + 30 1 4 10 -1. + <_> + 31 2 2 10 2. + 1 + -0.0304830092936754 + 0.6401454806327820 + -0.1133823990821838 + <_> + + <_> + + + + <_> + 13 0 10 8 -1. + <_> + 11 2 10 4 2. + 1 + 0.0258412398397923 + -0.1765469014644623 + 0.2556340098381043 + <_> + + <_> + + + + <_> + 32 2 2 14 -1. + <_> + 32 2 1 14 2. + 1 + 0.0121606197208166 + -0.0494619905948639 + 0.3473398983478546 + <_> + + <_> + + + + <_> + 4 2 14 2 -1. + <_> + 4 2 14 1 2. + 1 + -0.0159101597964764 + 0.4796676933765411 + -0.1300950944423676 + <_> + + <_> + + + + <_> + 30 14 6 4 -1. + <_> + 30 14 3 4 2. + 0 + 3.5282061435282230e-004 + -0.3418492972850800 + 0.2309112995862961 + <_> + + <_> + + + + <_> + 11 13 1 4 -1. + <_> + 11 15 1 2 2. + 0 + 6.7633582511916757e-004 + -0.1543250977993012 + 0.2668730020523071 + <_> + + <_> + + + + <_> + 11 0 14 18 -1. + <_> + 18 0 7 9 2. + <_> + 11 9 7 9 2. + 0 + -0.0599361397325993 + -0.4880258142948151 + 0.0933274477720261 + <_> + + <_> + + + + <_> + 0 1 20 9 -1. + <_> + 10 1 10 9 2. + 0 + -0.1134240999817848 + -0.6577144265174866 + 0.0591668188571930 + <_> + + <_> + + + + <_> + 21 3 8 3 -1. + <_> + 23 3 4 3 2. + 0 + -4.3361280113458633e-003 + -0.1593652069568634 + 0.0502370409667492 + <_> + + <_> + + + + <_> + 13 9 2 4 -1. + <_> + 13 10 2 2 2. + 0 + -1.8627740209922194e-003 + 0.3073025941848755 + -0.1254066973924637 + <_> + + <_> + + + + <_> + 14 9 11 2 -1. + <_> + 14 10 11 1 2. + 0 + 0.0126530099660158 + -0.1004493013024330 + 0.3749617934226990 + <_> + + <_> + + + + <_> + 0 2 36 9 -1. + <_> + 12 5 12 3 9. + 0 + 0.6911857724189758 + -0.0471464097499847 + 0.8321244120597839 + <_> + + <_> + + + + <_> + 34 12 2 6 -1. + <_> + 34 15 2 3 2. + 0 + -2.6093868655152619e-004 + 0.3198773860931397 + -0.2718330919742584 + <_> + + <_> + + + + <_> + 11 4 14 6 -1. + <_> + 11 6 14 2 3. + 0 + -0.0763450562953949 + 0.4309130012989044 + -0.0908882692456245 + <_> + + <_> + + + + <_> + 31 0 4 1 -1. + <_> + 31 0 2 1 2. + 0 + 2.8098300099372864e-003 + 0.0587311200797558 + -0.6199675202369690 + <_> + + <_> + + + + <_> + 1 0 4 1 -1. + <_> + 3 0 2 1 2. + 0 + -1.3322039740160108e-004 + 0.2000005990266800 + -0.2012010961771011 + <_> + + <_> + + + + <_> + 19 14 6 4 -1. + <_> + 21 14 2 4 3. + 0 + -0.0137176299467683 + -0.7309545278549194 + 0.0271785296499729 + <_> + + <_> + + + + <_> + 11 14 6 4 -1. + <_> + 13 14 2 4 3. + 0 + -6.2303808517754078e-003 + -0.5478098988533020 + 0.0687499493360519 + <_> + + <_> + + + + <_> + 0 14 36 1 -1. + <_> + 9 14 18 1 2. + 0 + 0.0499227195978165 + -0.0473043099045753 + 0.8242310285568237 + <_> + + <_> + + + + <_> + 5 0 2 2 -1. + <_> + 5 0 2 1 2. + 1 + -1.9126719562336802e-003 + -0.5394017100334168 + 0.0774475932121277 + <_> + + <_> + + + + <_> + 26 3 5 3 -1. + <_> + 26 4 5 1 3. + 0 + 1.1384560493752360e-003 + -0.0965376868844032 + 0.1548569053411484 + <_> + + <_> + + + + <_> + 16 8 1 3 -1. + <_> + 15 9 1 1 3. + 1 + -2.4732090532779694e-003 + 0.3559078872203827 + -0.0931698307394981 + <_> + + <_> + + + + <_> + 21 11 2 3 -1. + <_> + 21 12 2 1 3. + 0 + -7.1464257780462503e-004 + 0.1452019065618515 + -0.0741942077875137 + <_> + + <_> + + + + <_> + 9 5 6 4 -1. + <_> + 8 6 6 2 2. + 1 + -0.0204371493309736 + 0.4416376948356628 + -0.0809424370527267 + <_> + + <_> + + + + <_> + 31 0 2 2 -1. + <_> + 31 0 1 2 2. + 1 + -4.0483791381120682e-003 + -0.5999277830123901 + 0.0330253802239895 + <_> + + <_> + + + + <_> + 6 4 3 9 -1. + <_> + 6 7 3 3 3. + 0 + 0.0111480504274368 + -0.1135832965373993 + 0.3264499902725220 + <_> + + <_> + + + + <_> + 19 0 11 2 -1. + <_> + 19 0 11 1 2. + 1 + 9.8842009902000427e-003 + 0.0554044805467129 + -0.3273097872734070 + <_> + + <_> + + + + <_> + 5 0 2 2 -1. + <_> + 5 0 2 1 2. + 1 + 3.1296359375119209e-003 + 0.0774086564779282 + -0.4595307111740112 + <_> + + <_> + + + + <_> + 22 0 14 4 -1. + <_> + 29 0 7 2 2. + <_> + 22 2 7 2 2. + 0 + 2.9721839819103479e-003 + -0.1291726976633072 + 0.1552311033010483 + <_> + + <_> + + + + <_> + 15 1 4 13 -1. + <_> + 15 1 2 13 2. + 1 + 0.0205544792115688 + 0.0876004695892334 + -0.4577418863773346 + <_> + + <_> + + + + <_> + 21 3 8 4 -1. + <_> + 23 3 4 4 2. + 0 + -0.0230272803455591 + 0.3548808991909027 + -0.0205669198185205 + <_> + + <_> + + + + <_> + 7 3 8 4 -1. + <_> + 9 3 4 4 2. + 0 + -8.3903772756457329e-003 + -0.4324072897434235 + 0.0920679792761803 + <_> + + <_> + + + + <_> + 32 14 2 2 -1. + <_> + 33 14 1 1 2. + <_> + 32 15 1 1 2. + 0 + -1.1431539896875620e-003 + 0.3959133923053742 + -0.0231928899884224 + <_> + + <_> + + + + <_> + 2 14 2 2 -1. + <_> + 2 14 1 1 2. + <_> + 3 15 1 1 2. + 0 + -4.9133709399029613e-004 + 0.4274964034557343 + -0.0855242162942886 + <_> + + <_> + + + + <_> + 35 5 1 12 -1. + <_> + 35 9 1 4 3. + 0 + 5.1292928401380777e-004 + -0.1619673967361450 + 0.1961497068405151 + <_> + + <_> + + + + <_> + 0 7 1 9 -1. + <_> + 0 10 1 3 3. + 0 + -5.8478871360421181e-003 + -0.5911636948585510 + 0.0624482408165932 + <_> + + <_> + + + + <_> + 12 2 15 6 -1. + <_> + 12 4 15 2 3. + 0 + -0.0941330492496490 + 0.4770160913467407 + -0.0567101612687111 + <_> + + <_> + + + + <_> + 0 17 2 1 -1. + <_> + 1 17 1 1 2. + 0 + 1.0079269850393757e-004 + -0.1625709980726242 + 0.2140229046344757 + <_> + + <_> + + + + <_> + 34 17 2 1 -1. + <_> + 34 17 1 1 2. + 0 + 3.2930231100181118e-005 + -0.1859605014324188 + 0.1964769065380096 + <_> + + <_> + + + + <_> + 0 17 2 1 -1. + <_> + 1 17 1 1 2. + 0 + -1.1743210052372888e-004 + 0.3182134926319122 + -0.1328738033771515 + <_> + + <_> + + + + <_> + 11 0 16 10 -1. + <_> + 15 0 8 10 2. + 0 + 0.1275181025266647 + 0.0301400795578957 + -0.7411035895347595 + <_> + + <_> + + + + <_> + 5 10 24 8 -1. + <_> + 5 10 12 4 2. + <_> + 17 14 12 4 2. + 0 + 0.0803262963891029 + 0.0415550395846367 + -0.8263683915138245 + <_> + + <_> + + + + <_> + 27 4 3 3 -1. + <_> + 27 5 3 1 3. + 0 + 1.6904190415516496e-003 + -0.1029061973094940 + 0.2972418069839478 + -1.3022350072860718 + 17 + -1 + <_> + + + <_> + + <_> + + + + <_> + 6 6 14 12 -1. + <_> + 6 6 7 6 2. + <_> + 13 12 7 6 2. + 0 + -0.0461227893829346 + 0.4425258934497833 + -0.2991319894790649 + <_> + + <_> + + + + <_> + 6 5 24 6 -1. + <_> + 14 7 8 2 9. + 0 + 0.3672331869602203 + -0.0630117505788803 + 0.7712538242340088 + <_> + + <_> + + + + <_> + 12 6 3 4 -1. + <_> + 12 7 3 2 2. + 0 + -3.0962929595261812e-003 + 0.3514241874217987 + -0.1730643957853317 + <_> + + <_> + + + + <_> + 30 7 6 10 -1. + <_> + 33 7 3 5 2. + <_> + 30 12 3 5 2. + 0 + 9.2647131532430649e-003 + -0.1607280969619751 + 0.1853290945291519 + <_> + + <_> + + + + <_> + 3 12 6 6 -1. + <_> + 3 12 3 3 2. + <_> + 6 15 3 3 2. + 0 + 3.1748649198561907e-003 + -0.1968899965286255 + 0.2409728020429611 + <_> + + <_> + + + + <_> + 20 0 13 2 -1. + <_> + 20 0 13 1 2. + 1 + 8.0439839512109756e-003 + 0.0898629724979401 + -0.3655225932598114 + <_> + + <_> + + + + <_> + 6 10 24 6 -1. + <_> + 14 12 8 2 9. + 0 + 0.3275249004364014 + -0.0568796806037426 + 0.7749336957931519 + <_> + + <_> + + + + <_> + 15 4 8 8 -1. + <_> + 19 4 4 4 2. + <_> + 15 8 4 4 2. + 0 + -0.0190744306892157 + -0.2895380854606628 + 0.0622916705906391 + <_> + + <_> + + + + <_> + 13 4 8 8 -1. + <_> + 13 4 4 4 2. + <_> + 17 8 4 4 2. + 0 + -0.0205017495900393 + -0.6262530088424683 + 0.0682769715785980 + <_> + + <_> + + + + <_> + 34 16 2 2 -1. + <_> + 34 16 1 2 2. + 0 + 5.3187010053079575e-005 + -0.2514955997467041 + 0.2613196074962616 + <_> + + <_> + + + + <_> + 12 6 3 3 -1. + <_> + 12 7 3 1 3. + 0 + 3.3275580499321222e-003 + -0.1199077963829041 + 0.3651930093765259 + <_> + + <_> + + + + <_> + 21 7 4 4 -1. + <_> + 21 8 4 2 2. + 0 + 5.8408430777490139e-003 + -0.0827485173940659 + 0.2365082055330277 + <_> + + <_> + + + + <_> + 2 8 30 4 -1. + <_> + 2 8 15 2 2. + <_> + 17 10 15 2 2. + 0 + -0.0464623309671879 + -0.6928564906120300 + 0.0781976729631424 + <_> + + <_> + + + + <_> + 27 4 3 4 -1. + <_> + 27 5 3 2 2. + 0 + -3.7785700988024473e-003 + 0.3437257111072540 + -0.1027545034885407 + <_> + + <_> + + + + <_> + 5 4 3 4 -1. + <_> + 5 5 3 2 2. + 0 + 1.6655459767207503e-003 + -0.1160527989268303 + 0.3716202974319458 + <_> + + <_> + + + + <_> + 34 16 2 2 -1. + <_> + 34 16 1 2 2. + 0 + -5.7107670727418736e-005 + 0.4589366912841797 + -0.2123643010854721 + <_> + + <_> + + + + <_> + 0 16 34 2 -1. + <_> + 0 16 17 1 2. + <_> + 17 17 17 1 2. + 0 + -9.0066380798816681e-003 + -0.5953341126441956 + 0.0808764025568962 + <_> + + <_> + + + + <_> + 12 5 15 12 -1. + <_> + 12 9 15 4 3. + 0 + -0.1378971040248871 + 0.3957067131996155 + -0.0898853763937950 + <_> + + <_> + + + + <_> + 0 8 36 6 -1. + <_> + 12 10 12 2 9. + 0 + 0.5759987235069275 + -0.0538108199834824 + 0.8170394897460938 + <_> + + <_> + + + + <_> + 25 4 6 2 -1. + <_> + 25 5 6 1 2. + 0 + -2.3918158840388060e-003 + 0.1393374055624008 + -0.0421559289097786 + <_> + + <_> + + + + <_> + 0 17 2 1 -1. + <_> + 1 17 1 1 2. + 0 + 2.4896071408875287e-004 + -0.1485866010189056 + 0.2626332938671112 + <_> + + <_> + + + + <_> + 16 0 9 9 -1. + <_> + 19 0 3 9 3. + 0 + 0.0330624915659428 + 0.0306599102914333 + -0.3231860101222992 + <_> + + <_> + + + + <_> + 11 0 9 9 -1. + <_> + 14 0 3 9 3. + 0 + 0.0443218797445297 + 0.0478538200259209 + -0.7813590168952942 + <_> + + <_> + + + + <_> + 20 5 16 5 -1. + <_> + 24 5 8 5 2. + 0 + -0.0187181904911995 + 0.1201262027025223 + -0.1121146976947784 + <_> + + <_> + + + + <_> + 0 3 16 9 -1. + <_> + 4 3 8 9 2. + 0 + 0.0923093706369400 + 0.0424630790948868 + -0.8009700179100037 + <_> + + <_> + + + + <_> + 7 6 26 12 -1. + <_> + 20 6 13 6 2. + <_> + 7 12 13 6 2. + 0 + 0.0906654372811317 + -0.0223045293241739 + 0.1284797936677933 + <_> + + <_> + + + + <_> + 5 6 24 12 -1. + <_> + 5 6 12 6 2. + <_> + 17 12 12 6 2. + 0 + -0.0582949295639992 + -0.3936854004859924 + 0.0954821407794952 + <_> + + <_> + + + + <_> + 17 4 3 12 -1. + <_> + 18 4 1 12 3. + 0 + 4.6649780124425888e-003 + -0.0656419470906258 + 0.3640717864036560 + <_> + + <_> + + + + <_> + 1 11 6 1 -1. + <_> + 3 13 2 1 3. + 1 + 5.2480432204902172e-003 + 0.0687657818198204 + -0.5050830245018005 + <_> + + <_> + + + + <_> + 21 12 14 2 -1. + <_> + 28 12 7 1 2. + <_> + 21 13 7 1 2. + 0 + 2.5315659586340189e-003 + -0.0933471694588661 + 0.1649612933397293 + <_> + + <_> + + + + <_> + 1 13 2 3 -1. + <_> + 2 13 1 3 2. + 0 + 2.4391160695813596e-004 + -0.1888543963432312 + 0.1695670038461685 + <_> + + <_> + + + + <_> + 26 8 3 2 -1. + <_> + 27 9 1 2 3. + 1 + -6.3037211075425148e-003 + 0.3826352953910828 + -0.0590420998632908 + <_> + + <_> + + + + <_> + 10 8 2 3 -1. + <_> + 9 9 2 1 3. + 1 + 2.2754059173166752e-003 + -0.1224882006645203 + 0.2828365862369537 + <_> + + <_> + + + + <_> + 12 0 18 18 -1. + <_> + 12 0 9 18 2. + 0 + -0.2769486904144287 + 0.4851497113704681 + -0.0404825396835804 + <_> + + <_> + + + + <_> + 8 9 3 3 -1. + <_> + 7 10 3 1 3. + 1 + 5.8051547966897488e-003 + -0.0835584178566933 + 0.4215149879455566 + <_> + + <_> + + + + <_> + 28 5 5 6 -1. + <_> + 28 7 5 2 3. + 0 + 2.4654529988765717e-003 + -0.1281685978174210 + 0.2077662944793701 + <_> + + <_> + + + + <_> + 9 1 9 8 -1. + <_> + 9 1 9 4 2. + 1 + 7.8863510861992836e-003 + -0.1719754040241242 + 0.2079081982374191 + <_> + + <_> + + + + <_> + 0 0 36 2 -1. + <_> + 18 0 18 1 2. + <_> + 0 1 18 1 2. + 0 + -0.0118171302601695 + -0.5788066983222961 + 0.0589591413736343 + <_> + + <_> + + + + <_> + 5 0 26 6 -1. + <_> + 5 0 13 3 2. + <_> + 18 3 13 3 2. + 0 + -0.0641399174928665 + -0.6368926167488098 + 0.0417975001037121 + <_> + + <_> + + + + <_> + 28 3 3 3 -1. + <_> + 28 4 3 1 3. + 0 + -1.2179970508441329e-003 + 0.2356870025396347 + -0.0805152580142021 + <_> + + <_> + + + + <_> + 5 3 5 3 -1. + <_> + 5 4 5 1 3. + 0 + 2.8652620967477560e-003 + -0.0931371971964836 + 0.3902595043182373 + <_> + + <_> + + + + <_> + 14 12 8 2 -1. + <_> + 16 12 4 2 2. + 0 + -5.7746102102100849e-003 + -0.5753986835479736 + 0.0596776902675629 + <_> + + <_> + + + + <_> + 13 0 9 14 -1. + <_> + 16 0 3 14 3. + 0 + 0.0653770864009857 + 0.0341660715639591 + -0.7425342202186585 + <_> + + <_> + + + + <_> + 23 0 10 1 -1. + <_> + 23 0 5 1 2. + 1 + 0.0162657108157873 + 0.0536542609333992 + -0.2365860939025879 + <_> + + <_> + + + + <_> + 8 14 2 2 -1. + <_> + 8 14 1 2 2. + 1 + 2.2717609535902739e-003 + 0.0533591099083424 + -0.5494074225425720 + <_> + + <_> + + + + <_> + 0 12 36 3 -1. + <_> + 12 13 12 1 9. + 0 + 0.2262602001428604 + -0.0420460589230061 + 0.7791252136230469 + <_> + + <_> + + + + <_> + 0 13 34 4 -1. + <_> + 0 13 17 2 2. + <_> + 17 15 17 2 2. + 0 + -0.0293774604797363 + -0.5947058796882629 + 0.0548178702592850 + -1.1933319568634033 + 18 + -1 + diff --git a/doc/tutorials/introduction/android_binary_package/O4A_SDK.rst b/doc/tutorials/introduction/android_binary_package/O4A_SDK.rst index 3730a8f402..b37126f308 100644 --- a/doc/tutorials/introduction/android_binary_package/O4A_SDK.rst +++ b/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: - /platform-tools/adb install /apk/OpenCV_2.4.4_Manager_armv7a-neon.apk + /platform-tools/adb install /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. \ No newline at end of file +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. diff --git a/doc/tutorials/introduction/android_binary_package/android_dev_intro.rst b/doc/tutorials/introduction/android_binary_package/android_dev_intro.rst index 021561e8cb..9545bee286 100644 --- a/doc/tutorials/introduction/android_binary_package/android_dev_intro.rst +++ b/doc/tutorials/introduction/android_binary_package/android_dev_intro.rst @@ -103,8 +103,8 @@ You need the following software to be installed in order to develop for Android Here is Google's `install guide `_ 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! @@ -112,15 +112,15 @@ You need the following software to be installed in order to develop for Android 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 `_ 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 `_. diff --git a/doc/tutorials/introduction/android_binary_package/images/eclipse_10_crystal_clean.png b/doc/tutorials/introduction/android_binary_package/images/eclipse_10_crystal_clean.png index 18e14d1c0f..499247a482 100644 Binary files a/doc/tutorials/introduction/android_binary_package/images/eclipse_10_crystal_clean.png and b/doc/tutorials/introduction/android_binary_package/images/eclipse_10_crystal_clean.png differ diff --git a/doc/tutorials/introduction/android_binary_package/images/eclipse_7_select_projects.png b/doc/tutorials/introduction/android_binary_package/images/eclipse_7_select_projects.png index 0c5a4bb12d..e152bc4ed2 100644 Binary files a/doc/tutorials/introduction/android_binary_package/images/eclipse_7_select_projects.png and b/doc/tutorials/introduction/android_binary_package/images/eclipse_7_select_projects.png differ diff --git a/doc/tutorials/introduction/android_binary_package/images/eclipse_cdt_cfg4.png b/doc/tutorials/introduction/android_binary_package/images/eclipse_cdt_cfg4.png index 633e3d2943..f8126b5b56 100644 Binary files a/doc/tutorials/introduction/android_binary_package/images/eclipse_cdt_cfg4.png and b/doc/tutorials/introduction/android_binary_package/images/eclipse_cdt_cfg4.png differ diff --git a/doc/tutorials/introduction/android_binary_package/images/emulator_canny.png b/doc/tutorials/introduction/android_binary_package/images/emulator_canny.png index 1bc0511318..d08340be9c 100644 Binary files a/doc/tutorials/introduction/android_binary_package/images/emulator_canny.png and b/doc/tutorials/introduction/android_binary_package/images/emulator_canny.png differ diff --git a/doc/tutorials/introduction/desktop_java/images/eclipse_run.png b/doc/tutorials/introduction/desktop_java/images/eclipse_run.png index 2efc8e6715..fee34afa10 100644 Binary files a/doc/tutorials/introduction/desktop_java/images/eclipse_run.png and b/doc/tutorials/introduction/desktop_java/images/eclipse_run.png differ diff --git a/doc/tutorials/introduction/desktop_java/java_dev_intro.rst b/doc/tutorials/introduction/desktop_java/java_dev_intro.rst index 2bb50f00ed..3676871449 100644 --- a/doc/tutorials/introduction/desktop_java/java_dev_intro.rst +++ b/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 `_. @@ -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 `_), `Apache Ant `_ 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 - + @@ -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 /build/bin/opencv_.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. diff --git a/modules/gpu/perf/perf_calib3d.cpp b/modules/gpu/perf/perf_calib3d.cpp index 906024f640..b174d9a12e 100644 --- a/modules/gpu/perf/perf_calib3d.cpp +++ b/modules/gpu/perf/perf_calib3d.cpp @@ -3,15 +3,14 @@ using namespace std; using namespace testing; -namespace { - ////////////////////////////////////////////////////////////////////// // StereoBM typedef std::tr1::tuple 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,18 +27,13 @@ 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; + const cv::gpu::GpuMat d_imgLeft(imgLeft); + const cv::gpu::GpuMat d_imgRight(imgRight); + cv::gpu::GpuMat dst; - d_bm(d_imgLeft, d_imgRight, d_dst); + TEST_CYCLE() d_bm(d_imgLeft, d_imgRight, dst); - TEST_CYCLE() - { - d_bm(d_imgLeft, d_imgRight, d_dst); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { @@ -47,12 +41,7 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(pair_string("gpu/perf/aloe.png", 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; + const cv::gpu::GpuMat d_imgLeft(imgLeft); + const cv::gpu::GpuMat d_imgRight(imgRight); + cv::gpu::GpuMat dst; - d_csbp(d_imgLeft, d_imgRight, d_dst); + TEST_CYCLE() d_csbp(d_imgLeft, d_imgRight, dst); - TEST_CYCLE() - { - d_csbp(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(); } } ////////////////////////////////////////////////////////////////////// // 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,45 +152,42 @@ 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; + const cv::gpu::GpuMat d_src(src); + cv::gpu::GpuMat dst; - cv::gpu::transformPoints(d_src, rvec, tvec, d_dst); + TEST_CYCLE() cv::gpu::transformPoints(d_src, rvec, tvec, dst); - TEST_CYCLE() - { - cv::gpu::transformPoints(d_src, rvec, tvec, d_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); @@ -221,28 +195,18 @@ PERF_TEST_P(Count, Calib3D_ProjectPoints, Values(5000, 10000, 20000)) 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,17 +215,18 @@ 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(0, 1) = 0.f; camera_mat.at(1, 0) = 0.f; camera_mat.at(2, 0) = 0.f; @@ -269,79 +234,66 @@ PERF_TEST_P(Count, Calib3D_SolvePnPRansac, Values(5000, 10000, 20000)) const cv::Mat dist_coef(1, 8, CV_32F, cv::Scalar::all(0)); - std::vector 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 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 diff --git a/modules/gpu/perf/perf_core.cpp b/modules/gpu/perf/perf_core.cpp index b97c4999cd..22840f9f46 100644 --- a/modules/gpu/perf/perf_core.cpp +++ b/modules/gpu/perf/perf_core.cpp @@ -2,15 +2,17 @@ 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); @@ -18,7 +20,10 @@ PERF_TEST_P(Sz_Depth_Cn, Core_Merge, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_D std::vector 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()) { @@ -26,11 +31,11 @@ PERF_TEST_P(Sz_Depth_Cn, Core_Merge, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_D 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 { @@ -38,31 +43,37 @@ PERF_TEST_P(Sz_Depth_Cn, Core_Merge, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_D 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 dst; - std::vector 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 { @@ -70,33 +81,39 @@ PERF_TEST_P(Sz_Depth_Cn, Core_Split, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_D 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 { @@ -104,31 +121,34 @@ PERF_TEST_P(Sz_Depth, Core_AddMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEP 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 { @@ -136,33 +156,35 @@ PERF_TEST_P(Sz_Depth, Core_AddScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_ 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 { @@ -170,31 +192,34 @@ PERF_TEST_P(Sz_Depth, Core_SubtractMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MA 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 { @@ -202,33 +227,35 @@ PERF_TEST_P(Sz_Depth, Core_SubtractScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM 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 { @@ -236,33 +263,34 @@ PERF_TEST_P(Sz_Depth, Core_MultiplyMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MA 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 { @@ -270,33 +298,35 @@ PERF_TEST_P(Sz_Depth, Core_MultiplyScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM 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 { @@ -304,31 +334,34 @@ PERF_TEST_P(Sz_Depth, Core_DivideMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_ 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 { @@ -336,31 +369,34 @@ PERF_TEST_P(Sz_Depth, Core_DivideScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_M 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 { @@ -368,33 +404,35 @@ PERF_TEST_P(Sz_Depth, Core_DivideScalarInv, Combine(GPU_TYPICAL_MAT_SIZES, ARITH 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 { @@ -402,31 +440,34 @@ PERF_TEST_P(Sz_Depth, Core_AbsDiffMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT 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 { @@ -434,75 +475,87 @@ PERF_TEST_P(Sz_Depth, Core_AbsDiffScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_ 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 { @@ -510,29 +563,31 @@ PERF_TEST_P(Sz_Depth, Core_Sqrt, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV 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 { @@ -540,37 +595,39 @@ PERF_TEST_P(Sz_Depth, Core_Log, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_ 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); 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::bitwise_not(d_src,d_dst); + TEST_CYCLE() cv::gpu::bitwise_not(d_src, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - TEST_CYCLE() cv::bitwise_not(src,dst); + TEST_CYCLE() cv::bitwise_not(src, dst); CPU_SANITY_CHECK(dst); } @@ -713,39 +782,46 @@ PERF_TEST_P(Sz_Depth, Core_BitwiseNot, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_ ////////////////////////////////////////////////////////////////////// // BitwiseAndMat -PERF_TEST_P(Sz_Depth, Core_BitwiseAndMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S))) +PERF_TEST_P(Sz_Depth, Core_BitwiseAndMat, + 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 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::bitwise_and(d_src1, d_src2,d_dst); + TEST_CYCLE() cv::gpu::bitwise_and(d_src1, d_src2, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - TEST_CYCLE() cv::bitwise_and(src1, src2,dst); + TEST_CYCLE() cv::bitwise_and(src1, src2, dst); + + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // BitwiseAndScalar -PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseAndScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseAndScalar, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32S), + GPU_CHANNELS_1_3_4)) { const cv::Size size = GET_PARAM(0); const int depth = GET_PARAM(1); @@ -754,24 +830,26 @@ PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseAndScalar, Combine(GPU_TYPICAL_MAT_SIZES, V const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); - cv::Scalar s = cv::Scalar::all(100); + cv::Scalar s; + declare.in(s, WARMUP_RNG); + cv::Scalar_ is = s; 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::bitwise_and(d_src, s,d_dst); + TEST_CYCLE() cv::gpu::bitwise_and(d_src, is, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - TEST_CYCLE() cv::bitwise_and(src, s,dst); + TEST_CYCLE() cv::bitwise_and(src, is, dst); CPU_SANITY_CHECK(dst); } @@ -780,32 +858,34 @@ PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseAndScalar, Combine(GPU_TYPICAL_MAT_SIZES, V ////////////////////////////////////////////////////////////////////// // BitwiseOrMat -PERF_TEST_P(Sz_Depth, Core_BitwiseOrMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S))) +PERF_TEST_P(Sz_Depth, Core_BitwiseOrMat, + 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 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::bitwise_or(d_src1, d_src2,d_dst); + TEST_CYCLE() cv::gpu::bitwise_or(d_src1, d_src2, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - TEST_CYCLE() cv::bitwise_or(src1, src2,dst); + TEST_CYCLE() cv::bitwise_or(src1, src2, dst); CPU_SANITY_CHECK(dst); } @@ -814,7 +894,10 @@ PERF_TEST_P(Sz_Depth, Core_BitwiseOrMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(C ////////////////////////////////////////////////////////////////////// // BitwiseOrScalar -PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseOrScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseOrScalar, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32S), + GPU_CHANNELS_1_3_4)) { const cv::Size size = GET_PARAM(0); const int depth = GET_PARAM(1); @@ -823,24 +906,26 @@ PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseOrScalar, Combine(GPU_TYPICAL_MAT_SIZES, Va const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); - cv::Scalar s = cv::Scalar::all(100); + cv::Scalar s; + declare.in(s, WARMUP_RNG); + cv::Scalar_ is = s; 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::bitwise_or(d_src, s,d_dst); + TEST_CYCLE() cv::gpu::bitwise_or(d_src, is, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - TEST_CYCLE() cv::bitwise_or(src, s,dst); + TEST_CYCLE() cv::bitwise_or(src, is, dst); CPU_SANITY_CHECK(dst); } @@ -849,39 +934,46 @@ PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseOrScalar, Combine(GPU_TYPICAL_MAT_SIZES, Va ////////////////////////////////////////////////////////////////////// // BitwiseXorMat -PERF_TEST_P(Sz_Depth, Core_BitwiseXorMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S))) +PERF_TEST_P(Sz_Depth, Core_BitwiseXorMat, + 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 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::bitwise_xor(d_src1, d_src2,d_dst); + TEST_CYCLE() cv::gpu::bitwise_xor(d_src1, d_src2, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - TEST_CYCLE() cv::bitwise_xor(src1, src2,dst); + TEST_CYCLE() cv::bitwise_xor(src1, src2, dst); + + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // BitwiseXorScalar -PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseXorScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseXorScalar, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32S), + GPU_CHANNELS_1_3_4)) { const cv::Size size = GET_PARAM(0); const int depth = GET_PARAM(1); @@ -890,24 +982,26 @@ PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseXorScalar, Combine(GPU_TYPICAL_MAT_SIZES, V const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); - cv::Scalar s = cv::Scalar::all(100); + cv::Scalar s; + declare.in(s, WARMUP_RNG); + cv::Scalar_ is = s; 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::bitwise_xor(d_src, s,d_dst); + TEST_CYCLE() cv::gpu::bitwise_xor(d_src, is, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - TEST_CYCLE() cv::bitwise_xor(src, s,dst); + TEST_CYCLE() cv::bitwise_xor(src, is, dst); CPU_SANITY_CHECK(dst); } @@ -916,7 +1010,10 @@ PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseXorScalar, Combine(GPU_TYPICAL_MAT_SIZES, V ////////////////////////////////////////////////////////////////////// // RShift -PERF_TEST_P(Sz_Depth_Cn, Core_RShift, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, Core_RShift, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32S), + GPU_CHANNELS_1_3_4)) { const cv::Size size = GET_PARAM(0); const int depth = GET_PARAM(1); @@ -925,18 +1022,18 @@ PERF_TEST_P(Sz_Depth_Cn, Core_RShift, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8 const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); const cv::Scalar_ val = cv::Scalar_::all(4); 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::rshift(d_src, val,d_dst); + TEST_CYCLE() cv::gpu::rshift(d_src, val, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { @@ -947,7 +1044,10 @@ PERF_TEST_P(Sz_Depth_Cn, Core_RShift, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8 ////////////////////////////////////////////////////////////////////// // LShift -PERF_TEST_P(Sz_Depth_Cn, Core_LShift, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, Core_LShift, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32S), + GPU_CHANNELS_1_3_4)) { const cv::Size size = GET_PARAM(0); const int depth = GET_PARAM(1); @@ -956,18 +1056,18 @@ PERF_TEST_P(Sz_Depth_Cn, Core_LShift, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8 const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); const cv::Scalar_ val = cv::Scalar_::all(4); 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::lshift(d_src, val,d_dst); + TEST_CYCLE() cv::gpu::lshift(d_src, val, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { @@ -978,32 +1078,34 @@ PERF_TEST_P(Sz_Depth_Cn, Core_LShift, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8 ////////////////////////////////////////////////////////////////////// // MinMat -PERF_TEST_P(Sz_Depth, Core_MinMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F))) +PERF_TEST_P(Sz_Depth, Core_MinMat, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F))) { 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::min(d_src1, d_src2,d_dst); + TEST_CYCLE() cv::gpu::min(d_src1, d_src2, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - TEST_CYCLE() cv::min(src1, src2,dst); + TEST_CYCLE() cv::min(src1, src2, dst); CPU_SANITY_CHECK(dst); } @@ -1012,30 +1114,33 @@ PERF_TEST_P(Sz_Depth, Core_MinMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, ////////////////////////////////////////////////////////////////////// // MinScalar -PERF_TEST_P(Sz_Depth, Core_MinScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F))) +PERF_TEST_P(Sz_Depth, Core_MinScalar, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, 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); - const double val = 50.0; + cv::Scalar val; + declare.in(val, 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::min(d_src, val,d_dst); + TEST_CYCLE() cv::gpu::min(d_src, val[0], dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - TEST_CYCLE() cv::min(src, val,dst); + TEST_CYCLE() cv::min(src, val[0], dst); CPU_SANITY_CHECK(dst); } @@ -1044,32 +1149,34 @@ PERF_TEST_P(Sz_Depth, Core_MinScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8 ////////////////////////////////////////////////////////////////////// // MaxMat -PERF_TEST_P(Sz_Depth, Core_MaxMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F))) +PERF_TEST_P(Sz_Depth, Core_MaxMat, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F))) { 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::max(d_src1, d_src2,d_dst); + TEST_CYCLE() cv::gpu::max(d_src1, d_src2, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - TEST_CYCLE() cv::max(src1, src2,dst); + TEST_CYCLE() cv::max(src1, src2, dst); CPU_SANITY_CHECK(dst); } @@ -1078,30 +1185,33 @@ PERF_TEST_P(Sz_Depth, Core_MaxMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, ////////////////////////////////////////////////////////////////////// // MaxScalar -PERF_TEST_P(Sz_Depth, Core_MaxScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F))) +PERF_TEST_P(Sz_Depth, Core_MaxScalar, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, 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); - const double val = 50.0; + cv::Scalar val; + declare.in(val, 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::max(d_src, val,d_dst); + TEST_CYCLE() cv::gpu::max(d_src, val[0], dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - TEST_CYCLE() cv::max(src, val,dst); + TEST_CYCLE() cv::max(src, val[0], dst); CPU_SANITY_CHECK(dst); } @@ -1112,11 +1222,11 @@ PERF_TEST_P(Sz_Depth, Core_MaxScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8 DEF_PARAM_TEST(Sz_3Depth, cv::Size, MatDepth, MatDepth, MatDepth); -PERF_TEST_P(Sz_3Depth, Core_AddWeighted, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F, CV_64F), - Values(CV_8U, CV_16U, CV_32F, CV_64F), - Values(CV_8U, CV_16U, CV_32F, CV_64F))) +PERF_TEST_P(Sz_3Depth, Core_AddWeighted, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F, CV_64F), + Values(CV_8U, CV_16U, CV_32F, CV_64F), + Values(CV_8U, CV_16U, CV_32F, CV_64F))) { const cv::Size size = GET_PARAM(0); const int depth1 = GET_PARAM(1); @@ -1124,20 +1234,20 @@ PERF_TEST_P(Sz_3Depth, Core_AddWeighted, Combine( const int dst_depth = GET_PARAM(3); cv::Mat src1(size, depth1); - fillRandom(src1); + declare.in(src1, WARMUP_RNG); cv::Mat src2(size, depth2); - 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::addWeighted(d_src1, 0.5, d_src2, 0.5, 10.0, d_dst, dst_depth); + TEST_CYCLE() cv::gpu::addWeighted(d_src1, 0.5, d_src2, 0.5, 10.0, dst, dst_depth); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1e-10); } else { @@ -1157,76 +1267,76 @@ CV_FLAGS(GemmFlags, 0, cv::GEMM_1_T, cv::GEMM_2_T, cv::GEMM_3_T) DEF_PARAM_TEST(Sz_Type_Flags, cv::Size, MatType, GemmFlags); -PERF_TEST_P(Sz_Type_Flags, Core_GEMM, Combine( - Values(cv::Size(512, 512), cv::Size(1024, 1024)), - Values(CV_32FC1, CV_32FC2, CV_64FC1, CV_64FC2), - ALL_GEMM_FLAGS)) +PERF_TEST_P(Sz_Type_Flags, Core_GEMM, + Combine(Values(cv::Size(512, 512), cv::Size(1024, 1024)), + Values(CV_32FC1, CV_32FC2, CV_64FC1), + ALL_GEMM_FLAGS)) { - declare.time(5.0); - const cv::Size size = GET_PARAM(0); const int type = GET_PARAM(1); const int flags = GET_PARAM(2); cv::Mat src1(size, type); - fillRandom(src1); + declare.in(src1, WARMUP_RNG); cv::Mat src2(size, type); - fillRandom(src2); + declare.in(src2, WARMUP_RNG); cv::Mat src3(size, type); - fillRandom(src3); + declare.in(src3, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src1(src1); - cv::gpu::GpuMat d_src2(src2); - cv::gpu::GpuMat d_src3(src3); - cv::gpu::GpuMat d_dst; + declare.time(5.0); - TEST_CYCLE() cv::gpu::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst, flags); + const cv::gpu::GpuMat d_src1(src1); + const cv::gpu::GpuMat d_src2(src2); + const cv::gpu::GpuMat d_src3(src3); + cv::gpu::GpuMat dst; - GPU_SANITY_CHECK(d_dst, 1e-8); + TEST_CYCLE() cv::gpu::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, dst, flags); + + GPU_SANITY_CHECK(dst, 1e-6); } else { - cv::Mat dst; - declare.time(50.0); + cv::Mat dst; + TEST_CYCLE() cv::gemm(src1, src2, 1.0, src3, 1.0, dst, flags); - CPU_SANITY_CHECK(dst, 1e-8); + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // Transpose -PERF_TEST_P(Sz_Type, Core_Transpose, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8UC1, CV_8UC4, CV_16UC2, CV_16SC2, CV_32SC1, CV_32SC2, CV_64FC1))) +PERF_TEST_P(Sz_Type, Core_Transpose, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8UC1, CV_8UC4, CV_16UC2, CV_16SC2, CV_32SC1, CV_32SC2, CV_64FC1))) { - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); cv::Mat src(size, type); - 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::transpose(d_src,d_dst); + TEST_CYCLE() cv::gpu::transpose(d_src, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1e-10); } else { cv::Mat dst; - TEST_CYCLE() cv::transpose(src,dst); + TEST_CYCLE() cv::transpose(src, dst); CPU_SANITY_CHECK(dst); } @@ -1241,30 +1351,30 @@ CV_ENUM(FlipCode, FLIP_BOTH, FLIP_X, FLIP_Y) DEF_PARAM_TEST(Sz_Depth_Cn_Code, cv::Size, MatDepth, MatCn, FlipCode); -PERF_TEST_P(Sz_Depth_Cn_Code, Core_Flip, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4, - ALL_FLIP_CODES)) +PERF_TEST_P(Sz_Depth_Cn_Code, Core_Flip, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4, + ALL_FLIP_CODES)) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); - int flipCode = GET_PARAM(3); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int channels = GET_PARAM(2); + const int flipCode = GET_PARAM(3); - int type = CV_MAKE_TYPE(depth, channels); + const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - 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::flip(d_src, d_dst, flipCode); + TEST_CYCLE() cv::gpu::flip(d_src, dst, flipCode); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { @@ -1279,27 +1389,27 @@ PERF_TEST_P(Sz_Depth_Cn_Code, Core_Flip, Combine( ////////////////////////////////////////////////////////////////////// // LutOneChannel -PERF_TEST_P(Sz_Type, Core_LutOneChannel, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8UC1, CV_8UC3))) +PERF_TEST_P(Sz_Type, Core_LutOneChannel, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8UC1, CV_8UC3))) { - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); cv::Mat lut(1, 256, CV_8UC1); - fillRandom(lut); + declare.in(lut, 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::LUT(d_src, lut,d_dst); + TEST_CYCLE() cv::gpu::LUT(d_src, lut, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { @@ -1314,27 +1424,27 @@ PERF_TEST_P(Sz_Type, Core_LutOneChannel, Combine( ////////////////////////////////////////////////////////////////////// // LutMultiChannel -PERF_TEST_P(Sz_Type, Core_LutMultiChannel, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8UC3))) +PERF_TEST_P(Sz_Type, Core_LutMultiChannel, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8UC3))) { - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); cv::Mat lut(1, 256, CV_MAKE_TYPE(CV_8U, src.channels())); - fillRandom(lut); + declare.in(lut, 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::LUT(d_src, lut,d_dst); + TEST_CYCLE() cv::gpu::LUT(d_src, lut, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { @@ -1349,21 +1459,22 @@ PERF_TEST_P(Sz_Type, Core_LutMultiChannel, Combine( ////////////////////////////////////////////////////////////////////// // MagnitudeComplex -PERF_TEST_P(Sz, Core_MagnitudeComplex, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, Core_MagnitudeComplex, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); cv::Mat src(size, CV_32FC2); - fillRandom(src, -100.0, 100.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::magnitude(d_src,d_dst); + TEST_CYCLE() cv::gpu::magnitude(d_src, dst); - GPU_SANITY_CHECK(d_dst, 1e-8); + GPU_SANITY_CHECK(dst); } else { @@ -1374,28 +1485,29 @@ PERF_TEST_P(Sz, Core_MagnitudeComplex, GPU_TYPICAL_MAT_SIZES) TEST_CYCLE() cv::magnitude(xy[0], xy[1], dst); - CPU_SANITY_CHECK(dst, 1e-8); + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // MagnitudeSqrComplex -PERF_TEST_P(Sz, Core_MagnitudeSqrComplex, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, Core_MagnitudeSqrComplex, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); cv::Mat src(size, CV_32FC2); - fillRandom(src, -100.0, 100.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::magnitudeSqr(d_src, d_dst); + TEST_CYCLE() cv::gpu::magnitudeSqr(d_src, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { @@ -1406,25 +1518,26 @@ PERF_TEST_P(Sz, Core_MagnitudeSqrComplex, GPU_TYPICAL_MAT_SIZES) ////////////////////////////////////////////////////////////////////// // Magnitude -PERF_TEST_P(Sz, Core_Magnitude, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, Core_Magnitude, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); cv::Mat src1(size, CV_32FC1); - fillRandom(src1, -100.0, 100.0); + declare.in(src1, WARMUP_RNG); cv::Mat src2(size, CV_32FC1); - fillRandom(src2, -100.0, 100.0); + 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::magnitude(d_src1, d_src2, d_dst); + TEST_CYCLE() cv::gpu::magnitude(d_src1, d_src2, dst); - GPU_SANITY_CHECK(d_dst, 1e-8); + GPU_SANITY_CHECK(dst); } else { @@ -1432,33 +1545,33 @@ PERF_TEST_P(Sz, Core_Magnitude, GPU_TYPICAL_MAT_SIZES) TEST_CYCLE() cv::magnitude(src1, src2, dst); - CPU_SANITY_CHECK(dst, 1e-8); - + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // MagnitudeSqr -PERF_TEST_P(Sz, Core_MagnitudeSqr, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, Core_MagnitudeSqr, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); cv::Mat src1(size, CV_32FC1); - fillRandom(src1, -100.0, 100.0); + declare.in(src1, WARMUP_RNG); cv::Mat src2(size, CV_32FC1); - fillRandom(src2, -100.0, 100.0); + 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::magnitudeSqr(d_src1, d_src2, d_dst); + TEST_CYCLE() cv::gpu::magnitudeSqr(d_src1, d_src2, dst); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { @@ -1471,26 +1584,28 @@ PERF_TEST_P(Sz, Core_MagnitudeSqr, GPU_TYPICAL_MAT_SIZES) DEF_PARAM_TEST(Sz_AngleInDegrees, cv::Size, bool); -PERF_TEST_P(Sz_AngleInDegrees, Core_Phase, Combine(GPU_TYPICAL_MAT_SIZES, Bool())) +PERF_TEST_P(Sz_AngleInDegrees, Core_Phase, + Combine(GPU_TYPICAL_MAT_SIZES, + Bool())) { - cv::Size size = GET_PARAM(0); - bool angleInDegrees = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const bool angleInDegrees = GET_PARAM(1); cv::Mat src1(size, CV_32FC1); - fillRandom(src1, -100.0, 100.0); + declare.in(src1, WARMUP_RNG); cv::Mat src2(size, CV_32FC1); - fillRandom(src2, -100.0, 100.0); + 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::phase(d_src1, d_src2, d_dst, angleInDegrees); + TEST_CYCLE() cv::gpu::phase(d_src1, d_src2, dst, angleInDegrees); - GPU_SANITY_CHECK(d_dst, 1e-8); + GPU_SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE); } else { @@ -1498,36 +1613,37 @@ PERF_TEST_P(Sz_AngleInDegrees, Core_Phase, Combine(GPU_TYPICAL_MAT_SIZES, Bool() TEST_CYCLE() cv::phase(src1, src2, dst, angleInDegrees); - CPU_SANITY_CHECK(dst, 1e-8); + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // CartToPolar -PERF_TEST_P(Sz_AngleInDegrees, Core_CartToPolar, Combine(GPU_TYPICAL_MAT_SIZES, Bool())) +PERF_TEST_P(Sz_AngleInDegrees, Core_CartToPolar, + Combine(GPU_TYPICAL_MAT_SIZES, + Bool())) { - cv::Size size = GET_PARAM(0); - bool angleInDegrees = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const bool angleInDegrees = GET_PARAM(1); cv::Mat src1(size, CV_32FC1); - fillRandom(src1, -100.0, 100.0); + declare.in(src1, WARMUP_RNG); cv::Mat src2(size, CV_32FC1); - fillRandom(src2, -100.0, 100.0); + 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_magnitude; - cv::gpu::GpuMat d_angle; + const cv::gpu::GpuMat d_src1(src1); + const cv::gpu::GpuMat d_src2(src2); + cv::gpu::GpuMat magnitude; + cv::gpu::GpuMat angle; - TEST_CYCLE() cv::gpu::cartToPolar(d_src1, d_src2, d_magnitude, d_angle, angleInDegrees); - - GPU_SANITY_CHECK(d_magnitude, 1e-8); - GPU_SANITY_CHECK(d_angle, 1e-8); + TEST_CYCLE() cv::gpu::cartToPolar(d_src1, d_src2, magnitude, angle, angleInDegrees); + GPU_SANITY_CHECK(magnitude); + GPU_SANITY_CHECK(angle, 1e-6, ERROR_RELATIVE); } else { @@ -1536,36 +1652,38 @@ PERF_TEST_P(Sz_AngleInDegrees, Core_CartToPolar, Combine(GPU_TYPICAL_MAT_SIZES, TEST_CYCLE() cv::cartToPolar(src1, src2, magnitude, angle, angleInDegrees); - CPU_SANITY_CHECK(magnitude, 1e-8); - CPU_SANITY_CHECK(angle, 1e-8); + CPU_SANITY_CHECK(magnitude); + CPU_SANITY_CHECK(angle); } } ////////////////////////////////////////////////////////////////////// // PolarToCart -PERF_TEST_P(Sz_AngleInDegrees, Core_PolarToCart, Combine(GPU_TYPICAL_MAT_SIZES, Bool())) +PERF_TEST_P(Sz_AngleInDegrees, Core_PolarToCart, + Combine(GPU_TYPICAL_MAT_SIZES, + Bool())) { - cv::Size size = GET_PARAM(0); - bool angleInDegrees = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const bool angleInDegrees = GET_PARAM(1); cv::Mat magnitude(size, CV_32FC1); - fillRandom(magnitude, 0.0, 100.0); + declare.in(magnitude, WARMUP_RNG); cv::Mat angle(size, CV_32FC1); - fillRandom(angle, 0.0, angleInDegrees ? 360.0 : 2 * CV_PI); + declare.in(angle, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_magnitude(magnitude); - cv::gpu::GpuMat d_angle(angle); - cv::gpu::GpuMat d_x; - cv::gpu::GpuMat d_y; + const cv::gpu::GpuMat d_magnitude(magnitude); + const cv::gpu::GpuMat d_angle(angle); + cv::gpu::GpuMat x; + cv::gpu::GpuMat y; - TEST_CYCLE() cv::gpu::polarToCart(d_magnitude, d_angle, d_x, d_y, angleInDegrees); + TEST_CYCLE() cv::gpu::polarToCart(d_magnitude, d_angle, x, y, angleInDegrees); - GPU_SANITY_CHECK(d_x, 1e-8); - GPU_SANITY_CHECK(d_y, 1e-8); + GPU_SANITY_CHECK(x); + GPU_SANITY_CHECK(y); } else { @@ -1574,37 +1692,45 @@ PERF_TEST_P(Sz_AngleInDegrees, Core_PolarToCart, Combine(GPU_TYPICAL_MAT_SIZES, TEST_CYCLE() cv::polarToCart(magnitude, angle, x, y, angleInDegrees); - CPU_SANITY_CHECK(x, 1e-8); - CPU_SANITY_CHECK(y, 1e-8); + CPU_SANITY_CHECK(x); + CPU_SANITY_CHECK(y); } } ////////////////////////////////////////////////////////////////////// // MeanStdDev -PERF_TEST_P(Sz, Core_MeanStdDev, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, Core_MeanStdDev, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); cv::Mat src(size, CV_8UC1); - fillRandom(src); + declare.in(src, WARMUP_RNG); - cv::Scalar mean; - cv::Scalar stddev; if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat d_buf; + cv::Scalar gpu_mean; + cv::Scalar gpu_stddev; - TEST_CYCLE() cv::gpu::meanStdDev(d_src, mean, stddev, d_buf); + TEST_CYCLE() cv::gpu::meanStdDev(d_src, gpu_mean, gpu_stddev, d_buf); + + SANITY_CHECK(gpu_mean); + SANITY_CHECK(gpu_stddev); } else { - TEST_CYCLE() cv::meanStdDev(src, mean, stddev); - } + cv::Scalar cpu_mean; + cv::Scalar cpu_stddev; - GPU_SANITY_CHECK(stddev, 1e-6); + TEST_CYCLE() cv::meanStdDev(src, cpu_mean, cpu_stddev); + + SANITY_CHECK(cpu_mean); + SANITY_CHECK(cpu_stddev); + } } ////////////////////////////////////////////////////////////////////// @@ -1612,33 +1738,36 @@ PERF_TEST_P(Sz, Core_MeanStdDev, GPU_TYPICAL_MAT_SIZES) DEF_PARAM_TEST(Sz_Depth_Norm, cv::Size, MatDepth, NormType); -PERF_TEST_P(Sz_Depth_Norm, Core_Norm, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32S, CV_32F), - Values(NormType(cv::NORM_INF), NormType(cv::NORM_L1), NormType(cv::NORM_L2)))) +PERF_TEST_P(Sz_Depth_Norm, Core_Norm, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32S, CV_32F), + Values(NormType(cv::NORM_INF), NormType(cv::NORM_L1), NormType(cv::NORM_L2)))) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int normType = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int normType = GET_PARAM(2); cv::Mat src(size, depth); - fillRandom(src); - - double dst; + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat d_buf; + double gpu_dst; - TEST_CYCLE() dst = cv::gpu::norm(d_src, normType, cv::gpu::GpuMat(), d_buf); + TEST_CYCLE() gpu_dst = cv::gpu::norm(d_src, normType, d_buf); + + SANITY_CHECK(gpu_dst, 1e-6, ERROR_RELATIVE); } else { - TEST_CYCLE() dst = cv::norm(src, normType); - } + double cpu_dst; - SANITY_CHECK(dst, 1e-6); + TEST_CYCLE() cpu_dst = cv::norm(src, normType); + + SANITY_CHECK(cpu_dst, 1e-6, ERROR_RELATIVE); + } } ////////////////////////////////////////////////////////////////////// @@ -1646,99 +1775,103 @@ PERF_TEST_P(Sz_Depth_Norm, Core_Norm, Combine( DEF_PARAM_TEST(Sz_Norm, cv::Size, NormType); -PERF_TEST_P(Sz_Norm, Core_NormDiff, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(NormType(cv::NORM_INF), NormType(cv::NORM_L1), NormType(cv::NORM_L2)))) +PERF_TEST_P(Sz_Norm, Core_NormDiff, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(NormType(cv::NORM_INF), NormType(cv::NORM_L1), NormType(cv::NORM_L2)))) { - cv::Size size = GET_PARAM(0); - int normType = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int normType = GET_PARAM(1); cv::Mat src1(size, CV_8UC1); - fillRandom(src1); + declare.in(src1, WARMUP_RNG); cv::Mat src2(size, CV_8UC1); - fillRandom(src2); - - double dst; + declare.in(src2, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src1(src1); - cv::gpu::GpuMat d_src2(src2); + const cv::gpu::GpuMat d_src1(src1); + const cv::gpu::GpuMat d_src2(src2); + double gpu_dst; - TEST_CYCLE() dst = cv::gpu::norm(d_src1, d_src2, normType); + TEST_CYCLE() gpu_dst = cv::gpu::norm(d_src1, d_src2, normType); + + SANITY_CHECK(gpu_dst); } else { - TEST_CYCLE() dst = cv::norm(src1, src2, normType); - } + double cpu_dst; - SANITY_CHECK(dst, 1e-6); + TEST_CYCLE() cpu_dst = cv::norm(src1, src2, normType); + + SANITY_CHECK(cpu_dst); + } } ////////////////////////////////////////////////////////////////////// // Sum -PERF_TEST_P(Sz_Depth_Cn, Core_Sum, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, Core_Sum, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4)) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + 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); - fillRandom(src); - - cv::Scalar dst; + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat d_buf; + cv::Scalar gpu_dst; - TEST_CYCLE() dst = cv::gpu::sum(d_src, cv::gpu::GpuMat(), d_buf); + TEST_CYCLE() gpu_dst = cv::gpu::sum(d_src, d_buf); + + SANITY_CHECK(gpu_dst, 1e-5, ERROR_RELATIVE); } else { - TEST_CYCLE() dst = cv::sum(src); - } + cv::Scalar cpu_dst; - double error = (depth == CV_32F) ? 3e+1 : 1e-6; - SANITY_CHECK(dst, error); + TEST_CYCLE() cpu_dst = cv::sum(src); + + SANITY_CHECK(cpu_dst, 1e-6, ERROR_RELATIVE); + } } ////////////////////////////////////////////////////////////////////// // SumAbs -PERF_TEST_P(Sz_Depth_Cn, Core_SumAbs, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, Core_SumAbs, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4)) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + 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); - fillRandom(src); - - cv::Scalar dst; + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat d_buf; + cv::Scalar gpu_dst; - TEST_CYCLE() dst = cv::gpu::absSum(d_src, cv::gpu::GpuMat(), d_buf); + TEST_CYCLE() gpu_dst = cv::gpu::absSum(d_src, d_buf); - SANITY_CHECK(dst, 1e-6); + SANITY_CHECK(gpu_dst, 1e-6, ERROR_RELATIVE); } else { @@ -1749,30 +1882,29 @@ PERF_TEST_P(Sz_Depth_Cn, Core_SumAbs, Combine( ////////////////////////////////////////////////////////////////////// // SumSqr -PERF_TEST_P(Sz_Depth_Cn, Core_SumSqr, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, Core_SumSqr, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4)) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + 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); - fillRandom(src); - - cv::Scalar dst; + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat d_buf; + cv::Scalar gpu_dst; - TEST_CYCLE() dst = cv::gpu::sqrSum(d_src, cv::gpu::GpuMat(), d_buf); + TEST_CYCLE() gpu_dst = cv::gpu::sqrSum(d_src, d_buf); - SANITY_CHECK(dst, 1e-6); + SANITY_CHECK(gpu_dst, 1e-6, ERROR_RELATIVE); } else { @@ -1783,98 +1915,106 @@ PERF_TEST_P(Sz_Depth_Cn, Core_SumSqr, Combine( ////////////////////////////////////////////////////////////////////// // MinMax -PERF_TEST_P(Sz_Depth, Core_MinMax, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F, CV_64F))) +PERF_TEST_P(Sz_Depth, Core_MinMax, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F, CV_64F))) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); cv::Mat src(size, depth); - fillRandom(src); - - double minVal, maxVal; + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat d_buf; + double gpu_minVal, gpu_maxVal; - TEST_CYCLE() cv::gpu::minMax(d_src, &minVal, &maxVal, cv::gpu::GpuMat(), d_buf); + TEST_CYCLE() cv::gpu::minMax(d_src, &gpu_minVal, &gpu_maxVal, cv::gpu::GpuMat(), d_buf); - SANITY_CHECK(minVal); - SANITY_CHECK(maxVal); + SANITY_CHECK(gpu_minVal, 1e-10); + SANITY_CHECK(gpu_maxVal, 1e-10); } else { - FAIL_NO_CPU(); + double cpu_minVal, cpu_maxVal; + + TEST_CYCLE() cv::minMaxLoc(src, &cpu_minVal, &cpu_maxVal); + + SANITY_CHECK(cpu_minVal); + SANITY_CHECK(cpu_maxVal); } } ////////////////////////////////////////////////////////////////////// // MinMaxLoc -PERF_TEST_P(Sz_Depth, Core_MinMaxLoc, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F, CV_64F))) +PERF_TEST_P(Sz_Depth, Core_MinMaxLoc, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F, CV_64F))) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); cv::Mat src(size, depth); - fillRandom(src); - - double minVal, maxVal; - cv::Point minLoc, maxLoc; + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat d_valbuf, d_locbuf; + double gpu_minVal, gpu_maxVal; + cv::Point gpu_minLoc, gpu_maxLoc; - TEST_CYCLE() cv::gpu::minMaxLoc(d_src, &minVal, &maxVal, &minLoc, &maxLoc, cv::gpu::GpuMat(), d_valbuf, d_locbuf); + TEST_CYCLE() cv::gpu::minMaxLoc(d_src, &gpu_minVal, &gpu_maxVal, &gpu_minLoc, &gpu_maxLoc, cv::gpu::GpuMat(), d_valbuf, d_locbuf); + + SANITY_CHECK(gpu_minVal, 1e-10); + SANITY_CHECK(gpu_maxVal, 1e-10); } else { - TEST_CYCLE() cv::minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc); + double cpu_minVal, cpu_maxVal; + cv::Point cpu_minLoc, cpu_maxLoc; + + TEST_CYCLE() cv::minMaxLoc(src, &cpu_minVal, &cpu_maxVal, &cpu_minLoc, &cpu_maxLoc); + + SANITY_CHECK(cpu_minVal); + SANITY_CHECK(cpu_maxVal); } - - SANITY_CHECK(minVal, 1e-12); - SANITY_CHECK(maxVal, 1e-12); - - // unsupported by peft system - //SANITY_CHECK(minLoc); - //SANITY_CHECK(maxLoc); } ////////////////////////////////////////////////////////////////////// // CountNonZero -PERF_TEST_P(Sz_Depth, Core_CountNonZero, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F, CV_64F))) +PERF_TEST_P(Sz_Depth, Core_CountNonZero, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F, CV_64F))) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); cv::Mat src(size, depth); - fillRandom(src); - - int dst = 0; + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat d_buf; + int gpu_dst = 0; - TEST_CYCLE() dst = cv::gpu::countNonZero(d_src, d_buf); + TEST_CYCLE() gpu_dst = cv::gpu::countNonZero(d_src, d_buf); + + SANITY_CHECK(gpu_dst); } else { - TEST_CYCLE() dst = cv::countNonZero(src); - } + int cpu_dst = 0; - SANITY_CHECK(dst); + TEST_CYCLE() cpu_dst = cv::countNonZero(src); + + SANITY_CHECK(cpu_dst); + } } ////////////////////////////////////////////////////////////////////// @@ -1889,32 +2029,32 @@ CV_ENUM(ReduceDim, Rows, Cols) DEF_PARAM_TEST(Sz_Depth_Cn_Code_Dim, cv::Size, MatDepth, MatCn, ReduceCode, ReduceDim); -PERF_TEST_P(Sz_Depth_Cn_Code_Dim, Core_Reduce, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_16S, CV_32F), - Values(1, 2, 3, 4), - ALL_REDUCE_CODES, - ALL_REDUCE_DIMS)) +PERF_TEST_P(Sz_Depth_Cn_Code_Dim, Core_Reduce, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_16S, CV_32F), + Values(1, 2, 3, 4), + ALL_REDUCE_CODES, + ALL_REDUCE_DIMS)) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); - int reduceOp = GET_PARAM(3); - int dim = GET_PARAM(4); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int channels = GET_PARAM(2); + const int reduceOp = GET_PARAM(3); + const int dim = GET_PARAM(4); - int type = CV_MAKE_TYPE(depth, channels); + const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - 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::reduce(d_src, d_dst, dim, reduceOp); + TEST_CYCLE() cv::gpu::reduce(d_src, dst, dim, reduceOp); - GPU_SANITY_CHECK(d_dst, 1); + GPU_SANITY_CHECK(dst); } else { @@ -1922,43 +2062,41 @@ PERF_TEST_P(Sz_Depth_Cn_Code_Dim, Core_Reduce, Combine( TEST_CYCLE() cv::reduce(src, dst, dim, reduceOp); - CPU_SANITY_CHECK(dst, 1); + CPU_SANITY_CHECK(dst); } } - ////////////////////////////////////////////////////////////////////// // Normalize DEF_PARAM_TEST(Sz_Depth_NormType, cv::Size, MatDepth, NormType); -PERF_TEST_P(Sz_Depth_NormType, Core_Normalize, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F, CV_64F), - Values(NormType(cv::NORM_INF), - NormType(cv::NORM_L1), - NormType(cv::NORM_L2), - NormType(cv::NORM_MINMAX)) - )) +PERF_TEST_P(Sz_Depth_NormType, Core_Normalize, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F, CV_64F), + Values(NormType(cv::NORM_INF), + NormType(cv::NORM_L1), + NormType(cv::NORM_L2), + NormType(cv::NORM_MINMAX)))) { - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); - int norm_type = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); + const int norm_type = GET_PARAM(2); - double alpha = 1; - double beta = 0; + const double alpha = 1; + const double beta = 0; cv::Mat src(size, type); - 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; cv::gpu::GpuMat d_norm_buf, d_cvt_buf; - TEST_CYCLE() cv::gpu::normalize(d_src, d_dst, alpha, beta, norm_type, type, cv::gpu::GpuMat(), d_norm_buf, d_cvt_buf); + TEST_CYCLE() cv::gpu::normalize(d_src, dst, alpha, beta, norm_type, type, cv::gpu::GpuMat(), d_norm_buf, d_cvt_buf); - GPU_SANITY_CHECK(d_dst, 1); + GPU_SANITY_CHECK(dst, 1e-6); } else { @@ -1966,8 +2104,6 @@ PERF_TEST_P(Sz_Depth_NormType, Core_Normalize, Combine( TEST_CYCLE() cv::normalize(src, dst, alpha, beta, norm_type, type); - CPU_SANITY_CHECK(dst, 1); + CPU_SANITY_CHECK(dst); } } - -} // namespace diff --git a/modules/gpu/perf/perf_denoising.cpp b/modules/gpu/perf/perf_denoising.cpp index ed63177ddb..6f03994bd9 100644 --- a/modules/gpu/perf/perf_denoising.cpp +++ b/modules/gpu/perf/perf_denoising.cpp @@ -3,8 +3,7 @@ using namespace std; 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 @@ -12,96 +11,86 @@ using namespace testing; DEF_PARAM_TEST(Sz_Depth_Cn_KernelSz, cv::Size, MatDepth, MatCn, int); 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); - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); - int kernel_size = GET_PARAM(3); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int channels = GET_PARAM(2); + const int kernel_size = GET_PARAM(3); - float sigma_color = 7; - float sigma_spatial = 5; - int borderMode = cv::BORDER_REFLECT101; + const float sigma_color = 7; + const float sigma_spatial = 5; + 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); - 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; + const cv::gpu::GpuMat d_src(src); + cv::gpu::GpuMat dst; - cv::gpu::bilateralFilter(d_src, d_dst, kernel_size, sigma_color, sigma_spatial, borderMode); + TEST_CYCLE() cv::gpu::bilateralFilter(d_src, dst, kernel_size, sigma_color, sigma_spatial, borderMode); - TEST_CYCLE() - { - cv::gpu::bilateralFilter(d_src, d_dst, kernel_size, sigma_color, sigma_spatial, borderMode); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { 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); } } - ////////////////////////////////////////////////////////////////////// // nonLocalMeans DEF_PARAM_TEST(Sz_Depth_Cn_WinSz_BlockSz, cv::Size, MatDepth, MatCn, int, int); PERF_TEST_P(Sz_Depth_Cn_WinSz_BlockSz, Denoising_NonLocalMeans, - Combine(GPU_DENOISING_IMAGE_SIZES, Values(CV_8U), GPU_CHANNELS_1_3, Values(21), Values(5, 7))) + Combine(GPU_DENOISING_IMAGE_SIZES, + Values(CV_8U), + GPU_CHANNELS_1_3, + Values(21), + Values(5))) { declare.time(60.0); - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int channels = GET_PARAM(2); + const int search_widow_size = GET_PARAM(3); + const int block_size = GET_PARAM(4); - int search_widow_size = GET_PARAM(3); - int block_size = GET_PARAM(4); + const float h = 10; + const int borderMode = cv::BORDER_REFLECT101; - float h = 10; - 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); - 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; - 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 { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } @@ -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); PERF_TEST_P(Sz_Depth_Cn_WinSz_BlockSz, Denoising_FastNonLocalMeans, - Combine(GPU_DENOISING_IMAGE_SIZES, Values(CV_8U), GPU_CHANNELS_1_3, Values(21), Values(7))) + Combine(GPU_DENOISING_IMAGE_SIZES, + Values(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); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int search_widow_size = GET_PARAM(2); + const int block_size = GET_PARAM(3); - int search_widow_size = GET_PARAM(2); - int block_size = GET_PARAM(3); - - float h = 10; - int type = CV_MAKE_TYPE(depth, 1); + const float h = 10; + const int type = CV_MAKE_TYPE(depth, 1); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); - cv::gpu::GpuMat d_dst; 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() - { - fnlmd.simpleMethod(d_src, d_dst, h, search_widow_size, block_size); - } + TEST_CYCLE() fnlmd.simpleMethod(d_src, dst, h, search_widow_size, block_size); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::fastNlMeansDenoising(src, dst, h, block_size, search_widow_size); - TEST_CYCLE() - { - cv::fastNlMeansDenoising(src, dst, h, block_size, search_widow_size); - } + TEST_CYCLE() cv::fastNlMeansDenoising(src, dst, h, block_size, search_widow_size); CPU_SANITY_CHECK(dst); } @@ -163,47 +147,41 @@ PERF_TEST_P(Sz_Depth_Cn_WinSz_BlockSz, Denoising_FastNonLocalMeans, DEF_PARAM_TEST(Sz_Depth_WinSz_BlockSz, cv::Size, MatDepth, int, int); PERF_TEST_P(Sz_Depth_WinSz_BlockSz, Denoising_FastNonLocalMeansColored, - Combine(GPU_DENOISING_IMAGE_SIZES, Values(CV_8U), Values(21), Values(7))) + Combine(GPU_DENOISING_IMAGE_SIZES, + Values(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); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int search_widow_size = GET_PARAM(2); + const int block_size = GET_PARAM(3); - int search_widow_size = GET_PARAM(2); - int block_size = GET_PARAM(3); - - float h = 10; - int type = CV_MAKE_TYPE(depth, 3); + const float h = 10; + const int type = CV_MAKE_TYPE(depth, 3); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); - cv::gpu::GpuMat d_dst; 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() - { - fnlmd.labMethod(d_src, d_dst, h, h, search_widow_size, block_size); - } + TEST_CYCLE() fnlmd.labMethod(d_src, dst, h, h, search_widow_size, block_size); - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::fastNlMeansDenoisingColored(src, dst, h, h, block_size, search_widow_size); - TEST_CYCLE() - { - cv::fastNlMeansDenoisingColored(src, dst, h, h, block_size, search_widow_size); - } + TEST_CYCLE() cv::fastNlMeansDenoisingColored(src, dst, h, h, block_size, search_widow_size); CPU_SANITY_CHECK(dst); } -} \ No newline at end of file +} diff --git a/modules/gpu/perf/perf_features2d.cpp b/modules/gpu/perf/perf_features2d.cpp index a93cef9b33..480f582383 100644 --- a/modules/gpu/perf/perf_features2d.cpp +++ b/modules/gpu/perf/perf_features2d.cpp @@ -3,139 +3,194 @@ using namespace std; using namespace testing; -namespace { +struct KeypointIdxCompare +{ + std::vector* keypoints; + + explicit KeypointIdxCompare(std::vector* _keypoints) : keypoints(_keypoints) {} + + bool operator ()(size_t i1, size_t i2) const + { + cv::KeyPoint kp1 = (*keypoints)[i1]; + cv::KeyPoint kp2 = (*keypoints)[i2]; + if (kp1.pt.x != kp2.pt.x) + return kp1.pt.x < kp2.pt.x; + if (kp1.pt.y != kp2.pt.y) + return kp1.pt.y < kp2.pt.y; + if (kp1.response != kp2.response) + return kp1.response < kp2.response; + return kp1.octave < kp2.octave; + } +}; + +static void sortKeyPoints(std::vector& keypoints, cv::InputOutputArray _descriptors = cv::noArray()) +{ + std::vector indexies(keypoints.size()); + for (size_t i = 0; i < indexies.size(); ++i) + indexies[i] = i; + + std::sort(indexies.begin(), indexies.end(), KeypointIdxCompare(&keypoints)); + + std::vector new_keypoints; + cv::Mat new_descriptors; + + new_keypoints.resize(keypoints.size()); + + cv::Mat descriptors; + if (_descriptors.needed()) + { + descriptors = _descriptors.getMat(); + new_descriptors.create(descriptors.size(), descriptors.type()); + } + + for (size_t i = 0; i < indexies.size(); ++i) + { + size_t new_idx = indexies[i]; + new_keypoints[i] = keypoints[new_idx]; + if (!new_descriptors.empty()) + descriptors.row((int) new_idx).copyTo(new_descriptors.row((int) i)); + } + + keypoints.swap(new_keypoints); + if (_descriptors.needed()) + new_descriptors.copyTo(_descriptors); +} ////////////////////////////////////////////////////////////////////// // SURF DEF_PARAM_TEST_1(Image, string); -PERF_TEST_P(Image, Features2D_SURF, Values("gpu/perf/aloe.png")) +PERF_TEST_P(Image, Features2D_SURF, + Values("gpu/perf/aloe.png")) { declare.time(50.0); - cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE); + const cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); if (PERF_RUN_GPU()) { cv::gpu::SURF_GPU d_surf; - cv::gpu::GpuMat d_img(img); + const cv::gpu::GpuMat d_img(img); cv::gpu::GpuMat d_keypoints, d_descriptors; - d_surf(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors); + TEST_CYCLE() d_surf(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors); - TEST_CYCLE() - { - d_surf(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors); - } + std::vector gpu_keypoints; + d_surf.downloadKeypoints(d_keypoints, gpu_keypoints); - GPU_SANITY_CHECK(d_descriptors, 1e-4); - GPU_SANITY_CHECK_KEYPOINTS(SURF, d_keypoints); + cv::Mat gpu_descriptors(d_descriptors); + + sortKeyPoints(gpu_keypoints, gpu_descriptors); + + SANITY_CHECK_KEYPOINTS(gpu_keypoints); + SANITY_CHECK(gpu_descriptors, 1e-3); } else { cv::SURF surf; - std::vector keypoints; - cv::Mat descriptors; + std::vector cpu_keypoints; + cv::Mat cpu_descriptors; - surf(img, cv::noArray(), keypoints, descriptors); + TEST_CYCLE() surf(img, cv::noArray(), cpu_keypoints, cpu_descriptors); - TEST_CYCLE() - { - keypoints.clear(); - surf(img, cv::noArray(), keypoints, descriptors); - } - - SANITY_CHECK_KEYPOINTS(keypoints); - SANITY_CHECK(descriptors, 1e-4); + SANITY_CHECK_KEYPOINTS(cpu_keypoints); + SANITY_CHECK(cpu_descriptors); } } ////////////////////////////////////////////////////////////////////// // FAST -PERF_TEST_P(Image, Features2D_FAST, Values("gpu/perf/aloe.png")) +DEF_PARAM_TEST(Image_Threshold_NonMaxSupression, string, int, bool); + +PERF_TEST_P(Image_Threshold_NonMaxSupression, Features2D_FAST, + Combine(Values("gpu/perf/aloe.png"), + Values(20), + Bool())) { - cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE); + const cv::Mat img = readImage(GET_PARAM(0), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); + const int threshold = GET_PARAM(1); + const bool nonMaxSuppersion = GET_PARAM(2); + if (PERF_RUN_GPU()) { - cv::gpu::FAST_GPU d_fast(20); + cv::gpu::FAST_GPU d_fast(threshold, nonMaxSuppersion, 0.5); - cv::gpu::GpuMat d_img(img); + const cv::gpu::GpuMat d_img(img); cv::gpu::GpuMat d_keypoints; - d_fast(d_img, cv::gpu::GpuMat(), d_keypoints); + TEST_CYCLE() d_fast(d_img, cv::gpu::GpuMat(), d_keypoints); - TEST_CYCLE() - { - d_fast(d_img, cv::gpu::GpuMat(), d_keypoints); - } + std::vector gpu_keypoints; + d_fast.downloadKeypoints(d_keypoints, gpu_keypoints); - GPU_SANITY_CHECK_RESPONSE(FAST, d_keypoints); + sortKeyPoints(gpu_keypoints); + + SANITY_CHECK_KEYPOINTS(gpu_keypoints); } else { - std::vector keypoints; + std::vector cpu_keypoints; - cv::FAST(img, keypoints, 20); + TEST_CYCLE() cv::FAST(img, cpu_keypoints, threshold, nonMaxSuppersion); - TEST_CYCLE() - { - keypoints.clear(); - cv::FAST(img, keypoints, 20); - } - - SANITY_CHECK_KEYPOINTS(keypoints); + SANITY_CHECK_KEYPOINTS(cpu_keypoints); } } ////////////////////////////////////////////////////////////////////// // ORB -PERF_TEST_P(Image, Features2D_ORB, Values("gpu/perf/aloe.png")) +DEF_PARAM_TEST(Image_NFeatures, string, int); + +PERF_TEST_P(Image_NFeatures, Features2D_ORB, + Combine(Values("gpu/perf/aloe.png"), + Values(4000))) { - cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE); + const cv::Mat img = readImage(GET_PARAM(0), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); + const int nFeatures = GET_PARAM(1); + if (PERF_RUN_GPU()) { - cv::gpu::ORB_GPU d_orb(4000); + cv::gpu::ORB_GPU d_orb(nFeatures); - cv::gpu::GpuMat d_img(img); + const cv::gpu::GpuMat d_img(img); cv::gpu::GpuMat d_keypoints, d_descriptors; - d_orb(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors); + TEST_CYCLE() d_orb(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors); - TEST_CYCLE() - { - d_orb(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors); - } + std::vector gpu_keypoints; + d_orb.downloadKeyPoints(d_keypoints, gpu_keypoints); - GPU_SANITY_CHECK_KEYPOINTS(ORB, d_keypoints); - GPU_SANITY_CHECK(d_descriptors); + cv::Mat gpu_descriptors(d_descriptors); + + gpu_keypoints.resize(10); + gpu_descriptors = gpu_descriptors.rowRange(0, 10); + + sortKeyPoints(gpu_keypoints, gpu_descriptors); + + SANITY_CHECK_KEYPOINTS(gpu_keypoints); + SANITY_CHECK(gpu_descriptors); } else { - cv::ORB orb(4000); + cv::ORB orb(nFeatures); - std::vector keypoints; - cv::Mat descriptors; + std::vector cpu_keypoints; + cv::Mat cpu_descriptors; - orb(img, cv::noArray(), keypoints, descriptors); + TEST_CYCLE() orb(img, cv::noArray(), cpu_keypoints, cpu_descriptors); - TEST_CYCLE() - { - keypoints.clear(); - orb(img, cv::noArray(), keypoints, descriptors); - } - - SANITY_CHECK_KEYPOINTS(keypoints); - SANITY_CHECK(descriptors); + SANITY_CHECK_KEYPOINTS(cpu_keypoints); + SANITY_CHECK(cpu_descriptors); } } @@ -144,166 +199,165 @@ PERF_TEST_P(Image, Features2D_ORB, Values("gpu/perf/aloe.png")) DEF_PARAM_TEST(DescSize_Norm, int, NormType); -PERF_TEST_P(DescSize_Norm, Features2D_BFMatch, Combine(Values(64, 128, 256), Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING)))) +PERF_TEST_P(DescSize_Norm, Features2D_BFMatch, + Combine(Values(64, 128, 256), + Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING)))) { declare.time(20.0); - int desc_size = GET_PARAM(0); - int normType = GET_PARAM(1); + const int desc_size = GET_PARAM(0); + const int normType = GET_PARAM(1); - int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F; + const int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F; cv::Mat query(3000, desc_size, type); - fillRandom(query); + declare.in(query, WARMUP_RNG); cv::Mat train(3000, desc_size, type); - fillRandom(train); + declare.in(train, WARMUP_RNG); if (PERF_RUN_GPU()) { cv::gpu::BFMatcher_GPU d_matcher(normType); - cv::gpu::GpuMat d_query(query); - cv::gpu::GpuMat d_train(train); + const cv::gpu::GpuMat d_query(query); + const cv::gpu::GpuMat d_train(train); cv::gpu::GpuMat d_trainIdx, d_distance; - d_matcher.matchSingle(d_query, d_train, d_trainIdx, d_distance); + TEST_CYCLE() d_matcher.matchSingle(d_query, d_train, d_trainIdx, d_distance); - TEST_CYCLE() - { - d_matcher.matchSingle(d_query, d_train, d_trainIdx, d_distance); - } + std::vector gpu_matches; + d_matcher.matchDownload(d_trainIdx, d_distance, gpu_matches); - GPU_SANITY_CHECK(d_trainIdx); - GPU_SANITY_CHECK(d_distance); + SANITY_CHECK_MATCHES(gpu_matches); } else { cv::BFMatcher matcher(normType); - std::vector matches; + std::vector cpu_matches; - matcher.match(query, train, matches); + TEST_CYCLE() matcher.match(query, train, cpu_matches); - TEST_CYCLE() - { - matcher.match(query, train, matches); - } - - SANITY_CHECK(matches); + SANITY_CHECK_MATCHES(cpu_matches); } } ////////////////////////////////////////////////////////////////////// // BFKnnMatch +static void toOneRowMatches(const std::vector< std::vector >& src, std::vector& dst) +{ + dst.clear(); + for (size_t i = 0; i < src.size(); ++i) + for (size_t j = 0; j < src[i].size(); ++j) + dst.push_back(src[i][j]); +} + DEF_PARAM_TEST(DescSize_K_Norm, int, int, NormType); -PERF_TEST_P(DescSize_K_Norm, Features2D_BFKnnMatch, Combine( - Values(64, 128, 256), - Values(2, 3), - Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING)))) +PERF_TEST_P(DescSize_K_Norm, Features2D_BFKnnMatch, + Combine(Values(64, 128, 256), + Values(2, 3), + Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2)))) { declare.time(30.0); - int desc_size = GET_PARAM(0); - int k = GET_PARAM(1); - int normType = GET_PARAM(2); + const int desc_size = GET_PARAM(0); + const int k = GET_PARAM(1); + const int normType = GET_PARAM(2); - int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F; + const int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F; cv::Mat query(3000, desc_size, type); - fillRandom(query); + declare.in(query, WARMUP_RNG); cv::Mat train(3000, desc_size, type); - fillRandom(train); + declare.in(train, WARMUP_RNG); if (PERF_RUN_GPU()) { cv::gpu::BFMatcher_GPU d_matcher(normType); - cv::gpu::GpuMat d_query(query); - cv::gpu::GpuMat d_train(train); + const cv::gpu::GpuMat d_query(query); + const cv::gpu::GpuMat d_train(train); cv::gpu::GpuMat d_trainIdx, d_distance, d_allDist; - d_matcher.knnMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_allDist, k); + TEST_CYCLE() d_matcher.knnMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_allDist, k); - TEST_CYCLE() - { - d_matcher.knnMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_allDist, k); - } + std::vector< std::vector > matchesTbl; + d_matcher.knnMatchDownload(d_trainIdx, d_distance, matchesTbl); - GPU_SANITY_CHECK(d_trainIdx); - GPU_SANITY_CHECK(d_distance); + std::vector gpu_matches; + toOneRowMatches(matchesTbl, gpu_matches); + + SANITY_CHECK_MATCHES(gpu_matches); } else { cv::BFMatcher matcher(normType); - std::vector< std::vector > matches; + std::vector< std::vector > matchesTbl; - matcher.knnMatch(query, train, matches, k); + TEST_CYCLE() matcher.knnMatch(query, train, matchesTbl, k); - TEST_CYCLE() - { - matcher.knnMatch(query, train, matches, k); - } + std::vector cpu_matches; + toOneRowMatches(matchesTbl, cpu_matches); - SANITY_CHECK(matches); + SANITY_CHECK_MATCHES(cpu_matches); } } ////////////////////////////////////////////////////////////////////// // BFRadiusMatch -PERF_TEST_P(DescSize_Norm, Features2D_BFRadiusMatch, Combine(Values(64, 128, 256), Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING)))) +PERF_TEST_P(DescSize_Norm, Features2D_BFRadiusMatch, + Combine(Values(64, 128, 256), + Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2)))) { declare.time(30.0); - int desc_size = GET_PARAM(0); - int normType = GET_PARAM(1); + const int desc_size = GET_PARAM(0); + const int normType = GET_PARAM(1); - int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F; + const int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F; + const float maxDistance = 10000; cv::Mat query(3000, desc_size, type); - fillRandom(query, 0.0, 1.0); + declare.in(query, WARMUP_RNG); cv::Mat train(3000, desc_size, type); - fillRandom(train, 0.0, 1.0); + declare.in(train, WARMUP_RNG); if (PERF_RUN_GPU()) { cv::gpu::BFMatcher_GPU d_matcher(normType); - cv::gpu::GpuMat d_query(query); - cv::gpu::GpuMat d_train(train); + const cv::gpu::GpuMat d_query(query); + const cv::gpu::GpuMat d_train(train); cv::gpu::GpuMat d_trainIdx, d_nMatches, d_distance; - d_matcher.radiusMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_nMatches, 2.0); + TEST_CYCLE() d_matcher.radiusMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_nMatches, maxDistance); - TEST_CYCLE() - { - d_matcher.radiusMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_nMatches, 2.0); - } + std::vector< std::vector > matchesTbl; + d_matcher.radiusMatchDownload(d_trainIdx, d_distance, d_nMatches, matchesTbl); - GPU_SANITY_CHECK(d_trainIdx); - GPU_SANITY_CHECK(d_distance); + std::vector gpu_matches; + toOneRowMatches(matchesTbl, gpu_matches); + + SANITY_CHECK_MATCHES(gpu_matches); } else { cv::BFMatcher matcher(normType); - std::vector< std::vector > matches; + std::vector< std::vector > matchesTbl; - matcher.radiusMatch(query, train, matches, 2.0); + TEST_CYCLE() matcher.radiusMatch(query, train, matchesTbl, maxDistance); - TEST_CYCLE() - { - matcher.radiusMatch(query, train, matches, 2.0); - } + std::vector cpu_matches; + toOneRowMatches(matchesTbl, cpu_matches); - SANITY_CHECK(matches); + SANITY_CHECK_MATCHES(cpu_matches); } } - -} // namespace diff --git a/modules/gpu/perf/perf_filters.cpp b/modules/gpu/perf/perf_filters.cpp index 7faf93e979..3516954a6c 100644 --- a/modules/gpu/perf/perf_filters.cpp +++ b/modules/gpu/perf/perf_filters.cpp @@ -3,48 +3,39 @@ using namespace std; using namespace testing; -namespace { - ////////////////////////////////////////////////////////////////////// // Blur DEF_PARAM_TEST(Sz_Type_KernelSz, cv::Size, MatType, int); -PERF_TEST_P(Sz_Type_KernelSz, Filters_Blur, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4), Values(3, 5, 7))) +PERF_TEST_P(Sz_Type_KernelSz, Filters_Blur, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8UC1, CV_8UC4), + Values(3, 5, 7))) { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); - int ksize = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); + const int ksize = GET_PARAM(2); cv::Mat src(size, type); - 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; - cv::gpu::blur(d_src, d_dst, cv::Size(ksize, ksize)); + TEST_CYCLE() cv::gpu::blur(d_src, dst, cv::Size(ksize, ksize)); - TEST_CYCLE() - { - cv::gpu::blur(d_src, d_dst, cv::Size(ksize, ksize)); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::blur(src, dst, cv::Size(ksize, ksize)); - - TEST_CYCLE() - { - cv::blur(src, dst, cv::Size(ksize, ksize)); - } + TEST_CYCLE() cv::blur(src, dst, cv::Size(ksize, ksize)); CPU_SANITY_CHECK(dst); } @@ -57,38 +48,28 @@ PERF_TEST_P(Sz_Type_KernelSz, Filters_Sobel, Combine(GPU_TYPICAL_MAT_SIZES, Valu { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); - int ksize = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); + const int ksize = GET_PARAM(2); cv::Mat src(size, type); - 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; cv::gpu::GpuMat d_buf; - cv::gpu::Sobel(d_src, d_dst, -1, 1, 1, d_buf, ksize); + TEST_CYCLE() cv::gpu::Sobel(d_src, dst, -1, 1, 1, d_buf, ksize); - TEST_CYCLE() - { - cv::gpu::Sobel(d_src, d_dst, -1, 1, 1, d_buf, ksize); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::Sobel(src, dst, -1, 1, 1, ksize); - - TEST_CYCLE() - { - cv::Sobel(src, dst, -1, 1, 1, ksize); - } + TEST_CYCLE() cv::Sobel(src, dst, -1, 1, 1, ksize); CPU_SANITY_CHECK(dst); } @@ -101,37 +82,27 @@ PERF_TEST_P(Sz_Type, Filters_Scharr, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); cv::Mat src(size, type); - 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; cv::gpu::GpuMat d_buf; - cv::gpu::Scharr(d_src, d_dst, -1, 1, 0, d_buf); + TEST_CYCLE() cv::gpu::Scharr(d_src, dst, -1, 1, 0, d_buf); - TEST_CYCLE() - { - cv::gpu::Scharr(d_src, d_dst, -1, 1, 0, d_buf); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::Scharr(src, dst, -1, 1, 0); - - TEST_CYCLE() - { - cv::Scharr(src, dst, -1, 1, 0); - } + TEST_CYCLE() cv::Scharr(src, dst, -1, 1, 0); CPU_SANITY_CHECK(dst); } @@ -144,38 +115,28 @@ PERF_TEST_P(Sz_Type_KernelSz, Filters_GaussianBlur, Combine(GPU_TYPICAL_MAT_SIZE { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); - int ksize = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); + const int ksize = GET_PARAM(2); cv::Mat src(size, type); - 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; cv::gpu::GpuMat d_buf; - cv::gpu::GaussianBlur(d_src, d_dst, cv::Size(ksize, ksize), d_buf, 0.5); + TEST_CYCLE() cv::gpu::GaussianBlur(d_src, dst, cv::Size(ksize, ksize), d_buf, 0.5); - TEST_CYCLE() - { - cv::gpu::GaussianBlur(d_src, d_dst, cv::Size(ksize, ksize), d_buf, 0.5); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::GaussianBlur(src, dst, cv::Size(ksize, ksize), 0.5); - - TEST_CYCLE() - { - cv::GaussianBlur(src, dst, cv::Size(ksize, ksize), 0.5); - } + TEST_CYCLE() cv::GaussianBlur(src, dst, cv::Size(ksize, ksize), 0.5); CPU_SANITY_CHECK(dst); } @@ -188,37 +149,27 @@ PERF_TEST_P(Sz_Type_KernelSz, Filters_Laplacian, Combine(GPU_TYPICAL_MAT_SIZES, { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); - int ksize = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); + const int ksize = GET_PARAM(2); cv::Mat src(size, type); - 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; - cv::gpu::Laplacian(d_src, d_dst, -1, ksize); + TEST_CYCLE() cv::gpu::Laplacian(d_src, dst, -1, ksize); - TEST_CYCLE() - { - cv::gpu::Laplacian(d_src, d_dst, -1, ksize); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::Laplacian(src, dst, -1, ksize); - - TEST_CYCLE() - { - cv::Laplacian(src, dst, -1, ksize); - } + TEST_CYCLE() cv::Laplacian(src, dst, -1, ksize); CPU_SANITY_CHECK(dst); } @@ -231,39 +182,29 @@ PERF_TEST_P(Sz_Type, Filters_Erode, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); - cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3)); + const cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3)); 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::GpuMat d_buf; - cv::gpu::erode(d_src, d_dst, ker, d_buf); + TEST_CYCLE() cv::gpu::erode(d_src, dst, ker, d_buf); - TEST_CYCLE() - { - cv::gpu::erode(d_src, d_dst, ker, d_buf); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::erode(src, dst, ker); - - TEST_CYCLE() - { - cv::erode(src, dst, ker); - } + TEST_CYCLE() cv::erode(src, dst, ker); CPU_SANITY_CHECK(dst); } @@ -276,39 +217,29 @@ PERF_TEST_P(Sz_Type, Filters_Dilate, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); - cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3)); + const cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3)); 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::GpuMat d_buf; - cv::gpu::dilate(d_src, d_dst, ker, d_buf); + TEST_CYCLE() cv::gpu::dilate(d_src, dst, ker, d_buf); - TEST_CYCLE() - { - cv::gpu::dilate(d_src, d_dst, ker, d_buf); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::dilate(src, dst, ker); - - TEST_CYCLE() - { - cv::dilate(src, dst, ker); - } + TEST_CYCLE() cv::dilate(src, dst, ker); CPU_SANITY_CHECK(dst); } @@ -326,41 +257,31 @@ PERF_TEST_P(Sz_Type_Op, Filters_MorphologyEx, Combine(GPU_TYPICAL_MAT_SIZES, Val { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); - int morphOp = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); + const int morphOp = GET_PARAM(2); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); - cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3)); + const cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3)); 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::GpuMat d_buf1; cv::gpu::GpuMat d_buf2; - cv::gpu::morphologyEx(d_src, d_dst, morphOp, ker, d_buf1, d_buf2); + TEST_CYCLE() cv::gpu::morphologyEx(d_src, dst, morphOp, ker, d_buf1, d_buf2); - TEST_CYCLE() - { - cv::gpu::morphologyEx(d_src, d_dst, morphOp, ker, d_buf1, d_buf2); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::morphologyEx(src, dst, morphOp, ker); - - TEST_CYCLE() - { - cv::morphologyEx(src, dst, morphOp, ker); - } + TEST_CYCLE() cv::morphologyEx(src, dst, morphOp, ker); CPU_SANITY_CHECK(dst); } @@ -373,43 +294,31 @@ PERF_TEST_P(Sz_Type_KernelSz, Filters_Filter2D, Combine(GPU_TYPICAL_MAT_SIZES, V { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); - int ksize = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); + const int ksize = GET_PARAM(2); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); cv::Mat kernel(ksize, ksize, CV_32FC1); - fillRandom(kernel, 0.0, 1.0); + declare.in(kernel, 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::filter2D(d_src, d_dst, -1, kernel); + TEST_CYCLE() cv::gpu::filter2D(d_src, dst, -1, kernel); - TEST_CYCLE() - { - cv::gpu::filter2D(d_src, d_dst, -1, kernel); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::filter2D(src, dst, -1, kernel); - - TEST_CYCLE() - { - cv::filter2D(src, dst, -1, kernel); - } + TEST_CYCLE() cv::filter2D(src, dst, -1, kernel); CPU_SANITY_CHECK(dst); } } - -} // namespace diff --git a/modules/gpu/perf/perf_imgproc.cpp b/modules/gpu/perf/perf_imgproc.cpp index 56cb257c2c..be6eb4877c 100644 --- a/modules/gpu/perf/perf_imgproc.cpp +++ b/modules/gpu/perf/perf_imgproc.cpp @@ -2,13 +2,12 @@ using namespace std; using namespace testing; - -namespace { +using namespace perf; ////////////////////////////////////////////////////////////////////// // Remap -enum{HALF_SIZE=0, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH}; +enum { HALF_SIZE=0, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH }; CV_ENUM(RemapMode, HALF_SIZE, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH); #define ALL_REMAP_MODES ValuesIn(RemapMode::all()) @@ -51,59 +50,50 @@ void generateMap(cv::Mat& map_x, cv::Mat& map_y, int remapMode) DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Border_Mode, cv::Size, MatDepth, MatCn, Interpolation, BorderMode, RemapMode); -PERF_TEST_P(Sz_Depth_Cn_Inter_Border_Mode, ImgProc_Remap, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4, - Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), - ALL_BORDER_MODES, - ALL_REMAP_MODES)) +PERF_TEST_P(Sz_Depth_Cn_Inter_Border_Mode, ImgProc_Remap, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4, + Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), + ALL_BORDER_MODES, + ALL_REMAP_MODES)) { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); - int interpolation = GET_PARAM(3); - int borderMode = GET_PARAM(4); - int remapMode = GET_PARAM(5); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int channels = GET_PARAM(2); + const int interpolation = GET_PARAM(3); + const int borderMode = GET_PARAM(4); + const int remapMode = GET_PARAM(5); - int type = CV_MAKE_TYPE(depth, channels); + const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); cv::Mat xmap(size, CV_32FC1); cv::Mat ymap(size, CV_32FC1); - generateMap(xmap, ymap, remapMode); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); - cv::gpu::GpuMat d_xmap(xmap); - cv::gpu::GpuMat d_ymap(ymap); - cv::gpu::GpuMat d_dst; + const cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_xmap(xmap); + const cv::gpu::GpuMat d_ymap(ymap); + cv::gpu::GpuMat dst; - cv::gpu::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode); + TEST_CYCLE() cv::gpu::remap(d_src, dst, d_xmap, d_ymap, interpolation, borderMode); - TEST_CYCLE() - { - cv::gpu::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::remap(src, dst, xmap, ymap, interpolation, borderMode); + TEST_CYCLE() cv::remap(src, dst, xmap, ymap, interpolation, borderMode); - TEST_CYCLE() - { - cv::remap(src, dst, xmap, ymap, interpolation, borderMode); - } + CPU_SANITY_CHECK(dst); } } @@ -112,50 +102,42 @@ PERF_TEST_P(Sz_Depth_Cn_Inter_Border_Mode, ImgProc_Remap, Combine( DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Scale, cv::Size, MatDepth, MatCn, Interpolation, double); -PERF_TEST_P(Sz_Depth_Cn_Inter_Scale, ImgProc_Resize, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4, - ALL_INTERPOLATIONS, - Values(0.5, 0.3, 2.0))) +PERF_TEST_P(Sz_Depth_Cn_Inter_Scale, ImgProc_Resize, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4, + Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), + Values(0.5, 0.3, 2.0))) { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); - int interpolation = GET_PARAM(3); - double f = GET_PARAM(4); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int channels = GET_PARAM(2); + const int interpolation = GET_PARAM(3); + const double f = GET_PARAM(4); - int type = CV_MAKE_TYPE(depth, channels); + const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - 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; - cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation); + TEST_CYCLE() cv::gpu::resize(d_src, dst, cv::Size(), f, f, interpolation); - TEST_CYCLE() - { - cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1e-3, ERROR_RELATIVE); } else { cv::Mat dst; - cv::resize(src, dst, cv::Size(), f, f, interpolation); + TEST_CYCLE() cv::resize(src, dst, cv::Size(), f, f, interpolation); - TEST_CYCLE() - { - cv::resize(src, dst, cv::Size(), f, f, interpolation); - } + CPU_SANITY_CHECK(dst); } } @@ -164,49 +146,41 @@ PERF_TEST_P(Sz_Depth_Cn_Inter_Scale, ImgProc_Resize, Combine( DEF_PARAM_TEST(Sz_Depth_Cn_Scale, cv::Size, MatDepth, MatCn, double); -PERF_TEST_P(Sz_Depth_Cn_Scale, ImgProc_ResizeArea, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4, - Values(0.2, 0.1, 0.05))) +PERF_TEST_P(Sz_Depth_Cn_Scale, ImgProc_ResizeArea, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4, + Values(0.2, 0.1, 0.05))) { declare.time(1.0); - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); - int interpolation = cv::INTER_AREA; - double f = GET_PARAM(3); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int channels = GET_PARAM(2); + const int interpolation = cv::INTER_AREA; + const double f = GET_PARAM(3); - int type = CV_MAKE_TYPE(depth, channels); + const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - 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; - cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation); + TEST_CYCLE() cv::gpu::resize(d_src, dst, cv::Size(), f, f, interpolation); - TEST_CYCLE() - { - cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::resize(src, dst, cv::Size(), f, f, interpolation); + TEST_CYCLE() cv::resize(src, dst, cv::Size(), f, f, interpolation); - TEST_CYCLE() - { - cv::resize(src, dst, cv::Size(), f, f, interpolation); - } + CPU_SANITY_CHECK(dst); } } @@ -215,111 +189,98 @@ PERF_TEST_P(Sz_Depth_Cn_Scale, ImgProc_ResizeArea, Combine( DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Border, cv::Size, MatDepth, MatCn, Interpolation, BorderMode); -PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpAffine, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4, - Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), - ALL_BORDER_MODES)) +PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpAffine, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4, + Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), + ALL_BORDER_MODES)) { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); - int interpolation = GET_PARAM(3); - int borderMode = GET_PARAM(4); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int channels = GET_PARAM(2); + const int interpolation = GET_PARAM(3); + const int borderMode = GET_PARAM(4); - int type = CV_MAKE_TYPE(depth, channels); + const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); const double aplha = CV_PI / 4; - double mat[2][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2}, - {std::sin(aplha), std::cos(aplha), 0}}; - cv::Mat M(2, 3, CV_64F, (void*) mat); + const double mat[2 * 3] = + { + std::cos(aplha), -std::sin(aplha), src.cols / 2, + std::sin(aplha), std::cos(aplha), 0 + }; + const cv::Mat M(2, 3, CV_64F, (void*) mat); 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::warpAffine(d_src, d_dst, M, size, interpolation, borderMode); + TEST_CYCLE() cv::gpu::warpAffine(d_src, dst, M, size, interpolation, borderMode); - TEST_CYCLE() - { - cv::gpu::warpAffine(d_src, d_dst, M, size, interpolation, borderMode); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1); } else { cv::Mat dst; - cv::warpAffine(src, dst, M, size, interpolation, borderMode); + TEST_CYCLE() cv::warpAffine(src, dst, M, size, interpolation, borderMode); - TEST_CYCLE() - { - cv::warpAffine(src, dst, M, size, interpolation, borderMode); - } + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // WarpPerspective -PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpPerspective, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4, - Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), - ALL_BORDER_MODES)) +PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpPerspective, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4, + Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), + ALL_BORDER_MODES)) { declare.time(20.0); - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); - int interpolation = GET_PARAM(3); - int borderMode = GET_PARAM(4); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int channels = GET_PARAM(2); + const int interpolation = GET_PARAM(3); + const int borderMode = GET_PARAM(4); - int type = CV_MAKE_TYPE(depth, channels); + const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - fillRandom(src); + declare.in(src, WARMUP_RNG); const double aplha = CV_PI / 4; double mat[3][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2}, {std::sin(aplha), std::cos(aplha), 0}, {0.0, 0.0, 1.0}}; - cv::Mat M(3, 3, CV_64F, (void*) mat); + const cv::Mat M(3, 3, CV_64F, (void*) mat); 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::warpPerspective(d_src, d_dst, M, size, interpolation, borderMode); + TEST_CYCLE() cv::gpu::warpPerspective(d_src, dst, M, size, interpolation, borderMode); - TEST_CYCLE() - { - cv::gpu::warpPerspective(d_src, d_dst, M, size, interpolation, borderMode); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1); } else { cv::Mat dst; - cv::warpPerspective(src, dst, M, size, interpolation, borderMode); + TEST_CYCLE() cv::warpPerspective(src, dst, M, size, interpolation, borderMode); - TEST_CYCLE() - { - cv::warpPerspective(src, dst, M, size, interpolation, borderMode); - } + CPU_SANITY_CHECK(dst); } } @@ -328,46 +289,38 @@ PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpPerspective, Combine( DEF_PARAM_TEST(Sz_Depth_Cn_Border, cv::Size, MatDepth, MatCn, BorderMode); -PERF_TEST_P(Sz_Depth_Cn_Border, ImgProc_CopyMakeBorder, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4, - ALL_BORDER_MODES)) +PERF_TEST_P(Sz_Depth_Cn_Border, ImgProc_CopyMakeBorder, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4, + ALL_BORDER_MODES)) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); - int borderMode = GET_PARAM(3); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int channels = GET_PARAM(2); + const int borderMode = GET_PARAM(3); - int type = CV_MAKE_TYPE(depth, channels); + const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - 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; - cv::gpu::copyMakeBorder(d_src, d_dst, 5, 5, 5, 5, borderMode); + TEST_CYCLE() cv::gpu::copyMakeBorder(d_src, dst, 5, 5, 5, 5, borderMode); - TEST_CYCLE() - { - cv::gpu::copyMakeBorder(d_src, d_dst, 5, 5, 5, 5, borderMode); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderMode); + TEST_CYCLE() cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderMode); - TEST_CYCLE() - { - cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderMode); - } + CPU_SANITY_CHECK(dst); } } @@ -379,168 +332,145 @@ CV_ENUM(ThreshOp, cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv DEF_PARAM_TEST(Sz_Depth_Op, cv::Size, MatDepth, ThreshOp); -PERF_TEST_P(Sz_Depth_Op, ImgProc_Threshold, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F, CV_64F), - ALL_THRESH_OPS)) +PERF_TEST_P(Sz_Depth_Op, ImgProc_Threshold, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F, CV_64F), + ALL_THRESH_OPS)) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int threshOp = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int threshOp = GET_PARAM(2); 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; - cv::gpu::threshold(d_src, d_dst, 100.0, 255.0, threshOp); + TEST_CYCLE() cv::gpu::threshold(d_src, dst, 100.0, 255.0, threshOp); - TEST_CYCLE() - { - cv::gpu::threshold(d_src, d_dst, 100.0, 255.0, threshOp); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1e-10); } else { cv::Mat dst; - cv::threshold(src, dst, 100.0, 255.0, threshOp); + TEST_CYCLE() cv::threshold(src, dst, 100.0, 255.0, threshOp); - TEST_CYCLE() - { - cv::threshold(src, dst, 100.0, 255.0, threshOp); - } + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // Integral -PERF_TEST_P(Sz, ImgProc_Integral, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, ImgProc_Integral, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); cv::Mat src(size, CV_8UC1); - 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; cv::gpu::GpuMat d_buf; - cv::gpu::integralBuffered(d_src, d_dst, d_buf); + TEST_CYCLE() cv::gpu::integralBuffered(d_src, dst, d_buf); - TEST_CYCLE() - { - cv::gpu::integralBuffered(d_src, d_dst, d_buf); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::integral(src, dst); + TEST_CYCLE() cv::integral(src, dst); - TEST_CYCLE() - { - cv::integral(src, dst); - } + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // IntegralSqr -PERF_TEST_P(Sz, ImgProc_IntegralSqr, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, ImgProc_IntegralSqr, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); cv::Mat src(size, CV_8UC1); - 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; - cv::gpu::sqrIntegral(d_src, d_dst); + TEST_CYCLE() cv::gpu::sqrIntegral(d_src, dst); - TEST_CYCLE() - { - cv::gpu::sqrIntegral(d_src, d_dst); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } ////////////////////////////////////////////////////////////////////// // HistEvenC1 -PERF_TEST_P(Sz_Depth, ImgProc_HistEvenC1, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_16S))) +PERF_TEST_P(Sz_Depth, ImgProc_HistEvenC1, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_16S))) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); + 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_hist; + const cv::gpu::GpuMat d_src(src); + cv::gpu::GpuMat dst; cv::gpu::GpuMat d_buf; - cv::gpu::histEven(d_src, d_hist, d_buf, 30, 0, 180); + TEST_CYCLE() cv::gpu::histEven(d_src, dst, d_buf, 30, 0, 180); - TEST_CYCLE() - { - cv::gpu::histEven(d_src, d_hist, d_buf, 30, 0, 180); - } - - GPU_SANITY_CHECK(d_hist); + GPU_SANITY_CHECK(dst); } else { - int hbins = 30; - float hranges[] = {0.0f, 180.0f}; - int histSize[] = {hbins}; + const int hbins = 30; + const float hranges[] = {0.0f, 180.0f}; + const int histSize[] = {hbins}; const float* ranges[] = {hranges}; - int channels[] = {0}; + const int channels[] = {0}; - cv::Mat hist; + cv::Mat dst; - cv::calcHist(&src, 1, channels, cv::Mat(), hist, 1, histSize, ranges); + TEST_CYCLE() cv::calcHist(&src, 1, channels, cv::Mat(), dst, 1, histSize, ranges); - TEST_CYCLE() - { - cv::calcHist(&src, 1, channels, cv::Mat(), hist, 1, histSize, ranges); - } + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // HistEvenC4 -PERF_TEST_P(Sz_Depth, ImgProc_HistEvenC4, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_16S))) +PERF_TEST_P(Sz_Depth, ImgProc_HistEvenC4, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_16S))) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); cv::Mat src(size, CV_MAKE_TYPE(depth, 4)); - fillRandom(src); + declare.in(src, WARMUP_RNG); int histSize[] = {30, 30, 30, 30}; int lowerLevel[] = {0, 0, 0, 0}; @@ -548,121 +478,109 @@ PERF_TEST_P(Sz_Depth, ImgProc_HistEvenC4, Combine(GPU_TYPICAL_MAT_SIZES, Values( if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat d_hist[4]; - cv::gpu::GpuMat d_buf, d_hist0; + cv::gpu::GpuMat d_buf; - cv::gpu::histEven(d_src, d_hist, d_buf, histSize, lowerLevel, upperLevel); + TEST_CYCLE() cv::gpu::histEven(d_src, d_hist, d_buf, histSize, lowerLevel, upperLevel); - TEST_CYCLE() - { - cv::gpu::histEven(d_src, d_hist, d_buf, histSize, lowerLevel, upperLevel); - } - - GPU_SANITY_CHECK(d_hist0); + cv::Mat cpu_hist0, cpu_hist1, cpu_hist2, cpu_hist3; + d_hist[0].download(cpu_hist0); + d_hist[1].download(cpu_hist1); + d_hist[2].download(cpu_hist2); + d_hist[3].download(cpu_hist3); + SANITY_CHECK(cpu_hist0); + SANITY_CHECK(cpu_hist1); + SANITY_CHECK(cpu_hist2); + SANITY_CHECK(cpu_hist3); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } ////////////////////////////////////////////////////////////////////// // CalcHist -PERF_TEST_P(Sz, ImgProc_CalcHist, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, ImgProc_CalcHist, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); cv::Mat src(size, CV_8UC1); - fillRandom(src); + declare.in(src, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); - cv::gpu::GpuMat d_hist; + const cv::gpu::GpuMat d_src(src); + cv::gpu::GpuMat dst; - cv::gpu::calcHist(d_src, d_hist); + TEST_CYCLE() cv::gpu::calcHist(d_src, dst); - TEST_CYCLE() - { - cv::gpu::calcHist(d_src, d_hist); - } - - GPU_SANITY_CHECK(d_hist); + GPU_SANITY_CHECK(dst); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } ////////////////////////////////////////////////////////////////////// // EqualizeHist -PERF_TEST_P(Sz, ImgProc_EqualizeHist, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, ImgProc_EqualizeHist, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); cv::Mat src(size, CV_8UC1); - 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; cv::gpu::GpuMat d_hist; cv::gpu::GpuMat d_buf; - cv::gpu::equalizeHist(d_src, d_dst, d_hist, d_buf); + TEST_CYCLE() cv::gpu::equalizeHist(d_src, dst, d_hist, d_buf); - TEST_CYCLE() - { - cv::gpu::equalizeHist(d_src, d_dst, d_hist, d_buf); - } - - GPU_SANITY_CHECK(d_hist); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::equalizeHist(src, dst); + TEST_CYCLE() cv::equalizeHist(src, dst); - TEST_CYCLE() - { - cv::equalizeHist(src, dst); - } + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // ColumnSum -PERF_TEST_P(Sz, ImgProc_ColumnSum, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, ImgProc_ColumnSum, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); cv::Mat src(size, CV_32FC1); - 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; - cv::gpu::columnSum(d_src, d_dst); + TEST_CYCLE() cv::gpu::columnSum(d_src, dst); - TEST_CYCLE() - { - cv::gpu::columnSum(d_src, d_dst); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } @@ -671,43 +589,38 @@ PERF_TEST_P(Sz, ImgProc_ColumnSum, GPU_TYPICAL_MAT_SIZES) DEF_PARAM_TEST(Image_AppertureSz_L2gradient, string, int, bool); -PERF_TEST_P(Image_AppertureSz_L2gradient, ImgProc_Canny, Combine( - Values("perf/800x600.png", "perf/1280x1024.png", "perf/1680x1050.png"), - Values(3, 5), - Bool())) +PERF_TEST_P(Image_AppertureSz_L2gradient, ImgProc_Canny, + Combine(Values("perf/800x600.png", "perf/1280x1024.png", "perf/1680x1050.png"), + Values(3, 5), + Bool())) { - string fileName = GET_PARAM(0); - int apperture_size = GET_PARAM(1); - bool useL2gradient = GET_PARAM(2); + const string fileName = GET_PARAM(0); + const int apperture_size = GET_PARAM(1); + const bool useL2gradient = GET_PARAM(2); - cv::Mat image = readImage(fileName, cv::IMREAD_GRAYSCALE); + const cv::Mat image = readImage(fileName, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(image.empty()); + const double low_thresh = 50.0; + const double high_thresh = 100.0; + if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_image(image); - cv::gpu::GpuMat d_dst; + const cv::gpu::GpuMat d_image(image); + cv::gpu::GpuMat dst; cv::gpu::CannyBuf d_buf; - cv::gpu::Canny(d_image, d_buf, d_dst, 50.0, 100.0, apperture_size, useL2gradient); + TEST_CYCLE() cv::gpu::Canny(d_image, d_buf, dst, low_thresh, high_thresh, apperture_size, useL2gradient); - TEST_CYCLE() - { - cv::gpu::Canny(d_image, d_buf, d_dst, 50.0, 100.0, apperture_size, useL2gradient); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::Canny(image, dst, 50.0, 100.0, apperture_size, useL2gradient); + TEST_CYCLE() cv::Canny(image, dst, low_thresh, high_thresh, apperture_size, useL2gradient); - TEST_CYCLE() - { - cv::Canny(image, dst, 50.0, 100.0, apperture_size, useL2gradient); - } + CPU_SANITY_CHECK(dst); } } @@ -716,148 +629,142 @@ PERF_TEST_P(Image_AppertureSz_L2gradient, ImgProc_Canny, Combine( DEF_PARAM_TEST_1(Image, string); -PERF_TEST_P(Image, ImgProc_MeanShiftFiltering, Values("gpu/meanshift/cones.png")) +PERF_TEST_P(Image, ImgProc_MeanShiftFiltering, + Values("gpu/meanshift/cones.png")) { declare.time(15.0); - cv::Mat img = readImage(GetParam()); + const cv::Mat img = readImage(GetParam()); ASSERT_FALSE(img.empty()); cv::Mat rgba; cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA); + const int sp = 50; + const int sr = 50; + if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(rgba); - cv::gpu::GpuMat d_dst; + const cv::gpu::GpuMat d_src(rgba); + cv::gpu::GpuMat dst; - cv::gpu::meanShiftFiltering(d_src, d_dst, 50, 50); + TEST_CYCLE() cv::gpu::meanShiftFiltering(d_src, dst, sp, sr); - TEST_CYCLE() - { - cv::gpu::meanShiftFiltering(d_src, d_dst, 50, 50); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::pyrMeanShiftFiltering(img, dst, 50, 50); + TEST_CYCLE() cv::pyrMeanShiftFiltering(img, dst, sp, sr); - TEST_CYCLE() - { - cv::pyrMeanShiftFiltering(img, dst, 50, 50); - } + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // MeanShiftProc -PERF_TEST_P(Image, ImgProc_MeanShiftProc, Values("gpu/meanshift/cones.png")) +PERF_TEST_P(Image, ImgProc_MeanShiftProc, + Values("gpu/meanshift/cones.png")) { declare.time(5.0); - cv::Mat img = readImage(GetParam()); + const cv::Mat img = readImage(GetParam()); ASSERT_FALSE(img.empty()); cv::Mat rgba; cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA); + const int sp = 50; + const int sr = 50; + if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(rgba); - cv::gpu::GpuMat d_dstr; - cv::gpu::GpuMat d_dstsp; + const cv::gpu::GpuMat d_src(rgba); + cv::gpu::GpuMat dstr; + cv::gpu::GpuMat dstsp; - cv::gpu::meanShiftProc(d_src, d_dstr, d_dstsp, 50, 50); + TEST_CYCLE() cv::gpu::meanShiftProc(d_src, dstr, dstsp, sp, sr); - TEST_CYCLE() - { - cv::gpu::meanShiftProc(d_src, d_dstr, d_dstsp, 50, 50); - } - - GPU_SANITY_CHECK(d_dstr); + GPU_SANITY_CHECK(dstr); + GPU_SANITY_CHECK(dstsp); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } ////////////////////////////////////////////////////////////////////// // MeanShiftSegmentation -PERF_TEST_P(Image, ImgProc_MeanShiftSegmentation, Values("gpu/meanshift/cones.png")) +PERF_TEST_P(Image, ImgProc_MeanShiftSegmentation, + Values("gpu/meanshift/cones.png")) { declare.time(5.0); - cv::Mat img = readImage(GetParam()); + const cv::Mat img = readImage(GetParam()); ASSERT_FALSE(img.empty()); cv::Mat rgba; cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA); - cv::Mat dst; + const int sp = 10; + const int sr = 10; + const int minsize = 20; if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(rgba); + const cv::gpu::GpuMat d_src(rgba); + cv::Mat dst; - cv::gpu::meanShiftSegmentation(d_src, dst, 10, 10, 20); - - TEST_CYCLE() - { - cv::gpu::meanShiftSegmentation(d_src, dst, 10, 10, 20); - } + TEST_CYCLE() cv::gpu::meanShiftSegmentation(d_src, dst, sp, sr, minsize); GPU_SANITY_CHECK(dst); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } ////////////////////////////////////////////////////////////////////// // BlendLinear -PERF_TEST_P(Sz_Depth_Cn, ImgProc_BlendLinear, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_32F), GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, ImgProc_BlendLinear, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_32F), + GPU_CHANNELS_1_3_4)) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int channels = GET_PARAM(2); - int type = CV_MAKE_TYPE(depth, channels); + const int type = CV_MAKE_TYPE(depth, channels); cv::Mat img1(size, type); - fillRandom(img1); - cv::Mat img2(size, type); - fillRandom(img2); + declare.in(img1, img2, WARMUP_RNG); + + const cv::Mat weights1(size, CV_32FC1, cv::Scalar::all(0.5)); + const cv::Mat weights2(size, CV_32FC1, cv::Scalar::all(0.5)); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_img1(img1); - cv::gpu::GpuMat d_img2(img2); - cv::gpu::GpuMat d_weights1(size, CV_32FC1, cv::Scalar::all(0.5)); - cv::gpu::GpuMat d_weights2(size, CV_32FC1, cv::Scalar::all(0.5)); - cv::gpu::GpuMat d_dst; + const cv::gpu::GpuMat d_img1(img1); + const cv::gpu::GpuMat d_img2(img2); + const cv::gpu::GpuMat d_weights1(weights1); + const cv::gpu::GpuMat d_weights2(weights2); + cv::gpu::GpuMat dst; - cv::gpu::blendLinear(d_img1, d_img2, d_weights1, d_weights2, d_dst); + TEST_CYCLE() cv::gpu::blendLinear(d_img1, d_img2, d_weights1, d_weights2, dst); - TEST_CYCLE() - { - cv::gpu::blendLinear(d_img1, d_img2, d_weights1, d_weights2, d_dst); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } @@ -866,19 +773,20 @@ PERF_TEST_P(Sz_Depth_Cn, ImgProc_BlendLinear, Combine(GPU_TYPICAL_MAT_SIZES, Val DEF_PARAM_TEST(Sz_KernelSz_Ccorr, cv::Size, int, bool); -PERF_TEST_P(Sz_KernelSz_Ccorr, ImgProc_Convolve, Combine(GPU_TYPICAL_MAT_SIZES, Values(17, 27, 32, 64), Bool())) +PERF_TEST_P(Sz_KernelSz_Ccorr, ImgProc_Convolve, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(17, 27, 32, 64), + Bool())) { declare.time(10.0); - cv::Size size = GET_PARAM(0); - int templ_size = GET_PARAM(1); - bool ccorr = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int templ_size = GET_PARAM(1); + const bool ccorr = GET_PARAM(2); - cv::Mat image(size, CV_32FC1); - image.setTo(1.0); - - cv::Mat templ(templ_size, templ_size, CV_32FC1); - templ.setTo(1.0); + const cv::Mat image(size, CV_32FC1); + const cv::Mat templ(templ_size, templ_size, CV_32FC1); + declare.in(image, templ, WARMUP_RNG); if (PERF_RUN_GPU()) { @@ -888,30 +796,21 @@ PERF_TEST_P(Sz_KernelSz_Ccorr, ImgProc_Convolve, Combine(GPU_TYPICAL_MAT_SIZES, cv::gpu::GpuMat d_templ = cv::gpu::createContinuous(templ_size, templ_size, CV_32FC1); d_templ.upload(templ); - cv::gpu::GpuMat d_dst; + cv::gpu::GpuMat dst; cv::gpu::ConvolveBuf d_buf; - cv::gpu::convolve(d_image, d_templ, d_dst, ccorr, d_buf); + TEST_CYCLE() cv::gpu::convolve(d_image, d_templ, dst, ccorr, d_buf); - TEST_CYCLE() - { - cv::gpu::convolve(d_image, d_templ, d_dst, ccorr, d_buf); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { - ASSERT_FALSE(ccorr); + if (ccorr) + FAIL_NO_CPU(); cv::Mat dst; - cv::filter2D(image, dst, image.depth(), templ); - - TEST_CYCLE() - { - cv::filter2D(image, dst, image.depth(), templ); - } + TEST_CYCLE() cv::filter2D(image, dst, image.depth(), templ); CPU_SANITY_CHECK(dst); } @@ -925,48 +824,36 @@ CV_ENUM(TemplateMethod, cv::TM_SQDIFF, cv::TM_SQDIFF_NORMED, cv::TM_CCORR, cv::T DEF_PARAM_TEST(Sz_TemplateSz_Cn_Method, cv::Size, cv::Size, MatCn, TemplateMethod); -PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate8U, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(cv::Size(5, 5), cv::Size(16, 16), cv::Size(30, 30)), - GPU_CHANNELS_1_3_4, - ALL_TEMPLATE_METHODS)) +PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate8U, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(cv::Size(5, 5), cv::Size(16, 16), cv::Size(30, 30)), + GPU_CHANNELS_1_3_4, + ALL_TEMPLATE_METHODS)) { - cv::Size size = GET_PARAM(0); - cv::Size templ_size = GET_PARAM(1); - int cn = GET_PARAM(2); - int method = GET_PARAM(3); + const cv::Size size = GET_PARAM(0); + const cv::Size templ_size = GET_PARAM(1); + const int cn = GET_PARAM(2); + const int method = GET_PARAM(3); cv::Mat image(size, CV_MAKE_TYPE(CV_8U, cn)); - fillRandom(image); - cv::Mat templ(templ_size, CV_MAKE_TYPE(CV_8U, cn)); - fillRandom(templ); + declare.in(image, templ, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_image(image); - cv::gpu::GpuMat d_templ(templ); - cv::gpu::GpuMat d_dst; + const cv::gpu::GpuMat d_image(image); + const cv::gpu::GpuMat d_templ(templ); + cv::gpu::GpuMat dst; - cv::gpu::matchTemplate(d_image, d_templ, d_dst, method); + TEST_CYCLE() cv::gpu::matchTemplate(d_image, d_templ, dst, method); - TEST_CYCLE() - { - cv::gpu::matchTemplate(d_image, d_templ, d_dst, method); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1e-5, ERROR_RELATIVE); } else { cv::Mat dst; - cv::matchTemplate(image, templ, dst, method); - - TEST_CYCLE() - { - cv::matchTemplate(image, templ, dst, method); - } + TEST_CYCLE() cv::matchTemplate(image, templ, dst, method); CPU_SANITY_CHECK(dst); } @@ -975,48 +862,36 @@ PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate8U, Combine( //////////////////////////////////////////////////////////////////////////////// // MatchTemplate32F -PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate32F, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(cv::Size(5, 5), cv::Size(16, 16), cv::Size(30, 30)), - GPU_CHANNELS_1_3_4, - Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_CCORR)))) +PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate32F, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(cv::Size(5, 5), cv::Size(16, 16), cv::Size(30, 30)), + GPU_CHANNELS_1_3_4, + Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_CCORR)))) { - cv::Size size = GET_PARAM(0); - cv::Size templ_size = GET_PARAM(1); - int cn = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const cv::Size templ_size = GET_PARAM(1); + const int cn = GET_PARAM(2); int method = GET_PARAM(3); cv::Mat image(size, CV_MAKE_TYPE(CV_32F, cn)); - fillRandom(image); - cv::Mat templ(templ_size, CV_MAKE_TYPE(CV_32F, cn)); - fillRandom(templ); + declare.in(image, templ, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_image(image); - cv::gpu::GpuMat d_templ(templ); - cv::gpu::GpuMat d_dst; + const cv::gpu::GpuMat d_image(image); + const cv::gpu::GpuMat d_templ(templ); + cv::gpu::GpuMat dst; - cv::gpu::matchTemplate(d_image, d_templ, d_dst, method); + TEST_CYCLE() cv::gpu::matchTemplate(d_image, d_templ, dst, method); - TEST_CYCLE() - { - cv::gpu::matchTemplate(d_image, d_templ, d_dst, method); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE); } else { cv::Mat dst; - cv::matchTemplate(image, templ, dst, method); - - TEST_CYCLE() - { - cv::matchTemplate(image, templ, dst, method); - } + TEST_CYCLE() cv::matchTemplate(image, templ, dst, method); CPU_SANITY_CHECK(dst); } @@ -1029,44 +904,32 @@ CV_FLAGS(DftFlags, 0, cv::DFT_INVERSE, cv::DFT_SCALE, cv::DFT_ROWS, cv::DFT_COMP DEF_PARAM_TEST(Sz_Flags, cv::Size, DftFlags); -PERF_TEST_P(Sz_Flags, ImgProc_MulSpectrums, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(0, DftFlags(cv::DFT_ROWS)))) +PERF_TEST_P(Sz_Flags, ImgProc_MulSpectrums, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(0, DftFlags(cv::DFT_ROWS)))) { - cv::Size size = GET_PARAM(0); - int flag = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int flag = GET_PARAM(1); cv::Mat a(size, CV_32FC2); - fillRandom(a, 0, 100); - cv::Mat b(size, CV_32FC2); - fillRandom(b, 0, 100); + declare.in(a, b, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_a(a); - cv::gpu::GpuMat d_b(b); - cv::gpu::GpuMat d_dst; + const cv::gpu::GpuMat d_a(a); + const cv::gpu::GpuMat d_b(b); + cv::gpu::GpuMat dst; - cv::gpu::mulSpectrums(d_a, d_b, d_dst, flag); + TEST_CYCLE() cv::gpu::mulSpectrums(d_a, d_b, dst, flag); - TEST_CYCLE() - { - cv::gpu::mulSpectrums(d_a, d_b, d_dst, flag); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::mulSpectrums(a, b, dst, flag); - - TEST_CYCLE() - { - cv::mulSpectrums(a, b, dst, flag); - } + TEST_CYCLE() cv::mulSpectrums(a, b, dst, flag); CPU_SANITY_CHECK(dst); } @@ -1075,78 +938,62 @@ PERF_TEST_P(Sz_Flags, ImgProc_MulSpectrums, Combine( ////////////////////////////////////////////////////////////////////// // MulAndScaleSpectrums -PERF_TEST_P(Sz, ImgProc_MulAndScaleSpectrums, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, ImgProc_MulAndScaleSpectrums, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); - float scale = 1.f / size.area(); + const float scale = 1.f / size.area(); cv::Mat src1(size, CV_32FC2); - fillRandom(src1, 0, 100); - cv::Mat src2(size, CV_32FC2); - fillRandom(src2, 0, 100); + declare.in(src1,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; - cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, d_dst, cv::DFT_ROWS, scale, false); + TEST_CYCLE() cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, dst, cv::DFT_ROWS, scale, false); - TEST_CYCLE() - { - cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, d_dst, cv::DFT_ROWS, scale, false); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } ////////////////////////////////////////////////////////////////////// // Dft -PERF_TEST_P(Sz_Flags, ImgProc_Dft, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(0, DftFlags(cv::DFT_ROWS), DftFlags(cv::DFT_INVERSE)))) +PERF_TEST_P(Sz_Flags, ImgProc_Dft, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(0, DftFlags(cv::DFT_ROWS), DftFlags(cv::DFT_INVERSE)))) { declare.time(10.0); - cv::Size size = GET_PARAM(0); - int flag = GET_PARAM(1); + const cv::Size size = GET_PARAM(0); + const int flag = GET_PARAM(1); cv::Mat src(size, CV_32FC2); - fillRandom(src, 0, 100); + 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::dft(d_src, d_dst, size, flag); + TEST_CYCLE() cv::gpu::dft(d_src, dst, size, flag); - TEST_CYCLE() - { - cv::gpu::dft(d_src, d_dst, size, flag); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1e-6, ERROR_RELATIVE); } else { cv::Mat dst; - cv::dft(src, dst, flag); - - TEST_CYCLE() - { - cv::dft(src, dst, flag); - } + TEST_CYCLE() cv::dft(src, dst, flag); CPU_SANITY_CHECK(dst); } @@ -1157,52 +1004,43 @@ PERF_TEST_P(Sz_Flags, ImgProc_Dft, Combine( DEF_PARAM_TEST(Image_Type_Border_BlockSz_ApertureSz, string, MatType, BorderMode, int, int); -PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerHarris, Combine( - Values("gpu/stereobm/aloe-L.png"), - Values(CV_8UC1, CV_32FC1), - Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)), - Values(3, 5, 7), - Values(0, 3, 5, 7))) +PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerHarris, + Combine(Values("gpu/stereobm/aloe-L.png"), + Values(CV_8UC1, CV_32FC1), + Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)), + Values(3, 5, 7), + Values(0, 3, 5, 7))) { - string fileName = GET_PARAM(0); - int type = GET_PARAM(1); - int borderMode = GET_PARAM(2); - int blockSize = GET_PARAM(3); - int apertureSize = GET_PARAM(4); + const string fileName = GET_PARAM(0); + const int type = GET_PARAM(1); + const int borderMode = GET_PARAM(2); + const int blockSize = GET_PARAM(3); + const int apertureSize = GET_PARAM(4); cv::Mat img = readImage(fileName, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); + img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0); - double k = 0.5; + const double k = 0.5; if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_img(img); - cv::gpu::GpuMat d_dst; + const cv::gpu::GpuMat d_img(img); + cv::gpu::GpuMat dst; cv::gpu::GpuMat d_Dx; cv::gpu::GpuMat d_Dy; cv::gpu::GpuMat d_buf; - cv::gpu::cornerHarris(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, k, borderMode); + TEST_CYCLE() cv::gpu::cornerHarris(d_img, dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, k, borderMode); - TEST_CYCLE() - { - cv::gpu::cornerHarris(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, k, borderMode); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderMode); - - TEST_CYCLE() - { - cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderMode); - } + TEST_CYCLE() cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderMode); CPU_SANITY_CHECK(dst); } @@ -1211,18 +1049,18 @@ PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerHarris, Combine( ////////////////////////////////////////////////////////////////////// // CornerMinEigenVal -PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerMinEigenVal, Combine( - Values("gpu/stereobm/aloe-L.png"), - Values(CV_8UC1, CV_32FC1), - Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)), - Values(3, 5, 7), - Values(0, 3, 5, 7))) +PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerMinEigenVal, + Combine(Values("gpu/stereobm/aloe-L.png"), + Values(CV_8UC1, CV_32FC1), + Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)), + Values(3, 5, 7), + Values(0, 3, 5, 7))) { - string fileName = GET_PARAM(0); - int type = GET_PARAM(1); - int borderMode = GET_PARAM(2); - int blockSize = GET_PARAM(3); - int apertureSize = GET_PARAM(4); + const string fileName = GET_PARAM(0); + const int type = GET_PARAM(1); + const int borderMode = GET_PARAM(2); + const int blockSize = GET_PARAM(3); + const int apertureSize = GET_PARAM(4); cv::Mat img = readImage(fileName, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); @@ -1231,31 +1069,21 @@ PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerMinEigenVal, Com if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_img(img); - cv::gpu::GpuMat d_dst; + const cv::gpu::GpuMat d_img(img); + cv::gpu::GpuMat dst; cv::gpu::GpuMat d_Dx; cv::gpu::GpuMat d_Dy; cv::gpu::GpuMat d_buf; - cv::gpu::cornerMinEigenVal(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode); + TEST_CYCLE() cv::gpu::cornerMinEigenVal(d_img, dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode); - TEST_CYCLE() - { - cv::gpu::cornerMinEigenVal(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderMode); - - TEST_CYCLE() - { - cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderMode); - } + TEST_CYCLE() cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderMode); CPU_SANITY_CHECK(dst); } @@ -1264,95 +1092,82 @@ PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerMinEigenVal, Com ////////////////////////////////////////////////////////////////////// // BuildWarpPlaneMaps -PERF_TEST_P(Sz, ImgProc_BuildWarpPlaneMaps, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, ImgProc_BuildWarpPlaneMaps, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); - cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1); - cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1); - cv::Mat T = cv::Mat::zeros(1, 3, CV_32F); + const cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1); + const cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1); + const cv::Mat T = cv::Mat::zeros(1, 3, CV_32F); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_map_x; - cv::gpu::GpuMat d_map_y; + cv::gpu::GpuMat map_x; + cv::gpu::GpuMat map_y; - cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, d_map_x, d_map_y); + TEST_CYCLE() cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, map_x, map_y); - TEST_CYCLE() - { - cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, d_map_x, d_map_y); - } - - GPU_SANITY_CHECK(d_map_x); - GPU_SANITY_CHECK(d_map_y); + GPU_SANITY_CHECK(map_x); + GPU_SANITY_CHECK(map_y); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } ////////////////////////////////////////////////////////////////////// // BuildWarpCylindricalMaps -PERF_TEST_P(Sz, ImgProc_BuildWarpCylindricalMaps, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, ImgProc_BuildWarpCylindricalMaps, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); - cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1); - cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1); + const cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1); + const cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_map_x; - cv::gpu::GpuMat d_map_y; + cv::gpu::GpuMat map_x; + cv::gpu::GpuMat map_y; - cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y); + TEST_CYCLE() cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y); - TEST_CYCLE() - { - cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y); - } - - GPU_SANITY_CHECK(d_map_x); - GPU_SANITY_CHECK(d_map_y); + GPU_SANITY_CHECK(map_x); + GPU_SANITY_CHECK(map_y); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } ////////////////////////////////////////////////////////////////////// // BuildWarpSphericalMaps -PERF_TEST_P(Sz, ImgProc_BuildWarpSphericalMaps, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, ImgProc_BuildWarpSphericalMaps, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); - cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1); - cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1); + const cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1); + const cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_map_x; - cv::gpu::GpuMat d_map_y; + cv::gpu::GpuMat map_x; + cv::gpu::GpuMat map_y; - cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y); - - TEST_CYCLE() - { - cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y); - } - - GPU_SANITY_CHECK(d_map_x); - GPU_SANITY_CHECK(d_map_y); + TEST_CYCLE() cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y); + GPU_SANITY_CHECK(map_x); + GPU_SANITY_CHECK(map_y); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } @@ -1361,83 +1176,68 @@ PERF_TEST_P(Sz, ImgProc_BuildWarpSphericalMaps, GPU_TYPICAL_MAT_SIZES) DEF_PARAM_TEST(Sz_Depth_Cn_Inter, cv::Size, MatDepth, MatCn, Interpolation); -PERF_TEST_P(Sz_Depth_Cn_Inter, ImgProc_Rotate, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4, - Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)))) +PERF_TEST_P(Sz_Depth_Cn_Inter, ImgProc_Rotate, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4, + Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)))) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); - int interpolation = GET_PARAM(3); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const int channels = GET_PARAM(2); + const int interpolation = GET_PARAM(3); - int type = CV_MAKE_TYPE(depth, channels); + const int type = CV_MAKE_TYPE(depth, channels); cv::Mat src(size, type); - 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; - cv::gpu::rotate(d_src, d_dst, size, 30.0, 0, 0, interpolation); + TEST_CYCLE() cv::gpu::rotate(d_src, dst, size, 30.0, 0, 0, interpolation); - TEST_CYCLE() - { - cv::gpu::rotate(d_src, d_dst, size, 30.0, 0, 0, interpolation); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1e-3, ERROR_RELATIVE); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } ////////////////////////////////////////////////////////////////////// // PyrDown -PERF_TEST_P(Sz_Depth_Cn, ImgProc_PyrDown, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, ImgProc_PyrDown, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4)) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + 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); - 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; - cv::gpu::pyrDown(d_src, d_dst); + TEST_CYCLE() cv::gpu::pyrDown(d_src, dst); - TEST_CYCLE() - { - cv::gpu::pyrDown(d_src, d_dst); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::pyrDown(src, dst); - - TEST_CYCLE() - { - cv::pyrDown(src, dst); - } + TEST_CYCLE() cv::pyrDown(src, dst); CPU_SANITY_CHECK(dst); } @@ -1446,44 +1246,34 @@ PERF_TEST_P(Sz_Depth_Cn, ImgProc_PyrDown, Combine( ////////////////////////////////////////////////////////////////////// // PyrUp -PERF_TEST_P(Sz_Depth_Cn, ImgProc_PyrUp, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, ImgProc_PyrUp, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4)) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + 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); - 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; - cv::gpu::pyrUp(d_src, d_dst); + TEST_CYCLE() cv::gpu::pyrUp(d_src, dst); - TEST_CYCLE() - { - cv::gpu::pyrUp(d_src, d_dst); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { cv::Mat dst; - cv::pyrUp(src, dst); - - TEST_CYCLE() - { - cv::pyrUp(src, dst); - } + TEST_CYCLE() cv::pyrUp(src, dst); CPU_SANITY_CHECK(dst); } @@ -1494,67 +1284,86 @@ PERF_TEST_P(Sz_Depth_Cn, ImgProc_PyrUp, Combine( DEF_PARAM_TEST(Sz_Depth_Code, cv::Size, MatDepth, CvtColorInfo); -PERF_TEST_P(Sz_Depth_Code, ImgProc_CvtColor, Combine( - GPU_TYPICAL_MAT_SIZES, - Values(CV_8U, CV_16U, CV_32F), - Values(CvtColorInfo(4, 4, cv::COLOR_RGBA2BGRA), - CvtColorInfo(4, 1, cv::COLOR_BGRA2GRAY), - CvtColorInfo(1, 4, cv::COLOR_GRAY2BGRA), - CvtColorInfo(3, 3, cv::COLOR_BGR2XYZ), - CvtColorInfo(3, 3, cv::COLOR_XYZ2BGR), - CvtColorInfo(3, 3, cv::COLOR_BGR2YCrCb), - CvtColorInfo(3, 3, cv::COLOR_YCrCb2BGR), - CvtColorInfo(3, 3, cv::COLOR_BGR2YUV), - CvtColorInfo(3, 3, cv::COLOR_YUV2BGR), - CvtColorInfo(3, 3, cv::COLOR_BGR2HSV), - CvtColorInfo(3, 3, cv::COLOR_HSV2BGR), - CvtColorInfo(3, 3, cv::COLOR_BGR2HLS), - CvtColorInfo(3, 3, cv::COLOR_HLS2BGR), - CvtColorInfo(3, 3, cv::COLOR_BGR2Lab), - CvtColorInfo(3, 3, cv::COLOR_RGB2Lab), - CvtColorInfo(3, 3, cv::COLOR_BGR2Luv), - CvtColorInfo(3, 3, cv::COLOR_RGB2Luv), - CvtColorInfo(3, 3, cv::COLOR_Lab2BGR), - CvtColorInfo(3, 3, cv::COLOR_Lab2RGB), - CvtColorInfo(3, 3, cv::COLOR_Luv2BGR), - CvtColorInfo(3, 3, cv::COLOR_Luv2RGB), - CvtColorInfo(1, 3, cv::COLOR_BayerBG2BGR), - CvtColorInfo(1, 3, cv::COLOR_BayerGB2BGR), - CvtColorInfo(1, 3, cv::COLOR_BayerRG2BGR), - CvtColorInfo(1, 3, cv::COLOR_BayerGR2BGR), - CvtColorInfo(4, 4, cv::COLOR_RGBA2mRGBA)))) +PERF_TEST_P(Sz_Depth_Code, ImgProc_CvtColor, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_32F), + Values(CvtColorInfo(4, 4, cv::COLOR_RGBA2BGRA), + CvtColorInfo(4, 1, cv::COLOR_BGRA2GRAY), + CvtColorInfo(1, 4, cv::COLOR_GRAY2BGRA), + CvtColorInfo(3, 3, cv::COLOR_BGR2XYZ), + CvtColorInfo(3, 3, cv::COLOR_XYZ2BGR), + CvtColorInfo(3, 3, cv::COLOR_BGR2YCrCb), + CvtColorInfo(3, 3, cv::COLOR_YCrCb2BGR), + CvtColorInfo(3, 3, cv::COLOR_BGR2YUV), + CvtColorInfo(3, 3, cv::COLOR_YUV2BGR), + CvtColorInfo(3, 3, cv::COLOR_BGR2HSV), + CvtColorInfo(3, 3, cv::COLOR_HSV2BGR), + CvtColorInfo(3, 3, cv::COLOR_BGR2HLS), + CvtColorInfo(3, 3, cv::COLOR_HLS2BGR), + CvtColorInfo(3, 3, cv::COLOR_BGR2Lab), + CvtColorInfo(3, 3, cv::COLOR_LBGR2Lab), + CvtColorInfo(3, 3, cv::COLOR_BGR2Luv), + CvtColorInfo(3, 3, cv::COLOR_LBGR2Luv), + CvtColorInfo(3, 3, cv::COLOR_Lab2BGR), + CvtColorInfo(3, 3, cv::COLOR_Lab2LBGR), + CvtColorInfo(3, 3, cv::COLOR_Luv2RGB), + CvtColorInfo(3, 3, cv::COLOR_Luv2LRGB)))) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - CvtColorInfo info = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const CvtColorInfo info = GET_PARAM(2); cv::Mat src(size, CV_MAKETYPE(depth, info.scn)); - fillRandom(src); + cv::randu(src, 0, depth == CV_8U ? 255.0 : 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::cvtColor(d_src, d_dst, info.code, info.dcn); + TEST_CYCLE() cv::gpu::cvtColor(d_src, dst, info.code, info.dcn); - TEST_CYCLE() - { - cv::gpu::cvtColor(d_src, d_dst, info.code, info.dcn); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1e-4); } else { cv::Mat dst; - cv::cvtColor(src, dst, info.code, info.dcn); + TEST_CYCLE() cv::cvtColor(src, dst, info.code, info.dcn); - TEST_CYCLE() - { - cv::cvtColor(src, dst, info.code, info.dcn); - } + CPU_SANITY_CHECK(dst); + } +} + +PERF_TEST_P(Sz_Depth_Code, ImgProc_CvtColorBayer, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U), + Values(CvtColorInfo(1, 3, cv::COLOR_BayerBG2BGR), + CvtColorInfo(1, 3, cv::COLOR_BayerGB2BGR), + CvtColorInfo(1, 3, cv::COLOR_BayerRG2BGR), + CvtColorInfo(1, 3, cv::COLOR_BayerGR2BGR)))) +{ + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + const CvtColorInfo info = GET_PARAM(2); + + cv::Mat src(size, CV_MAKETYPE(depth, info.scn)); + declare.in(src, WARMUP_RNG); + + if (PERF_RUN_GPU()) + { + const cv::gpu::GpuMat d_src(src); + cv::gpu::GpuMat dst; + + TEST_CYCLE() cv::gpu::cvtColor(d_src, dst, info.code, info.dcn); + + GPU_SANITY_CHECK(dst); + } + else + { + cv::Mat dst; + + TEST_CYCLE() cv::cvtColor(src, dst, info.code, info.dcn); CPU_SANITY_CHECK(dst); } @@ -1563,31 +1372,27 @@ PERF_TEST_P(Sz_Depth_Code, ImgProc_CvtColor, Combine( ////////////////////////////////////////////////////////////////////// // SwapChannels -PERF_TEST_P(Sz, ImgProc_SwapChannels, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, ImgProc_SwapChannels, + GPU_TYPICAL_MAT_SIZES) { - cv::Size size = GetParam(); + const cv::Size size = GetParam(); cv::Mat src(size, CV_8UC4); - fillRandom(src); + declare.in(src, WARMUP_RNG); const int dstOrder[] = {2, 1, 0, 3}; if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + cv::gpu::GpuMat dst(src); - cv::gpu::swapChannels(d_src, dstOrder); + TEST_CYCLE() cv::gpu::swapChannels(dst, dstOrder); - TEST_CYCLE() - { - cv::gpu::swapChannels(d_src, dstOrder); - } - - GPU_SANITY_CHECK(d_src); + GPU_SANITY_CHECK(dst); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } @@ -1599,113 +1404,116 @@ CV_ENUM(AlphaOp, cv::gpu::ALPHA_OVER, cv::gpu::ALPHA_IN, cv::gpu::ALPHA_OUT, cv: DEF_PARAM_TEST(Sz_Type_Op, cv::Size, MatType, AlphaOp); -PERF_TEST_P(Sz_Type_Op, ImgProc_AlphaComp, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC4, CV_16UC4, CV_32SC4, CV_32FC4), ALL_ALPHA_OPS)) +PERF_TEST_P(Sz_Type_Op, ImgProc_AlphaComp, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8UC4, CV_16UC4, CV_32SC4, CV_32FC4), + ALL_ALPHA_OPS)) { - cv::Size size = GET_PARAM(0); - int type = GET_PARAM(1); - int alpha_op = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int type = GET_PARAM(1); + const int alpha_op = GET_PARAM(2); cv::Mat img1(size, type); - fillRandom(img1); - cv::Mat img2(size, type); - fillRandom(img2); + declare.in(img1, img2, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_img1(img1); - cv::gpu::GpuMat d_img2(img2); - cv::gpu::GpuMat d_dst; + const cv::gpu::GpuMat d_img1(img1); + const cv::gpu::GpuMat d_img2(img2); + cv::gpu::GpuMat dst; - cv::gpu::alphaComp(d_img1, d_img2, d_dst, alpha_op); + TEST_CYCLE() cv::gpu::alphaComp(d_img1, d_img2, dst, alpha_op); - TEST_CYCLE() - { - cv::gpu::alphaComp(d_img1, d_img2, d_dst, alpha_op); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1e-3, ERROR_RELATIVE); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } ////////////////////////////////////////////////////////////////////// // ImagePyramidBuild -PERF_TEST_P(Sz_Depth_Cn, ImgProc_ImagePyramidBuild, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F), GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, ImgProc_ImagePyramidBuild, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4)) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + 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); - fillRandom(src); + declare.in(src, WARMUP_RNG); + + const int nLayers = 5; + const cv::Size dstSize(size.width / 2 + 10, size.height / 2 + 10); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_src(src); cv::gpu::ImagePyramid d_pyr; - d_pyr.build(d_src, 5); + TEST_CYCLE() d_pyr.build(d_src, nLayers); - TEST_CYCLE() - { - d_pyr.build(d_src, 5); - } + cv::gpu::GpuMat dst; + d_pyr.getLayer(dst, dstSize); - GPU_SANITY_CHECK(d_src); + GPU_SANITY_CHECK(dst); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } ////////////////////////////////////////////////////////////////////// // ImagePyramidGetLayer -PERF_TEST_P(Sz_Depth_Cn, ImgProc_ImagePyramidGetLayer, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F), GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Sz_Depth_Cn, ImgProc_ImagePyramidGetLayer, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(CV_8U, CV_16U, CV_32F), + GPU_CHANNELS_1_3_4)) { - cv::Size size = GET_PARAM(0); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + 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); - fillRandom(src); + declare.in(src, WARMUP_RNG); - cv::Size dstSize(size.width / 2 + 10, size.height / 2 + 10); + const int nLayers = 3; + const cv::Size dstSize(size.width / 2 + 10, size.height / 2 + 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; - cv::gpu::ImagePyramid d_pyr(d_src, 3); + cv::gpu::ImagePyramid d_pyr(d_src, nLayers); - d_pyr.getLayer(d_dst, dstSize); + TEST_CYCLE() d_pyr.getLayer(dst, dstSize); - TEST_CYCLE() - { - d_pyr.getLayer(d_dst, dstSize); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } -namespace { +////////////////////////////////////////////////////////////////////// +// HoughLines + +namespace +{ struct Vec4iComparator { bool operator()(const cv::Vec4i& a, const cv::Vec4i b) const @@ -1735,10 +1543,8 @@ namespace { }; } -////////////////////////////////////////////////////////////////////// -// HoughLines - -PERF_TEST_P(Sz, ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES) +PERF_TEST_P(Sz, ImgProc_HoughLines, + GPU_TYPICAL_MAT_SIZES) { declare.time(30.0); @@ -1748,49 +1554,35 @@ PERF_TEST_P(Sz, ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES) const float theta = static_cast(CV_PI / 180.0); const int threshold = 300; - cv::RNG rng(123456789); - cv::Mat src(size, CV_8UC1, cv::Scalar::all(0)); - - const int numLines = rng.uniform(100, 300); - for (int i = 0; i < numLines; ++i) - { - cv::Point p1(rng.uniform(0, src.cols), rng.uniform(0, src.rows)); - cv::Point p2(rng.uniform(0, src.cols), rng.uniform(0, src.rows)); - cv::line(src, p1, p2, cv::Scalar::all(255), 2); - } + cv::line(src, cv::Point(0, 100), cv::Point(src.cols, 100), cv::Scalar::all(255), 1); + cv::line(src, cv::Point(0, 200), cv::Point(src.cols, 200), cv::Scalar::all(255), 1); + cv::line(src, cv::Point(0, 400), cv::Point(src.cols, 400), cv::Scalar::all(255), 1); + cv::line(src, cv::Point(100, 0), cv::Point(100, src.rows), cv::Scalar::all(255), 1); + cv::line(src, cv::Point(200, 0), cv::Point(200, src.rows), cv::Scalar::all(255), 1); + cv::line(src, cv::Point(400, 0), cv::Point(400, src.rows), cv::Scalar::all(255), 1); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat d_lines; cv::gpu::HoughLinesBuf d_buf; - cv::gpu::HoughLines(d_src, d_lines, d_buf, rho, theta, threshold); + TEST_CYCLE() cv::gpu::HoughLines(d_src, d_lines, d_buf, rho, theta, threshold); - TEST_CYCLE() - { - cv::gpu::HoughLines(d_src, d_lines, d_buf, rho, theta, threshold); - } - - cv::Mat h_lines(d_lines); - cv::Vec2f* begin = (cv::Vec2f*)(h_lines.ptr(0)); - cv::Vec2f* end = (cv::Vec2f*)(h_lines.ptr(0) + (h_lines.cols) * 2 * sizeof(float)); + cv::Mat gpu_lines(d_lines.row(0)); + cv::Vec2f* begin = gpu_lines.ptr(0); + cv::Vec2f* end = begin + gpu_lines.cols; std::sort(begin, end, Vec2fComparator()); - SANITY_CHECK(h_lines); + SANITY_CHECK(gpu_lines); } else { - std::vector lines; - cv::HoughLines(src, lines, rho, theta, threshold); + std::vector cpu_lines; - TEST_CYCLE() - { - cv::HoughLines(src, lines, rho, theta, threshold); - } + TEST_CYCLE() cv::HoughLines(src, cpu_lines, rho, theta, threshold); - std::sort(lines.begin(), lines.end(), Vec2fComparator()); - SANITY_CHECK(lines); + SANITY_CHECK(cpu_lines); } } @@ -1799,11 +1591,12 @@ PERF_TEST_P(Sz, ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES) DEF_PARAM_TEST_1(Image, std::string); -PERF_TEST_P(Image, ImgProc_HoughLinesP, testing::Values("cv/shared/pic5.png", "stitching/a1.png")) +PERF_TEST_P(Image, ImgProc_HoughLinesP, + testing::Values("cv/shared/pic5.png", "stitching/a1.png")) { declare.time(30.0); - std::string fileName = getDataPath(GetParam()); + const std::string fileName = getDataPath(GetParam()); const float rho = 1.0f; const float theta = static_cast(CV_PI / 180.0); @@ -1811,42 +1604,33 @@ PERF_TEST_P(Image, ImgProc_HoughLinesP, testing::Values("cv/shared/pic5.png", "s const int minLineLenght = 50; const int maxLineGap = 5; - cv::Mat image = cv::imread(fileName, cv::IMREAD_GRAYSCALE); + const cv::Mat image = cv::imread(fileName, cv::IMREAD_GRAYSCALE); + ASSERT_FALSE(image.empty()); cv::Mat mask; cv::Canny(image, mask, 50, 100); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_mask(mask); + const cv::gpu::GpuMat d_mask(mask); cv::gpu::GpuMat d_lines; cv::gpu::HoughLinesBuf d_buf; - cv::gpu::HoughLinesP(d_mask, d_lines, d_buf, rho, theta, minLineLenght, maxLineGap); + TEST_CYCLE() cv::gpu::HoughLinesP(d_mask, d_lines, d_buf, rho, theta, minLineLenght, maxLineGap); - TEST_CYCLE() - { - cv::gpu::HoughLinesP(d_mask, d_lines, d_buf, rho, theta, minLineLenght, maxLineGap); - } - - cv::Mat h_lines(d_lines); - cv::Vec4i* begin = h_lines.ptr(); - cv::Vec4i* end = h_lines.ptr() + h_lines.cols; + cv::Mat gpu_lines(d_lines); + cv::Vec4i* begin = gpu_lines.ptr(); + cv::Vec4i* end = begin + gpu_lines.cols; std::sort(begin, end, Vec4iComparator()); - SANITY_CHECK(h_lines); + SANITY_CHECK(gpu_lines); } else { - std::vector lines; - cv::HoughLinesP(mask, lines, rho, theta, threshold, minLineLenght, maxLineGap); + std::vector cpu_lines; - TEST_CYCLE() - { - cv::HoughLinesP(mask, lines, rho, theta, threshold, minLineLenght, maxLineGap); - } + TEST_CYCLE() cv::HoughLinesP(mask, cpu_lines, rho, theta, threshold, minLineLenght, maxLineGap); - std::sort(lines.begin(), lines.end(), Vec4iComparator()); - SANITY_CHECK(lines); + SANITY_CHECK(cpu_lines); } } @@ -1855,7 +1639,10 @@ PERF_TEST_P(Image, ImgProc_HoughLinesP, testing::Values("cv/shared/pic5.png", "s DEF_PARAM_TEST(Sz_Dp_MinDist, cv::Size, float, float); -PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles, Combine(GPU_TYPICAL_MAT_SIZES, Values(1.0f, 2.0f, 4.0f), Values(1.0f, 10.0f))) +PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles, + Combine(GPU_TYPICAL_MAT_SIZES, + Values(1.0f, 2.0f, 4.0f), + Values(1.0f))) { declare.time(30.0); @@ -1868,51 +1655,32 @@ PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles, Combine(GPU_TYPICAL_MAT_SIZES, const int cannyThreshold = 100; const int votesThreshold = 15; - cv::RNG rng(123456789); - cv::Mat src(size, CV_8UC1, cv::Scalar::all(0)); - - const int numCircles = rng.uniform(50, 100); - for (int i = 0; i < numCircles; ++i) - { - cv::Point center(rng.uniform(0, src.cols), rng.uniform(0, src.rows)); - const int radius = rng.uniform(minRadius, maxRadius + 1); - - cv::circle(src, center, radius, cv::Scalar::all(255), -1); - } + cv::circle(src, cv::Point(100, 100), 20, cv::Scalar::all(255), -1); + cv::circle(src, cv::Point(200, 200), 25, cv::Scalar::all(255), -1); + cv::circle(src, cv::Point(200, 100), 25, cv::Scalar::all(255), -1); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_src(src); cv::gpu::GpuMat d_circles; cv::gpu::HoughCirclesBuf d_buf; - cv::gpu::HoughCircles(d_src, d_circles, d_buf, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); + TEST_CYCLE() cv::gpu::HoughCircles(d_src, d_circles, d_buf, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); - TEST_CYCLE() - { - cv::gpu::HoughCircles(d_src, d_circles, d_buf, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); - } - - cv::Mat h_circles(d_circles); - cv::Vec3f* begin = (cv::Vec3f*)(h_circles.ptr(0)); - cv::Vec3f* end = (cv::Vec3f*)(h_circles.ptr(0) + (h_circles.cols) * 3 * sizeof(float)); + cv::Mat gpu_circles(d_circles); + cv::Vec3f* begin = gpu_circles.ptr(0); + cv::Vec3f* end = begin + gpu_circles.cols; std::sort(begin, end, Vec3fComparator()); - SANITY_CHECK(h_circles); + SANITY_CHECK(gpu_circles); } else { - std::vector circles; + std::vector cpu_circles; - cv::HoughCircles(src, circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); + TEST_CYCLE() cv::HoughCircles(src, cpu_circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); - TEST_CYCLE() - { - cv::HoughCircles(src, circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius); - } - - std::sort(circles.begin(), circles.end(), Vec3fComparator()); - SANITY_CHECK(circles); + SANITY_CHECK(cpu_circles); } } @@ -1923,9 +1691,9 @@ CV_FLAGS(GHMethod, cv::GHT_POSITION, cv::GHT_SCALE, cv::GHT_ROTATION); DEF_PARAM_TEST(Method_Sz, GHMethod, cv::Size); -PERF_TEST_P(Method_Sz, ImgProc_GeneralizedHough, Combine( - Values(GHMethod(cv::GHT_POSITION), GHMethod(cv::GHT_POSITION | cv::GHT_SCALE), GHMethod(cv::GHT_POSITION | cv::GHT_ROTATION), GHMethod(cv::GHT_POSITION | cv::GHT_SCALE | cv::GHT_ROTATION)), - GPU_TYPICAL_MAT_SIZES)) +PERF_TEST_P(Method_Sz, ImgProc_GeneralizedHough, + Combine(Values(GHMethod(cv::GHT_POSITION), GHMethod(cv::GHT_POSITION | cv::GHT_SCALE), GHMethod(cv::GHT_POSITION | cv::GHT_ROTATION), GHMethod(cv::GHT_POSITION | cv::GHT_SCALE | cv::GHT_ROTATION)), + GPU_TYPICAL_MAT_SIZES)) { declare.time(10); @@ -1936,6 +1704,7 @@ PERF_TEST_P(Method_Sz, ImgProc_GeneralizedHough, Combine( ASSERT_FALSE(templ.empty()); cv::Mat image(imageSize, CV_8UC1, cv::Scalar::all(0)); + templ.copyTo(image(cv::Rect(50, 50, templ.cols, templ.rows))); cv::RNG rng(123456789); const int objCount = rng.uniform(5, 15); @@ -1967,10 +1736,10 @@ PERF_TEST_P(Method_Sz, ImgProc_GeneralizedHough, Combine( if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_edges(edges); - cv::gpu::GpuMat d_dx(dx); - cv::gpu::GpuMat d_dy(dy); - cv::gpu::GpuMat d_position; + const cv::gpu::GpuMat d_edges(edges); + const cv::gpu::GpuMat d_dx(dx); + const cv::gpu::GpuMat d_dy(dy); + cv::gpu::GpuMat posAndVotes; cv::Ptr d_hough = cv::gpu::GeneralizedHough_GPU::create(method); if (method & cv::GHT_ROTATION) @@ -1981,14 +1750,10 @@ PERF_TEST_P(Method_Sz, ImgProc_GeneralizedHough, Combine( d_hough->setTemplate(cv::gpu::GpuMat(templ)); - d_hough->detect(d_edges, d_dx, d_dy, d_position); + TEST_CYCLE() d_hough->detect(d_edges, d_dx, d_dy, posAndVotes); - TEST_CYCLE() - { - d_hough->detect(d_edges, d_dx, d_dy, d_position); - } - - GPU_SANITY_CHECK(d_position); + const cv::gpu::GpuMat positions(1, posAndVotes.cols, CV_32FC4, posAndVotes.data); + GPU_SANITY_CHECK(positions); } else { @@ -2003,16 +1768,8 @@ PERF_TEST_P(Method_Sz, ImgProc_GeneralizedHough, Combine( hough->setTemplate(templ); - hough->detect(edges, dx, dy, positions); + TEST_CYCLE() hough->detect(edges, dx, dy, positions); - TEST_CYCLE() - { - hough->detect(edges, dx, dy, positions); - } - - CPU_SANITY_CHECK(dx); - CPU_SANITY_CHECK(dy); + CPU_SANITY_CHECK(positions); } } - -} // namespace diff --git a/modules/gpu/perf/perf_labeling.cpp b/modules/gpu/perf/perf_labeling.cpp index 3b10ba3bef..f3ad12c949 100644 --- a/modules/gpu/perf/perf_labeling.cpp +++ b/modules/gpu/perf/perf_labeling.cpp @@ -3,8 +3,6 @@ using namespace std; using namespace testing; -namespace { - DEF_PARAM_TEST_1(Image, string); struct GreedyLabeling @@ -100,28 +98,45 @@ struct GreedyLabeling dot* stack; }; -PERF_TEST_P(Image, Labeling_ConnectedComponents, Values("gpu/labeling/aloe-disp.png")) +PERF_TEST_P(Image, DISABLED_Labeling_ConnectivityMask, + Values("gpu/labeling/aloe-disp.png")) { 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()) { + cv::gpu::GpuMat d_image(image); cv::gpu::GpuMat mask; - mask.create(image.rows, image.cols, CV_8UC1); + + TEST_CYCLE() cv::gpu::connectivityMask(d_image, mask, cv::Scalar::all(0), cv::Scalar::all(2)); + + GPU_SANITY_CHECK(mask); + } + else + { + FAIL_NO_CPU(); + } +} + +PERF_TEST_P(Image, DISABLED_Labeling_ConnectedComponents, + Values("gpu/labeling/aloe-disp.png")) +{ + declare.time(1.0); + + const cv::Mat image = readImage(GetParam(), cv::IMREAD_GRAYSCALE); + ASSERT_FALSE(image.empty()); + + if (PERF_RUN_GPU()) + { + 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; - components.create(image.rows, image.cols, CV_32SC1); - cv::gpu::connectivityMask(cv::gpu::GpuMat(image), mask, cv::Scalar::all(0), cv::Scalar::all(2)); - - ASSERT_NO_THROW(cv::gpu::labelComponents(mask, components)); - - TEST_CYCLE() - { - cv::gpu::labelComponents(mask, components); - } + TEST_CYCLE() cv::gpu::labelComponents(d_mask, components); GPU_SANITY_CHECK(components); } @@ -129,17 +144,9 @@ PERF_TEST_P(Image, Labeling_ConnectedComponents, Values("gpu/labeling/al { GreedyLabeling host(image); - host(host._labels); + TEST_CYCLE() host(host._labels); - declare.time(1.0); - - TEST_CYCLE() - { - host(host._labels); - } - - CPU_SANITY_CHECK(host._labels); + cv::Mat components = host._labels; + CPU_SANITY_CHECK(components); } } - -} // namespace diff --git a/modules/gpu/perf/perf_main.cpp b/modules/gpu/perf/perf_main.cpp index f8eb23d098..312b744482 100644 --- a/modules/gpu/perf/perf_main.cpp +++ b/modules/gpu/perf/perf_main.cpp @@ -1,7 +1,5 @@ #include "perf_precomp.hpp" -namespace{ - static void printOsInfo() { #if defined _WIN32 @@ -69,6 +67,4 @@ static void printCudaInfo() #endif } -} - -CV_PERF_TEST_MAIN(gpu, printCudaInfo()) \ No newline at end of file +CV_PERF_TEST_MAIN(gpu, printCudaInfo()) diff --git a/modules/gpu/perf/perf_matop.cpp b/modules/gpu/perf/perf_matop.cpp index b6d4a110f9..1696e3a7eb 100644 --- a/modules/gpu/perf/perf_matop.cpp +++ b/modules/gpu/perf/perf_matop.cpp @@ -3,137 +3,112 @@ using namespace std; using namespace testing; -namespace { - ////////////////////////////////////////////////////////////////////// // 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); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + 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()) { - cv::gpu::GpuMat d_src(size, type); + cv::gpu::GpuMat dst(size, type); - d_src.setTo(val); + TEST_CYCLE() dst.setTo(val); - TEST_CYCLE() - { - d_src.setTo(val); - } - - GPU_SANITY_CHECK(d_src); + GPU_SANITY_CHECK(dst); } else { - cv::Mat src(size, type); + cv::Mat dst(size, type); - src.setTo(val); + TEST_CYCLE() dst.setTo(val); - TEST_CYCLE() - { - src.setTo(val); - } - - CPU_SANITY_CHECK(src); + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // 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); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + 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); - fillRandom(src); - 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()) { - cv::gpu::GpuMat d_src(src); - cv::gpu::GpuMat d_mask(mask); + cv::gpu::GpuMat dst(src); + 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 { - src.setTo(val, mask); + cv::Mat dst = src; - TEST_CYCLE() - { - src.setTo(val, mask); - } + TEST_CYCLE() dst.setTo(val, mask); - CPU_SANITY_CHECK(src); + CPU_SANITY_CHECK(dst); } } ////////////////////////////////////////////////////////////////////// // 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); - int depth = GET_PARAM(1); - int channels = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth = GET_PARAM(1); + 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); - fillRandom(src); - cv::Mat mask(size, CV_8UC1); - fillRandom(mask, 0, 2); + declare.in(src, mask, WARMUP_RNG); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_src(src); - cv::gpu::GpuMat d_mask(mask); - cv::gpu::GpuMat d_dst; + const cv::gpu::GpuMat d_src(src); + const cv::gpu::GpuMat d_mask(mask); + cv::gpu::GpuMat dst(d_src.size(), d_src.type(), cv::Scalar::all(0)); - d_src.copyTo(d_dst, d_mask); + TEST_CYCLE() d_src.copyTo(dst, d_mask); - TEST_CYCLE() - { - d_src.copyTo(d_dst, d_mask); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1e-10); } else { - cv::Mat dst; + cv::Mat dst(src.size(), src.type(), cv::Scalar::all(0)); - src.copyTo(dst, mask); - - TEST_CYCLE() - { - src.copyTo(dst, mask); - } + TEST_CYCLE() src.copyTo(dst, mask); CPU_SANITY_CHECK(dst); } @@ -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); -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); - int depth1 = GET_PARAM(1); - int depth2 = GET_PARAM(2); + const cv::Size size = GET_PARAM(0); + const int depth1 = GET_PARAM(1); + const int depth2 = GET_PARAM(2); 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()) { - cv::gpu::GpuMat d_src(src); - cv::gpu::GpuMat d_dst; + const cv::gpu::GpuMat d_src(src); + cv::gpu::GpuMat dst; - d_src.convertTo(d_dst, depth2, 0.5, 1.0); + TEST_CYCLE() d_src.convertTo(dst, depth2, a, b); - TEST_CYCLE() - { - d_src.convertTo(d_dst, depth2, 0.5, 1.0); - } - - GPU_SANITY_CHECK(d_dst); + GPU_SANITY_CHECK(dst, 1e-10); } else { cv::Mat dst; - src.convertTo(dst, depth2, 0.5, 1.0); - - TEST_CYCLE() - { - src.convertTo(dst, depth2, 0.5, 1.0); - } + TEST_CYCLE() src.convertTo(dst, depth2, a, b); CPU_SANITY_CHECK(dst); } } - -} // namespace diff --git a/modules/gpu/perf/perf_objdetect.cpp b/modules/gpu/perf/perf_objdetect.cpp index 6d040ac02f..969ac10762 100644 --- a/modules/gpu/perf/perf_objdetect.cpp +++ b/modules/gpu/perf/perf_objdetect.cpp @@ -3,90 +3,47 @@ using namespace std; using namespace testing; -namespace { - /////////////////////////////////////////////////////////////// // HOG DEF_PARAM_TEST_1(Image, string); -PERF_TEST_P(Image, ObjDetect_HOG, Values("gpu/hog/road.png")) +PERF_TEST_P(Image, ObjDetect_HOG, + Values("gpu/hog/road.png", + "gpu/caltech/image_00000009_0.png", + "gpu/caltech/image_00000032_0.png", + "gpu/caltech/image_00000165_0.png", + "gpu/caltech/image_00000261_0.png", + "gpu/caltech/image_00000469_0.png", + "gpu/caltech/image_00000527_0.png", + "gpu/caltech/image_00000574_0.png")) { - cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE); + const cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); - std::vector found_locations; - if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_img(img); + const cv::gpu::GpuMat d_img(img); + std::vector gpu_found_locations; cv::gpu::HOGDescriptor d_hog; d_hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector()); - d_hog.detectMultiScale(d_img, found_locations); + TEST_CYCLE() d_hog.detectMultiScale(d_img, gpu_found_locations); - TEST_CYCLE() - { - d_hog.detectMultiScale(d_img, found_locations); - } + SANITY_CHECK(gpu_found_locations); } else { + std::vector cpu_found_locations; + cv::HOGDescriptor hog; hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector()); - hog.detectMultiScale(img, found_locations); + TEST_CYCLE() hog.detectMultiScale(img, cpu_found_locations); - TEST_CYCLE() - { - hog.detectMultiScale(img, found_locations); - } + SANITY_CHECK(cpu_found_locations); } - - SANITY_CHECK(found_locations); -} - -//===========test for CalTech data =============// -DEF_PARAM_TEST_1(HOG, string); - -PERF_TEST_P(HOG, CalTech, Values("gpu/caltech/image_00000009_0.png", "gpu/caltech/image_00000032_0.png", - "gpu/caltech/image_00000165_0.png", "gpu/caltech/image_00000261_0.png", "gpu/caltech/image_00000469_0.png", - "gpu/caltech/image_00000527_0.png", "gpu/caltech/image_00000574_0.png")) -{ - cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE); - ASSERT_FALSE(img.empty()); - - std::vector found_locations; - - if (PERF_RUN_GPU()) - { - cv::gpu::GpuMat d_img(img); - - cv::gpu::HOGDescriptor d_hog; - d_hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector()); - - d_hog.detectMultiScale(d_img, found_locations); - - TEST_CYCLE() - { - d_hog.detectMultiScale(d_img, found_locations); - } - } - else - { - cv::HOGDescriptor hog; - hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector()); - - hog.detectMultiScale(img, found_locations); - - TEST_CYCLE() - { - hog.detectMultiScale(img, found_locations); - } - } - - SANITY_CHECK(found_locations); } /////////////////////////////////////////////////////////////// @@ -96,9 +53,9 @@ typedef pair pair_string; DEF_PARAM_TEST_1(ImageAndCascade, pair_string); PERF_TEST_P(ImageAndCascade, ObjDetect_HaarClassifier, - Values(make_pair("gpu/haarcascade/group_1_640x480_VGA.pgm", "gpu/perf/haarcascade_frontalface_alt.xml"))) + Values(make_pair("gpu/haarcascade/group_1_640x480_VGA.pgm", "gpu/perf/haarcascade_frontalface_alt.xml"))) { - cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); + const cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); if (PERF_RUN_GPU()) @@ -106,33 +63,28 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_HaarClassifier, cv::gpu::CascadeClassifier_GPU d_cascade; ASSERT_TRUE(d_cascade.load(perf::TestBase::getDataPath(GetParam().second))); - cv::gpu::GpuMat d_img(img); - cv::gpu::GpuMat d_objects_buffer; + const cv::gpu::GpuMat d_img(img); + cv::gpu::GpuMat objects_buffer; + int detections_num = 0; - d_cascade.detectMultiScale(d_img, d_objects_buffer); + TEST_CYCLE() detections_num = d_cascade.detectMultiScale(d_img, objects_buffer); - TEST_CYCLE() - { - d_cascade.detectMultiScale(d_img, d_objects_buffer); - } - - GPU_SANITY_CHECK(d_objects_buffer); + std::vector gpu_rects(detections_num); + cv::Mat gpu_rects_mat(1, detections_num, cv::DataType::type, &gpu_rects[0]); + objects_buffer.colRange(0, detections_num).download(gpu_rects_mat); + cv::groupRectangles(gpu_rects, 3, 0.2); + SANITY_CHECK(gpu_rects); } else { cv::CascadeClassifier cascade; ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/perf/haarcascade_frontalface_alt.xml"))); - std::vector rects; + std::vector cpu_rects; - cascade.detectMultiScale(img, rects); + TEST_CYCLE() cascade.detectMultiScale(img, cpu_rects); - TEST_CYCLE() - { - cascade.detectMultiScale(img, rects); - } - - CPU_SANITY_CHECK(rects); + SANITY_CHECK(cpu_rects); } } @@ -140,9 +92,9 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_HaarClassifier, // LBP cascade PERF_TEST_P(ImageAndCascade, ObjDetect_LBPClassifier, - Values(make_pair("gpu/haarcascade/group_1_640x480_VGA.pgm", "gpu/lbpcascade/lbpcascade_frontalface.xml"))) + Values(make_pair("gpu/haarcascade/group_1_640x480_VGA.pgm", "gpu/lbpcascade/lbpcascade_frontalface.xml"))) { - cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); + const cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty()); if (PERF_RUN_GPU()) @@ -150,34 +102,27 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_LBPClassifier, cv::gpu::CascadeClassifier_GPU d_cascade; ASSERT_TRUE(d_cascade.load(perf::TestBase::getDataPath(GetParam().second))); - cv::gpu::GpuMat d_img(img); - cv::gpu::GpuMat d_gpu_rects; + const cv::gpu::GpuMat d_img(img); + cv::gpu::GpuMat objects_buffer; + int detections_num = 0; - d_cascade.detectMultiScale(d_img, d_gpu_rects); + TEST_CYCLE() detections_num = d_cascade.detectMultiScale(d_img, objects_buffer); - TEST_CYCLE() - { - d_cascade.detectMultiScale(d_img, d_gpu_rects); - } - - GPU_SANITY_CHECK(d_gpu_rects); + std::vector gpu_rects(detections_num); + cv::Mat gpu_rects_mat(1, detections_num, cv::DataType::type, &gpu_rects[0]); + objects_buffer.colRange(0, detections_num).download(gpu_rects_mat); + cv::groupRectangles(gpu_rects, 3, 0.2); + SANITY_CHECK(gpu_rects); } else { cv::CascadeClassifier cascade; ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/lbpcascade/lbpcascade_frontalface.xml"))); - std::vector rects; + std::vector cpu_rects; - cascade.detectMultiScale(img, rects); + TEST_CYCLE() cascade.detectMultiScale(img, cpu_rects); - TEST_CYCLE() - { - cascade.detectMultiScale(img, rects); - } - - CPU_SANITY_CHECK(rects); + SANITY_CHECK(cpu_rects); } } - -} // namespace \ No newline at end of file diff --git a/modules/gpu/perf/perf_video.cpp b/modules/gpu/perf/perf_video.cpp index 83213a1613..61c2687ca9 100644 --- a/modules/gpu/perf/perf_video.cpp +++ b/modules/gpu/perf/perf_video.cpp @@ -2,6 +2,7 @@ using namespace std; using namespace testing; +using namespace perf; namespace cv { @@ -11,17 +12,135 @@ namespace cv } } -namespace { - ////////////////////////////////////////////////////// -// BroxOpticalFlow +// InterpolateFrames typedef pair pair_string; DEF_PARAM_TEST_1(ImagePair, pair_string); +PERF_TEST_P(ImagePair, Video_InterpolateFrames, + Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) +{ + cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); + ASSERT_FALSE(frame0.empty()); + + cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); + ASSERT_FALSE(frame1.empty()); + + frame0.convertTo(frame0, CV_32FC1, 1.0 / 255.0); + frame1.convertTo(frame1, CV_32FC1, 1.0 / 255.0); + + if (PERF_RUN_GPU()) + { + const cv::gpu::GpuMat d_frame0(frame0); + const cv::gpu::GpuMat d_frame1(frame1); + cv::gpu::GpuMat d_fu, d_fv; + cv::gpu::GpuMat d_bu, d_bv; + + cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/, + 10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/); + + d_flow(d_frame0, d_frame1, d_fu, d_fv); + d_flow(d_frame1, d_frame0, d_bu, d_bv); + + cv::gpu::GpuMat newFrame; + cv::gpu::GpuMat d_buf; + + TEST_CYCLE() cv::gpu::interpolateFrames(d_frame0, d_frame1, d_fu, d_fv, d_bu, d_bv, 0.5f, newFrame, d_buf); + + GPU_SANITY_CHECK(newFrame); + } + else + { + FAIL_NO_CPU(); + } +} + +////////////////////////////////////////////////////// +// CreateOpticalFlowNeedleMap + +PERF_TEST_P(ImagePair, Video_CreateOpticalFlowNeedleMap, + Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) +{ + cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); + ASSERT_FALSE(frame0.empty()); + + cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); + ASSERT_FALSE(frame1.empty()); + + frame0.convertTo(frame0, CV_32FC1, 1.0 / 255.0); + frame1.convertTo(frame1, CV_32FC1, 1.0 / 255.0); + + if (PERF_RUN_GPU()) + { + const cv::gpu::GpuMat d_frame0(frame0); + const cv::gpu::GpuMat d_frame1(frame1); + cv::gpu::GpuMat u; + cv::gpu::GpuMat v; + + cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/, + 10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/); + + d_flow(d_frame0, d_frame1, u, v); + + cv::gpu::GpuMat vertex, colors; + + TEST_CYCLE() cv::gpu::createOpticalFlowNeedleMap(u, v, vertex, colors); + + GPU_SANITY_CHECK(vertex); + GPU_SANITY_CHECK(colors); + } + else + { + FAIL_NO_CPU(); + } +} + +////////////////////////////////////////////////////// +// GoodFeaturesToTrack + +DEF_PARAM_TEST(Image_MinDistance, string, double); + +PERF_TEST_P(Image_MinDistance, Video_GoodFeaturesToTrack, + Combine(Values("gpu/perf/aloe.png"), + Values(0.0, 3.0))) +{ + const string fileName = GET_PARAM(0); + const double minDistance = GET_PARAM(1); + + const cv::Mat image = readImage(fileName, cv::IMREAD_GRAYSCALE); + ASSERT_FALSE(image.empty()); + + const int maxCorners = 8000; + const double qualityLevel = 0.01; + + if (PERF_RUN_GPU()) + { + cv::gpu::GoodFeaturesToTrackDetector_GPU d_detector(maxCorners, qualityLevel, minDistance); + + const cv::gpu::GpuMat d_image(image); + cv::gpu::GpuMat pts; + + TEST_CYCLE() d_detector(d_image, pts); + + GPU_SANITY_CHECK(pts); + } + else + { + cv::Mat pts; + + TEST_CYCLE() cv::goodFeaturesToTrack(image, pts, maxCorners, qualityLevel, minDistance); + + CPU_SANITY_CHECK(pts); + } +} + +////////////////////////////////////////////////////// +// BroxOpticalFlow + PERF_TEST_P(ImagePair, Video_BroxOpticalFlow, - Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) + Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) { declare.time(10); @@ -36,166 +155,22 @@ PERF_TEST_P(ImagePair, Video_BroxOpticalFlow, if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_frame0(frame0); - cv::gpu::GpuMat d_frame1(frame1); - cv::gpu::GpuMat d_u; - cv::gpu::GpuMat d_v; + const cv::gpu::GpuMat d_frame0(frame0); + const cv::gpu::GpuMat d_frame1(frame1); + cv::gpu::GpuMat u; + cv::gpu::GpuMat v; cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/, 10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/); - d_flow(d_frame0, d_frame1, d_u, d_v); + TEST_CYCLE() d_flow(d_frame0, d_frame1, u, v); - TEST_CYCLE() - { - d_flow(d_frame0, d_frame1, d_u, d_v); - } - - GPU_SANITY_CHECK(d_u); - GPU_SANITY_CHECK(d_v); + GPU_SANITY_CHECK(u); + GPU_SANITY_CHECK(v); } else { - FAIL() << "No such CPU implementation analogy"; - } -} - -////////////////////////////////////////////////////// -// InterpolateFrames - -PERF_TEST_P(ImagePair, Video_InterpolateFrames, - Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) -{ - cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); - ASSERT_FALSE(frame0.empty()); - - cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); - ASSERT_FALSE(frame1.empty()); - - frame0.convertTo(frame0, CV_32FC1, 1.0 / 255.0); - frame1.convertTo(frame1, CV_32FC1, 1.0 / 255.0); - - if (PERF_RUN_GPU()) - { - cv::gpu::GpuMat d_frame0(frame0); - cv::gpu::GpuMat d_frame1(frame1); - cv::gpu::GpuMat d_fu, d_fv; - cv::gpu::GpuMat d_bu, d_bv; - - cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/, - 10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/); - - d_flow(d_frame0, d_frame1, d_fu, d_fv); - d_flow(d_frame1, d_frame0, d_bu, d_bv); - - cv::gpu::GpuMat d_newFrame; - cv::gpu::GpuMat d_buf; - - cv::gpu::interpolateFrames(d_frame0, d_frame1, d_fu, d_fv, d_bu, d_bv, 0.5f, d_newFrame, d_buf); - - TEST_CYCLE() - { - cv::gpu::interpolateFrames(d_frame0, d_frame1, d_fu, d_fv, d_bu, d_bv, 0.5f, d_newFrame, d_buf); - } - - GPU_SANITY_CHECK(d_fu); - GPU_SANITY_CHECK(d_fv); - GPU_SANITY_CHECK(d_bu); - GPU_SANITY_CHECK(d_bv); - } - else - { - FAIL() << "No such CPU implementation analogy"; - } -} - -////////////////////////////////////////////////////// -// CreateOpticalFlowNeedleMap - -PERF_TEST_P(ImagePair, Video_CreateOpticalFlowNeedleMap, - Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) -{ - cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); - ASSERT_FALSE(frame0.empty()); - - cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); - ASSERT_FALSE(frame1.empty()); - - frame0.convertTo(frame0, CV_32FC1, 1.0 / 255.0); - frame1.convertTo(frame1, CV_32FC1, 1.0 / 255.0); - - if (PERF_RUN_GPU()) - { - cv::gpu::GpuMat d_frame0(frame0); - cv::gpu::GpuMat d_frame1(frame1); - cv::gpu::GpuMat d_u; - cv::gpu::GpuMat d_v; - - cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/, - 10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/); - - d_flow(d_frame0, d_frame1, d_u, d_v); - - cv::gpu::GpuMat d_vertex, d_colors; - - cv::gpu::createOpticalFlowNeedleMap(d_u, d_v, d_vertex, d_colors); - - TEST_CYCLE() - { - cv::gpu::createOpticalFlowNeedleMap(d_u, d_v, d_vertex, d_colors); - } - - GPU_SANITY_CHECK(d_vertex); - GPU_SANITY_CHECK(d_colors); - } - else - { - FAIL() << "No such CPU implementation analogy"; - } -} - -////////////////////////////////////////////////////// -// GoodFeaturesToTrack - -DEF_PARAM_TEST(Image_MinDistance, string, double); - -PERF_TEST_P(Image_MinDistance, Video_GoodFeaturesToTrack, - Combine(Values("gpu/perf/aloe.png"), Values(0.0, 3.0))) -{ - string fileName = GET_PARAM(0); - double minDistance = GET_PARAM(1); - - cv::Mat image = readImage(fileName, cv::IMREAD_GRAYSCALE); - ASSERT_FALSE(image.empty()); - - if (PERF_RUN_GPU()) - { - cv::gpu::GoodFeaturesToTrackDetector_GPU d_detector(8000, 0.01, minDistance); - - cv::gpu::GpuMat d_image(image); - cv::gpu::GpuMat d_pts; - - d_detector(d_image, d_pts); - - TEST_CYCLE() - { - d_detector(d_image, d_pts); - } - - GPU_SANITY_CHECK(d_pts); - } - else - { - cv::Mat pts; - - cv::goodFeaturesToTrack(image, pts, 8000, 0.01, minDistance); - - TEST_CYCLE() - { - cv::goodFeaturesToTrack(image, pts, 8000, 0.01, minDistance); - } - - CPU_SANITY_CHECK(pts); + FAIL_NO_CPU(); } } @@ -204,27 +179,27 @@ PERF_TEST_P(Image_MinDistance, Video_GoodFeaturesToTrack, DEF_PARAM_TEST(ImagePair_Gray_NPts_WinSz_Levels_Iters, pair_string, bool, int, int, int, int); -PERF_TEST_P(ImagePair_Gray_NPts_WinSz_Levels_Iters, Video_PyrLKOpticalFlowSparse, Combine( - Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")), - Bool(), - Values(1000, 2000, 4000, 8000), - Values(9, 13, 17, 21), - Values(1, 2, 3), - Values(1, 10, 30))) +PERF_TEST_P(ImagePair_Gray_NPts_WinSz_Levels_Iters, Video_PyrLKOpticalFlowSparse, + Combine(Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")), + Bool(), + Values(8000), + Values(21), + Values(1, 3), + Values(1, 30))) { declare.time(20.0); - pair_string imagePair = GET_PARAM(0); - bool useGray = GET_PARAM(1); - int points = GET_PARAM(2); - int winSize = GET_PARAM(3); - int levels = GET_PARAM(4); - int iters = GET_PARAM(5); + const pair_string imagePair = GET_PARAM(0); + const bool useGray = GET_PARAM(1); + const int points = GET_PARAM(2); + const int winSize = GET_PARAM(3); + const int levels = GET_PARAM(4); + const int iters = GET_PARAM(5); - cv::Mat frame0 = readImage(imagePair.first, useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR); + const cv::Mat frame0 = readImage(imagePair.first, useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR); ASSERT_FALSE(frame0.empty()); - cv::Mat frame1 = readImage(imagePair.second, useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR); + const cv::Mat frame1 = readImage(imagePair.second, useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR); ASSERT_FALSE(frame1.empty()); cv::Mat gray_frame; @@ -238,36 +213,28 @@ PERF_TEST_P(ImagePair_Gray_NPts_WinSz_Levels_Iters, Video_PyrLKOpticalFlowSparse if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_pts(pts.reshape(2, 1)); + const cv::gpu::GpuMat d_pts(pts.reshape(2, 1)); cv::gpu::PyrLKOpticalFlow d_pyrLK; d_pyrLK.winSize = cv::Size(winSize, winSize); d_pyrLK.maxLevel = levels - 1; d_pyrLK.iters = iters; - cv::gpu::GpuMat d_frame0(frame0); - cv::gpu::GpuMat d_frame1(frame1); - cv::gpu::GpuMat d_nextPts; - cv::gpu::GpuMat d_status; + const cv::gpu::GpuMat d_frame0(frame0); + const cv::gpu::GpuMat d_frame1(frame1); + cv::gpu::GpuMat nextPts; + cv::gpu::GpuMat status; - d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status); + TEST_CYCLE() d_pyrLK.sparse(d_frame0, d_frame1, d_pts, nextPts, status); - TEST_CYCLE() - { - d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status); - } - - GPU_SANITY_CHECK(d_status); + GPU_SANITY_CHECK(nextPts); + GPU_SANITY_CHECK(status); } else { cv::Mat nextPts; cv::Mat status; - cv::calcOpticalFlowPyrLK(frame0, frame1, pts, nextPts, status, cv::noArray(), - cv::Size(winSize, winSize), levels - 1, - cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, iters, 0.01)); - TEST_CYCLE() { cv::calcOpticalFlowPyrLK(frame0, frame1, pts, nextPts, status, cv::noArray(), @@ -275,6 +242,7 @@ PERF_TEST_P(ImagePair_Gray_NPts_WinSz_Levels_Iters, Video_PyrLKOpticalFlowSparse cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, iters, 0.01)); } + CPU_SANITY_CHECK(nextPts); CPU_SANITY_CHECK(status); } } @@ -284,50 +252,45 @@ PERF_TEST_P(ImagePair_Gray_NPts_WinSz_Levels_Iters, Video_PyrLKOpticalFlowSparse DEF_PARAM_TEST(ImagePair_WinSz_Levels_Iters, pair_string, int, int, int); -PERF_TEST_P(ImagePair_WinSz_Levels_Iters, Video_PyrLKOpticalFlowDense, Combine( - Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")), - Values(3, 5, 7, 9, 13, 17, 21), - Values(1, 2, 3), - Values(1, 10))) +PERF_TEST_P(ImagePair_WinSz_Levels_Iters, Video_PyrLKOpticalFlowDense, + Combine(Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")), + Values(3, 5, 7, 9, 13, 17, 21), + Values(1, 3), + Values(1, 10))) { declare.time(30); - pair_string imagePair = GET_PARAM(0); - int winSize = GET_PARAM(1); - int levels = GET_PARAM(2); - int iters = GET_PARAM(3); + const pair_string imagePair = GET_PARAM(0); + const int winSize = GET_PARAM(1); + const int levels = GET_PARAM(2); + const int iters = GET_PARAM(3); - cv::Mat frame0 = readImage(imagePair.first, cv::IMREAD_GRAYSCALE); + const cv::Mat frame0 = readImage(imagePair.first, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame0.empty()); - cv::Mat frame1 = readImage(imagePair.second, cv::IMREAD_GRAYSCALE); + const cv::Mat frame1 = readImage(imagePair.second, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame1.empty()); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_frame0(frame0); - cv::gpu::GpuMat d_frame1(frame1); - cv::gpu::GpuMat d_u; - cv::gpu::GpuMat d_v; + const cv::gpu::GpuMat d_frame0(frame0); + const cv::gpu::GpuMat d_frame1(frame1); + cv::gpu::GpuMat u; + cv::gpu::GpuMat v; cv::gpu::PyrLKOpticalFlow d_pyrLK; d_pyrLK.winSize = cv::Size(winSize, winSize); d_pyrLK.maxLevel = levels - 1; d_pyrLK.iters = iters; - d_pyrLK.dense(d_frame0, d_frame1, d_u, d_v); + TEST_CYCLE() d_pyrLK.dense(d_frame0, d_frame1, u, v); - TEST_CYCLE() - { - d_pyrLK.dense(d_frame0, d_frame1, d_u, d_v); - } - - GPU_SANITY_CHECK(d_u); - GPU_SANITY_CHECK(d_v); + GPU_SANITY_CHECK(u); + GPU_SANITY_CHECK(v); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } @@ -335,30 +298,30 @@ PERF_TEST_P(ImagePair_WinSz_Levels_Iters, Video_PyrLKOpticalFlowDense, Combine( // FarnebackOpticalFlow PERF_TEST_P(ImagePair, Video_FarnebackOpticalFlow, - Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) + Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) { declare.time(10); - cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); + const cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame0.empty()); - cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); + const cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame1.empty()); - int numLevels = 5; - double pyrScale = 0.5; - int winSize = 13; - int numIters = 10; - int polyN = 5; - double polySigma = 1.1; - int flags = 0; + const int numLevels = 5; + const double pyrScale = 0.5; + const int winSize = 13; + const int numIters = 10; + const int polyN = 5; + const double polySigma = 1.1; + const int flags = 0; if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_frame0(frame0); - cv::gpu::GpuMat d_frame1(frame1); - cv::gpu::GpuMat d_u; - cv::gpu::GpuMat d_v; + const cv::gpu::GpuMat d_frame0(frame0); + const cv::gpu::GpuMat d_frame1(frame1); + cv::gpu::GpuMat u; + cv::gpu::GpuMat v; cv::gpu::FarnebackOpticalFlow d_farneback; d_farneback.numLevels = numLevels; @@ -369,26 +332,16 @@ PERF_TEST_P(ImagePair, Video_FarnebackOpticalFlow, d_farneback.polySigma = polySigma; d_farneback.flags = flags; - d_farneback(d_frame0, d_frame1, d_u, d_v); + TEST_CYCLE() d_farneback(d_frame0, d_frame1, u, v); - TEST_CYCLE() - { - d_farneback(d_frame0, d_frame1, d_u, d_v); - } - - GPU_SANITY_CHECK(d_u); - GPU_SANITY_CHECK(d_v); + GPU_SANITY_CHECK(u, 1e-4); + GPU_SANITY_CHECK(v, 1e-4); } else { cv::Mat flow; - cv::calcOpticalFlowFarneback(frame0, frame1, flow, pyrScale, numLevels, winSize, numIters, polyN, polySigma, flags); - - TEST_CYCLE() - { - cv::calcOpticalFlowFarneback(frame0, frame1, flow, pyrScale, numLevels, winSize, numIters, polyN, polySigma, flags); - } + TEST_CYCLE() cv::calcOpticalFlowFarneback(frame0, frame1, flow, pyrScale, numLevels, winSize, numIters, polyN, polySigma, flags); CPU_SANITY_CHECK(flow); } @@ -398,34 +351,29 @@ PERF_TEST_P(ImagePair, Video_FarnebackOpticalFlow, // OpticalFlowDual_TVL1 PERF_TEST_P(ImagePair, Video_OpticalFlowDual_TVL1, - Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) + Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) { declare.time(20); - cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); + const cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame0.empty()); - cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); + const cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame1.empty()); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_frame0(frame0); - cv::gpu::GpuMat d_frame1(frame1); - cv::gpu::GpuMat d_flowx; - cv::gpu::GpuMat d_flowy; + const cv::gpu::GpuMat d_frame0(frame0); + const cv::gpu::GpuMat d_frame1(frame1); + cv::gpu::GpuMat u; + cv::gpu::GpuMat v; cv::gpu::OpticalFlowDual_TVL1_GPU d_alg; - d_alg(d_frame0, d_frame1, d_flowx, d_flowy); + TEST_CYCLE() d_alg(d_frame0, d_frame1, u, v); - TEST_CYCLE() - { - d_alg(d_frame0, d_frame1, d_flowx, d_flowy); - } - - GPU_SANITY_CHECK(d_flowx); - GPU_SANITY_CHECK(d_flowy); + GPU_SANITY_CHECK(u, 1e-4); + GPU_SANITY_CHECK(v, 1e-4); } else { @@ -433,12 +381,7 @@ PERF_TEST_P(ImagePair, Video_OpticalFlowDual_TVL1, cv::Ptr alg = cv::createOptFlow_DualTVL1(); - alg->calc(frame0, frame1, flow); - - TEST_CYCLE() - { - alg->calc(frame0, frame1, flow); - } + TEST_CYCLE() alg->calc(frame0, frame1, flow); CPU_SANITY_CHECK(flow); } @@ -466,98 +409,73 @@ void calcOpticalFlowBM(const cv::Mat& prev, const cv::Mat& curr, } PERF_TEST_P(ImagePair, Video_OpticalFlowBM, - Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) + Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) { declare.time(400); - cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); + const cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame0.empty()); - cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); + const cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame1.empty()); - cv::Size block_size(16, 16); - cv::Size shift_size(1, 1); - cv::Size max_range(16, 16); + const cv::Size block_size(16, 16); + const cv::Size shift_size(1, 1); + const cv::Size max_range(16, 16); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_frame0(frame0); - cv::gpu::GpuMat d_frame1(frame1); - cv::gpu::GpuMat d_velx, d_vely, buf; + const cv::gpu::GpuMat d_frame0(frame0); + const cv::gpu::GpuMat d_frame1(frame1); + cv::gpu::GpuMat u, v, buf; - cv::gpu::calcOpticalFlowBM(d_frame0, d_frame1, block_size, shift_size, max_range, false, d_velx, d_vely, buf); + TEST_CYCLE() cv::gpu::calcOpticalFlowBM(d_frame0, d_frame1, block_size, shift_size, max_range, false, u, v, buf); - TEST_CYCLE() - { - cv::gpu::calcOpticalFlowBM(d_frame0, d_frame1, block_size, shift_size, max_range, false, d_velx, d_vely, buf); - } - - GPU_SANITY_CHECK(d_velx); - GPU_SANITY_CHECK(d_vely); + GPU_SANITY_CHECK(u); + GPU_SANITY_CHECK(v); } else { - cv::Mat velx, vely; + cv::Mat u, v; - calcOpticalFlowBM(frame0, frame1, block_size, shift_size, max_range, false, velx, vely); + TEST_CYCLE() calcOpticalFlowBM(frame0, frame1, block_size, shift_size, max_range, false, u, v); - TEST_CYCLE() - { - calcOpticalFlowBM(frame0, frame1, block_size, shift_size, max_range, false, velx, vely); - } - - CPU_SANITY_CHECK(velx); - CPU_SANITY_CHECK(vely); + CPU_SANITY_CHECK(u); + CPU_SANITY_CHECK(v); } } PERF_TEST_P(ImagePair, Video_FastOpticalFlowBM, - Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) + Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png"))) { declare.time(400); - cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); + const cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame0.empty()); - cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); + const cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE); ASSERT_FALSE(frame1.empty()); - cv::Size block_size(16, 16); - cv::Size shift_size(1, 1); - cv::Size max_range(16, 16); + const cv::Size block_size(16, 16); + const cv::Size shift_size(1, 1); + const cv::Size max_range(16, 16); if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_frame0(frame0); - cv::gpu::GpuMat d_frame1(frame1); - cv::gpu::GpuMat d_velx, d_vely; + const cv::gpu::GpuMat d_frame0(frame0); + const cv::gpu::GpuMat d_frame1(frame1); + cv::gpu::GpuMat u, v; cv::gpu::FastOpticalFlowBM fastBM; - fastBM(d_frame0, d_frame1, d_velx, d_vely, max_range.width, block_size.width); + TEST_CYCLE() fastBM(d_frame0, d_frame1, u, v, max_range.width, block_size.width); - TEST_CYCLE() - { - fastBM(d_frame0, d_frame1, d_velx, d_vely, max_range.width, block_size.width); - } - - GPU_SANITY_CHECK(d_velx); - GPU_SANITY_CHECK(d_vely); + GPU_SANITY_CHECK(u, 2); + GPU_SANITY_CHECK(v, 2); } else { - cv::Mat velx, vely; - - calcOpticalFlowBM(frame0, frame1, block_size, shift_size, max_range, false, velx, vely); - - TEST_CYCLE() - { - calcOpticalFlowBM(frame0, frame1, block_size, shift_size, max_range, false, velx, vely); - } - - CPU_SANITY_CHECK(velx); - CPU_SANITY_CHECK(vely); + FAIL_NO_CPU(); } } @@ -566,11 +484,12 @@ PERF_TEST_P(ImagePair, Video_FastOpticalFlowBM, DEF_PARAM_TEST_1(Video, string); -PERF_TEST_P(Video, DISABLED_Video_FGDStatModel, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi")) +PERF_TEST_P(Video, Video_FGDStatModel, + Values(string("gpu/video/768x576.avi"))) { declare.time(60); - string inputFile = perf::TestBase::getDataPath(GetParam()); + const string inputFile = perf::TestBase::getDataPath(GetParam()); cv::VideoCapture cap(inputFile); ASSERT_TRUE(cap.isOpened()); @@ -597,6 +516,12 @@ PERF_TEST_P(Video, DISABLED_Video_FGDStatModel, Values("gpu/video/768x576.avi", d_model.update(d_frame); stopTimer(); } + + const cv::gpu::GpuMat background = d_model.background; + const cv::gpu::GpuMat foreground = d_model.foreground; + + GPU_SANITY_CHECK(background, 1e-2, ERROR_RELATIVE); + GPU_SANITY_CHECK(foreground, 1e-2, ERROR_RELATIVE); } else { @@ -614,6 +539,12 @@ PERF_TEST_P(Video, DISABLED_Video_FGDStatModel, Values("gpu/video/768x576.avi", cvUpdateBGStatModel(&ipl_frame, model); stopTimer(); } + + const cv::Mat background = model->background; + const cv::Mat foreground = model->foreground; + + CPU_SANITY_CHECK(background); + CPU_SANITY_CHECK(foreground); } } @@ -622,12 +553,14 @@ PERF_TEST_P(Video, DISABLED_Video_FGDStatModel, Values("gpu/video/768x576.avi", DEF_PARAM_TEST(Video_Cn_LearningRate, string, MatCn, double); -PERF_TEST_P(Video_Cn_LearningRate, DISABLED_Video_MOG, - Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4, Values(0.0, 0.01))) +PERF_TEST_P(Video_Cn_LearningRate, Video_MOG, + Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), + GPU_CHANNELS_1_3_4, + Values(0.0, 0.01))) { - string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); - int cn = GET_PARAM(1); - float learningRate = static_cast(GET_PARAM(2)); + const string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); + const int cn = GET_PARAM(1); + const float learningRate = static_cast(GET_PARAM(2)); cv::VideoCapture cap(inputFile); ASSERT_TRUE(cap.isOpened()); @@ -651,9 +584,9 @@ PERF_TEST_P(Video_Cn_LearningRate, DISABLED_Video_MOG, { cv::gpu::GpuMat d_frame(frame); cv::gpu::MOG_GPU d_mog; - cv::gpu::GpuMat d_foreground; + cv::gpu::GpuMat foreground; - d_mog(d_frame, d_foreground, learningRate); + d_mog(d_frame, foreground, learningRate); for (int i = 0; i < 10; ++i) { @@ -673,9 +606,11 @@ PERF_TEST_P(Video_Cn_LearningRate, DISABLED_Video_MOG, d_frame.upload(frame); startTimer(); next(); - d_mog(d_frame, d_foreground, learningRate); + d_mog(d_frame, foreground, learningRate); stopTimer(); } + + GPU_SANITY_CHECK(foreground); } else { @@ -703,6 +638,8 @@ PERF_TEST_P(Video_Cn_LearningRate, DISABLED_Video_MOG, mog(frame, foreground, learningRate); stopTimer(); } + + CPU_SANITY_CHECK(foreground); } } @@ -711,11 +648,12 @@ PERF_TEST_P(Video_Cn_LearningRate, DISABLED_Video_MOG, DEF_PARAM_TEST(Video_Cn, string, int); -PERF_TEST_P(Video_Cn, DISABLED_Video_MOG2, - Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Video_Cn, Video_MOG2, + Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), + GPU_CHANNELS_1_3_4)) { - string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); - int cn = GET_PARAM(1); + const string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); + const int cn = GET_PARAM(1); cv::VideoCapture cap(inputFile); ASSERT_TRUE(cap.isOpened()); @@ -737,11 +675,13 @@ PERF_TEST_P(Video_Cn, DISABLED_Video_MOG2, if (PERF_RUN_GPU()) { - cv::gpu::GpuMat d_frame(frame); cv::gpu::MOG2_GPU d_mog2; - cv::gpu::GpuMat d_foreground; + d_mog2.bShadowDetection = false; - d_mog2(d_frame, d_foreground); + cv::gpu::GpuMat d_frame(frame); + cv::gpu::GpuMat foreground; + + d_mog2(d_frame, foreground); for (int i = 0; i < 10; ++i) { @@ -761,13 +701,17 @@ PERF_TEST_P(Video_Cn, DISABLED_Video_MOG2, d_frame.upload(frame); startTimer(); next(); - d_mog2(d_frame, d_foreground); + d_mog2(d_frame, foreground); stopTimer(); } + + GPU_SANITY_CHECK(foreground); } else { cv::BackgroundSubtractorMOG2 mog2; + mog2.set("detectShadows", false); + cv::Mat foreground; mog2(frame, foreground); @@ -791,6 +735,8 @@ PERF_TEST_P(Video_Cn, DISABLED_Video_MOG2, mog2(frame, foreground); stopTimer(); } + + CPU_SANITY_CHECK(foreground); } } @@ -798,10 +744,11 @@ PERF_TEST_P(Video_Cn, DISABLED_Video_MOG2, // MOG2GetBackgroundImage PERF_TEST_P(Video_Cn, Video_MOG2GetBackgroundImage, - Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4)) + Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), + GPU_CHANNELS_1_3_4)) { - string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); - int cn = GET_PARAM(1); + const string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); + const int cn = GET_PARAM(1); cv::VideoCapture cap(inputFile); ASSERT_TRUE(cap.isOpened()); @@ -834,15 +781,11 @@ PERF_TEST_P(Video_Cn, Video_MOG2GetBackgroundImage, d_mog2(d_frame, d_foreground); } - cv::gpu::GpuMat d_background; - d_mog2.getBackgroundImage(d_background); + cv::gpu::GpuMat background; - TEST_CYCLE() - { - d_mog2.getBackgroundImage(d_background); - } + TEST_CYCLE() d_mog2.getBackgroundImage(background); - GPU_SANITY_CHECK(d_background); + GPU_SANITY_CHECK(background, 1); } else { @@ -868,12 +811,8 @@ PERF_TEST_P(Video_Cn, Video_MOG2GetBackgroundImage, } cv::Mat background; - mog2.getBackgroundImage(background); - TEST_CYCLE() - { - mog2.getBackgroundImage(background); - } + TEST_CYCLE() mog2.getBackgroundImage(background); CPU_SANITY_CHECK(background); } @@ -882,11 +821,12 @@ PERF_TEST_P(Video_Cn, Video_MOG2GetBackgroundImage, ////////////////////////////////////////////////////// // VIBE -PERF_TEST_P(Video_Cn, DISABLED_Video_VIBE, - Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4)) +PERF_TEST_P(Video_Cn, Video_VIBE, + Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), + GPU_CHANNELS_1_3_4)) { - string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); - int cn = GET_PARAM(1); + const string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); + const int cn = GET_PARAM(1); cv::VideoCapture cap(inputFile); ASSERT_TRUE(cap.isOpened()); @@ -908,10 +848,10 @@ PERF_TEST_P(Video_Cn, DISABLED_Video_VIBE, if (PERF_RUN_GPU()) { cv::gpu::GpuMat d_frame(frame); - cv::gpu::VIBE_GPU d_vibe; - cv::gpu::GpuMat d_foreground; + cv::gpu::VIBE_GPU vibe; + cv::gpu::GpuMat foreground; - d_vibe(d_frame, d_foreground); + vibe(d_frame, foreground); for (int i = 0; i < 10; ++i) { @@ -931,13 +871,15 @@ PERF_TEST_P(Video_Cn, DISABLED_Video_VIBE, d_frame.upload(frame); startTimer(); next(); - d_vibe(d_frame, d_foreground); + vibe(d_frame, foreground); stopTimer(); } + + GPU_SANITY_CHECK(foreground); } else { - FAIL() << "No such CPU implementation analogy"; + FAIL_NO_CPU(); } } @@ -946,12 +888,14 @@ PERF_TEST_P(Video_Cn, DISABLED_Video_VIBE, DEF_PARAM_TEST(Video_Cn_MaxFeatures, string, MatCn, int); -PERF_TEST_P(Video_Cn_MaxFeatures, DISABLED_Video_GMG, - Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4, Values(20, 40, 60))) +PERF_TEST_P(Video_Cn_MaxFeatures, Video_GMG, + Combine(Values(string("gpu/video/768x576.avi")), + GPU_CHANNELS_1_3_4, + Values(20, 40, 60))) { - std::string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); - int cn = GET_PARAM(1); - int maxFeatures = GET_PARAM(2); + const std::string inputFile = perf::TestBase::getDataPath(GET_PARAM(0)); + const int cn = GET_PARAM(1); + const int maxFeatures = GET_PARAM(2); cv::VideoCapture cap(inputFile); ASSERT_TRUE(cap.isOpened()); @@ -973,12 +917,12 @@ PERF_TEST_P(Video_Cn_MaxFeatures, DISABLED_Video_GMG, if (PERF_RUN_GPU()) { cv::gpu::GpuMat d_frame(frame); - cv::gpu::GpuMat d_fgmask; + cv::gpu::GpuMat foreground; cv::gpu::GMG_GPU d_gmg; d_gmg.maxFeatures = maxFeatures; - d_gmg(d_frame, d_fgmask); + d_gmg(d_frame, foreground); for (int i = 0; i < 150; ++i) { @@ -1003,20 +947,22 @@ PERF_TEST_P(Video_Cn_MaxFeatures, DISABLED_Video_GMG, d_frame.upload(frame); startTimer(); next(); - d_gmg(d_frame, d_fgmask); + d_gmg(d_frame, foreground); stopTimer(); } + + GPU_SANITY_CHECK(foreground); } else { - cv::Mat fgmask; + cv::Mat foreground; cv::Mat zeros(frame.size(), CV_8UC1, cv::Scalar::all(0)); cv::BackgroundSubtractorGMG gmg; gmg.set("maxFeatures", maxFeatures); gmg.initialize(frame.size(), 0.0, 255.0); - gmg(frame, fgmask); + gmg(frame, foreground); for (int i = 0; i < 150; ++i) { @@ -1039,21 +985,60 @@ PERF_TEST_P(Video_Cn_MaxFeatures, DISABLED_Video_GMG, } startTimer(); next(); - gmg(frame, fgmask); + gmg(frame, foreground); stopTimer(); } + + CPU_SANITY_CHECK(foreground); + } +} + +#ifdef HAVE_NVCUVID + +////////////////////////////////////////////////////// +// VideoReader + +PERF_TEST_P(Video, Video_VideoReader, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi")) +{ + declare.time(20); + + const string inputFile = perf::TestBase::getDataPath(GetParam()); + + if (PERF_RUN_GPU()) + { + cv::gpu::VideoReader_GPU d_reader(inputFile); + ASSERT_TRUE( d_reader.isOpened() ); + + cv::gpu::GpuMat frame; + + TEST_CYCLE_N(10) d_reader.read(frame); + + GPU_SANITY_CHECK(frame); + } + else + { + cv::VideoCapture reader(inputFile); + ASSERT_TRUE( reader.isOpened() ); + + cv::Mat frame; + + TEST_CYCLE_N(10) reader >> frame; + + CPU_SANITY_CHECK(frame); } } ////////////////////////////////////////////////////// // VideoWriter -PERF_TEST_P(Video, DISABLED_Video_VideoWriter, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi")) +#ifdef WIN32 + +PERF_TEST_P(Video, Video_VideoWriter, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi")) { declare.time(30); - string inputFile = perf::TestBase::getDataPath(GetParam()); - string outputFile = cv::tempfile(".avi"); + const string inputFile = perf::TestBase::getDataPath(GetParam()); + const string outputFile = cv::tempfile(".avi"); const double FPS = 25.0; @@ -1100,49 +1085,10 @@ PERF_TEST_P(Video, DISABLED_Video_VideoWriter, Values("gpu/video/768x576.avi", " stopTimer(); } } + + SANITY_CHECK(frame); } -////////////////////////////////////////////////////// -// VideoReader +#endif // WIN32 -PERF_TEST_P(Video, Video_VideoReader, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi")) -{ - declare.time(20); - - string inputFile = perf::TestBase::getDataPath(GetParam()); - - if (PERF_RUN_GPU()) - { - cv::gpu::VideoReader_GPU d_reader(inputFile); - ASSERT_TRUE( d_reader.isOpened() ); - - cv::gpu::GpuMat d_frame; - - d_reader.read(d_frame); - - TEST_CYCLE_N(10) - { - d_reader.read(d_frame); - } - - GPU_SANITY_CHECK(d_frame); - } - else - { - cv::VideoCapture reader(inputFile); - ASSERT_TRUE( reader.isOpened() ); - - cv::Mat frame; - - reader >> frame; - - TEST_CYCLE_N(10) - { - reader >> frame; - } - - CPU_SANITY_CHECK(frame); - } -} - -} // namespace +#endif // HAVE_NVCUVID diff --git a/modules/gpu/perf/utility.cpp b/modules/gpu/perf/utility.cpp index c3099030b2..16c61e0c7d 100644 --- a/modules/gpu/perf/utility.cpp +++ b/modules/gpu/perf/utility.cpp @@ -2,13 +2,6 @@ using namespace std; 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) { @@ -188,4 +181,4 @@ void PrintTo(const CvtColorInfo& info, ostream* os) }; *os << str[info.code]; -} \ No newline at end of file +} diff --git a/modules/gpu/perf/utility.hpp b/modules/gpu/perf/utility.hpp index 6782b93768..cff4cdd77d 100644 --- a/modules/gpu/perf/utility.hpp +++ b/modules/gpu/perf/utility.hpp @@ -2,11 +2,9 @@ #define __OPENCV_PERF_GPU_UTILITY_HPP__ #include "opencv2/core/core.hpp" -#include "opencv2/core/gpumat.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/ts/ts_perf.hpp" -void fillRandom(cv::Mat& m, double a = 0.0, double b = 255.0); cv::Mat readImage(const std::string& fileName, int flags = cv::IMREAD_COLOR); using perf::MatType; @@ -17,12 +15,13 @@ CV_ENUM(BorderMode, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONS CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC, cv::INTER_AREA) #define ALL_INTERPOLATIONS testing::ValuesIn(Interpolation::all()) + CV_ENUM(NormType, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2, cv::NORM_HAMMING, cv::NORM_MINMAX) -const int Gray = 1, TwoChannel = 2, BGR = 3, BGRA = 4; +enum { Gray = 1, TwoChannel = 2, BGR = 3, BGRA = 4 }; CV_ENUM(MatCn, Gray, TwoChannel, BGR, BGRA) -#define GPU_CHANNELS_1_3_4 testing::Values(Gray, BGR, BGRA) -#define GPU_CHANNELS_1_3 testing::Values(Gray, BGR) +#define GPU_CHANNELS_1_3_4 testing::Values(MatCn(Gray), MatCn(BGR), MatCn(BGRA)) +#define GPU_CHANNELS_1_3 testing::Values(MatCn(Gray), MatCn(BGR)) struct CvtColorInfo { @@ -30,7 +29,8 @@ struct CvtColorInfo int dcn; int code; - explicit CvtColorInfo(int scn_=0, int dcn_=0, int code_=0) : scn(scn_), dcn(dcn_), code(code_) {} + CvtColorInfo() {} + explicit CvtColorInfo(int scn_, int dcn_, int code_) : scn(scn_), dcn(dcn_), code(code_) {} }; void PrintTo(const CvtColorInfo& info, std::ostream* os); @@ -46,39 +46,18 @@ DEF_PARAM_TEST(Sz_Depth_Cn, cv::Size, MatDepth, MatCn); #define GPU_TYPICAL_MAT_SIZES testing::Values(perf::sz720p, perf::szSXGA, perf::sz1080p) -#define GPU_SANITY_CHECK(dmat, ...) \ +#define FAIL_NO_CPU() FAIL() << "No such CPU implementation analogy" + +#define GPU_SANITY_CHECK(mat, ...) \ do{ \ - cv::Mat d##dmat(dmat); \ - SANITY_CHECK(d##dmat, ## __VA_ARGS__); \ + cv::Mat gpu_##mat(mat); \ + SANITY_CHECK(gpu_##mat, ## __VA_ARGS__); \ } while(0) -#define CPU_SANITY_CHECK(cmat, ...) \ +#define CPU_SANITY_CHECK(mat, ...) \ do{ \ - SANITY_CHECK(cmat, ## __VA_ARGS__); \ + cv::Mat cpu_##mat(mat); \ + SANITY_CHECK(cpu_##mat, ## __VA_ARGS__); \ } while(0) -#define GPU_SANITY_CHECK_KEYPOINTS(alg, dmat, ...) \ - do{ \ - cv::Mat d##dmat(dmat); \ - cv::Mat __pt_x = d##dmat.row(cv::gpu::alg##_GPU::X_ROW); \ - cv::Mat __pt_y = d##dmat.row(cv::gpu::alg##_GPU::Y_ROW); \ - cv::Mat __angle = d##dmat.row(cv::gpu::alg##_GPU::ANGLE_ROW); \ - cv::Mat __octave = d##dmat.row(cv::gpu::alg##_GPU::OCTAVE_ROW); \ - cv::Mat __size = d##dmat.row(cv::gpu::alg##_GPU::SIZE_ROW); \ - ::perf::Regression::add(this, std::string(#dmat) + "-pt-x-row", __pt_x, ## __VA_ARGS__); \ - ::perf::Regression::add(this, std::string(#dmat) + "-pt-y-row", __pt_y, ## __VA_ARGS__); \ - ::perf::Regression::add(this, std::string(#dmat) + "-angle-row", __angle, ## __VA_ARGS__); \ - ::perf::Regression::add(this, std::string(#dmat) + "octave-row", __octave, ## __VA_ARGS__); \ - ::perf::Regression::add(this, std::string(#dmat) + "-pt-size-row", __size, ## __VA_ARGS__); \ - } while(0) - -#define GPU_SANITY_CHECK_RESPONSE(alg, dmat, ...) \ - do{ \ - cv::Mat d##dmat(dmat); \ - cv::Mat __response = d##dmat.row(cv::gpu::alg##_GPU::RESPONSE_ROW); \ - ::perf::Regression::add(this, std::string(#dmat) + "-response-row", __response, ## __VA_ARGS__); \ - } while(0) - -#define FAIL_NO_CPU() FAIL() << "No such CPU implementation analogy" - #endif // __OPENCV_PERF_GPU_UTILITY_HPP__ diff --git a/modules/gpu/src/cuda/bgfg_mog.cu b/modules/gpu/src/cuda/bgfg_mog.cu index 4f78dbd2da..d99ffc498a 100644 --- a/modules/gpu/src/cuda/bgfg_mog.cu +++ b/modules/gpu/src/cuda/bgfg_mog.cu @@ -648,7 +648,7 @@ namespace cv { namespace gpu { namespace device tWeight += gmm_weight(mode * frame.rows + y, x); if (tWeight > c_TB) break; - }; + } } fgmask(y, x) = background ? 0 : isShadow ? c_shadowVal : 255; @@ -761,4 +761,4 @@ namespace cv { namespace gpu { namespace device }}} -#endif /* CUDA_DISABLER */ \ No newline at end of file +#endif /* CUDA_DISABLER */ diff --git a/modules/gpu/src/cuda/ccomponetns.cu b/modules/gpu/src/cuda/ccomponetns.cu index c094e08c0e..0533522bed 100644 --- a/modules/gpu/src/cuda/ccomponetns.cu +++ b/modules/gpu/src/cuda/ccomponetns.cu @@ -194,10 +194,10 @@ namespace cv { namespace gpu { namespace device if ( y > 0 && connected(intensity, image(y - 1, x))) c |= UP; - if ( x - 1 < image.cols && connected(intensity, image(y, x + 1))) + if ( x + 1 < image.cols && connected(intensity, image(y, x + 1))) c |= RIGHT; - if ( y - 1 < image.rows && connected(intensity, image(y + 1, x))) + if ( y + 1 < image.rows && connected(intensity, image(y + 1, x))) c |= DOWN; components(y, x) = c; diff --git a/modules/gpu/src/cuda/element_operations.cu b/modules/gpu/src/cuda/element_operations.cu index 27fb61ff70..5165b352ae 100644 --- a/modules/gpu/src/cuda/element_operations.cu +++ b/modules/gpu/src/cuda/element_operations.cu @@ -2284,15 +2284,18 @@ namespace arithm template void bitScalarAnd(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); template void bitScalarAnd(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); - template void bitScalarAnd(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); + template void bitScalarAnd(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); + template void bitScalarAnd(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); template void bitScalarOr(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); template void bitScalarOr(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); - template void bitScalarOr(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); + template void bitScalarOr(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); + template void bitScalarOr(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); template void bitScalarXor(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); template void bitScalarXor(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); - template void bitScalarXor(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); + template void bitScalarXor(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); + template void bitScalarXor(PtrStepSzb src1, uint src2, PtrStepSzb dst, cudaStream_t stream); } ////////////////////////////////////////////////////////////////////////// diff --git a/modules/gpu/src/element_operations.cpp b/modules/gpu/src/element_operations.cpp index 3d6cde377c..eedb31364a 100644 --- a/modules/gpu/src/element_operations.cpp +++ b/modules/gpu/src/element_operations.cpp @@ -2280,11 +2280,11 @@ namespace { typedef void (*bit_scalar_func_t)(PtrStepSzb src1, unsigned int src2, PtrStepSzb dst, cudaStream_t stream); - template struct BitScalar + template struct BitScalar { static void call(const GpuMat& src, Scalar sc, GpuMat& dst, cudaStream_t stream) { - func(src, static_cast(sc.val[0]), dst, stream); + func(src, saturate_cast(sc.val[0]), dst, stream); } }; @@ -2292,14 +2292,12 @@ namespace { static void call(const GpuMat& src, Scalar sc, GpuMat& dst, cudaStream_t stream) { - Scalar_ isc = sc; - unsigned int packedVal = 0; - packedVal |= (isc.val[0] & 0xffff); - packedVal |= (isc.val[1] & 0xffff) << 8; - packedVal |= (isc.val[2] & 0xffff) << 16; - packedVal |= (isc.val[3] & 0xffff) << 24; + packedVal |= (saturate_cast(sc.val[0]) & 0xffff); + packedVal |= (saturate_cast(sc.val[1]) & 0xffff) << 8; + packedVal |= (saturate_cast(sc.val[2]) & 0xffff) << 16; + packedVal |= (saturate_cast(sc.val[3]) & 0xffff) << 24; func(src, packedVal, dst, stream); } @@ -2330,7 +2328,7 @@ namespace oSizeROI.width = src.cols; oSizeROI.height = src.rows; - const npp_t pConstants[] = {static_cast(sc.val[0]), static_cast(sc.val[1]), static_cast(sc.val[2]), static_cast(sc.val[3])}; + const npp_t pConstants[] = {saturate_cast(sc.val[0]), saturate_cast(sc.val[1]), saturate_cast(sc.val[2]), saturate_cast(sc.val[3])}; nppSafeCall( func(src.ptr(), static_cast(src.step), pConstants, dst.ptr(), static_cast(dst.step), oSizeROI) ); @@ -2350,7 +2348,7 @@ namespace oSizeROI.width = src.cols; oSizeROI.height = src.rows; - nppSafeCall( func(src.ptr(), static_cast(src.step), static_cast(sc.val[0]), dst.ptr(), static_cast(dst.step), oSizeROI) ); + nppSafeCall( func(src.ptr(), static_cast(src.step), saturate_cast(sc.val[0]), dst.ptr(), static_cast(dst.step), oSizeROI) ); if (stream == 0) cudaSafeCall( cudaDeviceSynchronize() ); @@ -2365,11 +2363,11 @@ void cv::gpu::bitwise_and(const GpuMat& src, const Scalar& sc, GpuMat& dst, Stre typedef void (*func_t)(const GpuMat& src, Scalar sc, GpuMat& dst, cudaStream_t stream); static const func_t funcs[5][4] = { - {BitScalar< bitScalarAnd >::call , 0, NppBitwiseC::call, BitScalar4< bitScalarAnd >::call}, + {BitScalar >::call , 0, NppBitwiseC::call, BitScalar4< bitScalarAnd >::call}, {0,0,0,0}, - {BitScalar< bitScalarAnd >::call, 0, NppBitwiseC::call, NppBitwiseC::call}, + {BitScalar >::call, 0, NppBitwiseC::call, NppBitwiseC::call}, {0,0,0,0}, - {BitScalar< bitScalarAnd >::call , 0, NppBitwiseC::call, NppBitwiseC::call} + {BitScalar >::call , 0, NppBitwiseC::call, NppBitwiseC::call} }; const int depth = src.depth(); @@ -2390,11 +2388,11 @@ void cv::gpu::bitwise_or(const GpuMat& src, const Scalar& sc, GpuMat& dst, Strea typedef void (*func_t)(const GpuMat& src, Scalar sc, GpuMat& dst, cudaStream_t stream); static const func_t funcs[5][4] = { - {BitScalar< bitScalarOr >::call , 0, NppBitwiseC::call, BitScalar4< bitScalarOr >::call}, + {BitScalar >::call , 0, NppBitwiseC::call, BitScalar4< bitScalarOr >::call}, {0,0,0,0}, - {BitScalar< bitScalarOr >::call, 0, NppBitwiseC::call, NppBitwiseC::call}, + {BitScalar >::call, 0, NppBitwiseC::call, NppBitwiseC::call}, {0,0,0,0}, - {BitScalar< bitScalarOr >::call , 0, NppBitwiseC::call, NppBitwiseC::call} + {BitScalar >::call , 0, NppBitwiseC::call, NppBitwiseC::call} }; const int depth = src.depth(); @@ -2415,11 +2413,11 @@ void cv::gpu::bitwise_xor(const GpuMat& src, const Scalar& sc, GpuMat& dst, Stre typedef void (*func_t)(const GpuMat& src, Scalar sc, GpuMat& dst, cudaStream_t stream); static const func_t funcs[5][4] = { - {BitScalar< bitScalarXor >::call , 0, NppBitwiseC::call, BitScalar4< bitScalarXor >::call}, + {BitScalar >::call , 0, NppBitwiseC::call, BitScalar4< bitScalarXor >::call}, {0,0,0,0}, - {BitScalar< bitScalarXor >::call, 0, NppBitwiseC::call, NppBitwiseC::call}, + {BitScalar >::call, 0, NppBitwiseC::call, NppBitwiseC::call}, {0,0,0,0}, - {BitScalar< bitScalarXor >::call , 0, NppBitwiseC::call, NppBitwiseC::call} + {BitScalar >::call , 0, NppBitwiseC::call, NppBitwiseC::call} }; const int depth = src.depth(); diff --git a/modules/gpu/src/graphcuts.cpp b/modules/gpu/src/graphcuts.cpp index ab1607059a..49230e65a9 100644 --- a/modules/gpu/src/graphcuts.cpp +++ b/modules/gpu/src/graphcuts.cpp @@ -104,12 +104,12 @@ void cv::gpu::connectivityMask(const GpuMat& image, GpuMat& mask, const cv::Scal void cv::gpu::labelComponents(const GpuMat& mask, GpuMat& components, int flags, Stream& s) { - if (!TargetArchs::builtWith(SHARED_ATOMICS) || !DeviceInfo().supports(SHARED_ATOMICS)) - CV_Error(CV_StsNotImplemented, "The device doesn't support shared atomics and communicative synchronization!"); CV_Assert(!mask.empty() && mask.type() == CV_8U); - if (mask.size() != components.size() || components.type() != CV_32SC1) - components.create(mask.size(), CV_32SC1); + if (!deviceSupports(SHARED_ATOMICS)) + CV_Error(CV_StsNotImplemented, "The device doesn't support shared atomics and communicative synchronization!"); + + components.create(mask.size(), CV_32SC1); cudaStream_t stream = StreamAccessor::getStream(s); device::ccl::labelComponents(mask, components, flags, stream); diff --git a/modules/gpu/src/imgproc.cpp b/modules/gpu/src/imgproc.cpp index 283ca7cd77..63342231d0 100644 --- a/modules/gpu/src/imgproc.cpp +++ b/modules/gpu/src/imgproc.cpp @@ -517,6 +517,7 @@ void cv::gpu::rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, d CV_Assert(interpolation == INTER_NEAREST || interpolation == INTER_LINEAR || interpolation == INTER_CUBIC); dst.create(dsize, src.type()); + dst.setTo(Scalar::all(0)); funcs[src.depth()][src.channels() - 1](src, dst, dsize, angle, xShift, yShift, interpolation, StreamAccessor::getStream(stream)); } diff --git a/modules/gpu/src/mssegmentation.cpp b/modules/gpu/src/mssegmentation.cpp index 9eab4d0fb0..a0bce6ad07 100644 --- a/modules/gpu/src/mssegmentation.cpp +++ b/modules/gpu/src/mssegmentation.cpp @@ -380,6 +380,7 @@ void cv::gpu::meanShiftSegmentation(const GpuMat& src, Mat& dst, int sp, int sr, dstcol[0] = static_cast(sumcol[0] / comps.size[parent]); dstcol[1] = static_cast(sumcol[1] / comps.size[parent]); dstcol[2] = static_cast(sumcol[2] / comps.size[parent]); + dstcol[3] = 255; } } } diff --git a/modules/gpu/src/pyrlk.cpp b/modules/gpu/src/pyrlk.cpp index 71e04e9fc0..dac6f0bd9b 100644 --- a/modules/gpu/src/pyrlk.cpp +++ b/modules/gpu/src/pyrlk.cpp @@ -206,6 +206,8 @@ void cv::gpu::PyrLKOpticalFlow::dense(const GpuMat& prevImg, const GpuMat& nextI ensureSizeIsEnough(prevImg.size(), CV_32FC1, vPyr_[0]); ensureSizeIsEnough(prevImg.size(), CV_32FC1, uPyr_[1]); ensureSizeIsEnough(prevImg.size(), CV_32FC1, vPyr_[1]); + uPyr_[0].setTo(Scalar::all(0)); + vPyr_[0].setTo(Scalar::all(0)); uPyr_[1].setTo(Scalar::all(0)); vPyr_[1].setTo(Scalar::all(0)); diff --git a/modules/gpu/src/warp.cpp b/modules/gpu/src/warp.cpp index 0fb19addaa..827d5219f1 100644 --- a/modules/gpu/src/warp.cpp +++ b/modules/gpu/src/warp.cpp @@ -232,10 +232,8 @@ void cv::gpu::warpAffine(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsiz }; bool useNpp = borderMode == BORDER_CONSTANT && ofs.x == 0 && ofs.y == 0 && useNppTab[src.depth()][src.channels() - 1][interpolation]; - #ifdef linux - // NPP bug on float data - useNpp = useNpp && src.depth() != CV_32F; - #endif + // NPP bug on float data + useNpp = useNpp && src.depth() != CV_32F; if (useNpp) { @@ -372,10 +370,8 @@ void cv::gpu::warpPerspective(const GpuMat& src, GpuMat& dst, const Mat& M, Size }; bool useNpp = borderMode == BORDER_CONSTANT && ofs.x == 0 && ofs.y == 0 && useNppTab[src.depth()][src.channels() - 1][interpolation]; - #ifdef linux - // NPP bug on float data - useNpp = useNpp && src.depth() != CV_32F; - #endif + // NPP bug on float data + useNpp = useNpp && src.depth() != CV_32F; if (useNpp) { diff --git a/modules/gpu/test/test_bgfg.cpp b/modules/gpu/test/test_bgfg.cpp index bac835ef1b..ebf0a88afa 100644 --- a/modules/gpu/test/test_bgfg.cpp +++ b/modules/gpu/test/test_bgfg.cpp @@ -207,11 +207,17 @@ INSTANTIATE_TEST_CASE_P(GPU_Video, MOG, testing::Combine( ////////////////////////////////////////////////////// // MOG2 -PARAM_TEST_CASE(MOG2, cv::gpu::DeviceInfo, std::string, UseGray, UseRoi) +namespace +{ + IMPLEMENT_PARAM_CLASS(DetectShadow, bool) +} + +PARAM_TEST_CASE(MOG2, cv::gpu::DeviceInfo, std::string, UseGray, DetectShadow, UseRoi) { cv::gpu::DeviceInfo devInfo; std::string inputFile; bool useGray; + bool detectShadow; bool useRoi; virtual void SetUp() @@ -220,10 +226,9 @@ PARAM_TEST_CASE(MOG2, cv::gpu::DeviceInfo, std::string, UseGray, UseRoi) cv::gpu::setDevice(devInfo.deviceID()); inputFile = std::string(cvtest::TS::ptr()->get_data_path()) + "video/" + GET_PARAM(1); - useGray = GET_PARAM(2); - - useRoi = GET_PARAM(3); + detectShadow = GET_PARAM(3); + useRoi = GET_PARAM(4); } }; @@ -237,9 +242,11 @@ GPU_TEST_P(MOG2, Update) ASSERT_FALSE(frame.empty()); cv::gpu::MOG2_GPU mog2; + mog2.bShadowDetection = detectShadow; cv::gpu::GpuMat foreground = createMat(frame.size(), CV_8UC1, useRoi); cv::BackgroundSubtractorMOG2 mog2_gold; + mog2_gold.set("detectShadows", detectShadow); cv::Mat foreground_gold; for (int i = 0; i < 10; ++i) @@ -258,11 +265,14 @@ GPU_TEST_P(MOG2, Update) mog2_gold(frame, foreground_gold); - double norm = cv::norm(foreground_gold, cv::Mat(foreground), cv::NORM_L1); - - norm /= foreground_gold.size().area(); - - ASSERT_LE(norm, 0.09); + if (detectShadow) + { + ASSERT_MAT_SIMILAR(foreground_gold, foreground, 1e-2); + } + else + { + ASSERT_MAT_NEAR(foreground_gold, foreground, 0); + } } } @@ -277,9 +287,11 @@ GPU_TEST_P(MOG2, getBackgroundImage) cv::Mat frame; cv::gpu::MOG2_GPU mog2; + mog2.bShadowDetection = detectShadow; cv::gpu::GpuMat foreground; cv::BackgroundSubtractorMOG2 mog2_gold; + mog2_gold.set("detectShadows", detectShadow); cv::Mat foreground_gold; for (int i = 0; i < 10; ++i) @@ -305,6 +317,7 @@ INSTANTIATE_TEST_CASE_P(GPU_Video, MOG2, testing::Combine( ALL_DEVICES, testing::Values(std::string("768x576.avi")), testing::Values(UseGray(true), UseGray(false)), + testing::Values(DetectShadow(true), DetectShadow(false)), WHOLE_SUBMAT)); ////////////////////////////////////////////////////// diff --git a/modules/gpu/test/test_core.cpp b/modules/gpu/test/test_core.cpp index 6c046fca7b..52cfa5bae1 100644 --- a/modules/gpu/test/test_core.cpp +++ b/modules/gpu/test/test_core.cpp @@ -1873,7 +1873,7 @@ PARAM_TEST_CASE(Bitwise_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channel cv::gpu::setDevice(devInfo.deviceID()); src = randomMat(size, CV_MAKE_TYPE(depth, channels)); - cv::Scalar_ ival = randomScalar(0.0, 255.0); + cv::Scalar_ ival = randomScalar(0.0, std::numeric_limits::max()); val = ival; } }; diff --git a/modules/gpu/test/test_warp_affine.cpp b/modules/gpu/test/test_warp_affine.cpp index de8bc5d795..fe3a1353b1 100644 --- a/modules/gpu/test/test_warp_affine.cpp +++ b/modules/gpu/test/test_warp_affine.cpp @@ -252,6 +252,8 @@ PARAM_TEST_CASE(WarpAffineNPP, cv::gpu::DeviceInfo, MatType, Inverse, Interpolat GPU_TEST_P(WarpAffineNPP, Accuracy) { cv::Mat src = readImageType("stereobp/aloe-L.png", type); + ASSERT_FALSE(src.empty()); + cv::Mat M = createTransfomMatrix(src.size(), CV_PI / 4); int flags = interpolation; if (inverse) diff --git a/modules/gpu/test/test_warp_perspective.cpp b/modules/gpu/test/test_warp_perspective.cpp index 534edc0d2b..dd2054a049 100644 --- a/modules/gpu/test/test_warp_perspective.cpp +++ b/modules/gpu/test/test_warp_perspective.cpp @@ -255,6 +255,8 @@ PARAM_TEST_CASE(WarpPerspectiveNPP, cv::gpu::DeviceInfo, MatType, Inverse, Inter GPU_TEST_P(WarpPerspectiveNPP, Accuracy) { cv::Mat src = readImageType("stereobp/aloe-L.png", type); + ASSERT_FALSE(src.empty()); + cv::Mat M = createTransfomMatrix(src.size(), CV_PI / 4); int flags = interpolation; if (inverse) diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index f893490fb2..aa591321d1 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -275,7 +275,7 @@ if(WIN32 AND WITH_FFMPEG) COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Release/${ffmpeg_bare_name_ver}" COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Debug/${ffmpeg_bare_name_ver}" COMMENT "Copying ${ffmpeg_path} to the output directory") - elseif(MSVC) + elseif(MSVC AND (CMAKE_GENERATOR MATCHES "Visual")) add_custom_command(TARGET ${the_module} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/${ffmpeg_bare_name_ver}" COMMENT "Copying ${ffmpeg_path} to the output directory") diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt index 2fc52a703c..2639fe5a5c 100644 --- a/modules/java/CMakeLists.txt +++ b/modules/java/CMakeLists.txt @@ -217,6 +217,12 @@ endif(ANDROID AND ANDROID_EXECUTABLE) set(step3_depends ${step2_depends} ${step3_input_files} ${copied_files}) +if(ANDROID) + set(LIB_NAME_SUFIX "") +else() + set(LIB_NAME_SUFIX "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}") +endif() + # step 4: build jar if(ANDROID) set(JAR_FILE "${OpenCV_BINARY_DIR}/bin/classes.jar") @@ -241,7 +247,7 @@ if(ANDROID) ) endif() else(ANDROID) - set(JAR_NAME opencv-${OPENCV_VERSION}.jar) + set(JAR_NAME opencv-${LIB_NAME_SUFIX}.jar) set(JAR_FILE "${OpenCV_BINARY_DIR}/bin/${JAR_NAME}") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build.xml.in" "${OpenCV_BINARY_DIR}/build.xml" IMMEDIATE @ONLY) list(APPEND step3_depends "${OpenCV_BINARY_DIR}/build.xml") @@ -294,8 +300,8 @@ endif() # Additional target properties set_target_properties(${the_module} PROPERTIES - OUTPUT_NAME "${the_module}${OPENCV_DLLVERSION}" - DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" + OUTPUT_NAME "${the_module}${LIB_NAME_SUFIX}" + #DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} INSTALL_NAME_DIR ${OPENCV_LIB_INSTALL_PATH} diff --git a/modules/java/generator/gen_java.py b/modules/java/generator/gen_java.py index fb150eb506..a703fb8491 100755 --- a/modules/java/generator/gen_java.py +++ b/modules/java/generator/gen_java.py @@ -557,6 +557,15 @@ func_arg_fix = { }, # '', i.e. no class } # func_arg_fix + +def getLibVersion(version_hpp_path): + version_file = open(version_hpp_path, "rt").read() + epoch = re.search("^W*#\W*define\W+CV_VERSION_EPOCH\W+(\d+)\W*$", version_file, re.MULTILINE).group(1) + major = re.search("^W*#\W*define\W+CV_VERSION_MAJOR\W+(\d+)\W*$", version_file, re.MULTILINE).group(1) + minor = re.search("^W*#\W*define\W+CV_VERSION_MINOR\W+(\d+)\W*$", version_file, re.MULTILINE).group(1) + revision = re.search("^W*#\W*define\W+CV_VERSION_REVISION\W+(\d+)\W*$", version_file, re.MULTILINE).group(1) + return (epoch, major, minor, revision) + class ConstInfo(object): def __init__(self, cname, name, val, addedManually=False): self.cname = cname @@ -719,13 +728,16 @@ $imports public class %(jc)s { """ % { 'm' : self.module, 'jc' : jname } ) -# self.java_code[class_name]["jn_code"].write(""" -# // -# // native stuff -# // -# static { System.loadLibrary("opencv_java"); } -#""" ) - + if class_name == 'Core': + (epoch, major, minor, revision) = getLibVersion( + (os.path.dirname(__file__) or '.') + '/../../core/include/opencv2/core/version.hpp') + version_str = '.'.join( (epoch, major, minor, revision) ) + version_suffix = ''.join( (epoch, major, minor) ) + self.classes[class_name].imports.add("java.lang.String") + self.java_code[class_name]["j_code"].write(""" + public static final String VERSION = "%(v)s", NATIVE_LIBRARY_NAME = "opencv_java%(vs)s"; + public static final int VERSION_EPOCH = %(ep)s, VERSION_MAJOR = %(ma)s, VERSION_MINOR = %(mi)s, VERSION_REVISION = %(re)s; +""" % { 'v' : version_str, 'vs' : version_suffix, 'ep' : epoch, 'ma' : major, 'mi' : minor, 're' : revision } ) def add_class(self, decl): diff --git a/modules/ocl/src/arithm.cpp b/modules/ocl/src/arithm.cpp index 64b03b332e..232688895a 100644 --- a/modules/ocl/src/arithm.cpp +++ b/modules/ocl/src/arithm.cpp @@ -2122,12 +2122,16 @@ void cv::ocl::addWeighted(const oclMat &src1, double alpha, const oclMat &src2, }; int dst_step1 = dst.cols * dst.elemSize(); + int src1_step = (int) src1.step; + int src2_step = (int) src2.step; + int dst_step = (int) dst.step; + float alpha_f = alpha, beta_f = beta, gama_f = gama; std::vector > args; args.push_back( std::make_pair( sizeof(cl_mem), (void *)&src1.data )); - args.push_back( std::make_pair( sizeof(cl_int), (void *)&src1.step )); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&src1_step )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&src1.offset)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&src2.data )); - args.push_back( std::make_pair( sizeof(cl_int), (void *)&src2.step )); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&src2_step )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&src2.offset)); if(src1.clCxt -> impl -> double_support != 0) @@ -2138,14 +2142,13 @@ void cv::ocl::addWeighted(const oclMat &src1, double alpha, const oclMat &src2, } else { - float alpha_f = alpha, beta_f = beta, gama_f = gama; args.push_back( std::make_pair( sizeof(cl_float), (void *)&alpha_f )); args.push_back( std::make_pair( sizeof(cl_float), (void *)&beta_f )); args.push_back( std::make_pair( sizeof(cl_float), (void *)&gama_f )); } args.push_back( std::make_pair( sizeof(cl_mem), (void *)&dst.data )); - args.push_back( std::make_pair( sizeof(cl_int), (void *)&dst.step )); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&dst_step )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&dst.offset)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&src1.rows )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&cols )); diff --git a/modules/ocl/src/blend.cpp b/modules/ocl/src/blend.cpp index 3dfff323ba..d0af27c026 100644 --- a/modules/ocl/src/blend.cpp +++ b/modules/ocl/src/blend.cpp @@ -73,7 +73,7 @@ void cv::ocl::blendLinear(const oclMat &img1, const oclMat &img2, const oclMat & size_t localSize[] = {256, 1, 1}; std::vector< std::pair > args; - + result.create(img1.size(), CV_MAKE_TYPE(depth,img1.channels())); if(globalSize[0] != 0) { args.push_back( std::make_pair( sizeof(cl_mem), (void *)&result.data )); diff --git a/modules/ocl/src/brute_force_matcher.cpp b/modules/ocl/src/brute_force_matcher.cpp index 7654496f82..da9e5412aa 100644 --- a/modules/ocl/src/brute_force_matcher.cpp +++ b/modules/ocl/src/brute_force_matcher.cpp @@ -60,7 +60,7 @@ namespace cv } template < int BLOCK_SIZE, int MAX_DESC_LEN, typename T/*, typename Mask*/ > -void matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat &mask, +void matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, int distType) { cv::ocl::Context *ctx = query.clCxt; @@ -75,7 +75,7 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat { args.push_back( std::make_pair( sizeof(cl_mem), (void *)&query.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&train.data )); - args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); + //args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&trainIdx.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&distance.data )); args.push_back( std::make_pair( smemSize, (void *)NULL)); @@ -101,7 +101,7 @@ void matchUnrolledCached(const oclMat /*query*/, const oclMat * /*trains*/, int } template < int BLOCK_SIZE, typename T/*, typename Mask*/ > -void match(const oclMat &query, const oclMat &train, const oclMat &mask, +void match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, int distType) { cv::ocl::Context *ctx = query.clCxt; @@ -115,7 +115,7 @@ void match(const oclMat &query, const oclMat &train, const oclMat &mask, { args.push_back( std::make_pair( sizeof(cl_mem), (void *)&query.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&train.data )); - args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); + //args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&trainIdx.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&distance.data )); args.push_back( std::make_pair( smemSize, (void *)NULL)); @@ -141,7 +141,7 @@ void match(const oclMat /*query*/, const oclMat * /*trains*/, int /*n*/, const o //radius_matchUnrolledCached template < int BLOCK_SIZE, int MAX_DESC_LEN, typename T/*, typename Mask*/ > -void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &mask, +void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, int distType) { cv::ocl::Context *ctx = query.clCxt; @@ -157,7 +157,7 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDist args.push_back( std::make_pair( sizeof(cl_mem), (void *)&query.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&train.data )); args.push_back( std::make_pair( sizeof(cl_float), (void *)&maxDistance )); - args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); + //args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&trainIdx.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&distance.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&nMatches.data )); @@ -181,7 +181,7 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDist //radius_match template < int BLOCK_SIZE, typename T/*, typename Mask*/ > -void radius_match(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &mask, +void radius_match(const oclMat &query, const oclMat &train, float maxDistance, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, const oclMat &nMatches, int distType) { cv::ocl::Context *ctx = query.clCxt; @@ -196,7 +196,7 @@ void radius_match(const oclMat &query, const oclMat &train, float maxDistance, c args.push_back( std::make_pair( sizeof(cl_mem), (void *)&query.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&train.data )); args.push_back( std::make_pair( sizeof(cl_float), (void *)&maxDistance )); - args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); + //args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&trainIdx.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&distance.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&nMatches.data )); @@ -470,7 +470,7 @@ void matchDispatcher(const oclMat &query, const oclMat &train, int n, float maxD //knn match Dispatcher template < int BLOCK_SIZE, int MAX_DESC_LEN, typename T/*, typename Mask*/ > -void knn_matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat &mask, +void knn_matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, int distType) { cv::ocl::Context *ctx = query.clCxt; @@ -485,7 +485,7 @@ void knn_matchUnrolledCached(const oclMat &query, const oclMat &train, const ocl { args.push_back( std::make_pair( sizeof(cl_mem), (void *)&query.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&train.data )); - args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); + //args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&trainIdx.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&distance.data )); args.push_back( std::make_pair( smemSize, (void *)NULL)); @@ -505,7 +505,7 @@ void knn_matchUnrolledCached(const oclMat &query, const oclMat &train, const ocl } template < int BLOCK_SIZE, typename T/*, typename Mask*/ > -void knn_match(const oclMat &query, const oclMat &train, const oclMat &mask, +void knn_match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &trainIdx, const oclMat &distance, int distType) { cv::ocl::Context *ctx = query.clCxt; @@ -519,7 +519,7 @@ void knn_match(const oclMat &query, const oclMat &train, const oclMat &mask, { args.push_back( std::make_pair( sizeof(cl_mem), (void *)&query.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&train.data )); - args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); + //args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&trainIdx.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&distance.data )); args.push_back( std::make_pair( smemSize, (void *)NULL)); @@ -538,7 +538,7 @@ void knn_match(const oclMat &query, const oclMat &train, const oclMat &mask, } template < int BLOCK_SIZE, int MAX_DESC_LEN, typename T/*, typename Mask*/ > -void calcDistanceUnrolled(const oclMat &query, const oclMat &train, const oclMat &mask, const oclMat &allDist, int distType) +void calcDistanceUnrolled(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &allDist, int distType) { cv::ocl::Context *ctx = query.clCxt; size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; @@ -552,7 +552,7 @@ void calcDistanceUnrolled(const oclMat &query, const oclMat &train, const oclMat { args.push_back( std::make_pair( sizeof(cl_mem), (void *)&query.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&train.data )); - args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); + //args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&allDist.data )); args.push_back( std::make_pair( smemSize, (void *)NULL)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&block_size )); @@ -571,7 +571,7 @@ void calcDistanceUnrolled(const oclMat &query, const oclMat &train, const oclMat } template < int BLOCK_SIZE, typename T/*, typename Mask*/ > -void calcDistance(const oclMat &query, const oclMat &train, const oclMat &mask, const oclMat &allDist, int distType) +void calcDistance(const oclMat &query, const oclMat &train, const oclMat &/*mask*/, const oclMat &allDist, int distType) { cv::ocl::Context *ctx = query.clCxt; size_t globalSize[] = {(query.rows + BLOCK_SIZE - 1) / BLOCK_SIZE * BLOCK_SIZE, BLOCK_SIZE, 1}; @@ -584,7 +584,7 @@ void calcDistance(const oclMat &query, const oclMat &train, const oclMat &mask, { args.push_back( std::make_pair( sizeof(cl_mem), (void *)&query.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&train.data )); - args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); + //args.push_back( std::make_pair( sizeof(cl_mem), (void *)&mask.data )); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&allDist.data )); args.push_back( std::make_pair( smemSize, (void *)NULL)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&block_size )); @@ -1005,6 +1005,7 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchConvert(const Mat &trainIdx, cons void cv::ocl::BruteForceMatcher_OCL_base::match(const oclMat &query, const oclMat &train, std::vector &matches, const oclMat &mask) { + assert(mask.empty()); // mask is not supported at the moment oclMat trainIdx, distance; matchSingle(query, train, trainIdx, distance, mask); matchDownload(trainIdx, distance, matches); @@ -1448,7 +1449,7 @@ void cv::ocl::BruteForceMatcher_OCL_base::knnMatch(const oclMat &query, std::vec // radiusMatchSingle void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchSingle(const oclMat &query, const oclMat &train, - oclMat &trainIdx, oclMat &distance, oclMat &nMatches, float maxDistance, const oclMat &mask) + oclMat &trainIdx, oclMat &distance, oclMat &nMatches, float maxDistance, const oclMat &mask) { if (query.empty() || train.empty()) return; @@ -1694,4 +1695,4 @@ void cv::ocl::BruteForceMatcher_OCL_base::radiusMatch(const oclMat &query, std:: oclMat trainIdx, imgIdx, distance, nMatches; radiusMatchCollection(query, trainIdx, imgIdx, distance, nMatches, maxDistance, masks); radiusMatchDownload(trainIdx, imgIdx, distance, nMatches, matches, compactResult); -} \ No newline at end of file +} diff --git a/modules/ocl/src/imgproc.cpp b/modules/ocl/src/imgproc.cpp index 003830ccc0..3501636de5 100644 --- a/modules/ocl/src/imgproc.cpp +++ b/modules/ocl/src/imgproc.cpp @@ -288,13 +288,14 @@ namespace cv args.push_back( std::make_pair(sizeof(cl_int), (void *)&map1.cols)); args.push_back( std::make_pair(sizeof(cl_int), (void *)&map1.rows)); args.push_back( std::make_pair(sizeof(cl_int), (void *)&cols)); - if(src.clCxt -> impl -> double_support != 0) + float borderFloat[4] = {(float)borderValue[0], (float)borderValue[1], (float)borderValue[2], (float)borderValue[3]}; + + if(src.clCxt -> impl -> double_support != 0) { args.push_back( std::make_pair(sizeof(cl_double4), (void *)&borderValue)); } else { - float borderFloat[4] = {(float)borderValue[0], (float)borderValue[1], (float)borderValue[2], (float)borderValue[3]}; args.push_back( std::make_pair(sizeof(cl_float4), (void *)&borderFloat)); } } diff --git a/modules/ocl/src/kernels/brute_force_match.cl b/modules/ocl/src/kernels/brute_force_match.cl index a5d0d7b516..0730ac5ac7 100644 --- a/modules/ocl/src/kernels/brute_force_match.cl +++ b/modules/ocl/src/kernels/brute_force_match.cl @@ -5,11 +5,13 @@ int bit1Count(float x) { int c = 0; int ix = (int)x; + for (int i = 0 ; i < 32 ; i++) { c += ix & 0x1; ix >>= 1; } + return (float)c; } /* 2dim launch, global size: dim0 is (query rows + block_size - 1) / block_size * block_size, dim1 is block_size @@ -18,7 +20,7 @@ local size: dim0 is block_size, dim1 is block_size. __kernel void BruteForceMatch_UnrollMatch( __global float *query, __global float *train, - __global float *mask, + //__global float *mask, __global int *bestTrainIdx, __global float *bestDistance, __local float *sharebuffer, @@ -30,7 +32,7 @@ __kernel void BruteForceMatch_UnrollMatch( int train_cols, int step, int distType - ) +) { const int lidx = get_local_id(0); const int lidy = get_local_id(1); @@ -40,6 +42,7 @@ __kernel void BruteForceMatch_UnrollMatch( __local float *s_train = sharebuffer + block_size * max_desc_len; int queryIdx = groupidx * block_size + lidy; + // load the query into local memory. for (int i = 0 ; i < max_desc_len / block_size; i ++) { @@ -52,9 +55,11 @@ __kernel void BruteForceMatch_UnrollMatch( // loopUnrolledCached to find the best trainIdx and best distance. volatile int imgIdx = 0; + for (int t = 0 ; t < (train_rows + block_size - 1) / block_size ; t++) { float result = 0; + for (int i = 0 ; i < max_desc_len / block_size ; i++) { //load a block_size * block_size block into local train. @@ -67,28 +72,34 @@ __kernel void BruteForceMatch_UnrollMatch( /* there are threee types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ - switch(distType) + switch (distType) { - case 0: - for (int j = 0 ; j < block_size ; j++) - { - result += fabs(s_query[lidy * max_desc_len + i * block_size + j] - s_train[j * block_size + lidx]); - } - break; - case 1: - for (int j = 0 ; j < block_size ; j++) - { - float qr = s_query[lidy * max_desc_len + i * block_size + j] - s_train[j * block_size + lidx]; - result += qr * qr; - } - break; - case 2: - for (int j = 0 ; j < block_size ; j++) - { - //result += popcount((uint)s_query[lidy * max_desc_len + i * block_size + j] ^ (uint)s_train[j * block_size + lidx]); - result += bit1Count((uint)s_query[lidy * max_desc_len + i * block_size + j] ^ (uint)s_train[j * block_size + lidx]); - } - break; + case 0: + + for (int j = 0 ; j < block_size ; j++) + { + result += fabs(s_query[lidy * max_desc_len + i * block_size + j] - s_train[j * block_size + lidx]); + } + + break; + case 1: + + for (int j = 0 ; j < block_size ; j++) + { + float qr = s_query[lidy * max_desc_len + i * block_size + j] - s_train[j * block_size + lidx]; + result += qr * qr; + } + + break; + case 2: + + for (int j = 0 ; j < block_size ; j++) + { + //result += popcount((uint)s_query[lidy * max_desc_len + i * block_size + j] ^ (uint)s_train[j * block_size + lidx]); + result += bit1Count((uint)s_query[lidy * max_desc_len + i * block_size + j] ^(uint)s_train[j * block_size + lidx]); + } + + break; } barrier(CLK_LOCAL_MEM_FENCE); @@ -105,8 +116,8 @@ __kernel void BruteForceMatch_UnrollMatch( } barrier(CLK_LOCAL_MEM_FENCE); - __local float *s_distance = (__local float*)(sharebuffer); - __local int* s_trainIdx = (__local int *)(sharebuffer + block_size * block_size); + __local float *s_distance = (__local float *)(sharebuffer); + __local int *s_trainIdx = (__local int *)(sharebuffer + block_size * block_size); //find BestMatch s_distance += lidy * block_size; @@ -136,7 +147,7 @@ __kernel void BruteForceMatch_UnrollMatch( __kernel void BruteForceMatch_Match( __global float *query, __global float *train, - __global float *mask, + //__global float *mask, __global int *bestTrainIdx, __global float *bestDistance, __local float *sharebuffer, @@ -147,7 +158,7 @@ __kernel void BruteForceMatch_Match( int train_cols, int step, int distType - ) +) { const int lidx = get_local_id(0); const int lidy = get_local_id(1); @@ -166,6 +177,7 @@ __kernel void BruteForceMatch_Match( { //Dist dist; float result = 0; + for (int i = 0 ; i < (query_cols + block_size - 1) / block_size ; i++) { const int loadx = lidx + i * block_size; @@ -184,28 +196,34 @@ __kernel void BruteForceMatch_Match( /* there are threee types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ - switch(distType) + switch (distType) { - case 0: - for (int j = 0 ; j < block_size ; j++) - { - result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); - } - break; - case 1: - for (int j = 0 ; j < block_size ; j++) - { - float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; - result += qr * qr; - } - break; - case 2: - for (int j = 0 ; j < block_size ; j++) - { - //result += popcount((uint)s_query[lidy * block_size + j] ^ (uint)s_train[j * block_size + lidx]); - result += bit1Count((uint)s_query[lidy * block_size + j] ^ (uint)s_train[(uint)j * block_size + lidx]); - } - break; + case 0: + + for (int j = 0 ; j < block_size ; j++) + { + result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); + } + + break; + case 1: + + for (int j = 0 ; j < block_size ; j++) + { + float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; + result += qr * qr; + } + + break; + case 2: + + for (int j = 0 ; j < block_size ; j++) + { + //result += popcount((uint)s_query[lidy * block_size + j] ^ (uint)s_train[j * block_size + lidx]); + result += bit1Count((uint)s_query[lidy * block_size + j] ^(uint)s_train[(uint)j * block_size + lidx]); + } + + break; } barrier(CLK_LOCAL_MEM_FENCE); @@ -256,7 +274,7 @@ __kernel void BruteForceMatch_RadiusUnrollMatch( __global float *query, __global float *train, float maxDistance, - __global float *mask, + //__global float *mask, __global int *bestTrainIdx, __global float *bestDistance, __global int *nMatches, @@ -271,7 +289,7 @@ __kernel void BruteForceMatch_RadiusUnrollMatch( int step, int ostep, int distType - ) +) { const int lidx = get_local_id(0); const int lidy = get_local_id(1); @@ -285,6 +303,7 @@ __kernel void BruteForceMatch_RadiusUnrollMatch( __local float *s_train = sharebuffer + block_size * block_size; float result = 0; + for (int i = 0 ; i < max_desc_len / block_size ; ++i) { //load a block_size * block_size block into local train. @@ -299,27 +318,33 @@ __kernel void BruteForceMatch_RadiusUnrollMatch( /* there are three types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ - switch(distType) + switch (distType) { - case 0: - for (int j = 0 ; j < block_size ; ++j) - { - result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); - } - break; - case 1: - for (int j = 0 ; j < block_size ; ++j) - { - float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; - result += qr * qr; - } - break; - case 2: - for (int j = 0 ; j < block_size ; ++j) - { - result += bit1Count((uint)s_query[lidy * block_size + j] ^ (uint)s_train[j * block_size + lidx]); - } - break; + case 0: + + for (int j = 0 ; j < block_size ; ++j) + { + result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); + } + + break; + case 1: + + for (int j = 0 ; j < block_size ; ++j) + { + float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; + result += qr * qr; + } + + break; + case 2: + + for (int j = 0 ; j < block_size ; ++j) + { + result += bit1Count((uint)s_query[lidy * block_size + j] ^(uint)s_train[j * block_size + lidx]); + } + + break; } barrier(CLK_LOCAL_MEM_FENCE); @@ -329,7 +354,7 @@ __kernel void BruteForceMatch_RadiusUnrollMatch( { unsigned int ind = atom_inc(nMatches + queryIdx/*, (unsigned int) -1*/); - if(ind < bestTrainIdx_cols) + if (ind < bestTrainIdx_cols) { //bestImgIdx = imgIdx; bestTrainIdx[queryIdx * (ostep / sizeof(int)) + ind] = trainIdx; @@ -343,7 +368,7 @@ __kernel void BruteForceMatch_RadiusMatch( __global float *query, __global float *train, float maxDistance, - __global float *mask, + //__global float *mask, __global int *bestTrainIdx, __global float *bestDistance, __global int *nMatches, @@ -357,7 +382,7 @@ __kernel void BruteForceMatch_RadiusMatch( int step, int ostep, int distType - ) +) { const int lidx = get_local_id(0); const int lidy = get_local_id(1); @@ -371,6 +396,7 @@ __kernel void BruteForceMatch_RadiusMatch( __local float *s_train = sharebuffer + block_size * block_size; float result = 0; + for (int i = 0 ; i < (query_cols + block_size - 1) / block_size ; ++i) { //load a block_size * block_size block into local train. @@ -385,27 +411,33 @@ __kernel void BruteForceMatch_RadiusMatch( /* there are three types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ - switch(distType) + switch (distType) { - case 0: - for (int j = 0 ; j < block_size ; ++j) - { - result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); - } - break; - case 1: - for (int j = 0 ; j < block_size ; ++j) - { - float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; - result += qr * qr; - } - break; - case 2: - for (int j = 0 ; j < block_size ; ++j) - { - result += bit1Count((uint)s_query[lidy * block_size + j] ^ (uint)s_train[j * block_size + lidx]); - } - break; + case 0: + + for (int j = 0 ; j < block_size ; ++j) + { + result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); + } + + break; + case 1: + + for (int j = 0 ; j < block_size ; ++j) + { + float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; + result += qr * qr; + } + + break; + case 2: + + for (int j = 0 ; j < block_size ; ++j) + { + result += bit1Count((uint)s_query[lidy * block_size + j] ^(uint)s_train[j * block_size + lidx]); + } + + break; } barrier(CLK_LOCAL_MEM_FENCE); @@ -415,7 +447,7 @@ __kernel void BruteForceMatch_RadiusMatch( { unsigned int ind = atom_inc(nMatches + queryIdx/*, (unsigned int) -1*/); - if(ind < bestTrainIdx_cols) + if (ind < bestTrainIdx_cols) { //bestImgIdx = imgIdx; bestTrainIdx[queryIdx * (ostep / sizeof(int)) + ind] = trainIdx; @@ -428,7 +460,7 @@ __kernel void BruteForceMatch_RadiusMatch( __kernel void BruteForceMatch_knnUnrollMatch( __global float *query, __global float *train, - __global float *mask, + //__global float *mask, __global int2 *bestTrainIdx, __global float2 *bestDistance, __local float *sharebuffer, @@ -440,7 +472,7 @@ __kernel void BruteForceMatch_knnUnrollMatch( int train_cols, int step, int distType - ) +) { const int lidx = get_local_id(0); const int lidy = get_local_id(1); @@ -464,9 +496,11 @@ __kernel void BruteForceMatch_knnUnrollMatch( //loopUnrolledCached volatile int imgIdx = 0; + for (int t = 0 ; t < (train_rows + block_size - 1) / block_size ; t++) { float result = 0; + for (int i = 0 ; i < max_desc_len / block_size ; i++) { const int loadX = lidx + i * block_size; @@ -480,28 +514,34 @@ __kernel void BruteForceMatch_knnUnrollMatch( /* there are threee types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ - switch(distType) + switch (distType) { - case 0: - for (int j = 0 ; j < block_size ; j++) - { - result += fabs(s_query[lidy * max_desc_len + i * block_size + j] - s_train[j * block_size + lidx]); - } - break; - case 1: - for (int j = 0 ; j < block_size ; j++) - { - float qr = s_query[lidy * max_desc_len + i * block_size + j] - s_train[j * block_size + lidx]; - result += qr * qr; - } - break; - case 2: - for (int j = 0 ; j < block_size ; j++) - { - //result += popcount((uint)s_query[lidy * max_desc_len + i * block_size + j] ^ (uint)s_train[j * block_size + lidx]); - result += bit1Count((uint)s_query[lidy * max_desc_len + i * block_size + j] ^ (uint)s_train[j * block_size + lidx]); - } - break; + case 0: + + for (int j = 0 ; j < block_size ; j++) + { + result += fabs(s_query[lidy * max_desc_len + i * block_size + j] - s_train[j * block_size + lidx]); + } + + break; + case 1: + + for (int j = 0 ; j < block_size ; j++) + { + float qr = s_query[lidy * max_desc_len + i * block_size + j] - s_train[j * block_size + lidx]; + result += qr * qr; + } + + break; + case 2: + + for (int j = 0 ; j < block_size ; j++) + { + //result += popcount((uint)s_query[lidy * max_desc_len + i * block_size + j] ^ (uint)s_train[j * block_size + lidx]); + result += bit1Count((uint)s_query[lidy * max_desc_len + i * block_size + j] ^(uint)s_train[j * block_size + lidx]); + } + + break; } barrier(CLK_LOCAL_MEM_FENCE); @@ -549,6 +589,7 @@ __kernel void BruteForceMatch_knnUnrollMatch( for (int i = 0 ; i < block_size ; i++) { float val = s_distance[i]; + if (val < bestDistance1) { bestDistance2 = bestDistance1; @@ -602,7 +643,7 @@ __kernel void BruteForceMatch_knnUnrollMatch( __kernel void BruteForceMatch_knnMatch( __global float *query, __global float *train, - __global float *mask, + //__global float *mask, __global int2 *bestTrainIdx, __global float2 *bestDistance, __local float *sharebuffer, @@ -613,7 +654,7 @@ __kernel void BruteForceMatch_knnMatch( int train_cols, int step, int distType - ) +) { const int lidx = get_local_id(0); const int lidy = get_local_id(1); @@ -632,7 +673,8 @@ __kernel void BruteForceMatch_knnMatch( for (int t = 0 ; t < (train_rows + block_size - 1) / block_size ; t++) { float result = 0.0f; - for (int i = 0 ; i < (query_cols + block_size -1) / block_size ; i++) + + for (int i = 0 ; i < (query_cols + block_size - 1) / block_size ; i++) { const int loadx = lidx + i * block_size; //load query and train into local memory @@ -650,28 +692,34 @@ __kernel void BruteForceMatch_knnMatch( /* there are threee types in the reducer. the first is L1Dist, which to sum the abs(v1, v2), the second is L2Dist, which to sum the (v1 - v2) * (v1 - v2), the third is humming, which to popc(v1 ^ v2), popc is to count the bits are set to 1*/ - switch(distType) + switch (distType) { - case 0: - for (int j = 0 ; j < block_size ; j++) - { - result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); - } - break; - case 1: - for (int j = 0 ; j < block_size ; j++) - { - float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; - result += qr * qr; - } - break; - case 2: - for (int j = 0 ; j < block_size ; j++) - { - //result += popcount((uint)s_query[lidy * block_size + j] ^ (uint)s_train[j * block_size + lidx]); - result += bit1Count((uint)s_query[lidy * block_size + j] ^ (uint)s_train[(uint)j * block_size + lidx]); - } - break; + case 0: + + for (int j = 0 ; j < block_size ; j++) + { + result += fabs(s_query[lidy * block_size + j] - s_train[j * block_size + lidx]); + } + + break; + case 1: + + for (int j = 0 ; j < block_size ; j++) + { + float qr = s_query[lidy * block_size + j] - s_train[j * block_size + lidx]; + result += qr * qr; + } + + break; + case 2: + + for (int j = 0 ; j < block_size ; j++) + { + //result += popcount((uint)s_query[lidy * block_size + j] ^ (uint)s_train[j * block_size + lidx]); + result += bit1Count((uint)s_query[lidy * block_size + j] ^(uint)s_train[(uint)j * block_size + lidx]); + } + + break; } barrier(CLK_LOCAL_MEM_FENCE); @@ -719,6 +767,7 @@ __kernel void BruteForceMatch_knnMatch( for (int i = 0 ; i < block_size ; i++) { float val = s_distance[i]; + if (val < bestDistance1) { bestDistance2 = bestDistance1; @@ -772,7 +821,7 @@ __kernel void BruteForceMatch_knnMatch( kernel void BruteForceMatch_calcDistanceUnrolled( __global float *query, __global float *train, - __global float *mask, + //__global float *mask, __global float *allDist, __local float *sharebuffer, int block_size, @@ -790,7 +839,7 @@ kernel void BruteForceMatch_calcDistanceUnrolled( kernel void BruteForceMatch_calcDistance( __global float *query, __global float *train, - __global float *mask, + //__global float *mask, __global float *allDist, __local float *sharebuffer, int block_size, @@ -808,9 +857,9 @@ kernel void BruteForceMatch_findBestMatch( __global float *allDist, __global int *bestTrainIdx, __global float *bestDistance, - int k, - int block_size - ) + int k, + int block_size +) { /* Todo */ } \ No newline at end of file diff --git a/modules/ocl/src/kernels/nonfree_surf.cl b/modules/ocl/src/kernels/nonfree_surf.cl index f50b1674ee..e6acba2b0b 100644 --- a/modules/ocl/src/kernels/nonfree_surf.cl +++ b/modules/ocl/src/kernels/nonfree_surf.cl @@ -78,7 +78,7 @@ uchar read_imgTex(IMAGE_INT8 img, sampler_t sam, float2 coord, int rows, int col // dynamically change the precision used for floating type -#if defined (__ATI__) || defined (__NVIDIA__) +#if defined DOUBLE_SUPPORT #define F double #else #define F float @@ -299,7 +299,7 @@ __kernel __global const float * det, __global const float * trace, __global int4 * maxPosBuffer, - volatile __global unsigned int* maxCounter, + volatile __global int* maxCounter, int counter_offset, int det_step, // the step of det in bytes int trace_step, // the step of trace in bytes @@ -408,7 +408,7 @@ __kernel if(condmax) { - unsigned int ind = atomic_inc(maxCounter); + int ind = atomic_inc(maxCounter); if (ind < c_max_candidates) { @@ -427,7 +427,7 @@ __kernel __global float * det, __global float * trace, __global int4 * maxPosBuffer, - volatile __global unsigned int* maxCounter, + volatile __global int* maxCounter, int counter_offset, int det_step, // the step of det in bytes int trace_step, // the step of trace in bytes @@ -525,7 +525,7 @@ __kernel if(condmax) { - unsigned int ind = atomic_inc(maxCounter); + int ind = atomic_inc(maxCounter); if (ind < c_max_candidates) { @@ -585,7 +585,7 @@ __kernel __global const float * det, __global const int4 * maxPosBuffer, __global float * keypoints, - volatile __global unsigned int * featureCounter, + volatile __global int * featureCounter, int det_step, int keypoints_step, int c_img_rows, @@ -684,7 +684,7 @@ __kernel if ((c_img_rows + 1) >= grad_wav_size && (c_img_cols + 1) >= grad_wav_size) { // Get a new feature index. - unsigned int ind = atomic_inc(featureCounter); + int ind = atomic_inc(featureCounter); if (ind < c_max_features) { @@ -737,19 +737,19 @@ __constant float c_aptW[ORI_SAMPLES] = {0.001455130288377404f, 0.001707611023448 __constant float c_NX[2][5] = {{0, 0, 2, 4, -1}, {2, 0, 4, 4, 1}}; __constant float c_NY[2][5] = {{0, 0, 4, 2, 1}, {0, 2, 4, 4, -1}}; -void reduce_32_sum(volatile __local float * data, float partial_reduction, int tid) +void reduce_32_sum(volatile __local float * data, volatile float* partial_reduction, int tid) { -#define op(A, B) (A)+(B) - data[tid] = partial_reduction; +#define op(A, B) (*A)+(B) + data[tid] = *partial_reduction; barrier(CLK_LOCAL_MEM_FENCE); if (tid < 16) { - data[tid] = partial_reduction = op(partial_reduction, data[tid + 16]); - data[tid] = partial_reduction = op(partial_reduction, data[tid + 8 ]); - data[tid] = partial_reduction = op(partial_reduction, data[tid + 4 ]); - data[tid] = partial_reduction = op(partial_reduction, data[tid + 2 ]); - data[tid] = partial_reduction = op(partial_reduction, data[tid + 1 ]); + data[tid] = *partial_reduction = op(partial_reduction, data[tid + 16]); + data[tid] = *partial_reduction = op(partial_reduction, data[tid + 8 ]); + data[tid] = *partial_reduction = op(partial_reduction, data[tid + 4 ]); + data[tid] = *partial_reduction = op(partial_reduction, data[tid + 2 ]); + data[tid] = *partial_reduction = op(partial_reduction, data[tid + 1 ]); } #undef op } @@ -831,7 +831,7 @@ __kernel { const int dir = (i * 4 + get_local_id(1)) * ORI_SEARCH_INC; - float sumx = 0.0f, sumy = 0.0f; + volatile float sumx = 0.0f, sumy = 0.0f; int d = abs(convert_int_rte(s_angle[get_local_id(0)]) - dir); if (d < ORI_WIN / 2 || d > 360 - ORI_WIN / 2) { @@ -856,8 +856,8 @@ __kernel sumx += s_X[get_local_id(0) + 96]; sumy += s_Y[get_local_id(0) + 96]; } - reduce_32_sum(s_sumx + get_local_id(1) * 32, sumx, get_local_id(0)); - reduce_32_sum(s_sumy + get_local_id(1) * 32, sumy, get_local_id(0)); + reduce_32_sum(s_sumx + get_local_id(1) * 32, &sumx, get_local_id(0)); + reduce_32_sum(s_sumy + get_local_id(1) * 32, &sumy, get_local_id(0)); const float temp_mod = sumx * sumx + sumy * sumy; if (temp_mod > best_mod) @@ -892,14 +892,32 @@ __kernel kp_dir += 2.0f * CV_PI_F; kp_dir *= 180.0f / CV_PI_F; - kp_dir = 360.0f - kp_dir; - if (fabs(kp_dir - 360.f) < FLT_EPSILON) - kp_dir = 0.f; + //kp_dir = 360.0f - kp_dir; + //if (fabs(kp_dir - 360.f) < FLT_EPSILON) + // kp_dir = 0.f; featureDir[get_group_id(0)] = kp_dir; } } + +__kernel + void icvSetUpright( + __global float * keypoints, + int keypoints_step, + int nFeatures + ) +{ + keypoints_step /= sizeof(*keypoints); + __global float* featureDir = keypoints + ANGLE_ROW * keypoints_step; + + if(get_global_id(0) <= nFeatures) + { + featureDir[get_global_id(0)] = 90.0f; + } +} + + #undef ORI_SEARCH_INC #undef ORI_WIN #undef ORI_SAMPLES @@ -993,10 +1011,7 @@ void calc_dx_dy( const float centerX = featureX[get_group_id(0)]; const float centerY = featureY[get_group_id(0)]; const float size = featureSize[get_group_id(0)]; - float descriptor_dir = 360.0f - featureDir[get_group_id(0)]; - if (fabs(descriptor_dir - 360.f) < FLT_EPSILON) - descriptor_dir = 0.f; - descriptor_dir *= (float)(CV_PI_F / 180.0f); + float descriptor_dir = featureDir[get_group_id(0)] * (float)(CV_PI_F / 180.0f); /* The sampling intervals and wavelet sized for selecting an orientation and building the keypoint descriptor are defined relative to 's' */ @@ -1125,11 +1140,15 @@ __kernel { sdxabs[tid] = fabs(sdx[tid]); // |dx| array sdyabs[tid] = fabs(sdy[tid]); // |dy| array - //barrier(CLK_LOCAL_MEM_FENCE); - + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 25) + { reduce_sum25(sdx, sdy, sdxabs, sdyabs, tid); - //barrier(CLK_LOCAL_MEM_FENCE); - + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 25) + { volatile __global float* descriptors_block = descriptors + descriptors_step * get_group_id(0) + (get_group_id(1) << 2); // write dx, dy, |dx|, |dy| diff --git a/modules/ocl/src/kernels/objdetect_hog.cl b/modules/ocl/src/kernels/objdetect_hog.cl index 076c22cb89..db11ed1410 100644 --- a/modules/ocl/src/kernels/objdetect_hog.cl +++ b/modules/ocl/src/kernels/objdetect_hog.cl @@ -140,6 +140,10 @@ float reduce_smem(volatile __local float* smem, int size) if (tid < 32) { if (size >= 64) smem[tid] = sum = sum + smem[tid + 32]; + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 16) + { if (size >= 32) smem[tid] = sum = sum + smem[tid + 16]; if (size >= 16) smem[tid] = sum = sum + smem[tid + 8]; if (size >= 8) smem[tid] = sum = sum + smem[tid + 4]; @@ -224,6 +228,11 @@ __kernel void classify_hists_kernel(const int cblock_hist_size, const int cdescr { volatile __local float* smem = products; smem[tid] = product = product + smem[tid + 32]; + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < 16) + { + volatile __local float* smem = products; smem[tid] = product = product + smem[tid + 16]; smem[tid] = product = product + smem[tid + 8]; smem[tid] = product = product + smem[tid + 4]; diff --git a/modules/ocl/src/surf.cpp b/modules/ocl/src/surf.cpp index c389e155ee..a69b0082a7 100644 --- a/modules/ocl/src/surf.cpp +++ b/modules/ocl/src/surf.cpp @@ -56,6 +56,21 @@ namespace cv { ///////////////////////////OpenCL kernel strings/////////////////////////// extern const char *nonfree_surf; + + const char* noImage2dOption = "-D DISABLE_IMAGE2D"; + + static void openCLExecuteKernelSURF(Context *clCxt , const char **source, std::string kernelName, size_t globalThreads[3], + size_t localThreads[3], std::vector< std::pair > &args, int channels, int depth) + { + if(support_image2d()) + { + openCLExecuteKernel(clCxt, source, kernelName, globalThreads, localThreads, args, channels, depth); + } + else + { + openCLExecuteKernel(clCxt, source, kernelName, globalThreads, localThreads, args, channels, depth, noImage2dOption); + } + } } } @@ -79,10 +94,6 @@ static inline int calcSize(int octave, int layer) return (HAAR_SIZE0 + HAAR_SIZE_INC * layer) << octave; } -namespace -{ - const char* noImage2dOption = "-D DISABLE_IMAGE2D"; -} class SURF_OCL_Invoker { @@ -99,15 +110,16 @@ public: void icvFindMaximaInLayer_gpu(const oclMat &det, const oclMat &trace, oclMat &maxPosBuffer, oclMat &maxCounter, int counterOffset, int octave, bool use_mask, int nLayers, int layer_rows, int layer_cols); - void icvInterpolateKeypoint_gpu(const oclMat &det, const oclMat &maxPosBuffer, unsigned int maxCounter, + void icvInterpolateKeypoint_gpu(const oclMat &det, const oclMat &maxPosBuffer, int maxCounter, oclMat &keypoints, oclMat &counters, int octave, int layer_rows, int maxFeatures); void icvCalcOrientation_gpu(const oclMat &keypoints, int nFeatures); + void icvSetUpright_gpu(const oclMat &keypoints, int nFeatures); + void compute_descriptors_gpu(const oclMat &descriptors, const oclMat &keypoints, int nFeatures); // end of kernel callers declarations - SURF_OCL_Invoker(SURF_OCL &surf, const oclMat &img, const oclMat &mask) : surf_(surf), img_cols(img.cols), img_rows(img.rows), @@ -181,8 +193,8 @@ public: icvFindMaximaInLayer_gpu(surf_.det, surf_.trace, surf_.maxPosBuffer, counters, 1 + octave, octave, use_mask, surf_.nOctaveLayers, layer_rows, layer_cols); - unsigned int maxCounter = Mat(counters).at(1 + octave); - maxCounter = std::min(maxCounter, static_cast(maxCandidates)); + int maxCounter = ((Mat)counters).at(1 + octave); + maxCounter = std::min(maxCounter, static_cast(maxCandidates)); if (maxCounter > 0) { @@ -190,15 +202,29 @@ public: keypoints, counters, octave, layer_rows, maxFeatures); } } - unsigned int featureCounter = Mat(counters).at(0); - featureCounter = std::min(featureCounter, static_cast(maxFeatures)); + int featureCounter = Mat(counters).at(0); + featureCounter = std::min(featureCounter, static_cast(maxFeatures)); keypoints.cols = featureCounter; if (surf_.upright) - keypoints.row(SURF_OCL::ANGLE_ROW).setTo(Scalar::all(90.0)); + { + //keypoints.row(SURF_OCL::ANGLE_ROW).setTo(Scalar::all(90.0)); + setUpright(keypoints); + } else + { findOrientation(keypoints); + } + } + + void setUpright(oclMat &keypoints) + { + const int nFeatures = keypoints.cols; + if(nFeatures > 0) + { + icvSetUpright_gpu(keypoints, keypoints.cols); + } } void findOrientation(oclMat &keypoints) @@ -483,14 +509,7 @@ void SURF_OCL_Invoker::icvCalcLayerDetAndTrace_gpu(oclMat &det, oclMat &trace, i divUp(max_samples_i, localThreads[1]) *localThreads[1] *(nOctaveLayers + 2), 1 }; - if(support_image2d()) - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); -} - else - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1, noImage2dOption); - } + openCLExecuteKernelSURF(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); } void SURF_OCL_Invoker::icvFindMaximaInLayer_gpu(const oclMat &det, const oclMat &trace, oclMat &maxPosBuffer, oclMat &maxCounter, int counterOffset, @@ -536,17 +555,10 @@ void SURF_OCL_Invoker::icvFindMaximaInLayer_gpu(const oclMat &det, const oclMat 1 }; - if(support_image2d()) - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); -} - else - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1, noImage2dOption); - } + openCLExecuteKernelSURF(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); } -void SURF_OCL_Invoker::icvInterpolateKeypoint_gpu(const oclMat &det, const oclMat &maxPosBuffer, unsigned int maxCounter, +void SURF_OCL_Invoker::icvInterpolateKeypoint_gpu(const oclMat &det, const oclMat &maxPosBuffer, int maxCounter, oclMat &keypoints, oclMat &counters, int octave, int layer_rows, int maxFeatures) { Context *clCxt = det.clCxt; @@ -568,14 +580,7 @@ void SURF_OCL_Invoker::icvInterpolateKeypoint_gpu(const oclMat &det, const oclMa size_t localThreads[3] = {3, 3, 3}; size_t globalThreads[3] = {maxCounter *localThreads[0], localThreads[1], 1}; - if(support_image2d()) - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); -} - else - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1, noImage2dOption); - } + openCLExecuteKernelSURF(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); } void SURF_OCL_Invoker::icvCalcOrientation_gpu(const oclMat &keypoints, int nFeatures) @@ -602,16 +607,27 @@ void SURF_OCL_Invoker::icvCalcOrientation_gpu(const oclMat &keypoints, int nFeat size_t localThreads[3] = {32, 4, 1}; size_t globalThreads[3] = {nFeatures *localThreads[0], localThreads[1], 1}; - if(support_image2d()) - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); + openCLExecuteKernelSURF(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); } - else - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1, noImage2dOption); - } + +void SURF_OCL_Invoker::icvSetUpright_gpu(const oclMat &keypoints, int nFeatures) +{ + Context *clCxt = counters.clCxt; + std::string kernelName = "icvSetUpright"; + + std::vector< std::pair > args; + + args.push_back( std::make_pair( sizeof(cl_mem), (void *)&keypoints.data)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&keypoints.step)); + args.push_back( std::make_pair( sizeof(cl_int), (void *)&nFeatures)); + + size_t localThreads[3] = {256, 1, 1}; + size_t globalThreads[3] = {nFeatures, 1, 1}; + + openCLExecuteKernelSURF(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); } + void SURF_OCL_Invoker::compute_descriptors_gpu(const oclMat &descriptors, const oclMat &keypoints, int nFeatures) { // compute unnormalized descriptors, then normalize them - odd indexing since grid must be 2D @@ -647,14 +663,8 @@ void SURF_OCL_Invoker::compute_descriptors_gpu(const oclMat &descriptors, const args.push_back( std::make_pair( sizeof(cl_int), (void *)&_img.rows)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&_img.cols)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&_img.step)); - if(support_image2d()) - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); - } - else - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1, noImage2dOption); - } + + openCLExecuteKernelSURF(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); kernelName = "normalize_descriptors64"; @@ -667,14 +677,8 @@ void SURF_OCL_Invoker::compute_descriptors_gpu(const oclMat &descriptors, const args.clear(); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&descriptors.data)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&descriptors.step)); - if(support_image2d()) - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); - } - else - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1, noImage2dOption); - } + + openCLExecuteKernelSURF(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); } else { @@ -702,14 +706,8 @@ void SURF_OCL_Invoker::compute_descriptors_gpu(const oclMat &descriptors, const args.push_back( std::make_pair( sizeof(cl_int), (void *)&_img.rows)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&_img.cols)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&_img.step)); - if(support_image2d()) - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); - } - else - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1, noImage2dOption); - } + + openCLExecuteKernelSURF(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); kernelName = "normalize_descriptors128"; @@ -722,14 +720,8 @@ void SURF_OCL_Invoker::compute_descriptors_gpu(const oclMat &descriptors, const args.clear(); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&descriptors.data)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&descriptors.step)); - if(support_image2d()) - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); - } - else - { - openCLExecuteKernel(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1, noImage2dOption); - } + + openCLExecuteKernelSURF(clCxt, &nonfree_surf, kernelName, globalThreads, localThreads, args, -1, -1); } } diff --git a/samples/c/smiledetect.cpp b/samples/c/smiledetect.cpp new file mode 100644 index 0000000000..c54c724398 --- /dev/null +++ b/samples/c/smiledetect.cpp @@ -0,0 +1,247 @@ +#include "opencv2/objdetect/objdetect.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc/imgproc.hpp" + +#include +#include +#include +#include + +using namespace std; +using namespace cv; + +static void help() +{ + cout << "\nThis program demonstrates the smile detector.\n" + "Usage:\n" + "./smiledetect [--cascade= this is the frontal face classifier]\n" + " [--smile-cascade=[]]\n" + " [--scale=]\n" + " [--try-flip]\n" + " [video_filename|camera_index]\n\n" + "Example:\n" + "./smiledetect --cascade=\"../../data/haarcascades/haarcascade_frontalface_alt.xml\" --smile-cascade=\"../../data/haarcascades/haarcascade_smile.xml\" --scale=2.0\n\n" + "During execution:\n\tHit any key to quit.\n" + "\tUsing OpenCV version " << CV_VERSION << "\n" << endl; +} + +void detectAndDraw( Mat& img, CascadeClassifier& cascade, + CascadeClassifier& nestedCascade, + double scale, bool tryflip ); + +string cascadeName = "../../data/haarcascades/haarcascade_frontalface_alt.xml"; +string nestedCascadeName = "../../data/haarcascades/haarcascade_smile.xml"; + + +int main( int argc, const char** argv ) +{ + CvCapture* capture = 0; + Mat frame, frameCopy, image; + const string scaleOpt = "--scale="; + size_t scaleOptLen = scaleOpt.length(); + const string cascadeOpt = "--cascade="; + size_t cascadeOptLen = cascadeOpt.length(); + const string nestedCascadeOpt = "--smile-cascade"; + size_t nestedCascadeOptLen = nestedCascadeOpt.length(); + const string tryFlipOpt = "--try-flip"; + size_t tryFlipOptLen = tryFlipOpt.length(); + string inputName; + bool tryflip = false; + + help(); + + CascadeClassifier cascade, nestedCascade; + double scale = 1; + + for( int i = 1; i < argc; i++ ) + { + cout << "Processing " << i << " " << argv[i] << endl; + if( cascadeOpt.compare( 0, cascadeOptLen, argv[i], cascadeOptLen ) == 0 ) + { + cascadeName.assign( argv[i] + cascadeOptLen ); + cout << " from which we have cascadeName= " << cascadeName << endl; + } + else if( nestedCascadeOpt.compare( 0, nestedCascadeOptLen, argv[i], nestedCascadeOptLen ) == 0 ) + { + if( argv[i][nestedCascadeOpt.length()] == '=' ) + nestedCascadeName.assign( argv[i] + nestedCascadeOpt.length() + 1 ); + } + else if( scaleOpt.compare( 0, scaleOptLen, argv[i], scaleOptLen ) == 0 ) + { + if( !sscanf( argv[i] + scaleOpt.length(), "%lf", &scale ) || scale < 1 ) + scale = 1; + cout << " from which we read scale = " << scale << endl; + } + else if( tryFlipOpt.compare( 0, tryFlipOptLen, argv[i], tryFlipOptLen ) == 0 ) + { + tryflip = true; + cout << " will try to flip image horizontally to detect assymetric objects\n"; + } + else if( argv[i][0] == '-' ) + { + cerr << "WARNING: Unknown option " << argv[i] << endl; + } + else + inputName.assign( argv[i] ); + } + + if( !cascade.load( cascadeName ) ) + { + cerr << "ERROR: Could not load face cascade" << endl; + help(); + return -1; + } + if( !nestedCascade.load( nestedCascadeName ) ) + { + cerr << "ERROR: Could not load smile cascade" << endl; + help(); + return -1; + } + + if( inputName.empty() || (isdigit(inputName.c_str()[0]) && inputName.c_str()[1] == '\0') ) + { + capture = cvCaptureFromCAM( inputName.empty() ? 0 : inputName.c_str()[0] - '0' ); + int c = inputName.empty() ? 0 : inputName.c_str()[0] - '0' ; + if(!capture) cout << "Capture from CAM " << c << " didn't work" << endl; + } + else if( inputName.size() ) + { + capture = cvCaptureFromAVI( inputName.c_str() ); + if(!capture) cout << "Capture from AVI didn't work" << endl; + } + + cvNamedWindow( "result", 1 ); + + if( capture ) + { + cout << "In capture ..." << endl; + cout << endl << "NOTE: Smile intensity will only be valid after a first smile has been detected" << endl; + + for(;;) + { + IplImage* iplImg = cvQueryFrame( capture ); + frame = iplImg; + if( frame.empty() ) + break; + if( iplImg->origin == IPL_ORIGIN_TL ) + frame.copyTo( frameCopy ); + else + flip( frame, frameCopy, 0 ); + + detectAndDraw( frameCopy, cascade, nestedCascade, scale, tryflip ); + + if( waitKey( 10 ) >= 0 ) + goto _cleanup_; + } + + waitKey(0); + +_cleanup_: + cvReleaseCapture( &capture ); + } + else + { + cerr << "ERROR: Could not initiate capture" << endl; + help(); + return -1; + } + + cvDestroyWindow("result"); + return 0; +} + +void detectAndDraw( Mat& img, CascadeClassifier& cascade, + CascadeClassifier& nestedCascade, + double scale, bool tryflip) +{ + int i = 0; + vector faces, faces2; + const static Scalar colors[] = { CV_RGB(0,0,255), + CV_RGB(0,128,255), + CV_RGB(0,255,255), + CV_RGB(0,255,0), + CV_RGB(255,128,0), + CV_RGB(255,255,0), + CV_RGB(255,0,0), + CV_RGB(255,0,255)} ; + Mat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 ); + + cvtColor( img, gray, CV_BGR2GRAY ); + resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR ); + equalizeHist( smallImg, smallImg ); + + cascade.detectMultiScale( smallImg, faces, + 1.1, 2, 0 + //|CV_HAAR_FIND_BIGGEST_OBJECT + //|CV_HAAR_DO_ROUGH_SEARCH + |CV_HAAR_SCALE_IMAGE + , + Size(30, 30) ); + if( tryflip ) + { + flip(smallImg, smallImg, 1); + cascade.detectMultiScale( smallImg, faces2, + 1.1, 2, 0 + //|CV_HAAR_FIND_BIGGEST_OBJECT + //|CV_HAAR_DO_ROUGH_SEARCH + |CV_HAAR_SCALE_IMAGE + , + Size(30, 30) ); + for( vector::const_iterator r = faces2.begin(); r != faces2.end(); r++ ) + { + faces.push_back(Rect(smallImg.cols - r->x - r->width, r->y, r->width, r->height)); + } + } + + for( vector::iterator r = faces.begin(); r != faces.end(); r++, i++ ) + { + Mat smallImgROI; + vector nestedObjects; + Point center; + Scalar color = colors[i%8]; + int radius; + + double aspect_ratio = (double)r->width/r->height; + if( 0.75 < aspect_ratio && aspect_ratio < 1.3 ) + { + center.x = cvRound((r->x + r->width*0.5)*scale); + center.y = cvRound((r->y + r->height*0.5)*scale); + radius = cvRound((r->width + r->height)*0.25*scale); + circle( img, center, radius, color, 3, 8, 0 ); + } + else + rectangle( img, cvPoint(cvRound(r->x*scale), cvRound(r->y*scale)), + cvPoint(cvRound((r->x + r->width-1)*scale), cvRound((r->y + r->height-1)*scale)), + color, 3, 8, 0); + + const int half_height=cvRound((float)r->height/2); + r->y=r->y + half_height; + r->height = half_height; + smallImgROI = smallImg(*r); + nestedCascade.detectMultiScale( smallImgROI, nestedObjects, + 1.1, 0, 0 + //|CV_HAAR_FIND_BIGGEST_OBJECT + //|CV_HAAR_DO_ROUGH_SEARCH + //|CV_HAAR_DO_CANNY_PRUNING + |CV_HAAR_SCALE_IMAGE + , + Size(30, 30) ); + + // The number of detected neighbors depends on image size (and also illumination, etc.). The + // following steps use a floating minimum and maximum of neighbors. Intensity thus estimated will be + //accurate only after a first smile has been displayed by the user. + const int smile_neighbors = (int)nestedObjects.size(); + static int max_neighbors=-1; + static int min_neighbors=-1; + if (min_neighbors == -1) min_neighbors = smile_neighbors; + max_neighbors = MAX(max_neighbors, smile_neighbors); + + // Draw rectangle on the left side of the image reflecting smile intensity + float intensityZeroOne = ((float)smile_neighbors - min_neighbors) / (max_neighbors - min_neighbors + 1); + int rect_height = cvRound((float)img.rows * intensityZeroOne); + CvScalar col = CV_RGB((float)255 * intensityZeroOne, 0, 0); + rectangle(img, cvPoint(0, img.rows), cvPoint(img.cols/10, img.rows - rect_height), col, -1); + } + + cv::imshow( "result", img ); +} diff --git a/samples/java/ant/build.xml b/samples/java/ant/build.xml index 924af1f131..d817aa63dd 100644 --- a/samples/java/ant/build.xml +++ b/samples/java/ant/build.xml @@ -20,7 +20,7 @@ - + diff --git a/samples/java/ant/src/SimpleSample.java b/samples/java/ant/src/SimpleSample.java index 990536f2b8..a0375c5624 100644 --- a/samples/java/ant/src/SimpleSample.java +++ b/samples/java/ant/src/SimpleSample.java @@ -1,12 +1,14 @@ +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); diff --git a/samples/java/eclipse/HelloCV/src/Main.java b/samples/java/eclipse/HelloCV/src/Main.java index 0e9bb5898f..44f2bb02b3 100644 --- a/samples/java/eclipse/HelloCV/src/Main.java +++ b/samples/java/eclipse/HelloCV/src/Main.java @@ -1,10 +1,12 @@ +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.out.println("Welcome to OpenCV " + Core.VERSION); + System.loadLibrary(Core.NATIVE_LIBRARY_NAME); Mat m = Mat.eye(3, 3, CvType.CV_8UC1); System.out.println("m = " + m.dump()); } diff --git a/samples/java/sbt/src/main/scala/Main.scala b/samples/java/sbt/src/main/scala/Main.scala index 4a68d144a4..6f07aa19ce 100644 --- a/samples/java/sbt/src/main/scala/Main.scala +++ b/samples/java/sbt/src/main/scala/Main.scala @@ -8,11 +8,14 @@ * You're invited to submit your own examples, in any JVM language of * your choosing so long as you can get them to build. */ + +import org.opencv.core.Core + object Main extends App { // We must load the native library before using any OpenCV functions. // You must load this library _exactly once_ per Java invocation. // If you load it more than once, you will get a java.lang.UnsatisfiedLinkError. - System.loadLibrary("opencv_java") + System.loadLibrary(Core.NATIVE_LIBRARY_NAME) ScalaCorrespondenceMatchingDemo.run() ScalaDetectFaceDemo.run() diff --git a/samples/ocl/performance.cpp b/samples/ocl/performance.cpp index 751fbb5658..c5b9ab652f 100644 --- a/samples/ocl/performance.cpp +++ b/samples/ocl/performance.cpp @@ -25,7 +25,7 @@ using namespace cv; // This program test most of the functions in ocl module and generate data metrix of x-factor in .csv files // All images needed in this test are in samples/gpu folder. -// For haar template, please rename it to facedetect.xml +// For haar template, haarcascade_frontalface_alt.xml shouold be in working directory void gen(Mat &mat, int rows, int cols, int type, Scalar low, Scalar high); string abspath(const string &relpath); @@ -707,7 +707,7 @@ TEST(matchTemplate) for (size_t j = 0; j < sizeof(all_type) / sizeof(int); j++) { - for(templ_size = 5; templ_size <=5; templ_size *= 5) + for(templ_size = 5; templ_size <= 5; templ_size *= 5) { gen(src, size, size, all_type[j], 0, 1); @@ -749,7 +749,7 @@ TEST(matchTemplate) for (size_t j = 0; j < sizeof(all_type_8U) / sizeof(int); j++) { - for(templ_size = 5; templ_size < 200; templ_size *= 5) + for(templ_size = 5; templ_size <= 5; templ_size *= 5) { SUBTEST << src.cols << 'x' << src.rows << "; " << type_name_8U[j] << "; templ " << templ_size << 'x' << templ_size << "; CCORR_NORMED"; @@ -1063,9 +1063,9 @@ TEST(Haar) CascadeClassifier faceCascadeCPU; - if (!faceCascadeCPU.load(abspath("facedetect.xml"))) + if (!faceCascadeCPU.load(abspath("haarcascade_frontalface_alt.xml"))) { - throw runtime_error("can't load facedetect.xml"); + throw runtime_error("can't load haarcascade_frontalface_alt.xml"); } vector faces; @@ -1079,9 +1079,9 @@ TEST(Haar) #ifdef USE_OPENCL ocl::CascadeClassifier_GPU faceCascade; - if (!faceCascade.load(abspath("facedetect.xml"))) + if (!faceCascade.load(abspath("haarcascade_frontalface_alt.xml"))) { - throw runtime_error("can't load facedetect.xml"); + throw runtime_error("can't load haarcascade_frontalface_alt.xml"); } ocl::oclMat d_img(img); @@ -4345,7 +4345,7 @@ int main(int argc, const char *argv[]) { if (device == devidx) { - ocl::setDevice(oclinfo[i], j); + ocl::setDevice(oclinfo[i], (int)j); TestSystem::instance().setRecordName(oclinfo[i].DeviceName[j]); printf("\nuse %d: %s\n", devidx, oclinfo[i].DeviceName[j].c_str()); goto END_DEV;