diff --git a/3rdparty/libtiff/CMakeLists.txt b/3rdparty/libtiff/CMakeLists.txt
index ed9d1c86b..6dd7956f5 100644
--- a/3rdparty/libtiff/CMakeLists.txt
+++ b/3rdparty/libtiff/CMakeLists.txt
@@ -89,7 +89,7 @@ endif(WIN32)
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wunused -Wsign-compare
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
-ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations -Wunused-parameter /wd4100 /wd4244 /wd4706 /wd4127 /wd4701 /wd4018 /wd4267 /wd4306 /wd4305 /wd4312 /wd4311)
+ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations -Wunused-parameter /wd4100 /wd4244 /wd4706 /wd4127 /wd4701 /wd4018 /wd4267 /wd4306 /wd4305 /wd4312 /wd4311 /wd4703)
if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 80cf798ee..d893f1c74 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -189,11 +189,11 @@ OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add
OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CMAKE_COMPILER_IS_GNUCXX )
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)) )
-OCV_OPTION(ENABLE_SSE2 "Enable SSE2 instructions" ON IF (MSVC OR CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
-OCV_OPTION(ENABLE_SSE3 "Enable SSE3 instructions" OFF IF (CV_ICC OR CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
+OCV_OPTION(ENABLE_SSE "Enable SSE instructions" ON IF ((MSVC OR CMAKE_COMPILER_IS_GNUCXX) AND (X86 OR X86_64)) )
+OCV_OPTION(ENABLE_SSE2 "Enable SSE2 instructions" ON IF ((MSVC OR CMAKE_COMPILER_IS_GNUCXX) AND (X86 OR X86_64)) )
+OCV_OPTION(ENABLE_SSE3 "Enable SSE3 instructions" ON IF ((CV_ICC OR CMAKE_COMPILER_IS_GNUCXX) AND (X86 OR X86_64)) )
OCV_OPTION(ENABLE_SSSE3 "Enable SSSE3 instructions" OFF IF (CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
-OCV_OPTION(ENABLE_SSE41 "Enable SSE4.1 instructions" OFF IF (CV_ICC OR CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
+OCV_OPTION(ENABLE_SSE41 "Enable SSE4.1 instructions" OFF IF ((CV_ICC OR CMAKE_COMPILER_IS_GNUCXX) AND (X86 OR X86_64)) )
OCV_OPTION(ENABLE_SSE42 "Enable SSE4.2 instructions" OFF IF (CMAKE_COMPILER_IS_GNUCXX AND (X86 OR X86_64)) )
OCV_OPTION(ENABLE_NOISY_WARNINGS "Show all warnings even if they are too noisy" OFF )
OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors" OFF )
diff --git a/cmake/OpenCVDetectCUDA.cmake b/cmake/OpenCVDetectCUDA.cmake
index 60d800547..43e9c819a 100644
--- a/cmake/OpenCVDetectCUDA.cmake
+++ b/cmake/OpenCVDetectCUDA.cmake
@@ -88,7 +88,11 @@ if(CUDA_FOUND)
if(APPLE)
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fno-finite-math-only)
endif()
- string(REPLACE "-Wsign-promo" "" CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}")
+
+ # disabled because of multiple warnings during building nvcc auto generated files
+ if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GCC_REGEX_VERSION VERSION_GREATER "4.6.0")
+ ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-but-set-variable)
+ endif()
# we remove -ggdb3 flag as it leads to preprocessor errors when compiling CUDA files (CUDA 4.1)
set(CMAKE_CXX_FLAGS_DEBUG_ ${CMAKE_CXX_FLAGS_DEBUG})
diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake
index 7a38e4b4e..fcca310ce 100644
--- a/cmake/OpenCVGenConfig.cmake
+++ b/cmake/OpenCVGenConfig.cmake
@@ -64,9 +64,14 @@ macro(ocv_generate_dependencies_map_configcmake suffix configuration)
string(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}$" "${OPENCV_LINK_LIBRARY_SUFFIX}" __libname "${__libname}")
endif()
+ string(REPLACE " " "\\ " __mod_deps "${${__ocv_lib}_MODULE_DEPS_${suffix}}")
+ string(REPLACE " " "\\ " __ext_deps "${${__ocv_lib}_EXTRA_DEPS_${suffix}}")
+ string(REPLACE "\"" "\\\"" __mod_deps "${__mod_deps}")
+ string(REPLACE "\"" "\\\"" __ext_deps "${__ext_deps}")
+
set(OPENCV_DEPENDENCIES_MAP_${suffix} "${OPENCV_DEPENDENCIES_MAP_${suffix}}set(OpenCV_${__ocv_lib}_LIBNAME_${suffix} \"${__libname}\")\n")
- set(OPENCV_DEPENDENCIES_MAP_${suffix} "${OPENCV_DEPENDENCIES_MAP_${suffix}}set(OpenCV_${__ocv_lib}_DEPS_${suffix} ${${__ocv_lib}_MODULE_DEPS_${suffix}})\n")
- set(OPENCV_DEPENDENCIES_MAP_${suffix} "${OPENCV_DEPENDENCIES_MAP_${suffix}}set(OpenCV_${__ocv_lib}_EXTRA_DEPS_${suffix} ${${__ocv_lib}_EXTRA_DEPS_${suffix}})\n")
+ set(OPENCV_DEPENDENCIES_MAP_${suffix} "${OPENCV_DEPENDENCIES_MAP_${suffix}}set(OpenCV_${__ocv_lib}_DEPS_${suffix} ${__mod_deps})\n")
+ set(OPENCV_DEPENDENCIES_MAP_${suffix} "${OPENCV_DEPENDENCIES_MAP_${suffix}}set(OpenCV_${__ocv_lib}_EXTRA_DEPS_${suffix} ${__ext_deps})\n")
list(APPEND OPENCV_PROCESSED_LIBS ${__ocv_lib})
list(APPEND OPENCV_LIBS_TO_PROCESS ${${__ocv_lib}_MODULE_DEPS_${suffix}})
diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake
index 543f9970b..018a46730 100644
--- a/cmake/OpenCVModule.cmake
+++ b/cmake/OpenCVModule.cmake
@@ -509,8 +509,6 @@ endmacro()
macro(ocv_add_precompiled_headers the_target)
if("${the_target}" MATCHES "^opencv_test_.*$")
SET(pch_path "test/test_")
- elseif("${the_target}" MATCHES "opencv_perf_gpu_cpu")
- SET(pch_path "perf_cpu/perf_cpu_")
elseif("${the_target}" MATCHES "^opencv_perf_.*$")
SET(pch_path "perf/perf_")
else()
diff --git a/data/lbpcascades/lbpcascade_profileface.xml b/data/lbpcascades/lbpcascade_profileface.xml
new file mode 100755
index 000000000..a9e843730
--- /dev/null
+++ b/data/lbpcascades/lbpcascade_profileface.xml
@@ -0,0 +1,1275 @@
+
+
+
+
+ BOOST
+ LBP
+ 34
+ 20
+
+ GAB
+ 9.9500000476837158e-001
+ 3.0000001192092896e-001
+ 9.4999999999999996e-001
+ 1
+ 100
+
+ 256
+ 1
+ 16
+
+
+ <_>
+ 4
+ -5.9480339288711548e-001
+
+ <_>
+
+ 0 -1 114 -2360321 -82228595 -771518211 -713436773
+ -1060447799 -810385271 -2004135683 -2566104
+
+ -8.0942183732986450e-001 5.9530025720596313e-001
+ <_>
+
+ 0 -1 54 -649134608 -1060077114 1375916272 -719981432
+ 1073801352 33024 281198795 -5246465
+
+ -7.7979278564453125e-001 5.4052764177322388e-001
+ <_>
+
+ 0 -1 12 -960266913 -495857599 -1068498864 -867970987
+ 457398579 -1174173695 1749041235 1849162079
+
+ -8.0028575658798218e-001 5.0435048341751099e-001
+ <_>
+
+ 0 -1 120 -1228145793 -807247727 18059735 -138644520
+ 998980043 -41250583 673112549 -1930366540
+
+ -7.7902388572692871e-001 4.9006074666976929e-001
+
+ <_>
+ 6
+ -5.4879629611968994e-001
+
+ <_>
+
+ 0 -1 6 -254346881 -746143606 -1039596583 1963430479
+ -263790449 -1073545213 698505999 -1349357
+
+ -6.6315788030624390e-001 6.0000002384185791e-001
+ <_>
+
+ 0 -1 112 -134225985 -684228389 -988213089 -684716007
+ -1966960899 -896630615 152815840 -864497420
+
+ -7.0195454359054565e-001 5.8843690156936646e-001
+ <_>
+
+ 0 -1 53 -35923461 520818827 -1862167847 856916291 68141197
+ 2072530978 304306417 526079163
+
+ -6.4593964815139771e-001 5.7274609804153442e-001
+ <_>
+
+ 0 -1 101 -2097665 -1781432163 588321018 -1677405808
+ -1968469982 -1450147831 -1467632684 -593693808
+
+ -7.2959578037261963e-001 4.9470889568328857e-001
+ <_>
+
+ 0 -1 79 -205847273 -1088716541 285266431 1393693056
+ 293931101 -1634205688 -452263692 -111136684
+
+ -7.0331865549087524e-001 5.2564400434494019e-001
+ <_>
+
+ 0 -1 126 579801457 -670613495 -1065269989 -117095565
+ -1295163359 -779534335 -1744220101 -1355860
+
+ -7.5121974945068359e-001 4.5217981934547424e-001
+
+ <_>
+ 4
+ -4.3886357545852661e-001
+
+ <_>
+
+ 0 -1 20 -346563793 1217040543 -1324639677 206303367
+ -260894653 1165249072 1359168335 1652518863
+
+ -8.3054625988006592e-001 5.5417186021804810e-001
+ <_>
+
+ 0 -1 69 -925898078 -917290147 -2147368790 -1995968378
+ 1203961890 1765910571 789128481 -4201473
+
+ -7.5220447778701782e-001 6.1290657520294189e-001
+ <_>
+
+ 0 -1 7 -425790473 -368916470 -1065172848 -1877712894
+ -1067360254 -847191997 1342400518 -680037517
+
+ -7.8469508886337280e-001 5.9731280803680420e-001
+ <_>
+
+ 0 -1 5 -260315918 -1567751150 -805289977 1721229843
+ 1644296976 1954742530 824530213 -8392601
+
+ -7.3686408996582031e-001 5.6347119808197021e-001
+
+ <_>
+ 6
+ -4.6629825234413147e-001
+
+ <_>
+
+ 0 -1 111 -67634177 -72175593 -246181185 -144772036
+ -1465917455 -1426934837 -345249307 -539041852
+
+ -7.1692305803298950e-001 5.5034482479095459e-001
+ <_>
+
+ 0 -1 47 -1048705 -96415158 -1996126927 67301684 -659873481
+ 1800863745 -402143413 1647570815
+
+ -7.6134461164474487e-001 4.7370144724845886e-001
+ <_>
+
+ 0 -1 119 1905247351 -1111526689 1426654203 -116427277
+ 1731664419 -81052249 1051905317 -1628448513
+
+ -5.9460461139678955e-001 6.1952447891235352e-001
+ <_>
+
+ 0 -1 2 578486263 -2115313530 -788268733 -1122507629
+ -343408719 2127242147 -85406399 -37295
+
+ -6.0801470279693604e-001 5.8719038963317871e-001
+ <_>
+
+ 0 -1 127 -1147176065 52139167 21156225 -540503783 -771529299
+ -33325024 -671045243 -1913073360
+
+ -7.4383884668350220e-001 5.1643568277359009e-001
+ <_>
+
+ 0 -1 93 -319091633 -58633529 1166906391 1854443149
+ 1267403009 -1198817246 1208634960 -35661669
+
+ -6.8595260381698608e-001 5.5931246280670166e-001
+
+ <_>
+ 8
+ -6.0948312282562256e-001
+
+ <_>
+
+ 0 -1 102 -747899393 -543522675 545333467 -34230241
+ -1572626245 -17790840 -1182162691 -1078427420
+
+ -6.0826772451400757e-001 4.6491229534149170e-001
+ <_>
+
+ 0 -1 38 -103812609 503024467 -2121908081 722834075
+ 1375757518 2022089353 197321677 2077719203
+
+ -6.2948691844940186e-001 4.8044654726982117e-001
+ <_>
+
+ 0 -1 19 -774429826 -607461158 1158791644 -971587409
+ -1732167611 2015560010 -1278549257 -159911361
+
+ -5.9694272279739380e-001 4.7999730706214905e-001
+ <_>
+
+ 0 -1 122 735837495 -875325281 152208339 -741020481
+ -1471817477 -1165246433 -1450830159 -1696546384
+
+ -6.4947181940078735e-001 4.2661586403846741e-001
+ <_>
+
+ 0 -1 104 -629063145 -49708711 50692231 1973945160 157637120
+ 2056259593 1771350547 -78911181
+
+ -6.2496536970138550e-001 4.4524449110031128e-001
+ <_>
+
+ 0 -1 67 -74189973 -803307502 688005268 1600057378 -131870050
+ -1600503318 571446250 -386668002
+
+ -5.5046343803405762e-001 5.6090569496154785e-001
+ <_>
+
+ 0 -1 81 586347861 -2071051852 -250078020 -1455374076
+ 546287843 1216708619 -1853707673 -35130912
+
+ -6.3877129554748535e-001 4.7911971807479858e-001
+ <_>
+
+ 0 -1 22 -1436568057 1555188001 164315 2084672259 1809869105
+ 1132626050 1223430266 -596124761
+
+ -6.4428490400314331e-001 4.7921949625015259e-001
+
+ <_>
+ 8
+ -5.4387503862380981e-001
+
+ <_>
+
+ 0 -1 44 -783680003 -771883143 -302055943 -5898247 -253370375
+ -1996628131 1625947386 -2004157446
+
+ -5.2870607376098633e-001 5.9474670886993408e-001
+ <_>
+
+ 0 -1 49 -586034977 -41205679 352424062 -163145456 151126042
+ -1171652503 1208036058 -9019322
+
+ -5.6763833761215210e-001 4.8789894580841064e-001
+ <_>
+
+ 0 -1 39 1402589836 1363509256 103583 823365787 -1861443377
+ 412131360 539718283 1002160350
+
+ -5.9899079799652100e-001 4.9562713503837585e-001
+ <_>
+
+ 0 -1 113 -783429121 -1559215981 286355953 -794820602
+ 461510679 -611662910 -2136237584 -96429424
+
+ -6.3842493295669556e-001 4.3330931663513184e-001
+ <_>
+
+ 0 -1 99 -1365839532 -1291265163 1091604493 965968977
+ 147472779 -1466925055 -2013090821 -1410703205
+
+ -5.8633142709732056e-001 5.0152444839477539e-001
+ <_>
+
+ 0 -1 26 1846469631 -788479850 268796195 -754872317
+ 1630603451 -896532480 1208092751 -72652777
+
+ -5.9243172407150269e-001 4.7917708754539490e-001
+ <_>
+
+ 0 -1 85 -715395062 -113037167 1342198133 -552594287
+ 411123713 11059209 -2012512153 -877809205
+
+ -6.9079184532165527e-001 4.2610234022140503e-001
+ <_>
+
+ 0 -1 100 -526391817 -921022135 -1593630697 671093393
+ -2004270453 -1962835840 -1870413655 -1597095644
+
+ -6.5030521154403687e-001 4.4748127460479736e-001
+
+ <_>
+ 8
+ -6.3195121288299561e-001
+
+ <_>
+
+ 0 -1 109 -674761315 -581726065 352407899 -83717423
+ -660870145 -1165915966 -326837763 -927182608
+
+ -7.3185729980468750e-001 3.3258172869682312e-001
+ <_>
+
+ 0 -1 97 860755579 -707063662 1361264863 1065505299
+ -1022866435 -1776123776 -1865661700 -1615196136
+
+ -6.1147916316986084e-001 3.7205791473388672e-001
+ <_>
+
+ 0 -1 15 -678435969 -106962866 268652561 -826396597
+ -802066313 1931092070 1208025439 1211582847
+
+ -6.8679082393646240e-001 3.6285603046417236e-001
+ <_>
+
+ 0 -1 86 -1573074550 -2080337595 299991 110482176 268552379
+ -310373944 596185787 -1428952165
+
+ -6.4654982089996338e-001 4.1456297039985657e-001
+ <_>
+
+ 0 -1 30 -72637790 -1258143612 1342937104 -544352374
+ -1046875163 -121076606 -786059128 -71702400
+
+ -5.2772462368011475e-001 4.9787566065788269e-001
+ <_>
+
+ 0 -1 89 -683288417 -218031996 33734999 -16115386 -2013259561
+ -2008907509 -1978533232 -352342880
+
+ -5.2718847990036011e-001 5.2839303016662598e-001
+ <_>
+
+ 0 -1 10 -268764033 -1078984772 -65537 -281182212 -524291 -1
+ -8489090 -4227265
+
+ -5.0513482093811035e-001 5.8522778749465942e-001
+ <_>
+
+ 0 -1 82 -570445845 784662143 -268435661 -1292701712
+ -436263043 -1367507075 -671091243 -751108132
+
+ -5.2438414096832275e-001 5.4709094762802124e-001
+
+ <_>
+ 8
+ -5.9874147176742554e-001
+
+ <_>
+
+ 0 -1 27 -721421649 -1001940437 2300046 -720004829 -792686333
+ 1908900882 -160055232 -134763633
+
+ -5.7692307233810425e-001 3.7921348214149475e-001
+ <_>
+
+ 0 -1 78 -1764279809 -1755824061 1937871313 -42069793
+ -1241158993 -1196293937 -1576828673 -70371296
+
+ -4.7039109468460083e-001 4.8607903718948364e-001
+ <_>
+
+ 0 -1 29 -795875130 432079111 285457049 -620658641 -780072971
+ 1158283432 -226254016 1839935243
+
+ -6.2938809394836426e-001 4.1353255510330200e-001
+ <_>
+
+ 0 -1 33 -37236389 1654493543 202129823 1788182787
+ -1186162321 1912913933 -122942838 1968176815
+
+ -5.9031385183334351e-001 4.1488575935363770e-001
+ <_>
+
+ 0 -1 88 1903888863 -286828472 -2125248034 -623115882
+ -268301806 -894826357 -2046633148 -696873056
+
+ -6.3875061273574829e-001 4.0209171175956726e-001
+ <_>
+
+ 0 -1 123 -87223501 -1873424249 -1878929092 -586710990
+ -643825151 -1039040192 -285122488 -264093
+
+ -5.4196298122406006e-001 4.5856228470802307e-001
+ <_>
+
+ 0 -1 52 -780030833 1363755203 -385150929 25502018 1214818435
+ -1020786271 -1870036478 1200354241
+
+ -5.2826374769210815e-001 5.3351372480392456e-001
+ <_>
+
+ 0 -1 84 -1724706499 -184429355 620844509 -179010317
+ -1610327896 -341801844 -1190328066 1755915264
+
+ -5.7672232389450073e-001 4.4138705730438232e-001
+
+ <_>
+ 9
+ -5.4533123970031738e-001
+
+ <_>
+
+ 0 -1 48 -254347649 -565919658 1079050328 1090502875
+ 1895985446 2013437961 -916419445 -53481573
+
+ -5.8105266094207764e-001 3.3599999547004700e-001
+ <_>
+
+ 0 -1 65 2030928895 1438877010 1124143121 258207763
+ 1361199276 1527410834 2072519624 1004267991
+
+ -5.9629368782043457e-001 3.6112698912620544e-001
+ <_>
+
+ 0 -1 45 -247204964 -242712316 54544644 892459288 1888023456
+ -2138044280 -802615208 13199500
+
+ -6.5467655658721924e-001 3.0486112833023071e-001
+ <_>
+
+ 0 -1 3 -430509345 -1865653973 554091143 -1069121312
+ 1091180718 50577994 -1031731181 -211321225
+
+ -5.8759629726409912e-001 3.9526104927062988e-001
+ <_>
+
+ 0 -1 106 -741412064 -255623164 1090945848 -1687760764
+ 42428760 -1064762741 -1861683196 -81029101
+
+ -6.5875691175460815e-001 3.4154877066612244e-001
+ <_>
+
+ 0 -1 128 -464010241 762112 285299147 -589082223 1373135017
+ -2138955645 1057005712 -526876236
+
+ -6.5968728065490723e-001 3.3614772558212280e-001
+ <_>
+
+ 0 -1 80 -666744719 -635780797 33637339 -887860848
+ -1073532217 -108904320 440608996 -1100753973
+
+ -5.0520354509353638e-001 4.4810971617698669e-001
+ <_>
+
+ 0 -1 28 -1580738774 -1506653838 302055688 -721223615
+ 1427604224 -1566332144 1078565791 -558431977
+
+ -5.5560898780822754e-001 4.3426483869552612e-001
+ <_>
+
+ 0 -1 103 957796629 538644536 352997725 80838797 453085387
+ -1165492198 285346042 1487077737
+
+ -5.5915868282318115e-001 4.0778505802154541e-001
+
+ <_>
+ 9
+ -6.7299038171768188e-001
+
+ <_>
+
+ 0 -1 0 -882973185 -620584737 279035921 -673986422
+ -1568464349 -2105466877 1468391879 -38825
+
+ -5.7544225454330444e-001 3.4235453605651855e-001
+ <_>
+
+ 0 -1 90 -1820101795 -1336770299 285245717 -57216724
+ -502134548 -1425341984 -1475618680 -1195896480
+
+ -6.6810834407806396e-001 2.7653357386589050e-001
+ <_>
+
+ 0 -1 9 -100197449 -457893579 200991 1964749325 -754875920
+ 1897044675 1669843618 -70792821
+
+ -4.9064287543296814e-001 4.3120625615119934e-001
+ <_>
+
+ 0 -1 117 -792114173 -544111547 537001999 2034569362
+ -1065213888 1630052634 -1450583484 -532405661
+
+ -6.4218991994857788e-001 3.6113587021827698e-001
+ <_>
+
+ 0 -1 107 -1564241697 -1429683702 -2062974587 -1900539448
+ -1040078205 -394262006 -188628336 -390485984
+
+ -5.9181970357894897e-001 3.5756480693817139e-001
+ <_>
+
+ 0 -1 4 1893434787 -1945108258 82458 -318734161 -939347837
+ 684196040 1078496869 2133023515
+
+ -6.1955446004867554e-001 3.4674292802810669e-001
+ <_>
+
+ 0 -1 31 -196247204 1964277780 -1810886012 21827851
+ -364280891 -1062338560 -536741128 -362562814
+
+ -5.2849757671356201e-001 4.1380330920219421e-001
+ <_>
+
+ 0 -1 61 -1929140897 353472529 -721412674 -1228123782
+ -392951233 -1442693096 672800826 -232914898
+
+ -5.7934975624084473e-001 3.9208874106407166e-001
+ <_>
+
+ 0 -1 72 -1004361296 -1069243858 268710018 1393598601
+ 213956864 417530145 -912735606 1327495627
+
+ -7.5585323572158813e-001 2.6728668808937073e-001
+
+ <_>
+ 9
+ -7.1303337812423706e-001
+
+ <_>
+
+ 0 -1 23 -557797393 1524138462 277074064 -737259367
+ -1878818960 -81600384 -1740109301 -59267505
+
+ -6.7397260665893555e-001 1.9793814420700073e-001
+ <_>
+
+ 0 -1 42 -1222377543 960610456 -2013138684 -989277927
+ -1010064731 -802979830 -645806439 -885143219
+
+ -4.5935314893722534e-001 4.1904711723327637e-001
+ <_>
+
+ 0 -1 124 -783292542 -728791016 1342570700 1481418249
+ 1258825942 -1580563964 -1178136688 -272306640
+
+ -6.3012123107910156e-001 2.9463621973991394e-001
+ <_>
+
+ 0 -1 46 1369396573 -188563225 22085642 -1005861886
+ 2023260232 -1123842045 -2146991925 1245170171
+
+ -5.2092707157135010e-001 3.9743596315383911e-001
+ <_>
+
+ 0 -1 64 1540188400 1976259599 -805025279 864127692 544944
+ 1484935304 -2147056504 1002584738
+
+ -6.5315401554107666e-001 3.1758561730384827e-001
+ <_>
+
+ 0 -1 77 -188606981 -1873391210 16842830 -117157654
+ -1576842600 -1454767992 -518835576 -1625272280
+
+ -5.8580338954925537e-001 3.4936144948005676e-001
+ <_>
+
+ 0 -1 18 -473497030 -477572088 16842905 -12164860 184698994
+ 1350566019 -2143169323 1405313030
+
+ -6.0962837934494019e-001 3.0044576525688171e-001
+ <_>
+
+ 0 -1 92 -528022006 -611028904 1075937757 -577660920
+ 1073809492 -1341620207 -1475846395 -162412743
+
+ -6.6547930240631104e-001 3.1993752717971802e-001
+ <_>
+
+ 0 -1 116 -2062347245 35311783 406966429 -640155632
+ -1904205761 -2012610494 399245455 -937752211
+
+ -4.8515367507934570e-001 4.3642494082450867e-001
+
+ <_>
+ 10
+ -1.1831332445144653e+000
+
+ <_>
+
+ 0 -1 115 -912525479 -2146793066 247327 -554139184 320582141
+ -1442774971 1552517769 -1464330096
+
+ -7.2892564535140991e-001 1.2876711785793304e-001
+ <_>
+
+ 0 -1 41 -182757566 -683667118 268566545 -540408959
+ 1547915506 2014497074 1817806103 -549486525
+
+ -5.6024330854415894e-001 2.8734233975410461e-001
+ <_>
+
+ 0 -1 13 -1396013057 -175218480 536903951 -35946104 -92067077
+ 956498056 -200474487 1331907188
+
+ -5.5237007141113281e-001 3.2844060659408569e-001
+ <_>
+
+ 0 -1 17 2110443855 1547702666 -1874853670 1083212172
+ -2004008413 -498614008 572624451 1179093527
+
+ -7.2481799125671387e-001 2.6627025008201599e-001
+ <_>
+
+ 0 -1 43 -1751428966 -1626324992 -1073540847 -783806124
+ -2146909454 -913440767 -2138941303 -558233160
+
+ -4.4304186105728149e-001 4.1505634784698486e-001
+ <_>
+
+ 0 -1 37 -576405461 -1625709950 1627439763 1116373274
+ 1622902452 1107834529 975868423 2074176171
+
+ -5.6509882211685181e-001 3.5433205962181091e-001
+ <_>
+
+ 0 -1 118 1171205664 1426522307 49281 563122240 -791985520
+ -930869245 -364148081 -590624140
+
+ -5.6250953674316406e-001 3.3341854810714722e-001
+ <_>
+
+ 0 -1 76 1162033968 1180991656 16859165 230787289 -2104786299
+ -1819967351 1118240928 -343561865
+
+ -4.7331553697586060e-001 4.1576251387596130e-001
+ <_>
+
+ 0 -1 110 -2147085315 -1228897088 -2146839339 -1751314339
+ -531605907 -393183232 1804153563 -1399324416
+
+ -5.8979070186614990e-001 3.7525305151939392e-001
+ <_>
+
+ 0 -1 55 1581887865 999817729 151311688 331546624 -991625824
+ -938834941 1837335184 852075394
+
+ -5.4071021080017090e-001 4.0077716112136841e-001
+
+ <_>
+ 10
+ -6.4480733871459961e-001
+
+ <_>
+
+ 0 -1 16 -510660401 -884555766 272896026 -12189566
+ -1685363509 -662568805 1073840823 -545105785
+
+ -5.3361344337463379e-001 2.7807486057281494e-001
+ <_>
+
+ 0 -1 48 -557408354 2115155922 -2130669353 1616707591
+ 693193240 -1569554175 -1743918878 1983596555
+
+ -5.3364741802215576e-001 3.1411096453666687e-001
+ <_>
+
+ 0 -1 108 -413278733 83935516 536961502 1452278484
+ -2004277212 -391683967 -1426466672 -85395040
+
+ -7.4530494213104248e-001 2.3025059700012207e-001
+ <_>
+
+ 0 -1 32 -938623022 1469386887 822151432 421593370
+ -1433793568 -1602191360 -527916919 680112651
+
+ -4.6078306436538696e-001 4.0021440386772156e-001
+ <_>
+
+ 0 -1 50 1619785226 -1004367410 1417725137 126732357
+ 148062614 -625983352 -712398335 -412918226
+
+ -4.9818846583366394e-001 3.6678382754325867e-001
+ <_>
+
+ 0 -1 24 -1064322531 1351938204 196691 -561840073 -1978859471
+ -649944954 -2003664885 -1172094197
+
+ -4.7309580445289612e-001 4.2868506908416748e-001
+ <_>
+
+ 0 -1 96 -1878961904 1360035888 -1073721317 -1051487863
+ -431841087 1628112896 -2112640640 -1829440828
+
+ -6.9250243902206421e-001 2.8783574700355530e-001
+ <_>
+
+ 0 -1 62 67496095 391741589 -2146154237 96245592 -893992548
+ 982687872 571488264 278906307
+
+ -6.4613574743270874e-001 3.0145862698554993e-001
+ <_>
+
+ 0 -1 73 -415771792 1208487966 339825796 1792117580
+ 1128517807 144965669 -536376816 732856538
+
+ -6.9449120759963989e-001 3.0338683724403381e-001
+ <_>
+
+ 0 -1 40 -1991530440 324215457 -2080275930 -1857940798
+ 1342685625 721420800 1250592988 1493903457
+
+ -7.0043331384658813e-001 2.5916099548339844e-001
+
+ <_>
+ 10
+ -6.0248321294784546e-001
+
+ <_>
+
+ 0 -1 21 -16537745 2114438797 1409323561 1691064397
+ -207434939 822260754 -384857461 2031088579
+
+ -6.1256545782089233e-001 1.7948718369007111e-001
+ <_>
+
+ 0 -1 1 -95427858 67117166 -1308426467 -1962693439 601886855
+ 924320187 1661215701 2078945158
+
+ -6.8756872415542603e-001 2.2317354381084442e-001
+ <_>
+
+ 0 -1 121 -1853361185 -619857007 16793601 -184516476
+ -1422775873 -488996831 1476610285 -926297672
+
+ -5.2260422706604004e-001 3.2479336857795715e-001
+ <_>
+
+ 0 -1 105 -267171326 1436635177 1937772829 -2092859315
+ -769638067 -2122268534 1502103583 -18894227
+
+ -5.2588832378387451e-001 3.4061828255653381e-001
+ <_>
+
+ 0 -1 83 1880187281 -1862250368 303299 960921986 -2002701917
+ -1593343958 -334888263 1058018448
+
+ -6.9037044048309326e-001 2.7262538671493530e-001
+ <_>
+
+ 0 -1 34 -2125487365 1347551377 -1861970752 1368654274
+ -1064675233 436275211 327448684 2068015115
+
+ -5.3338903188705444e-001 3.2425448298454285e-001
+ <_>
+
+ 0 -1 36 1192659162 235536712 1078002258 428089414
+ -2138651204 -1937242101 507742421 1932739127
+
+ -6.4654779434204102e-001 3.0722403526306152e-001
+ <_>
+
+ 0 -1 14 -805047416 -1962622822 -2013265442 2030239751
+ 1082134810 1744963592 -1836871485 -249326965
+
+ -5.7250964641571045e-001 3.1499111652374268e-001
+ <_>
+
+ 0 -1 75 -650653297 170234379 -2063527695 448823424
+ -2139088862 319586315 -2067685344 -1347692410
+
+ -5.4618871212005615e-001 3.8171616196632385e-001
+ <_>
+
+ 0 -1 56 -168821125 -1107300354 -536871052 -1125515426
+ -1795721360 -1672085508 1845358040 -2114327569
+
+ -4.2669427394866943e-001 5.0532561540603638e-001
+
+ <_>
+ 11
+ -1.1912760734558105e+000
+
+ <_>
+
+ 0 -1 11 -1043414305 -1735900650 268517385 -1137929054
+ -1048411462 -2011152253 -1957405841 -497557425
+
+ -5.7042253017425537e-001 2.1933962404727936e-001
+ <_>
+
+ 0 -1 71 -233469310 1360073157 376971 626087057 -1180588024
+ -1191067261 -1474310132 830601690
+
+ -5.3927713632583618e-001 2.9026004672050476e-001
+ <_>
+
+ 0 -1 35 -1599643389 42074270 -1811918838 -949960625
+ 1564707361 289538187 1204527649 -112006873
+
+ -6.0980087518692017e-001 2.8851604461669922e-001
+ <_>
+
+ 0 -1 59 585529126 -1100070936 -1342177537 833961983
+ 1306961797 1986559992 -810088568 -1082149201
+
+ -3.2345715165138245e-001 5.5635309219360352e-001
+ <_>
+
+ 0 -1 95 1107806555 2030223765 17039707 -1224163308
+ -1073053535 -1291837432 822618633 -121972608
+
+ -6.5054124593734741e-001 3.1912675499916077e-001
+ <_>
+
+ 0 -1 51 -171583461 -1660890605 268504396 453157697
+ -1065215606 -1740602879 1824636801 1940062923
+
+ -4.7275745868682861e-001 4.2362514138221741e-001
+ <_>
+
+ 0 -1 87 -799546379 -2097769968 293605405 -21571376 285294733
+ 136347650 -930405536 -69420863
+
+ -5.5549502372741699e-001 3.3842340111732483e-001
+ <_>
+
+ 0 -1 60 -594509036 -267114166 35413 -1052598126 545325639
+ -1207959408 -1073643381 682827807
+
+ -5.4805672168731689e-001 3.7224516272544861e-001
+ <_>
+
+ 0 -1 63 1513710022 194882313 1109000450 28010496 -601835264
+ -645791614 -1041880446 1561822180
+
+ -5.3384119272232056e-001 3.7635508179664612e-001
+ <_>
+
+ 0 -1 125 -754581391 -246595569 -2113336948 -1855323709
+ 1090531337 -931133310 950984 -3971805
+
+ -5.2334308624267578e-001 4.0167775750160217e-001
+ <_>
+
+ 0 -1 58 -361268680 662383988 2147483638 -209756289
+ -1375932428 -1895890954 -1744855042 -1142215109
+
+ -3.4343415498733521e-001 6.1590969562530518e-001
+
+ <_>
+ 10
+ -7.7425497770309448e-001
+
+ <_>
+
+ 0 -1 66 -716447302 -602037376 1090519043 -150261760
+ 342934202 -2034138749 1141152394 -351301493
+
+ -4.8867926001548767e-001 3.4062498807907104e-001
+ <_>
+
+ 0 -1 98 -2071985592 -700120831 1078417460 672719121
+ 1082264136 -209075063 -1438988203 -1465205245
+
+ -7.1539443731307983e-001 2.4058867990970612e-001
+ <_>
+
+ 0 -1 74 872558624 331821072 1610649929 -1181384552
+ -2130081587 -92209146 -612134248 -1199562344
+
+ -4.4142067432403564e-001 3.7935256958007813e-001
+ <_>
+
+ 0 -1 68 -791554721 -737771072 2425605 740044819 1208549387
+ 973897998 1124108962 802102203
+
+ -4.6558478474617004e-001 4.2193859815597534e-001
+ <_>
+
+ 0 -1 8 1893114270 -1013792636 360523 -586362838 -1073151001
+ -2146917824 -2104934391 -875596965
+
+ -5.0676107406616211e-001 3.5864940285682678e-001
+ <_>
+
+ 0 -1 91 574816266 -2011773950 1476495634 580227538
+ -2146781128 -2147448830 1901535891 -692616573
+
+ -6.1020326614379883e-001 3.0061775445938110e-001
+ <_>
+
+ 0 -1 70 2125429880 2080309246 -285282561 2142961407
+ -1259516274 1073741823 754945025 867497448
+
+ -4.3854746222496033e-001 4.7815895080566406e-001
+ <_>
+
+ 0 -1 94 -1727736509 -1979678624 285229334 1115689064
+ 537927788 -1207402368 1098914016 -91503488
+
+ -6.8697202205657959e-001 3.5183742642402649e-001
+ <_>
+
+ 0 -1 57 -528465144 -707035113 -1048575869 1372127361 8651416
+ -526909310 -1845360374 -1451016182
+
+ -4.5901125669479370e-001 4.5875525474548340e-001
+ <_>
+
+ 0 -1 25 -2076984798 -533130869 -1060954112 1639977472
+ 828440586 1792508680 -1693988801 -13285232
+
+ -4.8493441939353943e-001 4.3403539061546326e-001
+
+ <_>
+
+ 0 1 1 9
+ <_>
+
+ 0 1 4 7
+ <_>
+
+ 0 2 2 6
+ <_>
+
+ 0 2 2 10
+ <_>
+
+ 0 2 3 4
+ <_>
+
+ 0 3 3 8
+ <_>
+
+ 0 4 1 8
+ <_>
+
+ 0 5 2 9
+ <_>
+
+ 0 7 1 8
+ <_>
+
+ 0 7 5 7
+ <_>
+
+ 0 9 1 5
+ <_>
+
+ 0 9 2 6
+ <_>
+
+ 0 10 3 7
+ <_>
+
+ 0 11 1 3
+ <_>
+
+ 0 12 2 1
+ <_>
+
+ 0 13 3 7
+ <_>
+
+ 0 14 1 1
+ <_>
+
+ 0 14 3 4
+ <_>
+
+ 0 16 1 1
+ <_>
+
+ 0 19 3 5
+ <_>
+
+ 0 20 3 4
+ <_>
+
+ 0 21 3 4
+ <_>
+
+ 0 22 2 4
+ <_>
+
+ 0 25 3 3
+ <_>
+
+ 0 25 4 3
+ <_>
+
+ 1 0 5 10
+ <_>
+
+ 1 2 1 9
+ <_>
+
+ 1 4 4 8
+ <_>
+
+ 1 4 5 9
+ <_>
+
+ 1 6 3 5
+ <_>
+
+ 1 9 2 3
+ <_>
+
+ 1 11 2 4
+ <_>
+
+ 1 15 3 2
+ <_>
+
+ 1 20 3 3
+ <_>
+
+ 1 28 2 2
+ <_>
+
+ 2 0 2 3
+ <_>
+
+ 2 0 3 5
+ <_>
+
+ 2 0 4 8
+ <_>
+
+ 2 3 4 5
+ <_>
+
+ 2 4 5 5
+ <_>
+
+ 2 5 2 5
+ <_>
+
+ 2 7 5 9
+ <_>
+
+ 2 8 1 3
+ <_>
+
+ 2 12 1 2
+ <_>
+
+ 2 13 3 3
+ <_>
+
+ 2 14 2 2
+ <_>
+
+ 2 16 3 5
+ <_>
+
+ 2 18 3 5
+ <_>
+
+ 2 22 2 4
+ <_>
+
+ 2 31 3 1
+ <_>
+
+ 3 0 2 3
+ <_>
+
+ 3 1 3 5
+ <_>
+
+ 3 1 3 8
+ <_>
+
+ 3 2 3 6
+ <_>
+
+ 3 8 4 6
+ <_>
+
+ 3 10 2 4
+ <_>
+
+ 3 14 2 2
+ <_>
+
+ 3 16 1 1
+ <_>
+
+ 3 18 1 1
+ <_>
+
+ 3 19 1 1
+ <_>
+
+ 3 19 1 2
+ <_>
+
+ 3 31 2 1
+ <_>
+
+ 4 4 4 4
+ <_>
+
+ 4 5 2 7
+ <_>
+
+ 4 6 2 4
+ <_>
+
+ 4 6 3 4
+ <_>
+
+ 4 7 2 8
+ <_>
+
+ 4 12 3 5
+ <_>
+
+ 4 19 2 3
+ <_>
+
+ 5 0 5 7
+ <_>
+
+ 5 3 4 4
+ <_>
+
+ 5 3 5 4
+ <_>
+
+ 5 5 2 8
+ <_>
+
+ 5 12 4 4
+ <_>
+
+ 5 22 1 1
+ <_>
+
+ 6 21 3 3
+ <_>
+
+ 6 26 2 2
+ <_>
+
+ 6 30 1 1
+ <_>
+
+ 6 31 1 1
+ <_>
+
+ 6 31 2 1
+ <_>
+
+ 7 0 2 3
+ <_>
+
+ 7 9 3 7
+ <_>
+
+ 7 17 1 1
+ <_>
+
+ 7 31 1 1
+ <_>
+
+ 7 31 2 1
+ <_>
+
+ 8 0 4 1
+ <_>
+
+ 8 5 2 4
+ <_>
+
+ 8 10 3 6
+ <_>
+
+ 8 16 2 1
+ <_>
+
+ 8 25 3 2
+ <_>
+
+ 8 30 1 1
+ <_>
+
+ 9 0 1 1
+ <_>
+
+ 9 0 3 2
+ <_>
+
+ 9 0 3 4
+ <_>
+
+ 9 15 2 1
+ <_>
+
+ 9 24 3 3
+ <_>
+
+ 9 29 1 1
+ <_>
+
+ 9 31 1 1
+ <_>
+
+ 10 4 2 2
+ <_>
+
+ 10 8 1 3
+ <_>
+
+ 10 15 1 3
+ <_>
+
+ 10 26 2 1
+ <_>
+
+ 10 30 1 1
+ <_>
+
+ 10 31 3 1
+ <_>
+
+ 11 0 3 2
+ <_>
+
+ 11 1 3 4
+ <_>
+
+ 11 5 3 8
+ <_>
+
+ 11 14 1 1
+ <_>
+
+ 11 23 2 2
+ <_>
+
+ 11 27 2 2
+ <_>
+
+ 11 31 1 1
+ <_>
+
+ 12 22 2 3
+ <_>
+
+ 12 29 1 1
+ <_>
+
+ 13 23 2 1
+ <_>
+
+ 13 24 1 3
+ <_>
+
+ 13 29 1 1
+ <_>
+
+ 13 31 2 1
+ <_>
+
+ 14 1 2 2
+ <_>
+
+ 14 1 2 6
+ <_>
+
+ 14 2 2 1
+ <_>
+
+ 14 24 2 2
+ <_>
+
+ 14 26 2 2
+ <_>
+
+ 14 28 1 1
+ <_>
+
+ 15 4 1 1
+ <_>
+
+ 15 24 1 1
+ <_>
+
+ 17 0 1 3
+ <_>
+
+ 17 3 1 4
+ <_>
+
+ 17 23 1 2
+ <_>
+
+ 17 27 1 1
+
diff --git a/data/lbpcascades/lbpcascade_silverware.xml b/data/lbpcascades/lbpcascade_silverware.xml
new file mode 100755
index 000000000..33aa443c2
--- /dev/null
+++ b/data/lbpcascades/lbpcascade_silverware.xml
@@ -0,0 +1,1279 @@
+
+
+
+
+ BOOST
+ LBP
+ 80
+ 12
+
+ GAB
+ 9.9500000476837158e-001
+ 3.0000001192092896e-001
+ 9.4999999999999996e-001
+ 1
+ 100
+
+ 256
+ 1
+ 16
+
+
+ <_>
+ 4
+ -8.2867860794067383e-002
+
+ <_>
+
+ 0 -1 99 -268435521 -486543361 -258 1659633406 -134217857
+ 1702887279 -134217929 -184549377
+
+ -7.5000000000000000e-001 8.6380833387374878e-001
+ <_>
+
+ 0 -1 39 -540541017 -1060113913 -781245688 -477121697
+ -1818664155 1105186857 -505961467 -152575569
+
+ -7.9976779222488403e-001 7.5056612491607666e-001
+ <_>
+
+ 0 -1 101 -479208497 -353380921 -855254781 -1566689761
+ -454302869 1893310787 -271591561 -134222965
+
+ -7.1062028408050537e-001 7.7380746603012085e-001
+ <_>
+
+ 0 -1 41 -338958865 -925383977 -1438297681 -981777969
+ -882901177 1913369038 -135286729 1995959223
+
+ -7.8616768121719360e-001 6.9309240579605103e-001
+
+ <_>
+ 5
+ -7.7058833837509155e-001
+
+ <_>
+
+ 0 -1 14 -34089161 -2245 1878980471 -8687769 -134316045
+ 1744797563 -8388737 1795146607
+
+ -6.1089491844177246e-001 7.3594772815704346e-001
+ <_>
+
+ 0 -1 32 -707274321 1896302609 1132560802 -183140351 17019099
+ 830472347 -1993621429 1440074510
+
+ -6.4869755506515503e-001 5.6941097974777222e-001
+ <_>
+
+ 0 -1 4 -1055898237 -104492975 -1795141251 1464975384
+ -1602043461 -914358144 1111543953 -2067496448
+
+ -6.0432785749435425e-001 5.5685383081436157e-001
+ <_>
+
+ 0 -1 96 -520160401 2063466495 -65665 -134217729 -50462805
+ 1761476478 1693969709 1910503031
+
+ -5.6237226724624634e-001 6.2263637781143188e-001
+ <_>
+
+ 0 -1 6 -1479564374 -954482597 16859161 -799804534 268468874
+ 713187329 1108033665 -714619755
+
+ -6.9048601388931274e-001 5.3264212608337402e-001
+
+ <_>
+ 5
+ -7.1249550580978394e-001
+
+ <_>
+
+ 0 -1 21 -34638473 -553976197 -134217865 -159715533
+ -142901385 -272629761 -8421377 -956303361
+
+ -6.4170038700103760e-001 7.0683228969573975e-001
+ <_>
+
+ 0 -1 100 -8389777 -185860353 -277 -2097152001 -161
+ -209780865 -1 -529006609
+
+ -5.5270516872406006e-001 6.9983023405075073e-001
+ <_>
+
+ 0 -1 118 -545259537 -276857217 -1258291302 1652358910
+ -134236308 1735819126 -16812809 -221249673
+
+ -5.6243920326232910e-001 6.2150186300277710e-001
+ <_>
+
+ 0 -1 19 -342885713 -1369882213 -2079215310 -765214587
+ -2113207945 1074365452 1393631959 1409022707
+
+ -6.8943935632705688e-001 5.3469669818878174e-001
+ <_>
+
+ 0 -1 23 -506991005 1360417115 -1844809365 -821575604
+ 21178499 986120459 1347943419 -969541850
+
+ -6.7428857088088989e-001 5.5008578300476074e-001
+
+ <_>
+ 6
+ -3.0183684825897217e-001
+
+ <_>
+
+ 0 -1 31 -144703505 -143130625 -17 -134381841 -143130625
+ 2012741567 -134218802 -134217841
+
+ -5.3079712390899658e-001 7.5616836547851563e-001
+ <_>
+
+ 0 -1 35 -137887809 -1924805943 1363218446 -817782134
+ 1099022547 1082327168 -1279204784 1128784467
+
+ -6.4090979099273682e-001 5.3444361686706543e-001
+ <_>
+
+ 0 -1 15 -786433589 -515129128 277173650 -132673121
+ -884037451 1137229866 1938662135 -676336865
+
+ -5.2920126914978027e-001 5.9623366594314575e-001
+ <_>
+
+ 0 -1 92 -1897400451 -1627924747 -335548553 -1 1257762559
+ -2113929417 -419433067 -235309193
+
+ -5.5294114351272583e-001 5.8814722299575806e-001
+ <_>
+
+ 0 -1 112 -187176146 1743897116 -1878957040 542033563
+ 1372582934 823282242 -158609727 -779295046
+
+ -6.8665105104446411e-001 4.4378995895385742e-001
+ <_>
+
+ 0 -1 9 1676637640 1887961346 16875658 1977614736 1682145753
+ 813744265 -842338550 1930548135
+
+ -7.5830078125000000e-001 3.9562159776687622e-001
+
+ <_>
+ 8
+ -3.9228534698486328e-001
+
+ <_>
+
+ 0 -1 25 -167774345 -6689161 -2097153 -4194541 -282329093 -1
+ -1 -352323601
+
+ -4.7727271914482117e-001 7.4114018678665161e-001
+ <_>
+
+ 0 -1 2 -1051598753 -1005571964 1900827102 2065404120
+ -1207262247 -120553331 -1725955392 -494812414
+
+ -5.2365595102310181e-001 5.3981113433837891e-001
+ <_>
+
+ 0 -1 116 -2142770433 -1601462143 16842760 -804892128 1032369
+ 268763273 1091011104 -1142957585
+
+ -4.7790464758872986e-001 5.4881525039672852e-001
+ <_>
+
+ 0 -1 87 -532155537 1351188929 1073823759 -1253637875
+ -721321497 -662691837 -955278809 1623500836
+
+ -6.8072116374969482e-001 3.7135115265846252e-001
+ <_>
+
+ 0 -1 113 -1996457508 -2146282492 -1728016135 -578347007
+ -1609004859 193626505 1153570968 -1920333632
+
+ -5.7289212942123413e-001 4.6210876107215881e-001
+ <_>
+
+ 0 -1 56 -972008109 -691003372 -2147413749 2098355010
+ 143009971 -1744174583 -1073051430 617488921
+
+ -5.9549087285995483e-001 4.8842963576316833e-001
+ <_>
+
+ 0 -1 48 26 1971388449 419479901 2080931848 -1140292918
+ -1719074813 -2130476842 -268398592
+
+ -5.8355164527893066e-001 4.7890499234199524e-001
+ <_>
+
+ 0 -1 57 -1052266874 167813132 -2130690045 -703061621
+ -131874777 -662142838 -1064730555 1119947703
+
+ -6.9379311800003052e-001 3.9936643838882446e-001
+
+ <_>
+ 9
+ -6.6581231355667114e-001
+
+ <_>
+
+ 0 -1 29 2080314175 -112910205 805323551 1024016674
+ 1073891387 -2137847805 1653140111 -7676933
+
+ -5.5957448482513428e-001 5.4044550657272339e-001
+ <_>
+
+ 0 -1 94 -1358956801 -100880986 -1887436809 1073741823
+ -1896350220 -838860811 268434686 -1912602633
+
+ -4.3124794960021973e-001 5.6135851144790649e-001
+ <_>
+
+ 0 -1 76 -26230993 1357905647 -1358958674 -135266305 -524434
+ -176291841 -142622837 -1005125829
+
+ -4.6799373626708984e-001 5.1660954952239990e-001
+ <_>
+
+ 0 -1 30 -313836176 -742240245 16818511 -1391787262
+ 1632363443 -156630911 -83631445 248984215
+
+ -6.2023061513900757e-001 3.9792594313621521e-001
+ <_>
+
+ 0 -1 91 -612895966 591778561 1073812490 369347088
+ -1870223303 556335107 553910792 1907094058
+
+ -6.2148678302764893e-001 4.1758581995964050e-001
+ <_>
+
+ 0 -1 46 -1430257749 -672663689 -218104082 -135266322
+ -1493174275 -873463809 -276826113 -690006715
+
+ -5.1617449522018433e-001 5.2012032270431519e-001
+ <_>
+
+ 0 -1 123 1088746207 1489289603 16781456 -443461355
+ -762795606 -670564192 -1465814774 -101527550
+
+ -5.0202989578247070e-001 5.0987190008163452e-001
+ <_>
+
+ 0 -1 53 -1001679641 -955695103 25248080 -738078457 671123502
+ 193003713 -1836523327 -216026117
+
+ -5.2692401409149170e-001 5.3243070840835571e-001
+ <_>
+
+ 0 -1 89 2147417937 -1048642 -1039 -1766457361 -134236382
+ -1922646177 -16777473 -1534591162
+
+ -4.6150138974189758e-001 5.6634509563446045e-001
+
+ <_>
+ 8
+ -1.2349532842636108e+000
+
+ <_>
+
+ 0 -1 67 -142902409 -67142273 1878982639 -1182802113 -75841
+ -274219146 -88604929 -31817921
+
+ -4.5625588297843933e-001 5.7534247636795044e-001
+ <_>
+
+ 0 -1 128 -808330661 1390004234 1107406871 -2098932967
+ -767440829 1208655939 -1971196977 1351600587
+
+ -5.7236993312835693e-001 4.1942635178565979e-001
+ <_>
+
+ 0 -1 0 -805307409 -1052697 -65684 -4233 -134217745 -4194453
+ -696778831 -708062879
+
+ -4.5485407114028931e-001 5.5909335613250732e-001
+ <_>
+
+ 0 -1 119 -169888509 1150652435 1074791064 541757442
+ -645182635 989929472 1262741126 1963976639
+
+ -6.4869618415832520e-001 3.9796143770217896e-001
+ <_>
+
+ 0 -1 38 -912524801 811171970 33644801 -717151469 -2108956437
+ 294158344 1109713681 1900266000
+
+ -5.0387507677078247e-001 5.1329559087753296e-001
+ <_>
+
+ 0 -1 20 -746687625 -200802301 1073872962 285491202
+ 1208512717 -2138664446 -1837102693 1174835902
+
+ -5.9465301036834717e-001 4.4057011604309082e-001
+ <_>
+
+ 0 -1 16 -442903927 -988184502 -717209211 1443168395
+ -1465793521 1252524168 1107337938 -1050414557
+
+ -5.9043467044830322e-001 4.3687704205513000e-001
+ <_>
+
+ 0 -1 104 -1692667790 -612286452 -1056931520 437452806
+ -2136309078 -401536992 -1987928929 -1033981310
+
+ -5.0495445728302002e-001 4.9910807609558105e-001
+
+ <_>
+ 9
+ -5.4583048820495605e-001
+
+ <_>
+
+ 0 -1 97 -419954689 -570949699 2147417599 -1 -872415749
+ -301989897 -872433670 -268443689
+
+ -4.0734556317329407e-001 7.1092438697814941e-001
+ <_>
+
+ 0 -1 3 -1062674253 1929486475 197402 1841550219 135268235
+ -1165491808 956369290 1258896162
+
+ -5.4886269569396973e-001 4.1644170880317688e-001
+ <_>
+
+ 0 -1 37 -620271105 -901300206 1359008346 -603537150
+ 1355455189 596312193 -247999129 -728767550
+
+ -5.1914668083190918e-001 3.9419922232627869e-001
+ <_>
+
+ 0 -1 17 -1072700149 546031429 12798103 1881656595 35238042
+ 682232321 176931799 1148695251
+
+ -5.4100900888442993e-001 4.0588796138763428e-001
+ <_>
+
+ 0 -1 71 -522857685 1350893957 17339597 1999601732 -779974469
+ -359071607 1879296642 -1236927697
+
+ -4.9249285459518433e-001 4.4877073168754578e-001
+ <_>
+
+ 0 -1 93 2037497904 492944831 -2013291075 -754983169
+ 1837104414 -671812233 -1660989976 -973105033
+
+ -4.6483671665191650e-001 4.8267844319343567e-001
+ <_>
+
+ 0 -1 33 -553943182 -100663369 -1327169 -181207174 -805896236
+ -16777225 -32770 -344459717
+
+ -3.9679497480392456e-001 5.6408804655075073e-001
+ <_>
+
+ 0 -1 44 -8439301 -9502850 2147412095 2134171367 1467968283
+ -555876513 1719612907 -959121
+
+ -3.7275579571723938e-001 6.2219065427780151e-001
+ <_>
+
+ 0 -1 62 -2086686357 -2143072184 1073745988 -1878839231
+ 1221503177 -2113732606 1133091218 1470880455
+
+ -5.5160778760910034e-001 4.4197219610214233e-001
+
+ <_>
+ 8
+ -4.9482953548431396e-001
+
+ <_>
+
+ 0 -1 124 803987455 -1207959557 -1073747969 -3 -1879048193
+ -1720221705 -1073744641 -1212159499
+
+ -4.2883211374282837e-001 5.8106172084808350e-001
+ <_>
+
+ 0 -1 1 -1520569905 -125497088 1360134399 -49444069
+ -1065189105 -612134877 -1497194288 -1006112575
+
+ -4.8296096920967102e-001 4.3431344628334045e-001
+ <_>
+
+ 0 -1 108 -67112229 -797503462 268623881 1083056391
+ -1874187198 1879638016 -804355463 1985162053
+
+ -6.1597704887390137e-001 3.4508374333381653e-001
+ <_>
+
+ 0 -1 26 -686760009 1468434576 1140918535 -880733942 12599987
+ -1304752000 -1593784081 115557220
+
+ -5.7973521947860718e-001 4.0324980020523071e-001
+ <_>
+
+ 0 -1 115 -753405796 4259842 -872415136 85172613 154534824
+ 8454145 -2147292968 1094185899
+
+ -4.7171372175216675e-001 4.6018373966217041e-001
+ <_>
+
+ 0 -1 64 -737160572 2107229470 1478238399 386729999 46739708
+ -1717532540 134302191 1502456202
+
+ -4.7625115513801575e-001 4.6307522058486938e-001
+ <_>
+
+ 0 -1 63 574973114 1079378118 151608 -1089433600 683881170
+ 1234370560 25761968 1305471639
+
+ -5.4804503917694092e-001 4.2817059159278870e-001
+ <_>
+
+ 0 -1 126 -913048353 -1333444591 303141015 1107341569
+ -1727960821 1644167297 -1190753878 1418524891
+
+ -6.3843786716461182e-001 3.2018747925758362e-001
+
+ <_>
+ 10
+ -4.7552201151847839e-001
+
+ <_>
+
+ 0 -1 54 -17825929 -8718489 -34111631 -135004289 -1358954497
+ -16814213 -151556225 -285220369
+
+ -4.1965106129646301e-001 5.5681818723678589e-001
+ <_>
+
+ 0 -1 88 -1856526326 -645691871 337711324 1464176998
+ -1602581814 -1710751608 168420078 -1341468062
+
+ -4.0517404675483704e-001 4.9981650710105896e-001
+ <_>
+
+ 0 -1 45 -741223945 -1627185101 822169913 407916675
+ -897447857 589300224 540099855 -1156899883
+
+ -4.4794428348541260e-001 4.3524059653282166e-001
+ <_>
+
+ 0 -1 66 258608606 -1120993285 -419517441 -578240642
+ -1879056401 -1101037569 -13383 -28301584
+
+ -3.9371734857559204e-001 5.2872020006179810e-001
+ <_>
+
+ 0 -1 117 -350280689 -829730738 -1073461695 38377489
+ -645158785 839057410 -1249137694 1882566387
+
+ -5.7474929094314575e-001 3.8859930634498596e-001
+ <_>
+
+ 0 -1 34 1536523031 -952168281 -1855975139 -854621937
+ -939095838 -1744699368 -796270511 1582955555
+
+ -5.4318642616271973e-001 4.1631007194519043e-001
+ <_>
+
+ 0 -1 51 1393782562 319525363 8471383 1368384004 889651722
+ 1921550554 -1836930098 1660195204
+
+ -7.2387772798538208e-001 2.8236424922943115e-001
+ <_>
+
+ 0 -1 78 1675075922 637567168 -2130116204 -1890844654
+ 34255055 167907336 1091555477 -2142773065
+
+ -5.3113341331481934e-001 3.7920853495597839e-001
+ <_>
+
+ 0 -1 7 1164149387 1433912608 16876979 1595080980 1275865262
+ -1446313974 1241665562 173580528
+
+ -5.0643980503082275e-001 4.4159597158432007e-001
+ <_>
+
+ 0 -1 129 -111949961 -783789413 268583504 -923765997
+ -1073657336 -1340440574 -394149886 1216081042
+
+ -5.0880813598632813e-001 4.1170257329940796e-001
+
+ <_>
+ 11
+ -6.9445723295211792e-001
+
+ <_>
+
+ 0 -1 106 -487588613 -118095873 -1 2109472735 -1258291202
+ -101712129 -33832963 -67652237
+
+ -4.0311419963836670e-001 6.2951332330703735e-001
+ <_>
+
+ 0 -1 49 -268435473 -353372166 2138045906 -4121 -276824105
+ 1317007308 -41945099 -134484017
+
+ -3.5493713617324829e-001 5.5815106630325317e-001
+ <_>
+
+ 0 -1 5 1460877355 -15613689 558207061 -1623109371
+ -1926723379 244908044 -113047169 1414649856
+
+ -5.8201593160629272e-001 3.5618588328361511e-001
+ <_>
+
+ 0 -1 103 -669296387 189940185 -1860046723 -1760460773
+ -1740078915 -931100536 276828352 -1917868015
+
+ -4.2647001147270203e-001 4.6035429835319519e-001
+ <_>
+
+ 0 -1 107 -2109233498 -602287230 -1054785005 1360101827
+ 1099137177 -318504822 -1341497202 232232049
+
+ -4.9850422143936157e-001 4.4256457686424255e-001
+ <_>
+
+ 0 -1 40 -54286241 -1608934766 286327519 -1270398764
+ 1267376258 1636335746 542720627 1966594122
+
+ -5.5573022365570068e-001 3.9825862646102905e-001
+ <_>
+
+ 0 -1 18 -904213325 1133543618 67508251 -714997735 1094779186
+ 160088201 872654991 -903019733
+
+ -5.2738076448440552e-001 3.8662704825401306e-001
+ <_>
+
+ 0 -1 70 1275766299 1347454976 150995380 -217382907
+ 1661501627 -788494333 1259046051 -1006600122
+
+ -4.6260216832160950e-001 4.6852749586105347e-001
+ <_>
+
+ 0 -1 121 -367803633 420562962 36765796 -502050533 1380984391
+ 268601345 536897573 -995624251
+
+ -5.2821987867355347e-001 4.4226339459419250e-001
+ <_>
+
+ 0 -1 68 -470086117 1069514507 -268472471 1936420849
+ -1904232854 1475346303 -160432647 -258802070
+
+ -4.5063796639442444e-001 5.2728754281997681e-001
+ <_>
+
+ 0 -1 85 -698610339 -1504477166 1267372697 822280328
+ -909606742 -561903583 -1658732533 962675013
+
+ -5.5067950487136841e-001 3.9346820116043091e-001
+
+ <_>
+ 9
+ -7.5511032342910767e-001
+
+ <_>
+
+ 0 -1 27 -485801045 -1031585761 285212749 -1013038975
+ 427848842 -1006632832 -1039468406 -162905189
+
+ -4.8945146799087524e-001 4.7218933701515198e-001
+ <_>
+
+ 0 -1 114 -962887670 1547862275 -1827077881 1140871689
+ -536829941 -763363328 -264142181 1112595267
+
+ -6.1379230022430420e-001 3.4447920322418213e-001
+ <_>
+
+ 0 -1 111 -784109321 320069633 1073811463 1074292770
+ -2138957664 -2130001880 -2147252214 315289683
+
+ -5.6861025094985962e-001 3.7049382925033569e-001
+ <_>
+
+ 0 -1 80 -679857295 -17928596 -328961 991442748 1064728144
+ -357040523 -1082493190 -1368229638
+
+ -3.9095887541770935e-001 6.0248941183090210e-001
+ <_>
+
+ 0 -1 82 175736687 -17072405 2130705262 -218107907
+ -1358978530 1692925804 787824558 -672137257
+
+ -4.0445902943611145e-001 6.0857713222503662e-001
+ <_>
+
+ 0 -1 47 -985116365 -553647839 420626839 1968635918
+ -1576924981 -360119808 142606465 -795508656
+
+ -4.8094493150711060e-001 5.1770961284637451e-001
+ <_>
+
+ 0 -1 50 -1459109750 33792144 21514342 1343230978 1124110539
+ 50364672 441024643 -202393597
+
+ -5.2261912822723389e-001 4.6680617332458496e-001
+ <_>
+
+ 0 -1 98 -259008926 1378975745 -1476362162 1888485505
+ 1082744897 571146241 1367392642 -1073229683
+
+ -6.1712646484375000e-001 3.8970091938972473e-001
+ <_>
+
+ 0 -1 125 34318799 1090695442 25199491 1342177299 -2060943181
+ 143360000 -2097010032 -907873592
+
+ -5.3400212526321411e-001 4.4268184900283813e-001
+
+ <_>
+ 10
+ -4.8388049006462097e-001
+
+ <_>
+
+ 0 -1 120 -1477443585 -1140940929 -1342185476 1308588029
+ -1376256001 218070525 1073741181 -41951875
+
+ -5.0602412223815918e-001 5.5081558227539063e-001
+ <_>
+
+ 0 -1 36 -73936261 -2137816955 -1073659749 -553533419
+ -1073706765 -30799693 -972443088 1998113303
+
+ -4.8420175909996033e-001 4.5527526736259460e-001
+ <_>
+
+ 0 -1 77 454566983 420696071 16777221 -2130608117 -1719576352
+ -644874174 -2111166071 577795078
+
+ -6.1467814445495605e-001 3.4610831737518311e-001
+ <_>
+
+ 0 -1 60 -1592753970 -251404269 570458176 486621571
+ -2130476982 -1207431030 25803086 -2029039551
+
+ -5.2004736661911011e-001 4.5498979091644287e-001
+ <_>
+
+ 0 -1 72 694105913 1907355278 -37129 821280759 931135417
+ -923336907 1073716718 -68419540
+
+ -4.1492795944213867e-001 5.7309722900390625e-001
+ <_>
+
+ 0 -1 79 1393265851 -1032732526 264196 -920530793 754211
+ 169623560 1149456611 1135983235
+
+ -5.1638025045394897e-001 4.7242832183837891e-001
+ <_>
+
+ 0 -1 73 706130001 -1708251305 1056944760 1006373626
+ -1303178409 -813991949 -1183128387 -604048669
+
+ -4.1649991273880005e-001 5.9589266777038574e-001
+ <_>
+
+ 0 -1 95 -904859491 -134017015 1090589192 -587038719
+ -167673709 -897449815 152141841 886696449
+
+ -6.4827072620391846e-001 3.5843926668167114e-001
+ <_>
+
+ 0 -1 90 -717057392 690163912 822149263 65803 -1706982525
+ -1736400884 534537 -1630082545
+
+ -5.0309199094772339e-001 5.1634097099304199e-001
+ <_>
+
+ 0 -1 12 -1366843350 -2126376671 1041 -566034432 142770176
+ 12583104 51712 1116198165
+
+ -7.9860860109329224e-001 3.1541401147842407e-001
+
+ <_>
+ 10
+ -5.6616169214248657e-001
+
+ <_>
+
+ 0 -1 28 -143395977 2004844407 -32897 1840447419 -852257
+ -4097 -272630497 -1165502065
+
+ -4.4186046719551086e-001 5.1379764080047607e-001
+ <_>
+
+ 0 -1 8 -519577109 -427718635 -1862262703 -65943231 9163380
+ 1112064264 553714225 1157599521
+
+ -6.9529622793197632e-001 2.9373377561569214e-001
+ <_>
+
+ 0 -1 109 990036221 -1392408495 85 -1455423472 537079956
+ -1451032448 -2121658180 -1917118335
+
+ -4.6548900008201599e-001 4.4904062151908875e-001
+ <_>
+
+ 0 -1 83 -307263958 1726969598 602799716 -587284627
+ -2110304757 -1500547078 1400237979 -194002951
+
+ -4.4492045044898987e-001 5.2867370843887329e-001
+ <_>
+
+ 0 -1 84 -696132137 331497536 -1868546039 -1859480056
+ 1753940107 -1029504896 -1341584891 937520647
+
+ -4.9129620194435120e-001 4.4696673750877380e-001
+ <_>
+
+ 0 -1 61 -1056718371 -912911872 67113021 1498447874 134777514
+ -1412955989 -2138406733 1082270464
+
+ -5.8106380701065063e-001 4.1291686892509460e-001
+ <_>
+
+ 0 -1 43 -648808770 -703963135 -2147401712 -1858043831
+ 1073823883 1074266248 159924795 1879588907
+
+ -5.2166140079498291e-001 4.6159252524375916e-001
+ <_>
+
+ 0 -1 65 538123210 285607041 -2122121208 -1651965941
+ -1047953261 1661077920 591915 1689841382
+
+ -7.4180144071578979e-001 3.0022916197776794e-001
+ <_>
+
+ 0 -1 55 805390529 407044123 285213203 211421255 -1702852378
+ -1919942528 -2134294375 2066729839
+
+ -4.8658525943756104e-001 5.4231238365173340e-001
+ <_>
+
+ 0 -1 69 -490280822 -1274937328 268439820 1359003776
+ -931126870 1220674050 268681287 1997226373
+
+ -5.6268626451492310e-001 4.5061412453651428e-001
+
+ <_>
+ 10
+ -9.9649858474731445e-001
+
+ <_>
+
+ 0 -1 122 -1745100805 -1209164803 -1073770531 -436207891
+ -1090560009 234354687 -1610664449 -1082138881
+
+ -4.0143370628356934e-001 5.6573116779327393e-001
+ <_>
+
+ 0 -1 11 -644493203 -1021149047 16847288 -804977263
+ 1074438223 1375879170 1099505907 -233072125
+
+ -4.9022576212882996e-001 4.1356840729713440e-001
+ <_>
+
+ 0 -1 110 -1092637138 -1127253650 -604013462 309325799
+ 511047567 -562074754 -700452946 -763371997
+
+ -4.2038223147392273e-001 5.0647193193435669e-001
+ <_>
+
+ 0 -1 24 1223739637 -1419051417 1043595135 -215335105
+ 376670206 -167870465 -4194306 -222771398
+
+ -4.0432786941528320e-001 5.9335744380950928e-001
+ <_>
+
+ 0 -1 75 -1761937577 -1076383745 -286361737 -9060559
+ 2013197781 2013265783 -98370 -1002109842
+
+ -4.4517979025840759e-001 5.2503407001495361e-001
+ <_>
+
+ 0 -1 102 1359075611 -233766656 65681 -1878048735 -1610570746
+ 1379991688 -1073689784 -221669373
+
+ -4.9918147921562195e-001 4.6203434467315674e-001
+ <_>
+
+ 0 -1 52 1186053495 -36241670 -268451888 519745529 175382495
+ 788381687 2147319804 1327036346
+
+ -4.6265572309494019e-001 5.1841813325881958e-001
+ <_>
+
+ 0 -1 59 -1040035797 1946189894 50247 -1862266624 1090519113
+ 268961800 679544907 757613389
+
+ -5.5006593465805054e-001 4.4656375050544739e-001
+ <_>
+
+ 0 -1 10 1610993732 -939524096 1073877397 -267910919
+ 151167146 537427968 -769096510 -181428117
+
+ -5.6329357624053955e-001 4.2267900705337524e-001
+ <_>
+
+ 0 -1 86 -1596021624 2047393801 -2130673584 -1856700352
+ 327207619 272728192 -2004808112 491069440
+
+ -6.3942277431488037e-001 3.8081073760986328e-001
+
+ <_>
+ 8
+ -5.5261385440826416e-001
+
+ <_>
+
+ 0 -1 13 -648185009 -1315897313 -2139077632 1367998985
+ 1744840211 -1005502457 -935198613 -74777841
+
+ -5.3191488981246948e-001 4.0654698014259338e-001
+ <_>
+
+ 0 -1 105 1699432742 -1890377581 1343232064 -1039957887
+ -2142687167 637566976 -2122282989 -460871217
+
+ -5.4315727949142456e-001 3.6683899164199829e-001
+ <_>
+
+ 0 -1 81 -67160267 2105388843 -1619001345 1937768302
+ -1359003974 -1098989786 -805322771 -1874678652
+
+ -3.9974156022071838e-001 5.5645257234573364e-001
+ <_>
+
+ 0 -1 58 -1072656189 1095241792 16777487 -352059374 4718723
+ 1109393544 1074438486 -1848987381
+
+ -5.0869542360305786e-001 4.9633875489234924e-001
+ <_>
+
+ 0 -1 22 226493774 -1911816127 1091108968 26214662 26222970
+ -1123287032 -1987040599 -882898875
+
+ -6.0312920808792114e-001 3.5752627253532410e-001
+ <_>
+
+ 0 -1 127 -259153461 -805273578 50364730 -1060208632
+ -1708161014 947912705 -2147450710 80388754
+
+ -6.9576680660247803e-001 3.3376914262771606e-001
+ <_>
+
+ 0 -1 42 -800800303 1368954882 75795 2031108096 -2013069281
+ 212336778 538680 2064105488
+
+ -5.6596046686172485e-001 4.3809539079666138e-001
+ <_>
+
+ 0 -1 74 -2108215089 1260109955 -1207926768 268812673
+ -2146893693 167788680 55189712 -140564306
+
+ -5.1393473148345947e-001 4.8148322105407715e-001
+
+ <_>
+
+ 0 0 1 2
+ <_>
+
+ 0 0 1 3
+ <_>
+
+ 0 0 2 1
+ <_>
+
+ 0 0 2 11
+ <_>
+
+ 0 0 3 1
+ <_>
+
+ 0 0 4 4
+ <_>
+
+ 0 1 1 3
+ <_>
+
+ 0 1 3 5
+ <_>
+
+ 0 2 1 2
+ <_>
+
+ 0 2 4 17
+ <_>
+
+ 0 3 1 1
+ <_>
+
+ 0 4 1 1
+ <_>
+
+ 0 4 1 4
+ <_>
+
+ 0 4 1 18
+ <_>
+
+ 0 4 2 21
+ <_>
+
+ 0 5 1 1
+ <_>
+
+ 0 5 1 2
+ <_>
+
+ 0 5 1 4
+ <_>
+
+ 0 5 2 11
+ <_>
+
+ 0 6 1 2
+ <_>
+
+ 0 7 1 15
+ <_>
+
+ 0 7 2 18
+ <_>
+
+ 0 13 3 3
+ <_>
+
+ 0 13 3 19
+ <_>
+
+ 0 14 2 5
+ <_>
+
+ 0 14 2 14
+ <_>
+
+ 0 16 3 17
+ <_>
+
+ 0 17 1 6
+ <_>
+
+ 0 17 2 9
+ <_>
+
+ 0 18 1 6
+ <_>
+
+ 0 19 2 17
+ <_>
+
+ 0 21 4 13
+ <_>
+
+ 0 21 4 16
+ <_>
+
+ 0 22 2 8
+ <_>
+
+ 0 36 1 5
+ <_>
+
+ 0 40 2 12
+ <_>
+
+ 0 43 1 7
+ <_>
+
+ 0 46 2 10
+ <_>
+
+ 0 48 1 9
+ <_>
+
+ 0 48 2 4
+ <_>
+
+ 0 50 1 2
+ <_>
+
+ 0 56 2 3
+ <_>
+
+ 0 71 1 3
+ <_>
+
+ 0 74 1 2
+ <_>
+
+ 0 77 1 1
+ <_>
+
+ 0 77 2 1
+ <_>
+
+ 1 0 1 3
+ <_>
+
+ 1 0 2 1
+ <_>
+
+ 1 0 3 1
+ <_>
+
+ 1 2 1 1
+ <_>
+
+ 1 4 1 2
+ <_>
+
+ 1 4 3 23
+ <_>
+
+ 1 5 2 7
+ <_>
+
+ 1 9 1 1
+ <_>
+
+ 1 10 2 15
+ <_>
+
+ 1 12 2 7
+ <_>
+
+ 1 14 2 9
+ <_>
+
+ 1 25 2 18
+ <_>
+
+ 1 39 2 10
+ <_>
+
+ 1 71 1 3
+ <_>
+
+ 2 0 1 3
+ <_>
+
+ 2 0 2 1
+ <_>
+
+ 2 3 1 2
+ <_>
+
+ 2 4 1 5
+ <_>
+
+ 2 16 3 8
+ <_>
+
+ 2 18 3 14
+ <_>
+
+ 2 21 2 2
+ <_>
+
+ 2 22 1 4
+ <_>
+
+ 2 24 1 2
+ <_>
+
+ 2 64 1 5
+ <_>
+
+ 3 0 2 1
+ <_>
+
+ 3 1 3 25
+ <_>
+
+ 3 2 3 6
+ <_>
+
+ 3 3 2 11
+ <_>
+
+ 3 6 1 3
+ <_>
+
+ 3 17 1 11
+ <_>
+
+ 3 22 3 17
+ <_>
+
+ 3 23 1 4
+ <_>
+
+ 3 42 1 10
+ <_>
+
+ 3 52 1 6
+ <_>
+
+ 3 77 1 1
+ <_>
+
+ 4 0 2 2
+ <_>
+
+ 4 1 1 2
+ <_>
+
+ 4 2 1 1
+ <_>
+
+ 5 7 2 20
+ <_>
+
+ 5 12 2 19
+ <_>
+
+ 5 14 1 3
+ <_>
+
+ 5 19 2 15
+ <_>
+
+ 6 0 1 1
+ <_>
+
+ 6 0 2 1
+ <_>
+
+ 6 1 2 13
+ <_>
+
+ 6 5 2 5
+ <_>
+
+ 6 7 2 17
+ <_>
+
+ 6 10 2 7
+ <_>
+
+ 6 13 2 10
+ <_>
+
+ 6 14 2 13
+ <_>
+
+ 6 16 2 14
+ <_>
+
+ 6 19 2 7
+ <_>
+
+ 6 36 1 8
+ <_>
+
+ 6 39 2 7
+ <_>
+
+ 6 41 2 9
+ <_>
+
+ 6 44 2 2
+ <_>
+
+ 6 51 2 6
+ <_>
+
+ 6 77 2 1
+ <_>
+
+ 7 0 1 1
+ <_>
+
+ 7 9 1 2
+ <_>
+
+ 7 20 1 9
+ <_>
+
+ 7 23 1 4
+ <_>
+
+ 7 45 1 7
+ <_>
+
+ 7 77 1 1
+ <_>
+
+ 8 0 1 1
+ <_>
+
+ 8 47 1 11
+ <_>
+
+ 8 53 1 4
+ <_>
+
+ 8 77 1 1
+ <_>
+
+ 9 0 1 2
+ <_>
+
+ 9 0 1 15
+ <_>
+
+ 9 0 1 20
+ <_>
+
+ 9 2 1 3
+ <_>
+
+ 9 3 1 2
+ <_>
+
+ 9 6 1 3
+ <_>
+
+ 9 9 1 13
+ <_>
+
+ 9 13 1 2
+ <_>
+
+ 9 13 1 8
+ <_>
+
+ 9 19 1 16
+ <_>
+
+ 9 20 1 4
+ <_>
+
+ 9 25 1 4
+ <_>
+
+ 9 43 1 5
+ <_>
+
+ 9 48 1 4
+ <_>
+
+ 9 59 1 3
+ <_>
+
+ 9 61 1 5
+
diff --git a/ios/cmake/Modules/Platform/iOS.cmake b/ios/cmake/Modules/Platform/iOS.cmake
index c657b800f..4ef75e7f1 100644
--- a/ios/cmake/Modules/Platform/iOS.cmake
+++ b/ios/cmake/Modules/Platform/iOS.cmake
@@ -42,6 +42,8 @@ set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
set (CMAKE_C_FLAGS "")
set (CMAKE_CXX_FLAGS "-headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden")
+set (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -fomit-frame-pointer -ffast-math")
+
if (HAVE_FLAG_SEARCH_PATHS_FIRST)
set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
diff --git a/modules/core/include/opencv2/core/core.hpp b/modules/core/include/opencv2/core/core.hpp
index fbaf13721..5fd927213 100644
--- a/modules/core/include/opencv2/core/core.hpp
+++ b/modules/core/include/opencv2/core/core.hpp
@@ -440,7 +440,7 @@ template class CV_EXPORTS Matx
{
public:
typedef _Tp value_type;
- typedef Matx<_Tp, MIN(m, n), 1> diag_type;
+ typedef Matx<_Tp, (m < n ? m : n), 1> diag_type;
typedef Matx<_Tp, m, n> mat_type;
enum { depth = DataDepth<_Tp>::value, rows = m, cols = n, channels = rows*cols,
type = CV_MAKETYPE(depth, channels) };
diff --git a/modules/core/include/opencv2/core/gpumat.hpp b/modules/core/include/opencv2/core/gpumat.hpp
index 989335925..e09f1bc4c 100644
--- a/modules/core/include/opencv2/core/gpumat.hpp
+++ b/modules/core/include/opencv2/core/gpumat.hpp
@@ -72,9 +72,11 @@ namespace cv { namespace gpu
FEATURE_SET_COMPUTE_13 = 13,
FEATURE_SET_COMPUTE_20 = 20,
FEATURE_SET_COMPUTE_21 = 21,
+ FEATURE_SET_COMPUTE_30 = 30,
GLOBAL_ATOMICS = FEATURE_SET_COMPUTE_11,
SHARED_ATOMICS = FEATURE_SET_COMPUTE_12,
- NATIVE_DOUBLE = FEATURE_SET_COMPUTE_13
+ NATIVE_DOUBLE = FEATURE_SET_COMPUTE_13,
+ WARP_SHUFFLE_FUNCTIONS = FEATURE_SET_COMPUTE_30
};
// Gives information about what GPU archs this OpenCV GPU module was
diff --git a/modules/core/src/cuda/matrix_operations.cu b/modules/core/src/cuda/matrix_operations.cu
index 6bf1549dd..671fa5fc3 100644
--- a/modules/core/src/cuda/matrix_operations.cu
+++ b/modules/core/src/cuda/matrix_operations.cu
@@ -44,7 +44,7 @@
#include "opencv2/gpu/device/transform.hpp"
#include "opencv2/gpu/device/functional.hpp"
-namespace cv { namespace gpu { namespace device
+namespace cv { namespace gpu { namespace device
{
template struct shift_and_sizeof;
template <> struct shift_and_sizeof { enum { shift = 0 }; };
@@ -272,7 +272,7 @@ namespace cv { namespace gpu { namespace device
template struct TransformFunctorTraits< Convertor > : detail::ConvertTraits< Convertor >
{
};
-
+
template
void cvt_(DevMem2Db src, DevMem2Db dst, double alpha, double beta, cudaStream_t stream)
{
@@ -282,6 +282,11 @@ namespace cv { namespace gpu { namespace device
cv::gpu::device::transform((DevMem2D_)src, (DevMem2D_)dst, op, WithOutMask(), stream);
}
+#if defined __clang__
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wmissing-declarations"
+#endif
+
void convert_gpu(DevMem2Db src, int sdepth, DevMem2Db dst, int ddepth, double alpha, double beta, cudaStream_t stream)
{
typedef void (*caller_t)(DevMem2Db src, DevMem2Db dst, double alpha, double beta, cudaStream_t stream);
@@ -318,4 +323,8 @@ namespace cv { namespace gpu { namespace device
func(src, dst, alpha, beta, stream);
}
+
+#if defined __clang__
+# pragma clang diagnostic pop
+#endif
}}} // namespace cv { namespace gpu { namespace device
diff --git a/modules/core/src/gpumat.cpp b/modules/core/src/gpumat.cpp
index c901bf492..105a5ff15 100644
--- a/modules/core/src/gpumat.cpp
+++ b/modules/core/src/gpumat.cpp
@@ -1199,10 +1199,6 @@ namespace
void setTo(GpuMat& m, Scalar s, const GpuMat& mask) const
{
- NppiSize sz;
- sz.width = m.cols;
- sz.height = m.rows;
-
if (mask.empty())
{
if (s[0] == 0.0 && s[1] == 0.0 && s[2] == 0.0 && s[3] == 0.0)
diff --git a/modules/features2d/src/features2d_init.cpp b/modules/features2d/src/features2d_init.cpp
index 6ecffebd4..c9abfefa9 100644
--- a/modules/features2d/src/features2d_init.cpp
+++ b/modules/features2d/src/features2d_init.cpp
@@ -59,7 +59,7 @@ CV_INIT_ALGORITHM(BriefDescriptorExtractor, "Feature2D.BRIEF",
CV_INIT_ALGORITHM(FastFeatureDetector, "Feature2D.FAST",
obj.info()->addParam(obj, "threshold", obj.threshold);
obj.info()->addParam(obj, "nonmaxSuppression", obj.nonmaxSuppression);
- obj.info()->addParam(obj, "type", obj.type, FastFeatureDetector::TYPE_9_16));
+ obj.info()->addParam(obj, "type", obj.type));
///////////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/modules/features2d/test/test_fast.cpp b/modules/features2d/test/test_fast.cpp
index 671e66d5f..761abfcca 100644
--- a/modules/features2d/test/test_fast.cpp
+++ b/modules/features2d/test/test_fast.cpp
@@ -75,8 +75,8 @@ void CV_FastTest::run( int )
vector keypoints1;
vector keypoints2;
- FAST(gray1, keypoints1, 30, type);
- FAST(gray2, keypoints2, 30, type);
+ FAST(gray1, keypoints1, 30, true, type);
+ FAST(gray2, keypoints2, 30, true, type);
for(size_t i = 0; i < keypoints1.size(); ++i)
{
diff --git a/modules/features2d/test/test_nearestneighbors.cpp b/modules/features2d/test/test_nearestneighbors.cpp
index 8a0482218..45131eff2 100644
--- a/modules/features2d/test/test_nearestneighbors.cpp
+++ b/modules/features2d/test/test_nearestneighbors.cpp
@@ -200,7 +200,7 @@ int CV_KDTreeTest_CPP::checkGetPoins( const Mat& data )
int CV_KDTreeTest_CPP::checkFindBoxed()
{
- vector min( dims, minValue), max(dims, maxValue);
+ vector min( dims, static_cast(minValue)), max(dims, static_cast(maxValue));
vector indices;
tr->findOrthoRange( min, max, indices );
// TODO check indices
@@ -214,8 +214,8 @@ int CV_KDTreeTest_CPP::findNeighbors( Mat& points, Mat& neighbors )
const int emax = 20;
Mat neighbors2( neighbors.size(), CV_32SC1 );
int j;
- vector min(points.cols, minValue);
- vector max(points.cols, maxValue);
+ vector min(points.cols, static_cast(minValue));
+ vector max(points.cols, static_cast(maxValue));
for( int pi = 0; pi < points.rows; pi++ )
{
// 1st way
diff --git a/modules/features2d/test/test_rotation_and_scale_invariance.cpp b/modules/features2d/test/test_rotation_and_scale_invariance.cpp
index d98431ba5..48dddd3ee 100644
--- a/modules/features2d/test/test_rotation_and_scale_invariance.cpp
+++ b/modules/features2d/test/test_rotation_and_scale_invariance.cpp
@@ -54,7 +54,7 @@ static
Mat generateHomography(float angle)
{
// angle - rotation around Oz in degrees
- float angleRadian = angle * CV_PI / 180.;
+ float angleRadian = static_cast(angle * CV_PI / 180);
Mat H = Mat::eye(3, 3, CV_32FC1);
H.at(0,0) = H.at(1,1) = std::cos(angleRadian);
H.at(0,1) = -std::sin(angleRadian);
@@ -69,8 +69,8 @@ Mat rotateImage(const Mat& srcImage, float angle, Mat& dstImage, Mat& dstMask)
// angle - rotation around Oz in degrees
float diag = std::sqrt(static_cast(srcImage.cols * srcImage.cols + srcImage.rows * srcImage.rows));
Mat LUShift = Mat::eye(3, 3, CV_32FC1); // left up
- LUShift.at(0,2) = -srcImage.cols/2;
- LUShift.at(1,2) = -srcImage.rows/2;
+ LUShift.at(0,2) = static_cast(-srcImage.cols/2);
+ LUShift.at(1,2) = static_cast(-srcImage.rows/2);
Mat RDShift = Mat::eye(3, 3, CV_32FC1); // right down
RDShift.at(0,2) = diag/2;
RDShift.at(1,2) = diag/2;
@@ -114,7 +114,7 @@ void scaleKeyPoints(const vector& src, vector& dst, float sc
static
float calcCirclesIntersectArea(const Point2f& p0, float r0, const Point2f& p1, float r1)
{
- float c = norm(p0 - p1), sqr_c = c * c;
+ float c = static_cast(norm(p0 - p1)), sqr_c = c * c;
float sqr_r0 = r0 * r0;
float sqr_r1 = r1 * r1;
@@ -125,7 +125,7 @@ float calcCirclesIntersectArea(const Point2f& p0, float r0, const Point2f& p1, f
float minR = std::min(r0, r1);
float maxR = std::max(r0, r1);
if(c + minR <= maxR)
- return CV_PI * minR * minR;
+ return static_cast(CV_PI * minR * minR);
float cos_halfA0 = (sqr_r0 + sqr_c - sqr_r1) / (2 * r0 * c);
float cos_halfA1 = (sqr_r1 + sqr_c - sqr_r0) / (2 * r1 * c);
@@ -133,15 +133,15 @@ float calcCirclesIntersectArea(const Point2f& p0, float r0, const Point2f& p1, f
float A0 = 2 * acos(cos_halfA0);
float A1 = 2 * acos(cos_halfA1);
- return 0.5 * sqr_r0 * (A0 - sin(A0)) +
- 0.5 * sqr_r1 * (A1 - sin(A1));
+ return 0.5f * sqr_r0 * (A0 - sin(A0)) +
+ 0.5f * sqr_r1 * (A1 - sin(A1));
}
static
float calcIntersectRatio(const Point2f& p0, float r0, const Point2f& p1, float r1)
{
float intersectArea = calcCirclesIntersectArea(p0, r0, p1, r1);
- float unionArea = CV_PI * (r0 * r0 + r1 * r1) - intersectArea;
+ float unionArea = static_cast(CV_PI) * (r0 * r0 + r1 * r1) - intersectArea;
return intersectArea / unionArea;
}
@@ -160,7 +160,7 @@ void matchKeyPoints(const vector& keypoints0, const Mat& H,
matches.clear();
vector usedMask(keypoints1.size(), 0);
- for(size_t i0 = 0; i0 < keypoints0.size(); i0++)
+ for(int i0 = 0; i0 < static_cast(keypoints0.size()); i0++)
{
int nearestPointIndex = -1;
float maxIntersectRatio = 0.f;
@@ -176,7 +176,7 @@ void matchKeyPoints(const vector& keypoints0, const Mat& H,
if(intersectRatio > maxIntersectRatio)
{
maxIntersectRatio = intersectRatio;
- nearestPointIndex = i1;
+ nearestPointIndex = static_cast(i1);
}
}
@@ -222,7 +222,7 @@ protected:
const int maxAngle = 360, angleStep = 15;
for(int angle = 0; angle < maxAngle; angle += angleStep)
{
- Mat H = rotateImage(image0, angle, image1, mask1);
+ Mat H = rotateImage(image0, static_cast(angle), image1, mask1);
vector keypoints1;
featureDetector->detect(image1, keypoints1, mask1);
@@ -339,10 +339,10 @@ protected:
const int maxAngle = 360, angleStep = 15;
for(int angle = 0; angle < maxAngle; angle += angleStep)
{
- Mat H = rotateImage(image0, angle, image1, mask1);
+ Mat H = rotateImage(image0, static_cast(angle), image1, mask1);
vector keypoints1;
- rotateKeyPoints(keypoints0, H, angle, keypoints1);
+ rotateKeyPoints(keypoints0, H, static_cast(angle), keypoints1);
Mat descriptors1;
descriptorExtractor->compute(image1, keypoints1, descriptors1);
@@ -457,7 +457,7 @@ protected:
keyPointMatchesCount++;
// Check does this inlier have consistent sizes
- const float maxSizeDiff = 0.8;//0.9f; // grad
+ const float maxSizeDiff = 0.8f;//0.9f; // grad
float size0 = keypoints0[matches[m].trainIdx].size;
float size1 = osiKeypoints1[matches[m].queryIdx].size;
CV_Assert(size0 > 0 && size1 > 0);
@@ -545,7 +545,7 @@ protected:
resize(image0, image1, Size(), 1./scale, 1./scale);
vector keypoints1;
- scaleKeyPoints(keypoints0, keypoints1, 1./scale);
+ scaleKeyPoints(keypoints0, keypoints1, 1.0f/scale);
Mat descriptors1;
descriptorExtractor->compute(image1, keypoints1, descriptors1);
diff --git a/modules/gpu/CMakeLists.txt b/modules/gpu/CMakeLists.txt
index e24b73a77..5d2c440fe 100644
--- a/modules/gpu/CMakeLists.txt
+++ b/modules/gpu/CMakeLists.txt
@@ -111,43 +111,3 @@ ocv_add_accuracy_tests(FILES "Include" ${test_hdrs}
FILES "Src" ${test_srcs}
${nvidia})
ocv_add_perf_tests()
-
-
-
-set(perf_cpu_path "${CMAKE_CURRENT_SOURCE_DIR}/perf_cpu")
-if(BUILD_PERF_TESTS AND EXISTS "${perf_cpu_path}")
- # opencv_highgui is required for imread/imwrite
- set(perf_deps ${the_module} opencv_ts opencv_highgui opencv_imgproc opencv_calib3d opencv_objdetect opencv_video opencv_nonfree)
- ocv_check_dependencies(${perf_deps})
-
- if(OCV_DEPENDENCIES_FOUND)
- set(the_target "opencv_perf_gpu_cpu")
-
- ocv_module_include_directories(${perf_deps} "${perf_cpu_path}")
-
- if(NOT OPENCV_PERF_${the_module}_CPU_SOURCES)
- file(GLOB perf_srcs "${perf_cpu_path}/*.cpp")
- file(GLOB perf_hdrs "${perf_cpu_path}/*.hpp" "${perf_cpu_path}/*.h")
- source_group("Src" FILES ${perf_srcs})
- source_group("Include" FILES ${perf_hdrs})
- set(OPENCV_PERF_${the_module}_CPU_SOURCES ${perf_srcs} ${perf_hdrs})
- endif()
-
- add_executable(${the_target} ${OPENCV_PERF_${the_module}_CPU_SOURCES})
- target_link_libraries(${the_target} ${OPENCV_MODULE_${the_module}_DEPS} ${perf_deps} ${OPENCV_LINKER_LIBS})
-
- # Additional target properties
- set_target_properties(${the_target} PROPERTIES
- DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
- RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}"
- )
-
- if(ENABLE_SOLUTION_FOLDERS)
- set_target_properties(${the_target} PROPERTIES FOLDER "tests performance")
- endif()
-
- ocv_add_precompiled_headers(${the_target})
- else(OCV_DEPENDENCIES_FOUND)
- #TODO: warn about unsatisfied dependencies
- endif(OCV_DEPENDENCIES_FOUND)
- endif()
diff --git a/modules/gpu/doc/object_detection.rst b/modules/gpu/doc/object_detection.rst
index 1f522f344..133660236 100644
--- a/modules/gpu/doc/object_detection.rst
+++ b/modules/gpu/doc/object_detection.rst
@@ -204,7 +204,7 @@ gpu::CascadeClassifier_GPU
--------------------------
.. ocv:class:: gpu::CascadeClassifier_GPU
-Cascade classifier class used for object detection. ::
+Cascade classifier class used for object detection. Supports HAAR and LBP cascades. ::
class CV_EXPORTS CascadeClassifier_GPU
{
@@ -219,6 +219,7 @@ Cascade classifier class used for object detection. ::
/* Returns number of detected objects */
int detectMultiScale( const GpuMat& image, GpuMat& objectsBuf, double scaleFactor=1.2, int minNeighbors=4, Size minSize=Size());
+ int detectMultiScale( const GpuMat& image, GpuMat& objectsBuf, Size maxObjectSize, Size minSize = Size(), double scaleFactor = 1.1, int minNeighbors = 4);
/* Finds only the largest object. Special mode if training is required.*/
bool findLargestObject;
@@ -233,11 +234,11 @@ Cascade classifier class used for object detection. ::
gpu::CascadeClassifier_GPU::CascadeClassifier_GPU
-----------------------------------------------------
-Loads the classifier from a file.
+Loads the classifier from a file. Cascade type is detected automatically by constructor parameter.
.. ocv:function:: gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const string& filename)
- :param filename: Name of the file from which the classifier is loaded. Only the old ``haar`` classifier (trained by the ``haar`` training application) and NVIDIA's ``nvbin`` are supported.
+ :param filename: Name of the file from which the classifier is loaded. Only the old ``haar`` classifier (trained by the ``haar`` training application) and NVIDIA's ``nvbin`` are supported for HAAR and only new type of OpenCV XML cascade supported for LBP.
@@ -255,8 +256,7 @@ Loads the classifier from a file. The previous content is destroyed.
.. ocv:function:: bool gpu::CascadeClassifier_GPU::load(const string& filename)
- :param filename: Name of the file from which the classifier is loaded. Only the old ``haar`` classifier (trained by the ``haar`` training application) and NVIDIA's ``nvbin`` are supported.
-
+ :param filename: Name of the file from which the classifier is loaded. Only the old ``haar`` classifier (trained by the ``haar`` training application) and NVIDIA's ``nvbin`` are supported for HAAR and only new type of OpenCV XML cascade supported for LBP.
gpu::CascadeClassifier_GPU::release
@@ -273,13 +273,17 @@ Detects objects of different sizes in the input image.
.. ocv:function:: int gpu::CascadeClassifier_GPU::detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, double scaleFactor=1.2, int minNeighbors=4, Size minSize=Size())
+.. ocv:function:: int gpu::CascadeClassifier_GPU::detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, Size maxObjectSize, Size minSize = Size(), double scaleFactor = 1.1, int minNeighbors = 4)
+
:param image: Matrix of type ``CV_8U`` containing an image where objects should be detected.
:param objectsBuf: Buffer to store detected objects (rectangles). If it is empty, it is allocated with the default size. If not empty, the function searches not more than N objects, where ``N = sizeof(objectsBufer's data)/sizeof(cv::Rect)``.
- :param scaleFactor: Value to specify how much the image size is reduced at each image scale.
+ :param maxObjectSize: Maximum possible object size. Objects larger than that are ignored. Used for second signature and supported only for LBP cascades.
- :param minNeighbors: Value to specify how many neighbours each candidate rectangle has to retain.
+ :param scaleFactor: Parameter specifying how much the image size is reduced at each image scale.
+
+ :param minNeighbors: Parameter specifying how many neighbors each candidate rectangle should have to retain it.
:param minSize: Minimum possible object size. Objects smaller than that are ignored.
diff --git a/modules/gpu/include/opencv2/gpu/gpu.hpp b/modules/gpu/include/opencv2/gpu/gpu.hpp
index a7f0ab32d..c6f2e1141 100644
--- a/modules/gpu/include/opencv2/gpu/gpu.hpp
+++ b/modules/gpu/include/opencv2/gpu/gpu.hpp
@@ -820,6 +820,7 @@ private:
int nLayers_;
};
+//! HoughLines
CV_EXPORTS void HoughLines(const GpuMat& src, GpuMat& lines, float rho, float theta, int threshold, bool doSort = false, int maxLines = 4096);
CV_EXPORTS void HoughLines(const GpuMat& src, GpuMat& lines, GpuMat& accum, GpuMat& buf, float rho, float theta, int threshold, bool doSort = false, int maxLines = 4096);
CV_EXPORTS void HoughLinesTransform(const GpuMat& src, GpuMat& accum, GpuMat& buf, float rho, float theta);
diff --git a/modules/gpu/misc/mark_nvidia.py b/modules/gpu/misc/mark_nvidia.py
index fd543e9f5..88070117d 100644
--- a/modules/gpu/misc/mark_nvidia.py
+++ b/modules/gpu/misc/mark_nvidia.py
@@ -1,255 +1,234 @@
import sys, re
spaces = '[\s]*'
-symbols = '[\s\w\d,.=:|]*'
+symbols = '[\s\w\d,.:|]*'
def pattern1(prefix, test):
- return re.compile(spaces + 'perf::' + prefix + '/' + test + '::' + '\(' + symbols + '\)' + spaces)
+ return re.compile(spaces + prefix + '_' + test + '::' + symbols + '::' + '\(' + symbols + '\)' + spaces)
-def pattern2(prefix, test, cvtype):
- return re.compile(spaces + 'perf::' + prefix + '/' + test + '::' + '\(' + symbols + cvtype + symbols + '\)' + spaces)
+def pattern2(prefix, test, param1):
+ return re.compile(spaces + prefix + '_' + test + '::' + symbols + '::' + '\(' + symbols + param1 + symbols + '\)' + spaces)
-def pattern3(prefix, test, cvtype, param1):
- return re.compile(spaces + 'perf::' + prefix + '/' + test + '::' + '\(' + symbols + cvtype + symbols + param1 + symbols + '\)' + spaces)
+def pattern3(prefix, test, param1, param2):
+ return re.compile(spaces + prefix + '_' + test + '::' + symbols + '::' + '\(' + symbols + param1 + symbols + param2 + symbols + '\)' + spaces)
-def pattern4(prefix, test, cvtype, param1, param2):
- return re.compile(spaces + 'perf::' + prefix + '/' + test + '::' + '\(' + symbols + cvtype + symbols + param1 + symbols + param2 + symbols + '\)' + spaces)
+def pattern4(prefix, test, param1, param2, param3):
+ return re.compile(spaces + prefix + '_' + test + '::' + symbols + '::' + '\(' + symbols + param1 + symbols + param2 + symbols + param3 + symbols + '\)' + spaces)
+
+def pattern5(prefix, test, param1, param2, param3, param5):
+ return re.compile(spaces + prefix + '_' + test + '::' + symbols + '::' + '\(' + symbols + param1 + symbols + param2 + symbols + param3 + symbols + param4 + symbols + '\)' + spaces)
npp_patterns = [
##############################################################
# Core
-
- # Core/Add_Mat (CV_8U | CV_16U | CV_32F)
- pattern2('Core', 'Add_Mat', '8U'),
- pattern2('Core', 'Add_Mat', '16U'),
- pattern2('Core', 'Add_Mat', '32F'),
-
- # Core/Add_Scalar (CV_8U | CV_16U | CV_32F)
- pattern2('Core', 'Add_Scalar', '8U'),
- pattern2('Core', 'Add_Scalar', '16U'),
- pattern2('Core', 'Add_Scalar', '32F'),
-
- # Core/Subtract_Mat (CV_8U | CV_16U | CV_32F)
- pattern2('Core', 'Subtract_Mat', '8U'),
- pattern2('Core', 'Subtract_Mat', '16U'),
- pattern2('Core', 'Subtract_Mat', '32F'),
-
- # Core/Subtract_Scalar (CV_8U | CV_16U | CV_32F)
- pattern2('Core', 'Subtract_Scalar', '8U'),
- pattern2('Core', 'Subtract_Scalar', '16U'),
- pattern2('Core', 'Subtract_Scalar', '32F'),
-
- # Core/Multiply_Mat (CV_8U | CV_16U | CV_32F)
- pattern2('Core', 'Multiply_Mat', '8U'),
- pattern2('Core', 'Multiply_Mat', '16U'),
- pattern2('Core', 'Multiply_Mat', '32F'),
-
- # Core/Multiply_Scalar (CV_8U | CV_16U | CV_32F)
- pattern2('Core', 'Multiply_Scalar', '8U'),
- pattern2('Core', 'Multiply_Scalar', '16U'),
- pattern2('Core', 'Multiply_Scalar', '32F'),
-
- # Core/Divide_Mat (CV_8U | CV_16U | CV_32F)
- pattern2('Core', 'Divide_Mat', '8U'),
- pattern2('Core', 'Divide_Mat', '16U'),
- pattern2('Core', 'Divide_Mat', '32F'),
-
- # Core/Divide_Scalar (CV_8U | CV_16U | CV_32F)
- pattern2('Core', 'Divide_Scalar', '8U'),
- pattern2('Core', 'Divide_Scalar', '16U'),
- pattern2('Core', 'Divide_Scalar', '32F'),
-
- # Core/AbsDiff_Mat (CV_8U | CV_16U | CV_32F)
- pattern2('Core', 'AbsDiff_Mat', '8U'),
- pattern2('Core', 'AbsDiff_Mat', '16U'),
- pattern2('Core', 'AbsDiff_Mat', '32F'),
-
- # Core/AbsDiff_Scalar (CV_8U | CV_16U | CV_32F)
- pattern2('Core', 'AbsDiff_Scalar', '8U'),
- pattern2('Core', 'AbsDiff_Scalar', '16U'),
- pattern2('Core', 'AbsDiff_Scalar', '32F'),
- # Core/Abs
+ # Core_AddMat (CV_8U | CV_16U | CV_32F)
+ pattern2('Core', 'AddMat', '8U'),
+ pattern2('Core', 'AddMat', '16U'),
+ pattern2('Core', 'AddMat', '32F'),
+
+ # Core_AddScalar (CV_8U | CV_16U | CV_32F)
+ pattern2('Core', 'AddScalar', '8U'),
+ pattern2('Core', 'AddScalar', '16U'),
+ pattern2('Core', 'AddScalar', '32F'),
+
+ # Core_SubtractMat (CV_8U | CV_16U | CV_32F)
+ pattern2('Core', 'SubtractMat', '8U'),
+ pattern2('Core', 'SubtractMat', '16U'),
+ pattern2('Core', 'SubtractMat', '32F'),
+
+ # Core_SubtractScalar (CV_8U | CV_16U | CV_32F)
+ pattern2('Core', 'SubtractScalar', '8U'),
+ pattern2('Core', 'SubtractScalar', '16U'),
+ pattern2('Core', 'SubtractScalar', '32F'),
+
+ # Core_MultiplyMat (CV_8U | CV_16U | CV_32F)
+ pattern2('Core', 'MultiplyMat', '8U'),
+ pattern2('Core', 'MultiplyMat', '16U'),
+ pattern2('Core', 'MultiplyMat', '32F'),
+
+ # Core_MultiplyScalar (CV_8U | CV_16U | CV_32F)
+ pattern2('Core', 'MultiplyScalar', '8U'),
+ pattern2('Core', 'MultiplyScalar', '16U'),
+ pattern2('Core', 'MultiplyScalar', '32F'),
+
+ # Core_DivideMat (CV_8U | CV_16U | CV_32F)
+ pattern2('Core', 'DivideMat', '8U'),
+ pattern2('Core', 'DivideMat', '16U'),
+ pattern2('Core', 'DivideMat', '32F'),
+
+ # Core_Divide_Scalar (CV_8U | CV_16U | CV_32F)
+ pattern2('Core', 'DivideScalar', '8U'),
+ pattern2('Core', 'DivideScalar', '16U'),
+ pattern2('Core', 'DivideScalar', '32F'),
+
+ # Core_AbsDiff_Mat (CV_8U | CV_16U | CV_32F)
+ pattern2('Core', 'AbsDiffMat', '8U'),
+ pattern2('Core', 'AbsDiffMat', '16U'),
+ pattern2('Core', 'AbsDiffMat', '32F'),
+
+ # Core_AbsDiffScalar (CV_8U | CV_16U | CV_32F)
+ pattern2('Core', 'AbsDiffScalar', '8U'),
+ pattern2('Core', 'AbsDiffScalar', '16U'),
+ pattern2('Core', 'AbsDiffScalar', '32F'),
+
+ # Core_Abs
pattern1('Core', 'Abs'),
- # Core/Sqr
+ # Core_Sqr
pattern1('Core', 'Sqr'),
- # Core/Sqrt
+ # Core_Sqrt
pattern1('Core', 'Sqrt'),
- # Core/Log
+ # Core_Log
pattern1('Core', 'Log'),
- # Core/Exp
+ # Core_Exp
pattern1('Core', 'Exp'),
- # Core/Bitwise_And_Scalar
- pattern1('Core', 'Bitwise_And_Scalar'),
+ # Core_BitwiseAndScalar
+ pattern1('Core', 'BitwiseAndScalar'),
- # Core/Bitwise_Or_Scalar
- pattern1('Core', 'Bitwise_Or_Scalar'),
+ # Core_BitwiseOrScalar
+ pattern1('Core', 'BitwiseOrScalar'),
- # Core/Bitwise_Xor_Scalar
- pattern1('Core', 'Bitwise_Xor_Scalar'),
+ # Core_BitwiseXorScalar
+ pattern1('Core', 'BitwiseXorScalar'),
- # Core/RShift
+ # Core_RShift
pattern1('Core', 'RShift'),
- # Core/LShift
+ # Core_LShift
pattern1('Core', 'LShift'),
- # Core/Transpose
+ # Core_Transpose
pattern1('Core', 'Transpose'),
- # Core/Flip
+ # Core_Flip
pattern1('Core', 'Flip'),
- # Core/LUT_OneChannel
- pattern1('Core', 'LUT_OneChannel'),
+ # Core_LutOneChannel
+ pattern1('Core', 'LutOneChannel'),
- # Core/LUT_MultiChannel
- pattern1('Core', 'LUT_MultiChannel'),
+ # Core_LutMultiChannel
+ pattern1('Core', 'LutMultiChannel'),
- # Core/Magnitude_Complex
- pattern1('Core', 'Magnitude_Complex'),
+ # Core_MagnitudeComplex
+ pattern1('Core', 'MagnitudeComplex'),
- # Core/Magnitude_Sqr_Complex
- pattern1('Core', 'Magnitude_Sqr_Complex'),
+ # Core_MagnitudeSqrComplex
+ pattern1('Core', 'MagnitudeSqrComplex'),
- # Core/MeanStdDev
+ # Core_MeanStdDev
pattern1('Core', 'MeanStdDev'),
- # Core/NormDiff
+ # Core_NormDiff
pattern1('Core', 'NormDiff'),
-
+
##############################################################
# Filters
- # Filters/Blur
+ # Filters_Blur
pattern1('Filters', 'Blur'),
-
- # Filters/Erode
+
+ # Filters_Erode
pattern1('Filters', 'Erode'),
-
- # Filters/Dilate
+
+ # Filters_Dilate
pattern1('Filters', 'Dilate'),
-
- # Filters/MorphologyEx
+
+ # Filters_MorphologyEx
pattern1('Filters', 'MorphologyEx'),
-
+
##############################################################
# ImgProc
-
- # ImgProc/Resize (8UC1 | 8UC4, INTER_NEAREST | INTER_LINEAR)
- pattern3('ImgProc', 'Resize', '8UC1', 'INTER_NEAREST'),
- pattern3('ImgProc', 'Resize', '8UC4', 'INTER_NEAREST'),
- pattern3('ImgProc', 'Resize', '8UC1', 'INTER_LINEAR'),
- pattern3('ImgProc', 'Resize', '8UC4', 'INTER_LINEAR'),
-
- # ImgProc/Resize (8UC4, INTER_CUBIC)
- pattern3('ImgProc', 'Resize', '8UC4', 'INTER_CUBIC'),
-
- # ImgProc/WarpAffine (8UC1 | 8UC3 | 8UC4 | 32FC1 | 32FC3 | 32FC4, INTER_NEAREST | INTER_LINEAR | INTER_CUBIC, BORDER_CONSTANT)
- pattern4('ImgProc', 'WarpAffine', '8UC1', 'INTER_NEAREST', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '8UC1', 'INTER_LINEAR', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '8UC1', 'INTER_CUBIC', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '8UC3', 'INTER_NEAREST', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '8UC3', 'INTER_LINEAR', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '8UC3', 'INTER_CUBIC', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '8UC4', 'INTER_NEAREST', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '8UC4', 'INTER_LINEAR', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '8UC4', 'INTER_CUBIC', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '32FC1', 'INTER_NEAREST', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '32FC1', 'INTER_LINEAR', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '32FC1', 'INTER_CUBIC', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '32FC3', 'INTER_NEAREST', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '32FC3', 'INTER_LINEAR', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '32FC3', 'INTER_CUBIC', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '32FC4', 'INTER_NEAREST', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '32FC4', 'INTER_LINEAR', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpAffine', '32FC4', 'INTER_CUBIC', 'BORDER_CONSTANT'),
-
- # ImgProc/WarpPerspective (8UC1 | 8UC3 | 8UC4 | 32FC1 | 32FC3 | 32FC4, INTER_NEAREST | INTER_LINEAR | INTER_CUBIC, BORDER_CONSTANT)
- pattern4('ImgProc', 'WarpPerspective', '8UC1', 'INTER_NEAREST', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '8UC1', 'INTER_LINEAR', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '8UC1', 'INTER_CUBIC', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '8UC3', 'INTER_NEAREST', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '8UC3', 'INTER_LINEAR', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '8UC3', 'INTER_CUBIC', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '8UC4', 'INTER_NEAREST', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '8UC4', 'INTER_LINEAR', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '8UC4', 'INTER_CUBIC', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '32FC1', 'INTER_NEAREST', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '32FC1', 'INTER_LINEAR', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '32FC1', 'INTER_CUBIC', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '32FC3', 'INTER_NEAREST', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '32FC3', 'INTER_LINEAR', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '32FC3', 'INTER_CUBIC', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '32FC4', 'INTER_NEAREST', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '32FC4', 'INTER_LINEAR', 'BORDER_CONSTANT'),
- pattern4('ImgProc', 'WarpPerspective', '32FC4', 'INTER_CUBIC', 'BORDER_CONSTANT'),
-
- # ImgProc/CopyMakeBorder (8UC1 | 8UC4 | 32SC1 | 32FC1, BORDER_CONSTANT)
- pattern3('ImgProc', 'CopyMakeBorder', '8UC1', 'BORDER_CONSTANT'),
- pattern3('ImgProc', 'CopyMakeBorder', '8UC4', 'BORDER_CONSTANT'),
- pattern3('ImgProc', 'CopyMakeBorder', '32SC1', 'BORDER_CONSTANT'),
- pattern3('ImgProc', 'CopyMakeBorder', '32FC1', 'BORDER_CONSTANT'),
-
- # ImgProc/Threshold (32F, THRESH_TRUNC)
+
+ # ImgProc_Resize (8U, 1 | 4, INTER_NEAREST | INTER_LINEAR)
+ pattern4('ImgProc', 'Resize', '8U', '1', 'INTER_NEAREST'),
+ pattern4('ImgProc', 'Resize', '8U', '4', 'INTER_NEAREST'),
+ pattern4('ImgProc', 'Resize', '8U', '1', 'INTER_LINEAR'),
+ pattern4('ImgProc', 'Resize', '8U', '4', 'INTER_LINEAR'),
+
+ # ImgProc_Resize (8U, 4, INTER_CUBIC)
+ pattern4('ImgProc', 'Resize', '8U', '4', 'INTER_CUBIC'),
+
+ # ImgProc_WarpAffine (8U | 32F, INTER_NEAREST | INTER_LINEAR | INTER_CUBIC, BORDER_CONSTANT)
+ pattern4('ImgProc', 'WarpAffine', '8U' , 'INTER_NEAREST', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'WarpAffine', '8U' , 'INTER_LINEAR', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'WarpAffine', '8U' , 'INTER_CUBIC', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'WarpAffine', '32F', 'INTER_NEAREST', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'WarpAffine', '32F', 'INTER_LINEAR', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'WarpAffine', '32F', 'INTER_CUBIC', 'BORDER_CONSTANT'),
+
+ # ImgProc_WarpPerspective (8U | 32F, INTER_NEAREST | INTER_LINEAR | INTER_CUBIC, BORDER_CONSTANT)
+ pattern4('ImgProc', 'WarpPerspective', '8U' , 'INTER_NEAREST', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'WarpPerspective', '8U' , 'INTER_LINEAR', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'WarpPerspective', '8U' , 'INTER_CUBIC', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'WarpPerspective', '32F', 'INTER_NEAREST', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'WarpPerspective', '32F', 'INTER_LINEAR', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'WarpPerspective', '32F', 'INTER_CUBIC', 'BORDER_CONSTANT'),
+
+ # ImgProc_CopyMakeBorder (8UC1 | 8UC4 | 32SC1 | 32FC1, BORDER_CONSTANT)
+ pattern4('ImgProc', 'CopyMakeBorder', '8U' , '1', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'CopyMakeBorder', '8U' , '4', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'CopyMakeBorder', '32S', '1', 'BORDER_CONSTANT'),
+ pattern4('ImgProc', 'CopyMakeBorder', '32F', '1', 'BORDER_CONSTANT'),
+
+ # ImgProc_Threshold (32F, THRESH_TRUNC)
pattern3('ImgProc', 'Threshold', '32F', 'THRESH_TRUNC'),
- # ImgProc/Integral_Sqr
- pattern1('ImgProc', 'Integral_Sqr'),
+ # ImgProc_IntegralSqr
+ pattern1('ImgProc', 'IntegralSqr'),
- # ImgProc/HistEven_OneChannel
- pattern1('ImgProc', 'HistEven_OneChannel'),
+ # ImgProc_HistEven_OneChannel
+ pattern1('ImgProc', 'HistEvenOneChannel'),
- # ImgProc/HistEven_FourChannel
- pattern1('ImgProc', 'HistEven_FourChannel'),
+ # ImgProc_HistEven_FourChannel
+ pattern1('ImgProc', 'HistEvenFourChannel'),
- # ImgProc/Rotate
+ # ImgProc_Rotate
pattern1('ImgProc', 'Rotate'),
- # ImgProc/SwapChannels
+ # ImgProc_SwapChannels
pattern1('ImgProc', 'SwapChannels'),
- # ImgProc/AlphaComp
+ # ImgProc_AlphaComp
pattern1('ImgProc', 'AlphaComp'),
- # ImgProc/ImagePyramid_build
- pattern1('ImgProc', 'ImagePyramid_build'),
+ # ImgProc_ImagePyramidBuild
+ pattern1('ImgProc', 'ImagePyramidBuild'),
+
+ # ImgProc_ImagePyramid_getLayer
+ pattern1('ImgProc', 'ImagePyramidGetLayer'),
- # ImgProc/ImagePyramid_getLayer
- pattern1('ImgProc', 'ImagePyramid_getLayer'),
-
##############################################################
# MatOp
-
- # MatOp/SetTo (8UC4 | 16UC1 | 16UC4 | 32FC1 | 32FC4)
- pattern2('MatOp', 'SetTo', '8UC4'),
- pattern2('MatOp', 'SetTo', '16UC1'),
- pattern2('MatOp', 'SetTo', '16UC4'),
- pattern2('MatOp', 'SetTo', '32FC1'),
- pattern2('MatOp', 'SetTo', '32FC4'),
-
- # MatOp/SetToMasked (8UC4 | 16UC1 | 16UC4 | 32FC1 | 32FC4)
- pattern2('MatOp', 'SetToMasked', '8UC4'),
- pattern2('MatOp', 'SetToMasked', '16UC1'),
- pattern2('MatOp', 'SetToMasked', '16UC4'),
- pattern2('MatOp', 'SetToMasked', '32FC1'),
- pattern2('MatOp', 'SetToMasked', '32FC4'),
-
- # MatOp/CopyToMasked (8UC1 | 8UC3 |8UC4 | 16UC1 | 16UC3 | 16UC4 | 32FC1 | 32FC3 | 32FC4)
- pattern2('MatOp', 'CopyToMasked', '8UC1'),
- pattern2('MatOp', 'CopyToMasked', '8UC3'),
- pattern2('MatOp', 'CopyToMasked', '8UC4'),
- pattern2('MatOp', 'CopyToMasked', '16UC1'),
- pattern2('MatOp', 'CopyToMasked', '16UC3'),
- pattern2('MatOp', 'CopyToMasked', '16UC4'),
- pattern2('MatOp', 'CopyToMasked', '32FC1'),
- pattern2('MatOp', 'CopyToMasked', '32FC3'),
- pattern2('MatOp', 'CopyToMasked', '32FC4'),
+
+ # MatOp_SetTo (8UC4 | 16UC1 | 16UC4 | 32FC1 | 32FC4)
+ pattern3('MatOp', 'SetTo', '8U' , '4'),
+ pattern3('MatOp', 'SetTo', '16U', '1'),
+ pattern3('MatOp', 'SetTo', '16U', '4'),
+ pattern3('MatOp', 'SetTo', '32F', '1'),
+ pattern3('MatOp', 'SetTo', '32F', '4'),
+
+ # MatOp_SetToMasked (8UC4 | 16UC1 | 16UC4 | 32FC1 | 32FC4)
+ pattern3('MatOp', 'SetToMasked', '8U' , '4'),
+ pattern3('MatOp', 'SetToMasked', '16U', '1'),
+ pattern3('MatOp', 'SetToMasked', '16U', '4'),
+ pattern3('MatOp', 'SetToMasked', '32F', '1'),
+ pattern3('MatOp', 'SetToMasked', '32F', '4'),
+
+ # MatOp_CopyToMasked (8UC1 | 8UC3 |8UC4 | 16UC1 | 16UC3 | 16UC4 | 32FC1 | 32FC3 | 32FC4)
+ pattern3('MatOp', 'CopyToMasked', '8U' , '1'),
+ pattern3('MatOp', 'CopyToMasked', '8U' , '3'),
+ pattern3('MatOp', 'CopyToMasked', '8U' , '4'),
+ pattern3('MatOp', 'CopyToMasked', '16U', '1'),
+ pattern3('MatOp', 'CopyToMasked', '16U', '3'),
+ pattern3('MatOp', 'CopyToMasked', '16U', '4'),
+ pattern3('MatOp', 'CopyToMasked', '32F', '1'),
+ pattern3('MatOp', 'CopyToMasked', '32F', '3'),
+ pattern3('MatOp', 'CopyToMasked', '32F', '4'),
]
cublasPattern = pattern1('Core', 'GEMM')
@@ -260,7 +239,7 @@ if __name__ == "__main__":
inputFile = open(sys.argv[1], 'r')
lines = inputFile.readlines()
inputFile.close()
-
+
for i in range(len(lines)):
if cublasPattern.match(lines[i]):
diff --git a/modules/gpu/perf/main.cpp b/modules/gpu/perf/main.cpp
new file mode 100644
index 000000000..aadeee955
--- /dev/null
+++ b/modules/gpu/perf/main.cpp
@@ -0,0 +1,125 @@
+#include "perf_precomp.hpp"
+
+using namespace std;
+using namespace cv;
+using namespace cv::gpu;
+using namespace cvtest;
+using namespace testing;
+
+void printOsInfo()
+{
+#if defined _WIN32
+# if defined _WIN64
+ cout << "OS: Windows x64 \n" << endl;
+# else
+ cout << "OS: Windows x32 \n" << endl;
+# endif
+#elif defined linux
+# if defined _LP64
+ cout << "OS: Linux x64 \n" << endl;
+# else
+ cout << "OS: Linux x32 \n" << endl;
+# endif
+#elif defined __APPLE__
+# if defined _LP64
+ cout << "OS: Apple x64 \n" << endl;
+# else
+ cout << "OS: Apple x32 \n" << endl;
+# endif
+#endif
+}
+
+void printCudaInfo()
+{
+#ifndef HAVE_CUDA
+ cout << "OpenCV was built without CUDA support \n" << endl;
+#else
+ int driver;
+ cudaDriverGetVersion(&driver);
+
+ cout << "CUDA Driver version: " << driver << '\n';
+ cout << "CUDA Runtime version: " << CUDART_VERSION << '\n';
+
+ cout << endl;
+
+ cout << "GPU module was compiled for the following GPU archs:" << endl;
+ cout << " BIN: " << CUDA_ARCH_BIN << '\n';
+ cout << " PTX: " << CUDA_ARCH_PTX << '\n';
+
+ cout << endl;
+
+ int deviceCount = getCudaEnabledDeviceCount();
+ cout << "CUDA device count: " << deviceCount << '\n';
+
+ cout << endl;
+
+ for (int i = 0; i < deviceCount; ++i)
+ {
+ DeviceInfo info(i);
+
+ cout << "Device [" << i << "] \n";
+ cout << "\t Name: " << info.name() << '\n';
+ cout << "\t Compute capability: " << info.majorVersion() << '.' << info.minorVersion()<< '\n';
+ cout << "\t Multi Processor Count: " << info.multiProcessorCount() << '\n';
+ cout << "\t Total memory: " << static_cast(static_cast(info.totalMemory() / 1024.0) / 1024.0) << " Mb \n";
+ cout << "\t Free memory: " << static_cast(static_cast(info.freeMemory() / 1024.0) / 1024.0) << " Mb \n";
+ if (!info.isCompatible())
+ cout << "\t !!! This device is NOT compatible with current GPU module build \n";
+
+ cout << endl;
+ }
+#endif
+}
+
+int main(int argc, char** argv)
+{
+ CommandLineParser cmd(argc, (const char**) argv,
+ "{ print_info_only | print_info_only | false | Print information about system and exit }"
+ "{ device | device | 0 | Device on which tests will be executed }"
+ "{ cpu | cpu | false | Run tests on cpu }"
+ );
+
+ printOsInfo();
+ printCudaInfo();
+
+ if (cmd.get("print_info_only"))
+ return 0;
+
+ int device = cmd.get("device");
+ bool cpu = cmd.get("cpu");
+#ifndef HAVE_CUDA
+ cpu = true;
+#endif
+
+ if (cpu)
+ {
+ runOnGpu = false;
+
+ cout << "Run tests on CPU \n" << endl;
+ }
+ else
+ {
+ runOnGpu = true;
+
+ if (device < 0 || device >= getCudaEnabledDeviceCount())
+ {
+ cerr << "Incorrect device index - " << device << endl;
+ return -1;
+ }
+
+ DeviceInfo info(device);
+ if (!info.isCompatible())
+ {
+ cerr << "Device " << device << " [" << info.name() << "] is NOT compatible with current GPU module build" << endl;
+ return -1;
+ }
+
+ setDevice(device);
+
+ cout << "Run tests on device " << device << " [" << info.name() << "] \n" << endl;
+ }
+
+ InitGoogleTest(&argc, argv);
+ perf::TestBase::Init(argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/modules/gpu/perf/perf_calib3d.cpp b/modules/gpu/perf/perf_calib3d.cpp
index 7a9c6c395..f62185e00 100644
--- a/modules/gpu/perf/perf_calib3d.cpp
+++ b/modules/gpu/perf/perf_calib3d.cpp
@@ -1,219 +1,263 @@
#include "perf_precomp.hpp"
-#ifdef HAVE_CUDA
+using namespace std;
+using namespace testing;
+
+namespace {
//////////////////////////////////////////////////////////////////////
// StereoBM
-GPU_PERF_TEST_1(StereoBM, cv::gpu::DeviceInfo)
+typedef pair pair_string;
+DEF_PARAM_TEST_1(ImagePair, pair_string);
+
+PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(make_pair("gpu/perf/aloe.jpg", "gpu/perf/aloeR.jpg")))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Mat img_l_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_l_host.empty());
-
- cv::Mat img_r_host = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_r_host.empty());
-
- cv::gpu::StereoBM_GPU bm(0, 256);
- cv::gpu::GpuMat img_l(img_l_host);
- cv::gpu::GpuMat img_r(img_r_host);
- cv::gpu::GpuMat dst;
-
- bm(img_l, img_r, dst);
-
declare.time(5.0);
- TEST_CYCLE()
+ const cv::Mat imgLeft = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(imgLeft.empty());
+
+ const cv::Mat imgRight = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(imgRight.empty());
+
+ const int preset = 0;
+ const int ndisp = 256;
+
+ if (runOnGpu)
{
- bm(img_l, img_r, dst);
+ cv::gpu::StereoBM_GPU d_bm(preset, ndisp);
+
+ cv::gpu::GpuMat d_imgLeft(imgLeft);
+ cv::gpu::GpuMat d_imgRight(imgRight);
+ cv::gpu::GpuMat d_dst;
+
+ d_bm(d_imgLeft, d_imgRight, d_dst);
+
+ TEST_CYCLE()
+ {
+ d_bm(d_imgLeft, d_imgRight, d_dst);
+ }
+ }
+ else
+ {
+ cv::StereoBM bm(preset, ndisp);
+
+ cv::Mat dst;
+
+ bm(imgLeft, imgRight, dst);
+
+ TEST_CYCLE()
+ {
+ bm(imgLeft, imgRight, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Calib3D, StereoBM, ALL_DEVICES);
-
//////////////////////////////////////////////////////////////////////
// StereoBeliefPropagation
-GPU_PERF_TEST_1(StereoBeliefPropagation, cv::gpu::DeviceInfo)
+PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, Values(make_pair("gpu/stereobp/aloe-L.png", "gpu/stereobp/aloe-R.png")))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Mat img_l_host = readImage("gpu/stereobp/aloe-L.png");
- ASSERT_FALSE(img_l_host.empty());
-
- cv::Mat img_r_host = readImage("gpu/stereobp/aloe-R.png");
- ASSERT_FALSE(img_r_host.empty());
-
- cv::gpu::StereoBeliefPropagation bp(64);
- cv::gpu::GpuMat img_l(img_l_host);
- cv::gpu::GpuMat img_r(img_r_host);
- cv::gpu::GpuMat dst;
-
- bp(img_l, img_r, dst);
-
declare.time(10.0);
- TEST_CYCLE()
+ const cv::Mat imgLeft = readImage(GetParam().first);
+ ASSERT_FALSE(imgLeft.empty());
+
+ const cv::Mat imgRight = readImage(GetParam().second);
+ ASSERT_FALSE(imgRight.empty());
+
+ const int ndisp = 64;
+
+ if (runOnGpu)
{
- bp(img_l, img_r, dst);
+ cv::gpu::StereoBeliefPropagation d_bp(ndisp);
+
+ cv::gpu::GpuMat d_imgLeft(imgLeft);
+ cv::gpu::GpuMat d_imgRight(imgRight);
+ cv::gpu::GpuMat d_dst;
+
+ d_bp(d_imgLeft, d_imgRight, d_dst);
+
+ TEST_CYCLE()
+ {
+ d_bp(d_imgLeft, d_imgRight, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Calib3D, StereoBeliefPropagation, ALL_DEVICES);
-
//////////////////////////////////////////////////////////////////////
// StereoConstantSpaceBP
-GPU_PERF_TEST_1(StereoConstantSpaceBP, cv::gpu::DeviceInfo)
+PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP, Values(make_pair("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-R.png")))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Mat img_l_host = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_l_host.empty());
-
- cv::Mat img_r_host = readImage("gpu/stereobm/aloe-R.png", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_r_host.empty());
-
- cv::gpu::StereoConstantSpaceBP csbp(128);
- cv::gpu::GpuMat img_l(img_l_host);
- cv::gpu::GpuMat img_r(img_r_host);
- cv::gpu::GpuMat dst;
-
- csbp(img_l, img_r, dst);
-
declare.time(10.0);
- TEST_CYCLE()
+ const cv::Mat imgLeft = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(imgLeft.empty());
+
+ const cv::Mat imgRight = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(imgRight.empty());
+
+ const int ndisp = 128;
+
+ if (runOnGpu)
{
- csbp(img_l, img_r, dst);
+ cv::gpu::StereoConstantSpaceBP d_csbp(ndisp);
+
+ cv::gpu::GpuMat d_imgLeft(imgLeft);
+ cv::gpu::GpuMat d_imgRight(imgRight);
+ cv::gpu::GpuMat d_dst;
+
+ d_csbp(d_imgLeft, d_imgRight, d_dst);
+
+ TEST_CYCLE()
+ {
+ d_csbp(d_imgLeft, d_imgRight, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Calib3D, StereoConstantSpaceBP, ALL_DEVICES);
-
//////////////////////////////////////////////////////////////////////
// DisparityBilateralFilter
-GPU_PERF_TEST_1(DisparityBilateralFilter, cv::gpu::DeviceInfo)
+PERF_TEST_P(ImagePair, Calib3D_DisparityBilateralFilter, Values(make_pair("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-disp.png")))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(img.empty());
- cv::Mat img_host = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_host.empty());
+ const cv::Mat disp = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(disp.empty());
- cv::Mat disp_host = readImage("gpu/stereobm/aloe-disp.png", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(disp_host.empty());
+ const int ndisp = 128;
- cv::gpu::DisparityBilateralFilter f(128);
- cv::gpu::GpuMat img(img_host);
- cv::gpu::GpuMat disp(disp_host);
- cv::gpu::GpuMat dst;
-
- f(disp, img, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- f(disp, img, dst);
+ cv::gpu::DisparityBilateralFilter d_filter(ndisp);
+
+ cv::gpu::GpuMat d_img(img);
+ cv::gpu::GpuMat d_disp(disp);
+ cv::gpu::GpuMat d_dst;
+
+ d_filter(d_disp, d_img, d_dst);
+
+ TEST_CYCLE()
+ {
+ d_filter(d_disp, d_img, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Calib3D, DisparityBilateralFilter, ALL_DEVICES);
-
//////////////////////////////////////////////////////////////////////
// TransformPoints
-IMPLEMENT_PARAM_CLASS(Count, int)
+DEF_PARAM_TEST_1(Count, int);
-GPU_PERF_TEST(TransformPoints, cv::gpu::DeviceInfo, Count)
+PERF_TEST_P(Count, Calib3D_TransformPoints, Values(5000, 10000, 20000))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const int count = GetParam();
- int count = GET_PARAM(1);
+ cv::Mat src(1, count, CV_32FC3);
+ fillRandom(src, -100, 100);
- cv::Mat src_host(1, count, CV_32FC3);
- fill(src_host, -100, 100);
+ const cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);
+ const cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);
- cv::gpu::GpuMat src(src_host);
- cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);
- cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);
- cv::gpu::GpuMat dst;
-
- cv::gpu::transformPoints(src, rvec, tvec, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::transformPoints(src, rvec, tvec, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::transformPoints(d_src, rvec, tvec, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::transformPoints(d_src, rvec, tvec, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Calib3D, TransformPoints, testing::Combine(
- ALL_DEVICES,
- testing::Values(5000, 10000, 20000)));
-
//////////////////////////////////////////////////////////////////////
// ProjectPoints
-GPU_PERF_TEST(ProjectPoints, cv::gpu::DeviceInfo, Count)
+PERF_TEST_P(Count, Calib3D_ProjectPoints, Values(5000, 10000, 20000))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const int count = GetParam();
- int count = GET_PARAM(1);
+ cv::Mat src(1, count, CV_32FC3);
+ fillRandom(src, -100, 100);
- cv::Mat src_host(1, count, CV_32FC3);
- fill(src_host, -100, 100);
+ const cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);
+ const cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);
+ const cv::Mat camera_mat = cv::Mat::ones(3, 3, CV_32FC1);
- cv::gpu::GpuMat src(src_host);
- cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);
- cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);
- cv::Mat camera_mat = cv::Mat::ones(3, 3, CV_32FC1);
- cv::gpu::GpuMat dst;
-
- cv::gpu::projectPoints(src, rvec, tvec, camera_mat, cv::Mat(), dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::projectPoints(src, rvec, tvec, camera_mat, cv::Mat(), dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_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(), d_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);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Calib3D, ProjectPoints, testing::Combine(
- ALL_DEVICES,
- testing::Values(5000, 10000, 20000)));
-
//////////////////////////////////////////////////////////////////////
// SolvePnPRansac
-GPU_PERF_TEST(SolvePnPRansac, cv::gpu::DeviceInfo, Count)
+PERF_TEST_P(Count, Calib3D_SolvePnPRansac, Values(5000, 10000, 20000))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(10.0);
- int count = GET_PARAM(1);
+ const int count = GetParam();
cv::Mat object(1, count, CV_32FC3);
- fill(object, -100, 100);
+ fillRandom(object, -100, 100);
cv::Mat camera_mat(3, 3, CV_32FC1);
- fill(camera_mat, 0.5, 1);
+ fillRandom(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;
camera_mat.at(2, 1) = 0.f;
- cv::Mat dist_coef(1, 8, CV_32F, cv::Scalar::all(0));
+ 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);
- fill(rvec_gold, 0, 1);
+ fillRandom(rvec_gold, 0, 1);
cv::Mat tvec_gold(1, 3, CV_32FC1);
- fill(tvec_gold, 0, 1);
+ fillRandom(tvec_gold, 0, 1);
cv::projectPoints(object, rvec_gold, tvec_gold, camera_mat, dist_coef, image_vec);
cv::Mat image(1, count, CV_32FC2, &image_vec[0]);
@@ -221,82 +265,92 @@ GPU_PERF_TEST(SolvePnPRansac, cv::gpu::DeviceInfo, Count)
cv::Mat rvec;
cv::Mat tvec;
- cv::gpu::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
-
- declare.time(3.0);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
cv::gpu::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
+ }
+ }
+ else
+ {
+ cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
+
+ TEST_CYCLE()
+ {
+ cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Calib3D, SolvePnPRansac, testing::Combine(
- ALL_DEVICES,
- testing::Values(5000, 10000, 20000)));
-
//////////////////////////////////////////////////////////////////////
// ReprojectImageTo3D
-GPU_PERF_TEST(ReprojectImageTo3D, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Calib3D_ReprojectImageTo3D, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src_host(size, depth);
- fill(src_host, 5.0, 30.0);
+ cv::Mat src(size, depth);
+ fillRandom(src, 5.0, 30.0);
cv::Mat Q(4, 4, CV_32FC1);
- fill(Q, 0.1, 1.0);
+ fillRandom(Q, 0.1, 1.0);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::reprojectImageTo3D(src, dst, Q);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::reprojectImageTo3D(src, dst, Q);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::reprojectImageTo3D(d_src, d_dst, Q);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::reprojectImageTo3D(d_src, d_dst, Q);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::reprojectImageTo3D(src, dst, Q);
+
+ TEST_CYCLE()
+ {
+ cv::reprojectImageTo3D(src, dst, Q);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Calib3D, ReprojectImageTo3D, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16S)));
-
//////////////////////////////////////////////////////////////////////
// DrawColorDisp
-GPU_PERF_TEST(DrawColorDisp, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Calib3D_DrawColorDisp, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int type = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ cv::Mat src(size, type);
+ fillRandom(src, 0, 255);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::drawColorDisp(src, dst, 255);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::drawColorDisp(src, dst, 255);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::drawColorDisp(d_src, d_dst, 255);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::drawColorDisp(d_src, d_dst, 255);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Calib3D, DrawColorDisp, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatDepth(CV_8U), MatDepth(CV_16S))));
-
-#endif
-
+} // namespace
diff --git a/modules/gpu/perf/perf_core.cpp b/modules/gpu/perf/perf_core.cpp
index f41343204..b638fbf4a 100644
--- a/modules/gpu/perf/perf_core.cpp
+++ b/modules/gpu/perf/perf_core.cpp
@@ -1,1883 +1,2252 @@
#include "perf_precomp.hpp"
-#ifdef HAVE_CUDA
+using namespace std;
+using namespace testing;
+
+namespace {
+
+#define ARITHM_MAT_DEPTH Values(CV_8U, CV_16U, CV_32F, CV_64F)
//////////////////////////////////////////////////////////////////////
// Merge
-GPU_PERF_TEST(Merge, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)
+PERF_TEST_P(Sz_Depth_Cn, Core_Merge, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, Values(2, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
+ const int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
-
- std::vector src(channels);
+ std::vector src(channels);
for (int i = 0; i < channels; ++i)
- src[i] = cv::gpu::GpuMat(size, depth, cv::Scalar::all(i));
+ src[i] = cv::Mat(size, depth, cv::Scalar::all(i));
- cv::gpu::GpuMat dst;
-
- cv::gpu::merge(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::merge(src, dst);
+ std::vector d_src(channels);
+ for (int i = 0; i < channels; ++i)
+ d_src[i].upload(src[i]);
+
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::merge(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::merge(d_src, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::merge(src, dst);
+
+ TEST_CYCLE()
+ {
+ cv::merge(src, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Merge, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F),
- testing::Values(2, 3, 4)));
-
//////////////////////////////////////////////////////////////////////
// Split
-GPU_PERF_TEST(Split, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)
+PERF_TEST_P(Sz_Depth_Cn, Core_Split, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, Values(2, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
+ const int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
+ cv::Mat src(size, CV_MAKE_TYPE(depth, channels), cv::Scalar(1, 2, 3, 4));
- cv::gpu::GpuMat src(size, CV_MAKE_TYPE(depth, channels), cv::Scalar(1, 2, 3, 4));
-
- std::vector dst;
-
- cv::gpu::split(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::split(src, dst);
+ cv::gpu::GpuMat d_src(src);
+
+ std::vector d_dst;
+
+ cv::gpu::split(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::split(d_src, d_dst);
+ }
+ }
+ else
+ {
+ std::vector dst;
+
+ cv::split(src, dst);
+
+ TEST_CYCLE()
+ {
+ cv::split(src, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Split, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F),
- testing::Values(2, 3, 4)));
-
//////////////////////////////////////////////////////////////////////
-// Add_Mat
+// AddMat
-GPU_PERF_TEST(Add_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_AddMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src1(size, depth);
+ fillRandom(src1);
- cv::Mat src1_host(size, depth);
- fill(src1_host, 0.0, 100.0);
+ cv::Mat src2(size, depth);
+ fillRandom(src2);
- cv::Mat src2_host(size, depth);
- fill(src2_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::add(src1, src2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::add(src1, src2, dst);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::add(d_src1, d_src2, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::add(d_src1, d_src2, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::add(src1, src2, dst);
+
+ TEST_CYCLE()
+ {
+ cv::add(src1, src2, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Add_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
-// Add_Scalar
+// AddScalar
-GPU_PERF_TEST(Add_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_AddScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
cv::Scalar s(1, 2, 3, 4);
- cv::gpu::GpuMat dst;
- cv::gpu::add(src, s, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::add(src, s, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::add(d_src, s, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::add(d_src, s, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::add(src, s, dst);
+
+ TEST_CYCLE()
+ {
+ cv::add(src, s, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Add_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
-// Subtract_Mat
+// SubtractMat
-GPU_PERF_TEST(Subtract_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_SubtractMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src1(size, depth);
+ fillRandom(src1);
- cv::Mat src1_host(size, depth);
- fill(src1_host, 0.0, 100.0);
+ cv::Mat src2(size, depth);
+ fillRandom(src2);
- cv::Mat src2_host(size, depth);
- fill(src2_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::subtract(src1, src2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::subtract(src1, src2, dst);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::subtract(d_src1, d_src2, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::subtract(d_src1, d_src2, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::subtract(src1, src2, dst);
+
+ TEST_CYCLE()
+ {
+ cv::subtract(src1, src2, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Subtract_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
-// Subtract_Scalar
+// SubtractScalar
-GPU_PERF_TEST(Subtract_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_SubtractScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
cv::Scalar s(1, 2, 3, 4);
- cv::gpu::GpuMat dst;
- cv::gpu::subtract(src, s, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::subtract(src, s, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::subtract(d_src, s, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::subtract(d_src, s, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::subtract(src, s, dst);
+
+ TEST_CYCLE()
+ {
+ cv::subtract(src, s, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Subtract_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
-// Multiply_Mat
+// MultiplyMat
-GPU_PERF_TEST(Multiply_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_MultiplyMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src1(size, depth);
+ fillRandom(src1);
- cv::Mat src1_host(size, depth);
- fill(src1_host, 0.0, 100.0);
+ cv::Mat src2(size, depth);
+ fillRandom(src2);
- cv::Mat src2_host(size, depth);
- fill(src2_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::multiply(src1, src2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::multiply(src1, src2, dst);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::multiply(d_src1, d_src2, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::multiply(d_src1, d_src2, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::multiply(src1, src2, dst);
+
+ TEST_CYCLE()
+ {
+ cv::multiply(src1, src2, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Multiply_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
-// Multiply_Scalar
+// MultiplyScalar
-GPU_PERF_TEST(Multiply_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_MultiplyScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
cv::Scalar s(1, 2, 3, 4);
- cv::gpu::GpuMat dst;
- cv::gpu::multiply(src, s, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::multiply(src, s, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::multiply(d_src, s, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::multiply(d_src, s, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::multiply(src, s, dst);
+
+ TEST_CYCLE()
+ {
+ cv::multiply(src, s, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Multiply_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
-// Divide_Mat
+// DivideMat
-GPU_PERF_TEST(Divide_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_DivideMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src1(size, depth);
+ fillRandom(src1);
- cv::Mat src1_host(size, depth);
- fill(src1_host, 0.0, 100.0);
+ cv::Mat src2(size, depth);
+ fillRandom(src2);
- cv::Mat src2_host(size, depth);
- fill(src2_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::divide(src1, src2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::divide(src1, src2, dst);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::divide(d_src1, d_src2, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::divide(d_src1, d_src2, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::divide(src1, src2, dst);
+
+ TEST_CYCLE()
+ {
+ cv::divide(src1, src2, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Divide_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
-// Divide_Scalar
+// DivideScalar
-GPU_PERF_TEST(Divide_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_DivideScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
cv::Scalar s(1, 2, 3, 4);
- cv::gpu::GpuMat dst;
- cv::gpu::divide(src, s, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::divide(src, s, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::divide(d_src, s, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::divide(d_src, s, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::divide(src, s, dst);
+
+ TEST_CYCLE()
+ {
+ cv::divide(src, s, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Divide_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
-// Divide_Scalar_Inv
+// DivideScalarInv
-GPU_PERF_TEST(Divide_Scalar_Inv, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_DivideScalarInv, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 100.0);
+ double s = 100.0;
- cv::gpu::GpuMat src(src_host);
- double scale = 100.0;
- cv::gpu::GpuMat dst;
-
- cv::gpu::divide(scale, src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::divide(scale, src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::divide(s, d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::divide(s, d_src, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::divide(s, src, dst);
+
+ TEST_CYCLE()
+ {
+ cv::divide(s, src, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Divide_Scalar_Inv, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
-// AbsDiff_Mat
+// AbsDiffMat
-GPU_PERF_TEST(AbsDiff_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_AbsDiffMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src1(size, depth);
+ fillRandom(src1);
- cv::Mat src1_host(size, depth);
- fill(src1_host, 0.0, 100.0);
+ cv::Mat src2(size, depth);
+ fillRandom(src2);
- cv::Mat src2_host(size, depth);
- fill(src2_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::absdiff(src1, src2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::absdiff(src1, src2, dst);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::absdiff(d_src1, d_src2, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::absdiff(d_src1, d_src2, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::absdiff(src1, src2, dst);
+
+ TEST_CYCLE()
+ {
+ cv::absdiff(src1, src2, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, AbsDiff_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
-// AbsDiff_Scalar
+// AbsDiffScalar
-GPU_PERF_TEST(AbsDiff_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_AbsDiffScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
cv::Scalar s(1, 2, 3, 4);
- cv::gpu::GpuMat dst;
- cv::gpu::absdiff(src, s, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::absdiff(src, s, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::absdiff(d_src, s, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::absdiff(d_src, s, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::absdiff(src, s, dst);
+
+ TEST_CYCLE()
+ {
+ cv::absdiff(src, s, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, AbsDiff_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
// Abs
-GPU_PERF_TEST(Abs, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_Abs, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_16S, CV_32F)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::abs(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::abs(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::abs(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::abs(d_src, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Core, Abs, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_16S, CV_32F)));
-
//////////////////////////////////////////////////////////////////////
// Sqr
-GPU_PERF_TEST(Sqr, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_Sqr, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::sqr(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::sqr(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::sqr(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::sqr(d_src, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Core, Sqr, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16S, CV_32F)));
-
//////////////////////////////////////////////////////////////////////
// Sqrt
-GPU_PERF_TEST(Sqrt, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_Sqrt, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::sqrt(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::sqrt(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::sqrt(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::sqrt(d_src, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::sqrt(src, dst);
+
+ TEST_CYCLE()
+ {
+ cv::sqrt(src, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Sqrt, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16S, CV_32F)));
-
//////////////////////////////////////////////////////////////////////
// Log
-GPU_PERF_TEST(Log, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_Log, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src, 1.0, 255.0);
- cv::Mat src_host(size, depth);
- fill(src_host, 1.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::log(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::log(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::log(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::log(d_src, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::log(src, dst);
+
+ TEST_CYCLE()
+ {
+ cv::log(src, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Log, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16S, CV_32F)));
-
//////////////////////////////////////////////////////////////////////
// Exp
-GPU_PERF_TEST(Exp, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_Exp, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src, 1.0, 10.0);
- cv::Mat src_host(size, depth);
- fill(src_host, 1.0, 10.0);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::exp(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::exp(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::exp(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::exp(d_src, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::exp(src, dst);
+
+ TEST_CYCLE()
+ {
+ cv::exp(src, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Exp, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16S, CV_32F)));
-
//////////////////////////////////////////////////////////////////////
// Pow
-GPU_PERF_TEST(Pow, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+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)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
+ const double power = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src, 1.0, 10.0);
- cv::Mat src_host(size, depth);
- fill(src_host, 1.0, 10.0);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::pow(src, 2.3, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::pow(src, 2.3, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::pow(d_src, power, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::pow(d_src, power, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::pow(src, power, dst);
+
+ TEST_CYCLE()
+ {
+ cv::pow(src, power, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Pow, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16S, CV_32F)));
-
//////////////////////////////////////////////////////////////////////
-// Compare_Mat
+// CompareMat
CV_ENUM(CmpCode, cv::CMP_EQ, cv::CMP_GT, cv::CMP_GE, cv::CMP_LT, cv::CMP_LE, cv::CMP_NE)
-#define ALL_CMP_CODES testing::Values(CmpCode(cv::CMP_EQ), CmpCode(cv::CMP_NE), CmpCode(cv::CMP_GT), CmpCode(cv::CMP_GE), CmpCode(cv::CMP_LT), CmpCode(cv::CMP_LE))
+#define ALL_CMP_CODES ValuesIn(CmpCode::all())
-GPU_PERF_TEST(Compare_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth, CmpCode)
+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))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
+ const int cmp_code = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int cmp_code = GET_PARAM(3);
+ cv::Mat src1(size, depth);
+ fillRandom(src1);
- cv::Mat src1_host(size, depth);
- fill(src1_host, 0, 100.0);
+ cv::Mat src2(size, depth);
+ fillRandom(src2);
- cv::Mat src2_host(size, depth);
- fill(src2_host, 0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::compare(src1, src2, dst, cmp_code);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::compare(src1, src2, dst, cmp_code);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::compare(d_src1, d_src2, d_dst, cmp_code);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::compare(d_src1, d_src2, d_dst, cmp_code);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::compare(src1, src2, dst, cmp_code);
+
+ TEST_CYCLE()
+ {
+ cv::compare(src1, src2, dst, cmp_code);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Compare_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F),
- ALL_CMP_CODES));
-
//////////////////////////////////////////////////////////////////////
-// Compare_Scalar
+// CompareScalar
-GPU_PERF_TEST(Compare_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, CmpCode)
+PERF_TEST_P(Sz_Depth_Code, Core_CompareScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, ALL_CMP_CODES))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
+ const int cmp_code = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int cmp_code = GET_PARAM(3);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0, 100.0);
+ cv::Scalar s = cv::Scalar::all(100);
- cv::gpu::GpuMat src(src_host);
- cv::Scalar s = cv::Scalar::all(50);
- cv::gpu::GpuMat dst;
-
- cv::gpu::compare(src, s, dst, cmp_code);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::compare(src, s, dst, cmp_code);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::compare(d_src, s, d_dst, cmp_code);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::compare(d_src, s, d_dst, cmp_code);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::compare(src, s, dst, cmp_code);
+
+ TEST_CYCLE()
+ {
+ cv::compare(src, s, dst, cmp_code);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Compare_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F),
- ALL_CMP_CODES));
-
//////////////////////////////////////////////////////////////////////
-// Bitwise_Not
+// BitwiseNot
-GPU_PERF_TEST(Bitwise_Not, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_BitwiseNot, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::bitwise_not(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::bitwise_not(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::bitwise_not(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::bitwise_not(d_src, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::bitwise_not(src, dst);
+
+ TEST_CYCLE()
+ {
+ cv::bitwise_not(src, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Not, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S)));
-
//////////////////////////////////////////////////////////////////////
-// Bitwise_And_Mat
+// BitwiseAndMat
-GPU_PERF_TEST(Bitwise_And_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_BitwiseAndMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src1(size, depth);
+ fillRandom(src1);
- cv::Mat src1_host(size, depth);
- fill(src1_host, 0, 100.0);
+ cv::Mat src2(size, depth);
+ fillRandom(src2);
- cv::Mat src2_host(size, depth);
- fill(src2_host, 0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::bitwise_and(src1, src2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::bitwise_and(src1, src2, dst);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::bitwise_and(d_src1, d_src2, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::bitwise_and(d_src1, d_src2, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::bitwise_and(src1, src2, dst);
+
+ TEST_CYCLE()
+ {
+ cv::bitwise_and(src1, src2, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_And_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S)));
-
//////////////////////////////////////////////////////////////////////
-// Bitwise_And_Scalar
+// BitwiseAndScalar
-GPU_PERF_TEST(Bitwise_And_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)
+PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseAndScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
+ const int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
+ const int type = CV_MAKE_TYPE(depth, channels);
- int type = CV_MAKE_TYPE(depth, channels);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 100.0);
+ cv::Scalar s = cv::Scalar::all(100);
- cv::gpu::GpuMat src(src_host);
- cv::Scalar s = cv::Scalar(50, 50, 50, 50);
- cv::gpu::GpuMat dst;
-
- cv::gpu::bitwise_and(src, s, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::bitwise_and(src, s, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::bitwise_and(d_src, s, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::bitwise_and(d_src, s, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::bitwise_and(src, s, dst);
+
+ TEST_CYCLE()
+ {
+ cv::bitwise_and(src, s, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_And_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S),
- testing::Values(1, 3, 4)));
-
//////////////////////////////////////////////////////////////////////
-// Bitwise_Or_Mat
+// BitwiseOrMat
-GPU_PERF_TEST(Bitwise_Or_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_BitwiseOrMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src1(size, depth);
+ fillRandom(src1);
- cv::Mat src1_host(size, depth);
- fill(src1_host, 0, 100.0);
+ cv::Mat src2(size, depth);
+ fillRandom(src2);
- cv::Mat src2_host(size, depth);
- fill(src2_host, 0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::bitwise_or(src1, src2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::bitwise_or(src1, src2, dst);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::bitwise_or(d_src1, d_src2, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::bitwise_or(d_src1, d_src2, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::bitwise_or(src1, src2, dst);
+
+ TEST_CYCLE()
+ {
+ cv::bitwise_or(src1, src2, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Or_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S)));
-
//////////////////////////////////////////////////////////////////////
-// Bitwise_Or_Scalar
+// BitwiseOrScalar
-GPU_PERF_TEST(Bitwise_Or_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)
+PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseOrScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
+ const int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
+ const int type = CV_MAKE_TYPE(depth, channels);
- int type = CV_MAKE_TYPE(depth, channels);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 100.0);
+ cv::Scalar s = cv::Scalar::all(100);
- cv::gpu::GpuMat src(src_host);
- cv::Scalar s = cv::Scalar(50, 50, 50, 50);
- cv::gpu::GpuMat dst;
-
- cv::gpu::bitwise_or(src, s, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::bitwise_or(src, s, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::bitwise_or(d_src, s, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::bitwise_or(d_src, s, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::bitwise_or(src, s, dst);
+
+ TEST_CYCLE()
+ {
+ cv::bitwise_or(src, s, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Or_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S),
- testing::Values(1, 3, 4)));
-
//////////////////////////////////////////////////////////////////////
-// Bitwise_Xor_Mat
+// BitwiseXorMat
-GPU_PERF_TEST(Bitwise_Xor_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_BitwiseXorMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src1(size, depth);
+ fillRandom(src1);
- cv::Mat src1_host(size, depth);
- fill(src1_host, 0, 100.0);
+ cv::Mat src2(size, depth);
+ fillRandom(src2);
- cv::Mat src2_host(size, depth);
- fill(src2_host, 0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::bitwise_xor(src1, src2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::bitwise_xor(src1, src2, dst);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::bitwise_xor(d_src1, d_src2, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::bitwise_xor(d_src1, d_src2, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::bitwise_xor(src1, src2, dst);
+
+ TEST_CYCLE()
+ {
+ cv::bitwise_xor(src1, src2, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Xor_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S)));
-
//////////////////////////////////////////////////////////////////////
-// Bitwise_Xor_Scalar
+// BitwiseXorScalar
-GPU_PERF_TEST(Bitwise_Xor_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)
+PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseXorScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
+ const int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
+ const int type = CV_MAKE_TYPE(depth, channels);
- int type = CV_MAKE_TYPE(depth, channels);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 100.0);
+ cv::Scalar s = cv::Scalar::all(100);
- cv::gpu::GpuMat src(src_host);
- cv::Scalar s = cv::Scalar(50, 50, 50, 50);
- cv::gpu::GpuMat dst;
-
- cv::gpu::bitwise_xor(src, s, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::bitwise_xor(src, s, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::bitwise_xor(d_src, s, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::bitwise_xor(d_src, s, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::bitwise_xor(src, s, dst);
+
+ TEST_CYCLE()
+ {
+ cv::bitwise_xor(src, s, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Xor_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S),
- testing::Values(1, 3, 4)));
-
//////////////////////////////////////////////////////////////////////
// RShift
-GPU_PERF_TEST(RShift, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)
+PERF_TEST_P(Sz_Depth_Cn, Core_RShift, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
+ const int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
+ const int type = CV_MAKE_TYPE(depth, channels);
- int type = CV_MAKE_TYPE(depth, channels);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255.0);
+ const cv::Scalar_ val = cv::Scalar_::all(4);
- cv::gpu::GpuMat src(src_host);
- cv::Scalar_ val = cv::Scalar_::all(4);
- cv::gpu::GpuMat dst;
-
- cv::gpu::rshift(src, val, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::rshift(src, val, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::rshift(d_src, val, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::rshift(d_src, val, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Core, RShift, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S),
- testing::Values(1, 3, 4)));
-
//////////////////////////////////////////////////////////////////////
// LShift
-GPU_PERF_TEST(LShift, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)
+PERF_TEST_P(Sz_Depth_Cn, Core_LShift, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
+ const int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
+ const int type = CV_MAKE_TYPE(depth, channels);
- int type = CV_MAKE_TYPE(depth, channels);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255.0);
+ const cv::Scalar_ val = cv::Scalar_::all(4);
- cv::gpu::GpuMat src(src_host);
- cv::Scalar_ val = cv::Scalar_::all(4);
- cv::gpu::GpuMat dst;
-
- cv::gpu::lshift(src, val, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::lshift(src, val, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::lshift(d_src, val, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::lshift(d_src, val, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Core, LShift, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S),
- testing::Values(1, 3, 4)));
-
//////////////////////////////////////////////////////////////////////
-// Min_Mat
+// MinMat
-GPU_PERF_TEST(Min_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_MinMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src1(size, depth);
+ fillRandom(src1);
- cv::Mat src1_host(size, depth);
- fill(src1_host, 0, 255.0);
+ cv::Mat src2(size, depth);
+ fillRandom(src2);
- cv::Mat src2_host(size, depth);
- fill(src2_host, 0, 255.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::min(src1, src2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::min(src1, src2, dst);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::min(d_src1, d_src2, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::min(d_src1, d_src2, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::min(src1, src2, dst);
+
+ TEST_CYCLE()
+ {
+ cv::min(src1, src2, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Min_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F)));
-
//////////////////////////////////////////////////////////////////////
-// Min_Scalar
+// MinScalar
-GPU_PERF_TEST(Min_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_MinScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0, 255.0);
+ const double val = 50.0;
- cv::gpu::GpuMat src(src_host);
- double val = 50.0;
- cv::gpu::GpuMat dst;
-
- cv::gpu::min(src, val, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::min(src, val, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::min(d_src, val, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::min(d_src, val, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::min(src, val, dst);
+
+ TEST_CYCLE()
+ {
+ cv::min(src, val, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Min_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F)));
-
//////////////////////////////////////////////////////////////////////
-// Max_Mat
+// MaxMat
-GPU_PERF_TEST(Max_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_MaxMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src1(size, depth);
+ fillRandom(src1);
- cv::Mat src1_host(size, depth);
- fill(src1_host, 0, 255.0);
+ cv::Mat src2(size, depth);
+ fillRandom(src2);
- cv::Mat src2_host(size, depth);
- fill(src2_host, 0, 255.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::max(src1, src2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::max(src1, src2, dst);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::max(d_src1, d_src2, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::max(d_src1, d_src2, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::max(src1, src2, dst);
+
+ TEST_CYCLE()
+ {
+ cv::max(src1, src2, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Max_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F)));
-
//////////////////////////////////////////////////////////////////////
-// Max_Scalar
+// MaxScalar
-GPU_PERF_TEST(Max_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_MaxScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0, 255.0);
+ const double val = 50.0;
- cv::gpu::GpuMat src(src_host);
- double val = 50.0;
- cv::gpu::GpuMat dst;
-
- cv::gpu::max(src, val, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::max(src, val, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::max(d_src, val, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::max(d_src, val, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::max(src, val, dst);
+
+ TEST_CYCLE()
+ {
+ cv::max(src, val, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Max_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F)));
-
//////////////////////////////////////////////////////////////////////
// AddWeighted
-GPU_PERF_TEST(AddWeighted, cv::gpu::DeviceInfo, cv::Size, MatDepth, MatDepth, MatDepth)
+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)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ const cv::Size size = GET_PARAM(0);
+ const int depth1 = GET_PARAM(1);
+ const int depth2 = GET_PARAM(2);
+ const int dst_depth = GET_PARAM(3);
- cv::Size size = GET_PARAM(1);
- int depth1 = GET_PARAM(2);
- int depth2 = GET_PARAM(3);
- int dst_depth = GET_PARAM(4);
+ cv::Mat src1(size, depth1);
+ fillRandom(src1);
- cv::Mat src1_host(size, depth1);
- fill(src1_host, 0, 100.0);
+ cv::Mat src2(size, depth2);
+ fillRandom(src2);
- cv::Mat src2_host(size, depth2);
- fill(src2_host, 0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::addWeighted(src1, 0.5, src2, 0.5, 10.0, dst, dst_depth);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::addWeighted(src1, 0.5, src2, 0.5, 10.0, dst, dst_depth);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ 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, d_dst, dst_depth);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::addWeighted(src1, 0.5, src2, 0.5, 10.0, dst, dst_depth);
+
+ TEST_CYCLE()
+ {
+ cv::addWeighted(src1, 0.5, src2, 0.5, 10.0, dst, dst_depth);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, AddWeighted, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F),
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F),
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
// GEMM
-#ifdef HAVE_CUBLAS
CV_FLAGS(GemmFlags, 0, cv::GEMM_1_T, cv::GEMM_2_T, cv::GEMM_3_T)
-#define ALL_GEMM_FLAGS testing::Values(GemmFlags(0), GemmFlags(cv::GEMM_1_T), GemmFlags(cv::GEMM_2_T), GemmFlags(cv::GEMM_3_T), GemmFlags(cv::GEMM_1_T | cv::GEMM_2_T), GemmFlags(cv::GEMM_1_T | cv::GEMM_3_T), GemmFlags(cv::GEMM_1_T | cv::GEMM_2_T | cv::GEMM_3_T))
+#define ALL_GEMM_FLAGS Values(0, CV_GEMM_A_T, CV_GEMM_B_T, CV_GEMM_C_T, CV_GEMM_A_T | CV_GEMM_B_T, CV_GEMM_A_T | CV_GEMM_C_T, CV_GEMM_A_T | CV_GEMM_B_T | CV_GEMM_C_T)
-GPU_PERF_TEST(GEMM, cv::gpu::DeviceInfo, cv::Size, MatType, GemmFlags)
+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))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
- int flags = GET_PARAM(3);
-
- cv::Mat src1_host(size, type);
- fill(src1_host, 0.0, 10.0);
-
- cv::Mat src2_host(size, type);
- fill(src2_host, 0.0, 10.0);
-
- cv::Mat src3_host(size, type);
- fill(src3_host, 0.0, 10.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat src3(src3_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::gemm(src1, src2, 1.0, src3, 1.0, dst, flags);
-
declare.time(5.0);
- TEST_CYCLE()
+ 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);
+
+ cv::Mat src2(size, type);
+ fillRandom(src2);
+
+ cv::Mat src3(size, type);
+ fillRandom(src3);
+
+ if (runOnGpu)
{
- cv::gpu::gemm(src1, src2, 1.0, src3, 1.0, dst, flags);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_src3(src3);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst, flags);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst, flags);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::gemm(src1, src2, 1.0, src3, 1.0, dst, flags);
+
+ declare.time(50.0);
+
+ TEST_CYCLE()
+ {
+ cv::gemm(src1, src2, 1.0, src3, 1.0, dst, flags);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, GEMM, testing::Combine(
- ALL_DEVICES,
- testing::Values(cv::Size(512, 512), cv::Size(1024, 1024)),
- testing::Values(CV_32FC1, CV_32FC2, CV_64FC1, CV_64FC2),
- ALL_GEMM_FLAGS));
-
-#endif
//////////////////////////////////////////////////////////////////////
// Transpose
-GPU_PERF_TEST(Transpose, cv::gpu::DeviceInfo, cv::Size, MatType)
+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::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::transpose(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::transpose(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::transpose(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::transpose(d_src, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::transpose(src, dst);
+
+ TEST_CYCLE()
+ {
+ cv::transpose(src, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Transpose, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8UC1, CV_8UC4, CV_16UC2, CV_16SC2, CV_32SC1, CV_32SC2, CV_64FC1)));
-
//////////////////////////////////////////////////////////////////////
// Flip
enum {FLIP_BOTH = 0, FLIP_X = 1, FLIP_Y = -1};
CV_ENUM(FlipCode, FLIP_BOTH, FLIP_X, FLIP_Y)
-#define ALL_FLIP_CODES testing::Values(FlipCode(FLIP_BOTH), FlipCode(FLIP_X), FlipCode(FLIP_Y))
+#define ALL_FLIP_CODES ValuesIn(FlipCode::all())
-GPU_PERF_TEST(Flip, cv::gpu::DeviceInfo, cv::Size, MatType, FlipCode)
+DEF_PARAM_TEST(Sz_Depth_Cn_Code, cv::Size, MatDepth, int, FlipCode);
+
+PERF_TEST_P(Sz_Depth_Cn_Code, Core_Flip, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F),
+ Values(1, 3, 4),
+ ALL_FLIP_CODES))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
int flipCode = GET_PARAM(3);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 100.0);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::flip(src, dst, flipCode);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::flip(src, dst, flipCode);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::flip(d_src, d_dst, flipCode);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::flip(d_src, d_dst, flipCode);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::flip(src, dst, flipCode);
+
+ TEST_CYCLE()
+ {
+ cv::flip(src, dst, flipCode);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Flip, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4),
- ALL_FLIP_CODES));
-
//////////////////////////////////////////////////////////////////////
-// LUT_OneChannel
+// LutOneChannel
-GPU_PERF_TEST(LUT_OneChannel, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Type, Core_LutOneChannel, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8UC1, CV_8UC3)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
-
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 100.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
cv::Mat lut(1, 256, CV_8UC1);
- fill(lut, 0.0, 100.0);
+ fillRandom(lut);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::LUT(src, lut, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::LUT(src, lut, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::LUT(d_src, lut, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::LUT(d_src, lut, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::LUT(src, lut, dst);
+
+ TEST_CYCLE()
+ {
+ cv::LUT(src, lut, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, LUT_OneChannel, testing::Combine(
- ALL_DEVICES,
+//////////////////////////////////////////////////////////////////////
+// LutMultiChannel
+
+PERF_TEST_P(Sz_Type, Core_LutMultiChannel, Combine(
GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8UC1, CV_8UC3)));
-
-//////////////////////////////////////////////////////////////////////
-// LUT_MultiChannel
-
-GPU_PERF_TEST(LUT_MultiChannel, cv::gpu::DeviceInfo, cv::Size, MatType)
+ Values(CV_8UC3)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 100.0);
+ cv::Mat lut(1, 256, CV_MAKE_TYPE(CV_8U, src.channels()));
+ fillRandom(lut);
- cv::Mat lut(1, 256, CV_MAKE_TYPE(CV_8U, src_host.channels()));
- fill(lut, 0.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::LUT(src, lut, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::LUT(src, lut, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::LUT(d_src, lut, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::LUT(d_src, lut, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::LUT(src, lut, dst);
+
+ TEST_CYCLE()
+ {
+ cv::LUT(src, lut, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, LUT_MultiChannel, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8UC3)));
-
//////////////////////////////////////////////////////////////////////
-// Magnitude_Complex
+// MagnitudeComplex
-GPU_PERF_TEST(Magnitude_Complex, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, Core_MagnitudeComplex, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GetParam();
- cv::Size size = GET_PARAM(1);
+ cv::Mat src(size, CV_32FC2);
+ fillRandom(src, -100.0, 100.0);
- cv::Mat src_host(size, CV_32FC2);
- fill(src_host, -100.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::magnitude(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::magnitude(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::magnitude(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::magnitude(d_src, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat xy[2];
+ cv::split(src, xy);
+
+ cv::Mat dst;
+
+ cv::magnitude(xy[0], xy[1], dst);
+
+ TEST_CYCLE()
+ {
+ cv::magnitude(xy[0], xy[1], dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Magnitude_Complex, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
-// Magnitude_Sqr_Complex
+// MagnitudeSqrComplex
-GPU_PERF_TEST(Magnitude_Sqr_Complex, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, Core_MagnitudeSqrComplex, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GetParam();
- cv::Size size = GET_PARAM(1);
+ cv::Mat src(size, CV_32FC2);
+ fillRandom(src, -100.0, 100.0);
- cv::Mat src_host(size, CV_32FC2);
- fill(src_host, -100.0, 100.0);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::magnitudeSqr(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::magnitudeSqr(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::magnitudeSqr(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::magnitudeSqr(d_src, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Core, Magnitude_Sqr_Complex, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
// Magnitude
-GPU_PERF_TEST(Magnitude, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, Core_Magnitude, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GetParam();
- cv::Size size = GET_PARAM(1);
+ cv::Mat src1(size, CV_32FC1);
+ fillRandom(src1, -100.0, 100.0);
- cv::Mat src1_host(size, CV_32FC1);
- fill(src1_host, -100.0, 100.0);
+ cv::Mat src2(size, CV_32FC1);
+ fillRandom(src2, -100.0, 100.0);
- cv::Mat src2_host(size, CV_32FC1);
- fill(src2_host, -100.0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::magnitude(src1, src2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::magnitude(src1, src2, dst);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::magnitude(d_src1, d_src2, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::magnitude(d_src1, d_src2, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::magnitude(src1, src2, dst);
+
+ TEST_CYCLE()
+ {
+ cv::magnitude(src1, src2, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Magnitude, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
-// Magnitude_Sqr
+// MagnitudeSqr
-GPU_PERF_TEST(Magnitude_Sqr, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, Core_MagnitudeSqr, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GetParam();
- cv::Size size = GET_PARAM(1);
+ cv::Mat src1(size, CV_32FC1);
+ fillRandom(src1, -100.0, 100.0);
- cv::Mat src1_host(size, CV_32FC1);
- fill(src1_host, -100.0, 100.0);
+ cv::Mat src2(size, CV_32FC1);
+ fillRandom(src2, -100.0, 100.0);
- cv::Mat src2_host(size, CV_32FC1);
- fill(src2_host, -100.0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::magnitudeSqr(src1, src2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::magnitudeSqr(src1, src2, dst);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::magnitudeSqr(d_src1, d_src2, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::magnitudeSqr(d_src1, d_src2, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Core, Magnitude_Sqr, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
// Phase
-IMPLEMENT_PARAM_CLASS(AngleInDegrees, bool)
+DEF_PARAM_TEST(Sz_AngleInDegrees, cv::Size, bool);
-GPU_PERF_TEST(Phase, cv::gpu::DeviceInfo, cv::Size, AngleInDegrees)
+PERF_TEST_P(Sz_AngleInDegrees, Core_Phase, Combine(GPU_TYPICAL_MAT_SIZES, Bool()))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ bool angleInDegrees = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- bool angleInDegrees = GET_PARAM(2);
+ cv::Mat src1(size, CV_32FC1);
+ fillRandom(src1, -100.0, 100.0);
- cv::Mat src1_host(size, CV_32FC1);
- fill(src1_host, -100.0, 100.0);
+ cv::Mat src2(size, CV_32FC1);
+ fillRandom(src2, -100.0, 100.0);
- cv::Mat src2_host(size, CV_32FC1);
- fill(src2_host, -100.0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::phase(src1, src2, dst, angleInDegrees);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::phase(src1, src2, dst, angleInDegrees);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::phase(d_src1, d_src2, d_dst, angleInDegrees);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::phase(d_src1, d_src2, d_dst, angleInDegrees);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::phase(src1, src2, dst, angleInDegrees);
+
+ TEST_CYCLE()
+ {
+ cv::phase(src1, src2, dst, angleInDegrees);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Phase, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(false, true)));
-
//////////////////////////////////////////////////////////////////////
// CartToPolar
-GPU_PERF_TEST(CartToPolar, cv::gpu::DeviceInfo, cv::Size, AngleInDegrees)
+PERF_TEST_P(Sz_AngleInDegrees, Core_CartToPolar, Combine(GPU_TYPICAL_MAT_SIZES, Bool()))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ bool angleInDegrees = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- bool angleInDegrees = GET_PARAM(2);
+ cv::Mat src1(size, CV_32FC1);
+ fillRandom(src1, -100.0, 100.0);
- cv::Mat src1_host(size, CV_32FC1);
- fill(src1_host, -100.0, 100.0);
+ cv::Mat src2(size, CV_32FC1);
+ fillRandom(src2, -100.0, 100.0);
- cv::Mat src2_host(size, CV_32FC1);
- fill(src2_host, -100.0, 100.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat magnitude;
- cv::gpu::GpuMat angle;
-
- cv::gpu::cartToPolar(src1, src2, magnitude, angle, angleInDegrees);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::cartToPolar(src1, src2, magnitude, angle, angleInDegrees);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_magnitude;
+ cv::gpu::GpuMat d_angle;
+
+ cv::gpu::cartToPolar(d_src1, d_src2, d_magnitude, d_angle, angleInDegrees);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::cartToPolar(d_src1, d_src2, d_magnitude, d_angle, angleInDegrees);
+ }
+ }
+ else
+ {
+ cv::Mat magnitude;
+ cv::Mat angle;
+
+ cv::cartToPolar(src1, src2, magnitude, angle, angleInDegrees);
+
+ TEST_CYCLE()
+ {
+ cv::cartToPolar(src1, src2, magnitude, angle, angleInDegrees);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, CartToPolar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(false, true)));
-
//////////////////////////////////////////////////////////////////////
// PolarToCart
-GPU_PERF_TEST(PolarToCart, cv::gpu::DeviceInfo, cv::Size, AngleInDegrees)
+PERF_TEST_P(Sz_AngleInDegrees, Core_PolarToCart, Combine(GPU_TYPICAL_MAT_SIZES, Bool()))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ bool angleInDegrees = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- bool angleInDegrees = GET_PARAM(2);
+ cv::Mat magnitude(size, CV_32FC1);
+ fillRandom(magnitude, 0.0, 100.0);
- cv::Mat magnitude_host(size, CV_32FC1);
- fill(magnitude_host, 0.0, 100.0);
+ cv::Mat angle(size, CV_32FC1);
+ fillRandom(angle, 0.0, angleInDegrees ? 360.0 : 2 * CV_PI);
- cv::Mat angle_host(size, CV_32FC1);
- fill(angle_host, 0.0, angleInDegrees ? 360.0 : 2 * CV_PI);
-
- cv::gpu::GpuMat magnitude(magnitude_host);
- cv::gpu::GpuMat angle(angle_host);
- cv::gpu::GpuMat x;
- cv::gpu::GpuMat y;
-
- cv::gpu::polarToCart(magnitude, angle, x, y, angleInDegrees);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::polarToCart(magnitude, angle, x, y, angleInDegrees);
+ cv::gpu::GpuMat d_magnitude(magnitude);
+ cv::gpu::GpuMat d_angle(angle);
+ cv::gpu::GpuMat d_x;
+ cv::gpu::GpuMat d_y;
+
+ cv::gpu::polarToCart(d_magnitude, d_angle, d_x, d_y, angleInDegrees);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::polarToCart(d_magnitude, d_angle, d_x, d_y, angleInDegrees);
+ }
+ }
+ else
+ {
+ cv::Mat x;
+ cv::Mat y;
+
+ cv::polarToCart(magnitude, angle, x, y, angleInDegrees);
+
+ TEST_CYCLE()
+ {
+ cv::polarToCart(magnitude, angle, x, y, angleInDegrees);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, PolarToCart, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(false, true)));
-
//////////////////////////////////////////////////////////////////////
// MeanStdDev
-GPU_PERF_TEST(MeanStdDev, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, Core_MeanStdDev, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GetParam();
- cv::Size size = GET_PARAM(1);
+ cv::Mat src(size, CV_8UC1);
+ fillRandom(src);
- cv::Mat src_host(size, CV_8UC1);
- fill(src_host, 0.0, 255.0);
-
- cv::gpu::GpuMat src(src_host);
cv::Scalar mean;
cv::Scalar stddev;
- cv::gpu::GpuMat buf;
- cv::gpu::meanStdDev(src, mean, stddev, buf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::meanStdDev(src, mean, stddev, buf);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_buf;
+
+ cv::gpu::meanStdDev(d_src, mean, stddev, d_buf);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::meanStdDev(d_src, mean, stddev, d_buf);
+ }
+ }
+ else
+ {
+ cv::meanStdDev(src, mean, stddev);
+
+ TEST_CYCLE()
+ {
+ cv::meanStdDev(src, mean, stddev);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, MeanStdDev, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
// Norm
-GPU_PERF_TEST(Norm, cv::gpu::DeviceInfo, cv::Size, MatDepth, NormType)
-{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+DEF_PARAM_TEST(Sz_Depth_Norm, cv::Size, MatDepth, NormType);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int normType = GET_PARAM(3);
-
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 255.0);
-
- cv::gpu::GpuMat src(src_host);
- double dst;
- cv::gpu::GpuMat buf;
-
- dst = cv::gpu::norm(src, normType, buf);
-
- TEST_CYCLE()
- {
- dst = cv::gpu::norm(src, normType, buf);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Norm, testing::Combine(
- ALL_DEVICES,
+PERF_TEST_P(Sz_Depth_Norm, Core_Norm, Combine(
GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S, CV_32F),
- testing::Values(NormType(cv::NORM_INF), NormType(cv::NORM_L1), NormType(cv::NORM_L2))));
+ 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);
+
+ cv::Mat src(size, depth);
+ fillRandom(src);
+
+ double dst;
+
+ if (runOnGpu)
+ {
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_buf;
+
+ dst = cv::gpu::norm(d_src, normType, d_buf);
+
+ TEST_CYCLE()
+ {
+ dst = cv::gpu::norm(d_src, normType, d_buf);
+ }
+ }
+ else
+ {
+ dst = cv::norm(src, normType);
+
+ TEST_CYCLE()
+ {
+ dst = cv::norm(src, normType);
+ }
+ }
+ (void)dst;
+}
//////////////////////////////////////////////////////////////////////
// NormDiff
-GPU_PERF_TEST(NormDiff, cv::gpu::DeviceInfo, cv::Size, NormType)
+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))))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int normType = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int normType = GET_PARAM(2);
+ cv::Mat src1(size, CV_8UC1);
+ fillRandom(src1);
- cv::Mat src1_host(size, CV_8UC1);
- fill(src1_host, 0.0, 255.0);
+ cv::Mat src2(size, CV_8UC1);
+ fillRandom(src2);
- cv::Mat src2_host(size, CV_8UC1);
- fill(src2_host, 0.0, 255.0);
-
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
double dst;
- dst = cv::gpu::norm(src1, src2, normType);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- dst = cv::gpu::norm(src1, src2, normType);
- }
-}
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
-INSTANTIATE_TEST_CASE_P(Core, NormDiff, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(NormType(cv::NORM_INF), NormType(cv::NORM_L1), NormType(cv::NORM_L2))));
+ dst = cv::gpu::norm(d_src1, d_src2, normType);
+
+ TEST_CYCLE()
+ {
+ dst = cv::gpu::norm(d_src1, d_src2, normType);
+ }
+ }
+ else
+ {
+ dst = cv::norm(src1, src2, normType);
+
+ TEST_CYCLE()
+ {
+ dst = cv::norm(src1, src2, normType);
+ }
+ }
+ (void)dst;
+}
//////////////////////////////////////////////////////////////////////
// Sum
-GPU_PERF_TEST(Sum, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Depth_Cn, Core_Sum, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F),
+ Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 255.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
cv::Scalar dst;
- cv::gpu::GpuMat buf;
- dst = cv::gpu::sum(src, buf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- dst = cv::gpu::sum(src, buf);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_buf;
+
+ dst = cv::gpu::sum(d_src, d_buf);
+
+ TEST_CYCLE()
+ {
+ dst = cv::gpu::sum(d_src, d_buf);
+ }
+ }
+ else
+ {
+ dst = cv::sum(src);
+
+ TEST_CYCLE()
+ {
+ dst = cv::sum(src);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Sum, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4)));
-
//////////////////////////////////////////////////////////////////////
-// Sum_Abs
+// SumAbs
-GPU_PERF_TEST(Sum_Abs, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Depth_Cn, Core_SumAbs, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F),
+ Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 255.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
cv::Scalar dst;
- cv::gpu::GpuMat buf;
- dst = cv::gpu::absSum(src, buf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- dst = cv::gpu::absSum(src, buf);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_buf;
+
+ dst = cv::gpu::absSum(d_src, d_buf);
+
+ TEST_CYCLE()
+ {
+ dst = cv::gpu::absSum(d_src, d_buf);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Core, Sum_Abs, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4)));
-
//////////////////////////////////////////////////////////////////////
-// Sum_Sqr
+// SumSqr
-GPU_PERF_TEST(Sum_Sqr, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Depth_Cn, Core_SumSqr, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F),
+ Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 255.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
cv::Scalar dst;
- cv::gpu::GpuMat buf;
- dst = cv::gpu::sqrSum(src, buf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- dst = cv::gpu::sqrSum(src, buf);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_buf;
+
+ dst = cv::gpu::sqrSum(d_src, d_buf);
+
+ TEST_CYCLE()
+ {
+ dst = cv::gpu::sqrSum(d_src, d_buf);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Core, Sum_Sqr, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4)));
-
//////////////////////////////////////////////////////////////////////
// MinMax
-GPU_PERF_TEST(MinMax, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_MinMax, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F, CV_64F)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 255.0);
-
- cv::gpu::GpuMat src(src_host);
double minVal, maxVal;
- cv::gpu::GpuMat buf;
- cv::gpu::minMax(src, &minVal, &maxVal, cv::gpu::GpuMat(), buf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::minMax(src, &minVal, &maxVal, cv::gpu::GpuMat(), buf);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_buf;
+
+ cv::gpu::minMax(d_src, &minVal, &maxVal, cv::gpu::GpuMat(), d_buf);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::minMax(d_src, &minVal, &maxVal, cv::gpu::GpuMat(), d_buf);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Core, MinMax, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
// MinMaxLoc
-GPU_PERF_TEST(MinMaxLoc, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, Core_MinMaxLoc, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F, CV_64F)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 255.0);
-
- cv::gpu::GpuMat src(src_host);
double minVal, maxVal;
cv::Point minLoc, maxLoc;
- cv::gpu::GpuMat valbuf, locbuf;
- cv::gpu::minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc, cv::gpu::GpuMat(), valbuf, locbuf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc, cv::gpu::GpuMat(), valbuf, locbuf);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_valbuf, d_locbuf;
+
+ cv::gpu::minMaxLoc(d_src, &minVal, &maxVal, &minLoc, &maxLoc, cv::gpu::GpuMat(), d_valbuf, d_locbuf);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::minMaxLoc(d_src, &minVal, &maxVal, &minLoc, &maxLoc, cv::gpu::GpuMat(), d_valbuf, d_locbuf);
+ }
+ }
+ else
+ {
+ cv::minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc);
+
+ TEST_CYCLE()
+ {
+ cv::minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, MinMaxLoc, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
//////////////////////////////////////////////////////////////////////
// CountNonZero
-GPU_PERF_TEST(CountNonZero, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src_host(size, depth);
- fill(src_host, 0.0, 1.5);
-
- cv::gpu::GpuMat src(src_host);
- int dst;
- cv::gpu::GpuMat buf;
-
- dst = cv::gpu::countNonZero(src, buf);
-
- TEST_CYCLE()
- {
- dst = cv::gpu::countNonZero(src, buf);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, CountNonZero, testing::Combine(
- ALL_DEVICES,
+PERF_TEST_P(Sz_Depth, Core_CountNonZero, Combine(
GPU_TYPICAL_MAT_SIZES,
- testing::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 depth = GET_PARAM(1);
+
+ cv::Mat src(size, depth);
+ fillRandom(src);
+
+ int dst;
+
+ if (runOnGpu)
+ {
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_buf;
+
+ dst = cv::gpu::countNonZero(d_src, d_buf);
+
+ TEST_CYCLE()
+ {
+ dst = cv::gpu::countNonZero(d_src, d_buf);
+ }
+ }
+ else
+ {
+ dst = cv::countNonZero(src);
+
+ TEST_CYCLE()
+ {
+ dst = cv::countNonZero(src);
+ }
+ }
+ (void)dst;
+}
//////////////////////////////////////////////////////////////////////
// Reduce
CV_ENUM(ReduceCode, CV_REDUCE_SUM, CV_REDUCE_AVG, CV_REDUCE_MAX, CV_REDUCE_MIN)
-#define ALL_REDUCE_CODES testing::Values(CV_REDUCE_SUM, CV_REDUCE_AVG, CV_REDUCE_MAX, CV_REDUCE_MIN)
+#define ALL_REDUCE_CODES ValuesIn(ReduceCode::all())
enum {Rows = 0, Cols = 1};
CV_ENUM(ReduceDim, Rows, Cols)
+#define ALL_REDUCE_DIMS ValuesIn(ReduceDim::all())
-GPU_PERF_TEST(Reduce, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels, ReduceCode, ReduceDim)
+DEF_PARAM_TEST(Sz_Depth_Cn_Code_Dim, cv::Size, MatDepth, int, 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))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
- int reduceOp = GET_PARAM(4);
- int dim = GET_PARAM(5);
+ 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);
int type = CV_MAKE_TYPE(depth, channels);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 10.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::reduce(src, dst, dim, reduceOp);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::reduce(src, dst, dim, reduceOp);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::reduce(d_src, d_dst, dim, reduceOp);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::reduce(d_src, d_dst, dim, reduceOp);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::reduce(src, dst, dim, reduceOp);
+
+ TEST_CYCLE()
+ {
+ cv::reduce(src, dst, dim, reduceOp);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Core, Reduce, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_16S, CV_32F),
- testing::Values(1, 2, 3, 4),
- ALL_REDUCE_CODES,
- testing::Values(ReduceDim(Rows), ReduceDim(Cols))));
-
-#endif
+} // namespace
diff --git a/modules/gpu/perf/perf_features2d.cpp b/modules/gpu/perf/perf_features2d.cpp
index 8a8186017..53b98d462 100644
--- a/modules/gpu/perf/perf_features2d.cpp
+++ b/modules/gpu/perf/perf_features2d.cpp
@@ -1,209 +1,278 @@
#include "perf_precomp.hpp"
-#ifdef HAVE_CUDA
+using namespace std;
+using namespace testing;
+
+namespace {
//////////////////////////////////////////////////////////////////////
// SURF
-GPU_PERF_TEST_1(SURF, cv::gpu::DeviceInfo)
+DEF_PARAM_TEST_1(Image, string);
+
+PERF_TEST_P(Image, Features2D_SURF, Values("gpu/perf/aloe.jpg"))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(50.0);
- cv::Mat img_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_host.empty());
+ cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(img.empty());
- cv::gpu::SURF_GPU surf;
-
- cv::gpu::GpuMat img(img_host);
- cv::gpu::GpuMat keypoints, descriptors;
-
- surf(img, cv::gpu::GpuMat(), keypoints, descriptors);
-
- declare.time(2.0);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- surf(img, cv::gpu::GpuMat(), keypoints, descriptors);
+ cv::gpu::SURF_GPU d_surf;
+
+ 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);
+ }
+ }
+ else
+ {
+ cv::SURF surf;
+
+ std::vector keypoints;
+ cv::Mat descriptors;
+
+ surf(img, cv::noArray(), keypoints, descriptors);
+
+ TEST_CYCLE()
+ {
+ keypoints.clear();
+ surf(img, cv::noArray(), keypoints, descriptors);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Features2D, SURF, ALL_DEVICES);
-
//////////////////////////////////////////////////////////////////////
// FAST
-GPU_PERF_TEST_1(FAST, cv::gpu::DeviceInfo)
+PERF_TEST_P(Image, Features2D_FAST, Values("gpu/perf/aloe.jpg"))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(img.empty());
- cv::Mat img_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_host.empty());
-
- cv::gpu::FAST_GPU fast(20);
-
- cv::gpu::GpuMat img(img_host);
- cv::gpu::GpuMat keypoints;
-
- fast(img, cv::gpu::GpuMat(), keypoints);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- fast(img, cv::gpu::GpuMat(), keypoints);
+ cv::gpu::FAST_GPU d_fast(20);
+
+ 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);
+ }
+ }
+ else
+ {
+ std::vector keypoints;
+
+ cv::FAST(img, keypoints, 20);
+
+ TEST_CYCLE()
+ {
+ keypoints.clear();
+ cv::FAST(img, keypoints, 20);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Features2D, FAST, ALL_DEVICES);
-
//////////////////////////////////////////////////////////////////////
// ORB
-GPU_PERF_TEST_1(ORB, cv::gpu::DeviceInfo)
+PERF_TEST_P(Image, Features2D_ORB, Values("gpu/perf/aloe.jpg"))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(img.empty());
- cv::Mat img_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_host.empty());
-
- cv::gpu::ORB_GPU orb(4000);
-
- cv::gpu::GpuMat img(img_host);
- cv::gpu::GpuMat keypoints, descriptors;
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- orb(img, cv::gpu::GpuMat(), keypoints, descriptors);
+ cv::gpu::ORB_GPU d_orb(4000);
+
+ 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);
+ }
+ }
+ else
+ {
+ cv::ORB orb(4000);
+
+ std::vector keypoints;
+ cv::Mat descriptors;
+
+ orb(img, cv::noArray(), keypoints, descriptors);
+
+ TEST_CYCLE()
+ {
+ keypoints.clear();
+ orb(img, cv::noArray(), keypoints, descriptors);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Features2D, ORB, ALL_DEVICES);
+//////////////////////////////////////////////////////////////////////
+// BFMatch
+
+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))))
+{
+ declare.time(20.0);
+
+ int desc_size = GET_PARAM(0);
+ int normType = GET_PARAM(1);
+
+ int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;
+
+ cv::Mat query(3000, desc_size, type);
+ fillRandom(query);
+
+ cv::Mat train(3000, desc_size, type);
+ fillRandom(train);
+
+ if (runOnGpu)
+ {
+ cv::gpu::BFMatcher_GPU d_matcher(normType);
+
+ cv::gpu::GpuMat d_query(query);
+ 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);
+ }
+ }
+ else
+ {
+ cv::BFMatcher matcher(normType);
+
+ std::vector matches;
+
+ matcher.match(query, train, matches);
+
+ TEST_CYCLE()
+ {
+ matcher.match(query, train, matches);
+ }
+ }
+}
//////////////////////////////////////////////////////////////////////
-// BruteForceMatcher_match
+// BFKnnMatch
-IMPLEMENT_PARAM_CLASS(DescriptorSize, int)
+DEF_PARAM_TEST(DescSize_K_Norm, int, int, NormType);
-GPU_PERF_TEST(BruteForceMatcher_match, cv::gpu::DeviceInfo, DescriptorSize, 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))))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(30.0);
- int desc_size = GET_PARAM(1);
+ int desc_size = GET_PARAM(0);
+ int k = GET_PARAM(1);
int normType = GET_PARAM(2);
int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;
- cv::Mat query_host(3000, desc_size, type);
- fill(query_host, 0.0, 10.0);
+ cv::Mat query(3000, desc_size, type);
+ fillRandom(query);
- cv::Mat train_host(3000, desc_size, type);
- fill(train_host, 0.0, 10.0);
+ cv::Mat train(3000, desc_size, type);
+ fillRandom(train);
- cv::gpu::BFMatcher_GPU matcher(normType);
-
- cv::gpu::GpuMat query(query_host);
- cv::gpu::GpuMat train(train_host);
- cv::gpu::GpuMat trainIdx, distance;
-
- matcher.matchSingle(query, train, trainIdx, distance);
-
- declare.time(3.0);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- matcher.matchSingle(query, train, trainIdx, distance);
+ cv::gpu::BFMatcher_GPU d_matcher(normType);
+
+ cv::gpu::GpuMat d_query(query);
+ 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);
+ }
+ }
+ else
+ {
+ cv::BFMatcher matcher(normType);
+
+ std::vector< std::vector > matches;
+
+ matcher.knnMatch(query, train, matches, k);
+
+ TEST_CYCLE()
+ {
+ matcher.knnMatch(query, train, matches, k);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_match, testing::Combine(
- ALL_DEVICES,
- testing::Values(DescriptorSize(64), DescriptorSize(128), DescriptorSize(256)),
- testing::Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))));
-
//////////////////////////////////////////////////////////////////////
-// BruteForceMatcher_knnMatch
+// BFRadiusMatch
-IMPLEMENT_PARAM_CLASS(K, int)
-
-GPU_PERF_TEST(BruteForceMatcher_knnMatch, cv::gpu::DeviceInfo, DescriptorSize, K, NormType)
+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))))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(30.0);
- int desc_size = GET_PARAM(1);
- int k = GET_PARAM(2);
- int normType = GET_PARAM(3);
+ int desc_size = GET_PARAM(0);
+ int normType = GET_PARAM(1);
int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;
- cv::Mat query_host(3000, desc_size, type);
- fill(query_host, 0.0, 10.0);
+ cv::Mat query(3000, desc_size, type);
+ fillRandom(query, 0.0, 1.0);
- cv::Mat train_host(3000, desc_size, type);
- fill(train_host, 0.0, 10.0);
+ cv::Mat train(3000, desc_size, type);
+ fillRandom(train, 0.0, 1.0);
- cv::gpu::BFMatcher_GPU matcher(normType);
-
- cv::gpu::GpuMat query(query_host);
- cv::gpu::GpuMat train(train_host);
- cv::gpu::GpuMat trainIdx, distance, allDist;
-
- matcher.knnMatchSingle(query, train, trainIdx, distance, allDist, k);
-
- declare.time(3.0);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- matcher.knnMatchSingle(query, train, trainIdx, distance, allDist, k);
+ cv::gpu::BFMatcher_GPU d_matcher(normType);
+
+ cv::gpu::GpuMat d_query(query);
+ 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, 2.0);
+ }
+ }
+ else
+ {
+ cv::BFMatcher matcher(normType);
+
+ std::vector< std::vector > matches;
+
+ matcher.radiusMatch(query, train, matches, 2.0);
+
+ TEST_CYCLE()
+ {
+ matcher.radiusMatch(query, train, matches, 2.0);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_knnMatch, testing::Combine(
- ALL_DEVICES,
- testing::Values(DescriptorSize(64), DescriptorSize(128), DescriptorSize(256)),
- testing::Values(K(2), K(3)),
- testing::Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))));
-
-//////////////////////////////////////////////////////////////////////
-// BruteForceMatcher_radiusMatch
-
-GPU_PERF_TEST(BruteForceMatcher_radiusMatch, cv::gpu::DeviceInfo, DescriptorSize, NormType)
-{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- int desc_size = GET_PARAM(1);
- int normType = GET_PARAM(2);
-
- int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;
-
- cv::Mat query_host(3000, desc_size, type);
- fill(query_host, 0.0, 1.0);
-
- cv::Mat train_host(3000, desc_size, type);
- fill(train_host, 0.0, 1.0);
-
- cv::gpu::BFMatcher_GPU matcher(normType);
-
- cv::gpu::GpuMat query(query_host);
- cv::gpu::GpuMat train(train_host);
- cv::gpu::GpuMat trainIdx, nMatches, distance;
-
- matcher.radiusMatchSingle(query, train, trainIdx, distance, nMatches, 2.0);
-
- declare.time(3.0);
-
- TEST_CYCLE()
- {
- matcher.radiusMatchSingle(query, train, trainIdx, distance, nMatches, 2.0);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_radiusMatch, testing::Combine(
- ALL_DEVICES,
- testing::Values(DescriptorSize(64), DescriptorSize(128), DescriptorSize(256)),
- testing::Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))));
-
-#endif
+} // namespace
diff --git a/modules/gpu/perf/perf_filters.cpp b/modules/gpu/perf/perf_filters.cpp
index 0263e8063..64ab829f8 100644
--- a/modules/gpu/perf/perf_filters.cpp
+++ b/modules/gpu/perf/perf_filters.cpp
@@ -1,308 +1,379 @@
#include "perf_precomp.hpp"
-#ifdef HAVE_CUDA
+using namespace std;
+using namespace testing;
+
+namespace {
//////////////////////////////////////////////////////////////////////
// Blur
-IMPLEMENT_PARAM_CLASS(KernelSize, int)
+DEF_PARAM_TEST(Sz_Type_KernelSz, cv::Size, MatType, int);
-GPU_PERF_TEST(Blur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
+PERF_TEST_P(Sz_Type_KernelSz, Filters_Blur, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4), Values(3, 5, 7)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(20.0);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
- int ksize = GET_PARAM(3);
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
+ int ksize = GET_PARAM(2);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 255.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::blur(src, dst, cv::Size(ksize, ksize));
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::blur(src, dst, cv::Size(ksize, ksize));
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::blur(d_src, d_dst, cv::Size(ksize, ksize));
+
+ TEST_CYCLE()
+ {
+ cv::gpu::blur(d_src, d_dst, cv::Size(ksize, ksize));
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::blur(src, dst, cv::Size(ksize, ksize));
+
+ TEST_CYCLE()
+ {
+ cv::blur(src, dst, cv::Size(ksize, ksize));
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Filters, Blur, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)),
- testing::Values(KernelSize(3), KernelSize(5), KernelSize(7))));
-
//////////////////////////////////////////////////////////////////////
// Sobel
-GPU_PERF_TEST(Sobel, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
+PERF_TEST_P(Sz_Type_KernelSz, Filters_Sobel, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4, CV_32FC1), Values(3, 5, 7, 9, 11, 13, 15)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(20.0);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
- int ksize = GET_PARAM(3);
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
+ int ksize = GET_PARAM(2);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 255.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
- cv::gpu::GpuMat buf;
-
- cv::gpu::Sobel(src, dst, -1, 1, 1, buf, ksize);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::Sobel(src, dst, -1, 1, 1, buf, ksize);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_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, d_dst, -1, 1, 1, d_buf, ksize);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::Sobel(src, dst, -1, 1, 1, ksize);
+
+ TEST_CYCLE()
+ {
+ cv::Sobel(src, dst, -1, 1, 1, ksize);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Filters, Sobel, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1)),
- testing::Values(KernelSize(3), KernelSize(5), KernelSize(7), KernelSize(9), KernelSize(11), KernelSize(13), KernelSize(15))));
-
//////////////////////////////////////////////////////////////////////
// Scharr
-GPU_PERF_TEST(Scharr, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Type, Filters_Scharr, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4, CV_32FC1)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(20.0);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 255.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
- cv::gpu::GpuMat buf;
-
- cv::gpu::Scharr(src, dst, -1, 1, 0, buf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::Scharr(src, dst, -1, 1, 0, buf);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_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, d_dst, -1, 1, 0, d_buf);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::Scharr(src, dst, -1, 1, 0);
+
+ TEST_CYCLE()
+ {
+ cv::Scharr(src, dst, -1, 1, 0);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Filters, Scharr, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1))));
-
//////////////////////////////////////////////////////////////////////
// GaussianBlur
-GPU_PERF_TEST(GaussianBlur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
+PERF_TEST_P(Sz_Type_KernelSz, Filters_GaussianBlur, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4, CV_32FC1), Values(3, 5, 7, 9, 11, 13, 15)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(20.0);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
- int ksize = GET_PARAM(3);
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
+ int ksize = GET_PARAM(2);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 255.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
- cv::gpu::GpuMat buf;
-
- cv::gpu::GaussianBlur(src, dst, cv::Size(ksize, ksize), buf, 0.5);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::GaussianBlur(src, dst, cv::Size(ksize, ksize), buf, 0.5);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_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, d_dst, cv::Size(ksize, ksize), d_buf, 0.5);
+ }
+ }
+ 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);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Filters, GaussianBlur, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1)),
- testing::Values(KernelSize(3), KernelSize(5), KernelSize(7), KernelSize(9), KernelSize(11), KernelSize(13), KernelSize(15))));
-
//////////////////////////////////////////////////////////////////////
// Laplacian
-GPU_PERF_TEST(Laplacian, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
+PERF_TEST_P(Sz_Type_KernelSz, Filters_Laplacian, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4), Values(1, 3)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(20.0);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
- int ksize = GET_PARAM(3);
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
+ int ksize = GET_PARAM(2);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 255.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::Laplacian(src, dst, -1, ksize);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::Laplacian(src, dst, -1, ksize);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::Laplacian(d_src, d_dst, -1, ksize);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::Laplacian(d_src, d_dst, -1, ksize);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::Laplacian(src, dst, -1, ksize);
+
+ TEST_CYCLE()
+ {
+ cv::Laplacian(src, dst, -1, ksize);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Filters, Laplacian, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4)),
- testing::Values(KernelSize(1), KernelSize(3))));
-
//////////////////////////////////////////////////////////////////////
// Erode
-GPU_PERF_TEST(Erode, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Type, Filters_Erode, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(20.0);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 255.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
- cv::gpu::GpuMat buf;
-
- cv::gpu::erode(src, dst, ker, buf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::erode(src, dst, ker, buf);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+ cv::gpu::GpuMat d_buf;
+
+ cv::gpu::erode(d_src, d_dst, ker, d_buf);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::erode(d_src, d_dst, ker, d_buf);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::erode(src, dst, ker);
+
+ TEST_CYCLE()
+ {
+ cv::erode(src, dst, ker);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Filters, Erode, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4))));
-
//////////////////////////////////////////////////////////////////////
// Dilate
-GPU_PERF_TEST(Dilate, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Type, Filters_Dilate, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(20.0);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 255.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
- cv::gpu::GpuMat buf;
-
- cv::gpu::dilate(src, dst, ker, buf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::dilate(src, dst, ker, buf);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+ cv::gpu::GpuMat d_buf;
+
+ cv::gpu::dilate(d_src, d_dst, ker, d_buf);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::dilate(d_src, d_dst, ker, d_buf);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::dilate(src, dst, ker);
+
+ TEST_CYCLE()
+ {
+ cv::dilate(src, dst, ker);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Filters, Dilate, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4))));
-
//////////////////////////////////////////////////////////////////////
// MorphologyEx
CV_ENUM(MorphOp, cv::MORPH_OPEN, cv::MORPH_CLOSE, cv::MORPH_GRADIENT, cv::MORPH_TOPHAT, cv::MORPH_BLACKHAT)
-#define ALL_MORPH_OPS testing::Values(MorphOp(cv::MORPH_OPEN), MorphOp(cv::MORPH_CLOSE), MorphOp(cv::MORPH_GRADIENT), MorphOp(cv::MORPH_TOPHAT), MorphOp(cv::MORPH_BLACKHAT))
+#define ALL_MORPH_OPS ValuesIn(MorphOp::all())
-GPU_PERF_TEST(MorphologyEx, cv::gpu::DeviceInfo, cv::Size, MatType, MorphOp)
+DEF_PARAM_TEST(Sz_Type_Op, cv::Size, MatType, MorphOp);
+
+PERF_TEST_P(Sz_Type_Op, Filters_MorphologyEx, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4), ALL_MORPH_OPS))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(20.0);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
- int morphOp = GET_PARAM(3);
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
+ int morphOp = GET_PARAM(2);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 255.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
- cv::gpu::GpuMat buf1;
- cv::gpu::GpuMat buf2;
-
- cv::gpu::morphologyEx(src, dst, morphOp, ker, buf1, buf2);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::morphologyEx(src, dst, morphOp, ker, buf1, buf2);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_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, d_dst, morphOp, ker, d_buf1, d_buf2);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::morphologyEx(src, dst, morphOp, ker);
+
+ TEST_CYCLE()
+ {
+ cv::morphologyEx(src, dst, morphOp, ker);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Filters, MorphologyEx, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)),
- ALL_MORPH_OPS));
-
//////////////////////////////////////////////////////////////////////
// Filter2D
-GPU_PERF_TEST(Filter2D, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
+PERF_TEST_P(Sz_Type_KernelSz, Filters_Filter2D, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4), Values(3, 5, 7, 9, 11, 13, 15)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(20.0);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
- int ksize = GET_PARAM(3);
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
+ int ksize = GET_PARAM(2);
- cv::Mat src_host(size, type);
- fill(src_host, 0.0, 255.0);
+ cv::Mat src(size, type);
+ fillRandom(src);
cv::Mat kernel(ksize, ksize, CV_32FC1);
- fill(kernel, 0.0, 1.0);
+ fillRandom(kernel, 0.0, 1.0);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::filter2D(src, dst, -1, kernel);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::filter2D(src, dst, -1, kernel);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::filter2D(d_src, d_dst, -1, kernel);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::filter2D(d_src, d_dst, -1, kernel);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::filter2D(src, dst, -1, kernel);
+
+ TEST_CYCLE()
+ {
+ cv::filter2D(src, dst, -1, kernel);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Filters, Filter2D, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4)),
- testing::Values(KernelSize(3), KernelSize(5), KernelSize(7), KernelSize(9), KernelSize(11), KernelSize(13), KernelSize(15))));
-
-#endif
+} // namespace
diff --git a/modules/gpu/perf/perf_imgproc.cpp b/modules/gpu/perf/perf_imgproc.cpp
index 0dbcd34c6..f938ca239 100644
--- a/modules/gpu/perf/perf_imgproc.cpp
+++ b/modules/gpu/perf/perf_imgproc.cpp
@@ -1,188 +1,286 @@
#include "perf_precomp.hpp"
-#ifdef HAVE_CUDA
+using namespace std;
+using namespace testing;
+
+namespace {
//////////////////////////////////////////////////////////////////////
// Remap
-GPU_PERF_TEST(Remap, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode)
+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())
+
+void generateMap(cv::Mat& map_x, cv::Mat& map_y, int remapMode)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
- int interpolation = GET_PARAM(3);
- int borderMode = GET_PARAM(4);
-
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
-
- cv::Mat xmap_host(size, CV_32FC1);
- fill(xmap_host, 0, size.width);
-
- cv::Mat ymap_host(size, CV_32FC1);
- fill(ymap_host, 0, size.height);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat xmap(xmap_host);
- cv::gpu::GpuMat ymap(ymap_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::remap(src, dst, xmap, ymap, interpolation, borderMode);
-
- declare.time(3.0);
-
- TEST_CYCLE()
+ for (int j = 0; j < map_x.rows; ++j)
{
- cv::gpu::remap(src, dst, xmap, ymap, interpolation, borderMode);
+ for (int i = 0; i < map_x.cols; ++i)
+ {
+ switch (remapMode)
+ {
+ case HALF_SIZE:
+ if (i > map_x.cols*0.25 && i < map_x.cols*0.75 && j > map_x.rows*0.25 && j < map_x.rows*0.75)
+ {
+ map_x.at(j,i) = 2 * (i - map_x.cols * 0.25f) + 0.5f;
+ map_y.at(j,i) = 2 * (j - map_x.rows * 0.25f) + 0.5f;
+ }
+ else
+ {
+ map_x.at(j,i) = 0;
+ map_y.at(j,i) = 0;
+ }
+ break;
+ case UPSIDE_DOWN:
+ map_x.at(j,i) = static_cast(i);
+ map_y.at(j,i) = static_cast(map_x.rows - j);
+ break;
+ case REFLECTION_X:
+ map_x.at(j,i) = static_cast(map_x.cols - i);
+ map_y.at(j,i) = static_cast(j);
+ break;
+ case REFLECTION_BOTH:
+ map_x.at(j,i) = static_cast(map_x.cols - i);
+ map_y.at(j,i) = static_cast(map_x.rows - j);
+ break;
+ } // end of switch
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, Remap, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
- testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
- testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));
+DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Border_Mode, cv::Size, MatDepth, int, 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),
+ Values(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);
+
+ int type = CV_MAKE_TYPE(depth, channels);
+
+ cv::Mat src(size, type);
+ fillRandom(src);
+
+ cv::Mat xmap(size, CV_32FC1);
+ cv::Mat ymap(size, CV_32FC1);
+
+ generateMap(xmap, ymap, remapMode);
+
+ if (runOnGpu)
+ {
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_xmap(xmap);
+ cv::gpu::GpuMat d_ymap(ymap);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::remap(src, dst, xmap, ymap, interpolation, borderMode);
+
+ TEST_CYCLE()
+ {
+ cv::remap(src, dst, xmap, ymap, interpolation, borderMode);
+ }
+ }
+}
//////////////////////////////////////////////////////////////////////
// Resize
-IMPLEMENT_PARAM_CLASS(Scale, double)
+DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Scale, cv::Size, MatDepth, int, Interpolation, double);
-GPU_PERF_TEST(Resize, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, Scale)
+PERF_TEST_P(Sz_Depth_Cn_Inter_Scale, ImgProc_Resize, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F),
+ Values(1, 3, 4),
+ ALL_INTERPOLATIONS,
+ Values(0.5, 0.3, 2.0)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(20.0);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ 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);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);
-
- declare.time(1.0);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::resize(src, dst, cv::Size(), f, f, interpolation);
+
+ TEST_CYCLE()
+ {
+ cv::resize(src, dst, cv::Size(), f, f, interpolation);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, Resize, testing::Combine(
- ALL_DEVICES,
+//////////////////////////////////////////////////////////////////////
+// ResizeArea
+
+DEF_PARAM_TEST(Sz_Depth_Cn_Scale, cv::Size, MatDepth, int, double);
+
+PERF_TEST_P(Sz_Depth_Cn_Scale, ImgProc_ResizeArea, Combine(
GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
- testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR),
- Interpolation(cv::INTER_CUBIC), Interpolation(cv::INTER_AREA)),
- testing::Values(Scale(0.5), Scale(0.3), Scale(2.0))));
-
-GPU_PERF_TEST(ResizeArea, cv::gpu::DeviceInfo, cv::Size, MatType, Scale)
+ Values(CV_8U, CV_16U, CV_32F),
+ Values(1, 3, 4),
+ Values(0.2, 0.1, 0.05)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(1.0);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ 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);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);
-
- declare.time(1.0);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::resize(src, dst, cv::Size(), f, f, interpolation);
+
+ TEST_CYCLE()
+ {
+ cv::resize(src, dst, cv::Size(), f, f, interpolation);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, ResizeArea, testing::Combine(
- ALL_DEVICES,
- testing::Values(perf::sz1080p/*, cv::Size(4096, 2048)*/),
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
- testing::Values(Scale(0.2),Scale(0.1),Scale(0.05))));
-
//////////////////////////////////////////////////////////////////////
// WarpAffine
-GPU_PERF_TEST(WarpAffine, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode)
-{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Border, cv::Size, MatDepth, int, Interpolation, BorderMode);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpAffine, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F),
+ Values(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);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
+ cv::Mat src(size, type);
+ fillRandom(src);
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);
- cv::gpu::warpAffine(src, dst, M, size, interpolation, borderMode);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::warpAffine(src, dst, M, size, interpolation, borderMode);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::warpAffine(d_src, d_dst, M, size, interpolation, borderMode);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::warpAffine(d_src, d_dst, M, size, interpolation, borderMode);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::warpAffine(src, dst, M, size, interpolation, borderMode);
+
+ TEST_CYCLE()
+ {
+ cv::warpAffine(src, dst, M, size, interpolation, borderMode);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, WarpAffine, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
- testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
- testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));
-
//////////////////////////////////////////////////////////////////////
// WarpPerspective
-GPU_PERF_TEST(WarpPerspective, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode)
+PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpPerspective, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F),
+ Values(1, 3, 4),
+ Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
+ ALL_BORDER_MODES))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(20.0);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ 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);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
+ cv::Mat src(size, type);
+ fillRandom(src);
const double aplha = CV_PI / 4;
double mat[3][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2},
@@ -190,1170 +288,1345 @@ GPU_PERF_TEST(WarpPerspective, cv::gpu::DeviceInfo, cv::Size, MatType, Interpola
{0.0, 0.0, 1.0}};
cv::Mat M(3, 3, CV_64F, (void*) mat);
- cv::gpu::warpPerspective(src, dst, M, size, interpolation, borderMode);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::warpPerspective(src, dst, M, size, interpolation, borderMode);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::warpPerspective(d_src, d_dst, M, size, interpolation, borderMode);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::warpPerspective(d_src, d_dst, M, size, interpolation, borderMode);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::warpPerspective(src, dst, M, size, interpolation, borderMode);
+
+ TEST_CYCLE()
+ {
+ cv::warpPerspective(src, dst, M, size, interpolation, borderMode);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, WarpPerspective, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
- testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
- testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));
-
//////////////////////////////////////////////////////////////////////
// CopyMakeBorder
-GPU_PERF_TEST(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, MatType, BorderMode)
+DEF_PARAM_TEST(Sz_Depth_Cn_Border, cv::Size, MatDepth, int, BorderMode);
+
+PERF_TEST_P(Sz_Depth_Cn_Border, ImgProc_CopyMakeBorder, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F),
+ Values(1, 3, 4),
+ ALL_BORDER_MODES))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
+ int borderMode = GET_PARAM(3);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
- int borderType = GET_PARAM(3);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::copyMakeBorder(src, dst, 5, 5, 5, 5, borderType);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::copyMakeBorder(src, dst, 5, 5, 5, 5, borderType);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::copyMakeBorder(d_src, d_dst, 5, 5, 5, 5, borderMode);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::copyMakeBorder(d_src, d_dst, 5, 5, 5, 5, borderMode);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderMode);
+
+ TEST_CYCLE()
+ {
+ cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderMode);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, CopyMakeBorder, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
- testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));
-
//////////////////////////////////////////////////////////////////////
// Threshold
CV_ENUM(ThreshOp, cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV)
-#define ALL_THRESH_OPS testing::Values(ThreshOp(cv::THRESH_BINARY), ThreshOp(cv::THRESH_BINARY_INV), ThreshOp(cv::THRESH_TRUNC), ThreshOp(cv::THRESH_TOZERO), ThreshOp(cv::THRESH_TOZERO_INV))
+#define ALL_THRESH_OPS ValuesIn(ThreshOp::all())
-GPU_PERF_TEST(Threshold, cv::gpu::DeviceInfo, cv::Size, MatDepth, ThreshOp)
+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))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int threshOp = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int threshOp = GET_PARAM(3);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0, 255);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::threshold(src, dst, 100.0, 255.0, threshOp);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::threshold(src, dst, 100.0, 255.0, threshOp);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::threshold(d_src, d_dst, 100.0, 255.0, threshOp);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::threshold(d_src, d_dst, 100.0, 255.0, threshOp);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::threshold(src, dst, 100.0, 255.0, threshOp);
+
+ TEST_CYCLE()
+ {
+ cv::threshold(src, dst, 100.0, 255.0, threshOp);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, Threshold, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F), MatDepth(CV_64F)),
- ALL_THRESH_OPS));
-
//////////////////////////////////////////////////////////////////////
// Integral
-GPU_PERF_TEST(Integral, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, ImgProc_Integral, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GetParam();
- cv::Size size = GET_PARAM(1);
+ cv::Mat src(size, CV_8UC1);
+ fillRandom(src);
- cv::Mat src_host(size, CV_8UC1);
- fill(src_host, 0, 255);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
- cv::gpu::GpuMat buf;
-
- cv::gpu::integralBuffered(src, dst, buf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::integralBuffered(src, dst, buf);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+ cv::gpu::GpuMat d_buf;
+
+ cv::gpu::integralBuffered(d_src, d_dst, d_buf);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::integralBuffered(d_src, d_dst, d_buf);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::integral(src, dst);
+
+ TEST_CYCLE()
+ {
+ cv::integral(src, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, Integral, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
-// Integral_Sqr
+// IntegralSqr
-GPU_PERF_TEST(Integral_Sqr, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, ImgProc_IntegralSqr, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GetParam();
- cv::Size size = GET_PARAM(1);
+ cv::Mat src(size, CV_8UC1);
+ fillRandom(src);
- cv::Mat src_host(size, CV_8UC1);
- fill(src_host, 0, 255);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::sqrIntegral(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::sqrIntegral(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::sqrIntegral(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::sqrIntegral(d_src, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, Integral_Sqr, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
-// HistEven_OneChannel
+// HistEvenC1
-GPU_PERF_TEST(HistEven_OneChannel, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, ImgProc_HistEvenC1, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_16S)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, depth);
+ fillRandom(src);
- cv::Mat src_host(size, depth);
- fill(src_host, 0, 255);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat hist;
- cv::gpu::GpuMat buf;
-
- cv::gpu::histEven(src, hist, buf, 30, 0, 180);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::histEven(src, hist, buf, 30, 0, 180);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_hist;
+ cv::gpu::GpuMat d_buf;
+
+ cv::gpu::histEven(d_src, d_hist, d_buf, 30, 0, 180);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::histEven(d_src, d_hist, d_buf, 30, 0, 180);
+ }
+ }
+ else
+ {
+ int hbins = 30;
+ float hranges[] = {0.0f, 180.0f};
+ int histSize[] = {hbins};
+ const float* ranges[] = {hranges};
+ int channels[] = {0};
+
+ cv::Mat hist;
+
+ cv::calcHist(&src, 1, channels, cv::Mat(), hist, 1, histSize, ranges);
+
+ TEST_CYCLE()
+ {
+ cv::calcHist(&src, 1, channels, cv::Mat(), hist, 1, histSize, ranges);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, HistEven_OneChannel, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_16S))));
-
//////////////////////////////////////////////////////////////////////
-// HistEven_FourChannel
+// HistEvenC4
-GPU_PERF_TEST(HistEven_FourChannel, cv::gpu::DeviceInfo, cv::Size, MatDepth)
+PERF_TEST_P(Sz_Depth, ImgProc_HistEvenC4, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_16S)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
+ cv::Mat src(size, CV_MAKE_TYPE(depth, 4));
+ fillRandom(src);
- cv::Mat src_host(size, CV_MAKE_TYPE(depth, 4));
- fill(src_host, 0, 255);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat hist[4];
- cv::gpu::GpuMat buf;
int histSize[] = {30, 30, 30, 30};
int lowerLevel[] = {0, 0, 0, 0};
int upperLevel[] = {180, 180, 180, 180};
- cv::gpu::histEven(src, hist, buf, histSize, lowerLevel, upperLevel);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::histEven(src, hist, buf, histSize, lowerLevel, upperLevel);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_hist[4];
+ 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);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, HistEven_FourChannel, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_16S))));
-
//////////////////////////////////////////////////////////////////////
// CalcHist
-GPU_PERF_TEST(CalcHist, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, ImgProc_CalcHist, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GetParam();
- cv::Size size = GET_PARAM(1);
+ cv::Mat src(size, CV_8UC1);
+ fillRandom(src);
- cv::Mat src_host(size, CV_8UC1);
- fill(src_host, 0, 255);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat hist;
- cv::gpu::GpuMat buf;
-
- cv::gpu::calcHist(src, hist, buf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::calcHist(src, hist, buf);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_hist;
+ cv::gpu::GpuMat d_buf;
+
+ cv::gpu::calcHist(d_src, d_hist, d_buf);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::calcHist(d_src, d_hist, d_buf);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, CalcHist, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
// EqualizeHist
-GPU_PERF_TEST(EqualizeHist, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, ImgProc_EqualizeHist, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GetParam();
- cv::Size size = GET_PARAM(1);
+ cv::Mat src(size, CV_8UC1);
+ fillRandom(src);
- cv::Mat src_host(size, CV_8UC1);
- fill(src_host, 0, 255);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
- cv::gpu::GpuMat hist;
- cv::gpu::GpuMat buf;
-
- cv::gpu::equalizeHist(src, dst, hist, buf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::equalizeHist(src, dst, hist, buf);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_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, d_dst, d_hist, d_buf);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::equalizeHist(src, dst);
+
+ TEST_CYCLE()
+ {
+ cv::equalizeHist(src, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, EqualizeHist, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
// ColumnSum
-GPU_PERF_TEST(ColumnSum, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, ImgProc_ColumnSum, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GetParam();
- cv::Size size = GET_PARAM(1);
+ cv::Mat src(size, CV_32FC1);
+ fillRandom(src);
- cv::Mat src_host(size, CV_32FC1);
- fill(src_host, 0, 255);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::columnSum(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::columnSum(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::columnSum(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::columnSum(d_src, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, ColumnSum, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
// Canny
-IMPLEMENT_PARAM_CLASS(AppertureSize, int)
-IMPLEMENT_PARAM_CLASS(L2gradient, bool)
+DEF_PARAM_TEST(Image_AppertureSz_L2gradient, string, int, bool);
-GPU_PERF_TEST(Canny, cv::gpu::DeviceInfo, AppertureSize, L2gradient)
+PERF_TEST_P(Image_AppertureSz_L2gradient, ImgProc_Canny, Combine(
+ Values("perf/800x600.jpg", "perf/1280x1024.jpg", "perf/1680x1050.jpg"),
+ Values(3, 5),
+ Bool()))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
+ string fileName = GET_PARAM(0);
int apperture_size = GET_PARAM(1);
bool useL2gradient = GET_PARAM(2);
- cv::Mat image_host = readImage("perf/1280x1024.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(image_host.empty());
+ cv::Mat image = readImage(fileName, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(image.empty());
- cv::gpu::GpuMat image(image_host);
- cv::gpu::GpuMat dst;
- cv::gpu::CannyBuf buf;
-
- cv::gpu::Canny(image, buf, dst, 50.0, 100.0, apperture_size, useL2gradient);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::Canny(image, buf, dst, 50.0, 100.0, apperture_size, useL2gradient);
+ cv::gpu::GpuMat d_image(image);
+ cv::gpu::GpuMat d_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, d_dst, 50.0, 100.0, apperture_size, useL2gradient);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::Canny(image, dst, 50.0, 100.0, apperture_size, useL2gradient);
+
+ TEST_CYCLE()
+ {
+ cv::Canny(image, dst, 50.0, 100.0, apperture_size, useL2gradient);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, Canny, testing::Combine(
- ALL_DEVICES,
- testing::Values(AppertureSize(3), AppertureSize(5)),
- testing::Values(L2gradient(false), L2gradient(true))));
-
//////////////////////////////////////////////////////////////////////
// MeanShiftFiltering
-GPU_PERF_TEST_1(MeanShiftFiltering, cv::gpu::DeviceInfo)
-{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
+DEF_PARAM_TEST_1(Image, string);
- cv::Mat img = readImage("gpu/meanshift/cones.png");
+PERF_TEST_P(Image, ImgProc_MeanShiftFiltering, Values("gpu/meanshift/cones.png"))
+{
+ declare.time(15.0);
+
+ cv::Mat img = readImage(GetParam());
ASSERT_FALSE(img.empty());
cv::Mat rgba;
cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
- cv::gpu::GpuMat src(rgba);
- cv::gpu::GpuMat dst;
-
- cv::gpu::meanShiftFiltering(src, dst, 50, 50);
-
- declare.time(5.0);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::meanShiftFiltering(src, dst, 50, 50);
+ cv::gpu::GpuMat d_src(rgba);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::meanShiftFiltering(d_src, d_dst, 50, 50);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::meanShiftFiltering(d_src, d_dst, 50, 50);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::pyrMeanShiftFiltering(img, dst, 50, 50);
+
+ TEST_CYCLE()
+ {
+ cv::pyrMeanShiftFiltering(img, dst, 50, 50);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftFiltering, ALL_DEVICES);
-
//////////////////////////////////////////////////////////////////////
// MeanShiftProc
-GPU_PERF_TEST_1(MeanShiftProc, cv::gpu::DeviceInfo)
+PERF_TEST_P(Image, ImgProc_MeanShiftProc, Values("gpu/meanshift/cones.png"))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(5.0);
- cv::Mat img = readImage("gpu/meanshift/cones.png");
+ cv::Mat img = readImage(GetParam());
ASSERT_FALSE(img.empty());
cv::Mat rgba;
cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
- cv::gpu::GpuMat src(rgba);
- cv::gpu::GpuMat dstr;
- cv::gpu::GpuMat dstsp;
-
- cv::gpu::meanShiftProc(src, dstr, dstsp, 50, 50);
-
- declare.time(5.0);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::meanShiftProc(src, dstr, dstsp, 50, 50);
+ cv::gpu::GpuMat d_src(rgba);
+ cv::gpu::GpuMat d_dstr;
+ cv::gpu::GpuMat d_dstsp;
+
+ cv::gpu::meanShiftProc(d_src, d_dstr, d_dstsp, 50, 50);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::meanShiftProc(d_src, d_dstr, d_dstsp, 50, 50);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftProc, ALL_DEVICES);
-
//////////////////////////////////////////////////////////////////////
// MeanShiftSegmentation
-GPU_PERF_TEST_1(MeanShiftSegmentation, cv::gpu::DeviceInfo)
+PERF_TEST_P(Image, ImgProc_MeanShiftSegmentation, Values("gpu/meanshift/cones.png"))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(5.0);
- cv::Mat img = readImage("gpu/meanshift/cones.png");
+ cv::Mat img = readImage(GetParam());
ASSERT_FALSE(img.empty());
cv::Mat rgba;
cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
- cv::gpu::GpuMat src(rgba);
cv::Mat dst;
- meanShiftSegmentation(src, dst, 10, 10, 20);
-
- declare.time(5.0);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- meanShiftSegmentation(src, dst, 10, 10, 20);
+ cv::gpu::GpuMat d_src(rgba);
+
+ cv::gpu::meanShiftSegmentation(d_src, dst, 10, 10, 20);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::meanShiftSegmentation(d_src, dst, 10, 10, 20);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftSegmentation, ALL_DEVICES);
-
//////////////////////////////////////////////////////////////////////
// BlendLinear
-GPU_PERF_TEST(BlendLinear, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Depth_Cn, ImgProc_BlendLinear, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_32F), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::Mat img1_host(size, type);
- fill(img1_host, 0, 255);
+ cv::Mat img1(size, type);
+ fillRandom(img1);
- cv::Mat img2_host(size, type);
- fill(img2_host, 0, 255);
+ cv::Mat img2(size, type);
+ fillRandom(img2);
- cv::gpu::GpuMat img1(img1_host);
- cv::gpu::GpuMat img2(img2_host);
- cv::gpu::GpuMat weights1(size, CV_32FC1, cv::Scalar::all(0.5));
- cv::gpu::GpuMat weights2(size, CV_32FC1, cv::Scalar::all(0.5));
- cv::gpu::GpuMat dst;
-
- cv::gpu::blendLinear(img1, img2, weights1, weights2, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::blendLinear(img1, img2, weights1, weights2, dst);
+ 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;
+
+ 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, d_dst);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, BlendLinear, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
-
//////////////////////////////////////////////////////////////////////
// Convolve
-IMPLEMENT_PARAM_CLASS(KSize, int)
-IMPLEMENT_PARAM_CLASS(Ccorr, bool)
+DEF_PARAM_TEST(Sz_KernelSz_Ccorr, cv::Size, int, bool);
-GPU_PERF_TEST(Convolve, cv::gpu::DeviceInfo, cv::Size, KSize, Ccorr)
+PERF_TEST_P(Sz_KernelSz_Ccorr, ImgProc_Convolve, Combine(GPU_TYPICAL_MAT_SIZES, Values(17, 27, 32, 64), Bool()))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(10.0);
- cv::Size size = GET_PARAM(1);
- int templ_size = GET_PARAM(2);
- bool ccorr = GET_PARAM(3);
+ cv::Size size = GET_PARAM(0);
+ int templ_size = GET_PARAM(1);
+ bool ccorr = GET_PARAM(2);
- cv::gpu::GpuMat image = cv::gpu::createContinuous(size, CV_32FC1);
- image.setTo(cv::Scalar(1.0));
+ cv::Mat image(size, CV_32FC1);
+ image.setTo(1.0);
- cv::gpu::GpuMat templ = cv::gpu::createContinuous(templ_size, templ_size, CV_32FC1);
- templ.setTo(cv::Scalar(1.0));
+ cv::Mat templ(templ_size, templ_size, CV_32FC1);
+ templ.setTo(1.0);
- cv::gpu::GpuMat dst;
- cv::gpu::ConvolveBuf buf;
-
- cv::gpu::convolve(image, templ, dst, ccorr, buf);
-
- declare.time(2.0);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::convolve(image, templ, dst, ccorr, buf);
+ cv::gpu::GpuMat d_image = cv::gpu::createContinuous(size, CV_32FC1);
+ d_image.upload(image);
+
+ 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::ConvolveBuf d_buf;
+
+ cv::gpu::convolve(d_image, d_templ, d_dst, ccorr, d_buf);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::convolve(d_image, d_templ, d_dst, ccorr, d_buf);
+ }
+ }
+ else
+ {
+ ASSERT_FALSE(ccorr);
+
+ cv::Mat dst;
+
+ cv::filter2D(image, dst, image.depth(), templ);
+
+ TEST_CYCLE()
+ {
+ cv::filter2D(image, dst, image.depth(), templ);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, Convolve, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(KSize(3), KSize(9), KSize(17), KSize(27), KSize(32), KSize(64)),
- testing::Values(Ccorr(false), Ccorr(true))));
-
////////////////////////////////////////////////////////////////////////////////
-// MatchTemplate_8U
+// MatchTemplate8U
CV_ENUM(TemplateMethod, cv::TM_SQDIFF, cv::TM_SQDIFF_NORMED, cv::TM_CCORR, cv::TM_CCORR_NORMED, cv::TM_CCOEFF, cv::TM_CCOEFF_NORMED)
-#define ALL_TEMPLATE_METHODS testing::Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_SQDIFF_NORMED), TemplateMethod(cv::TM_CCORR), TemplateMethod(cv::TM_CCORR_NORMED), TemplateMethod(cv::TM_CCOEFF), TemplateMethod(cv::TM_CCOEFF_NORMED))
+#define ALL_TEMPLATE_METHODS ValuesIn(TemplateMethod::all())
-IMPLEMENT_PARAM_CLASS(TemplateSize, cv::Size)
+DEF_PARAM_TEST(Sz_TemplateSz_Cn_Method, cv::Size, cv::Size, int, TemplateMethod);
-GPU_PERF_TEST(MatchTemplate_8U, cv::gpu::DeviceInfo, cv::Size, TemplateSize, Channels, 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)),
+ Values(1, 3, 4),
+ ALL_TEMPLATE_METHODS))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ cv::Size templ_size = GET_PARAM(1);
+ int cn = GET_PARAM(2);
+ int method = GET_PARAM(3);
- cv::Size size = GET_PARAM(1);
- cv::Size templ_size = GET_PARAM(2);
- int cn = GET_PARAM(3);
- int method = GET_PARAM(4);
+ cv::Mat image(size, CV_MAKE_TYPE(CV_8U, cn));
+ fillRandom(image);
- cv::Mat image_host(size, CV_MAKE_TYPE(CV_8U, cn));
- fill(image_host, 0, 255);
+ cv::Mat templ(templ_size, CV_MAKE_TYPE(CV_8U, cn));
+ fillRandom(templ);
- cv::Mat templ_host(templ_size, CV_MAKE_TYPE(CV_8U, cn));
- fill(templ_host, 0, 255);
-
- cv::gpu::GpuMat image(image_host);
- cv::gpu::GpuMat templ(templ_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::matchTemplate(image, templ, dst, method);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::matchTemplate(image, templ, dst, method);
+ cv::gpu::GpuMat d_image(image);
+ cv::gpu::GpuMat d_templ(templ);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::matchTemplate(image, templ, dst, method);
+
+ TEST_CYCLE()
+ {
+ cv::matchTemplate(image, templ, dst, method);
+ }
}
};
-INSTANTIATE_TEST_CASE_P(ImgProc, MatchTemplate_8U, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16)), TemplateSize(cv::Size(30, 30))),
- testing::Values(Channels(1), Channels(3), Channels(4)),
- ALL_TEMPLATE_METHODS));
-
////////////////////////////////////////////////////////////////////////////////
-// MatchTemplate_32F
+// MatchTemplate32F
-GPU_PERF_TEST(MatchTemplate_32F, cv::gpu::DeviceInfo, cv::Size, TemplateSize, Channels, TemplateMethod)
+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)),
+ Values(1, 3, 4),
+ Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_CCORR))))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ cv::Size templ_size = GET_PARAM(1);
+ int cn = GET_PARAM(2);
+ int method = GET_PARAM(3);
- cv::Size size = GET_PARAM(1);
- cv::Size templ_size = GET_PARAM(2);
- int cn = GET_PARAM(3);
- int method = GET_PARAM(4);
+ cv::Mat image(size, CV_MAKE_TYPE(CV_32F, cn));
+ fillRandom(image);
- cv::Mat image_host(size, CV_MAKE_TYPE(CV_32F, cn));
- fill(image_host, 0, 255);
+ cv::Mat templ(templ_size, CV_MAKE_TYPE(CV_32F, cn));
+ fillRandom(templ);
- cv::Mat templ_host(templ_size, CV_MAKE_TYPE(CV_32F, cn));
- fill(templ_host, 0, 255);
-
- cv::gpu::GpuMat image(image_host);
- cv::gpu::GpuMat templ(templ_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::matchTemplate(image, templ, dst, method);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::matchTemplate(image, templ, dst, method);
+ cv::gpu::GpuMat d_image(image);
+ cv::gpu::GpuMat d_templ(templ);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::matchTemplate(image, templ, dst, method);
+
+ TEST_CYCLE()
+ {
+ cv::matchTemplate(image, templ, dst, method);
+ }
}
};
-INSTANTIATE_TEST_CASE_P(ImgProc, MatchTemplate_32F, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16)), TemplateSize(cv::Size(30, 30))),
- testing::Values(Channels(1), Channels(3), Channels(4)),
- testing::Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_CCORR))));
-
//////////////////////////////////////////////////////////////////////
// MulSpectrums
CV_FLAGS(DftFlags, 0, cv::DFT_INVERSE, cv::DFT_SCALE, cv::DFT_ROWS, cv::DFT_COMPLEX_OUTPUT, cv::DFT_REAL_OUTPUT)
-GPU_PERF_TEST(MulSpectrums, cv::gpu::DeviceInfo, cv::Size, DftFlags)
+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))))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int flag = GET_PARAM(1);
- cv::Size size = GET_PARAM(1);
- int flag = GET_PARAM(2);
+ cv::Mat a(size, CV_32FC2);
+ fillRandom(a, 0, 100);
- cv::Mat a_host(size, CV_32FC2);
- fill(a_host, 0, 100);
+ cv::Mat b(size, CV_32FC2);
+ fillRandom(b, 0, 100);
- cv::Mat b_host(size, CV_32FC2);
- fill(b_host, 0, 100);
-
- cv::gpu::GpuMat a(a_host);
- cv::gpu::GpuMat b(b_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::mulSpectrums(a, b, dst, flag);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::mulSpectrums(a, b, dst, flag);
+ cv::gpu::GpuMat d_a(a);
+ cv::gpu::GpuMat d_b(b);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::mulSpectrums(d_a, d_b, d_dst, flag);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::mulSpectrums(d_a, d_b, d_dst, flag);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::mulSpectrums(a, b, dst, flag);
+
+ TEST_CYCLE()
+ {
+ cv::mulSpectrums(a, b, dst, flag);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, MulSpectrums, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(DftFlags(0), DftFlags(cv::DFT_ROWS))));
-
//////////////////////////////////////////////////////////////////////
// MulAndScaleSpectrums
-GPU_PERF_TEST(MulAndScaleSpectrums, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, ImgProc_MulAndScaleSpectrums, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Size size = GET_PARAM(1);
+ cv::Size size = GetParam();
float scale = 1.f / size.area();
- cv::Mat src1_host(size, CV_32FC2);
- fill(src1_host, 0, 100);
+ cv::Mat src1(size, CV_32FC2);
+ fillRandom(src1, 0, 100);
- cv::Mat src2_host(size, CV_32FC2);
- fill(src2_host, 0, 100);
+ cv::Mat src2(size, CV_32FC2);
+ fillRandom(src2, 0, 100);
- cv::gpu::GpuMat src1(src1_host);
- cv::gpu::GpuMat src2(src2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::mulAndScaleSpectrums(src1, src2, dst, cv::DFT_ROWS, scale, false);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::mulAndScaleSpectrums(src1, src2, dst, cv::DFT_ROWS, scale, false);
+ cv::gpu::GpuMat d_src1(src1);
+ cv::gpu::GpuMat d_src2(src2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, d_dst, cv::DFT_ROWS, scale, false);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, d_dst, cv::DFT_ROWS, scale, false);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, MulAndScaleSpectrums, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
// Dft
-GPU_PERF_TEST(Dft, cv::gpu::DeviceInfo, cv::Size, DftFlags)
+PERF_TEST_P(Sz_Flags, ImgProc_Dft, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(0, DftFlags(cv::DFT_ROWS), DftFlags(cv::DFT_INVERSE))))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ declare.time(10.0);
- cv::Size size = GET_PARAM(1);
- int flag = GET_PARAM(2);
+ cv::Size size = GET_PARAM(0);
+ int flag = GET_PARAM(1);
- cv::Mat src_host(size, CV_32FC2);
- fill(src_host, 0, 100);
+ cv::Mat src(size, CV_32FC2);
+ fillRandom(src, 0, 100);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::dft(src, dst, size, flag);
-
- declare.time(2.0);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::dft(src, dst, size, flag);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::dft(d_src, d_dst, size, flag);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::dft(d_src, d_dst, size, flag);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::dft(src, dst, flag);
+
+ TEST_CYCLE()
+ {
+ cv::dft(src, dst, flag);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, Dft, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(DftFlags(0), DftFlags(cv::DFT_ROWS), DftFlags(cv::DFT_INVERSE))));
-
//////////////////////////////////////////////////////////////////////
// CornerHarris
-IMPLEMENT_PARAM_CLASS(BlockSize, int)
-IMPLEMENT_PARAM_CLASS(ApertureSize, int)
+DEF_PARAM_TEST(Image_Type_Border_BlockSz_ApertureSz, string, MatType, BorderMode, int, int);
-GPU_PERF_TEST(CornerHarris, cv::gpu::DeviceInfo, MatType, BorderMode, BlockSize, ApertureSize)
+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)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
+ string fileName = GET_PARAM(0);
int type = GET_PARAM(1);
- int borderType = GET_PARAM(2);
+ int borderMode = GET_PARAM(2);
int blockSize = GET_PARAM(3);
int apertureSize = GET_PARAM(4);
- cv::Mat img = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
+ 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);
- cv::gpu::GpuMat src(img);
- cv::gpu::GpuMat dst;
- cv::gpu::GpuMat Dx;
- cv::gpu::GpuMat Dy;
- cv::gpu::GpuMat buf;
-
double k = 0.5;
- cv::gpu::cornerHarris(src, dst, Dx, Dy, buf, blockSize, apertureSize, k, borderType);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::cornerHarris(src, dst, Dx, Dy, buf, blockSize, apertureSize, k, borderType);
+ cv::gpu::GpuMat d_img(img);
+ cv::gpu::GpuMat d_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, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, k, borderMode);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderMode);
+
+ TEST_CYCLE()
+ {
+ cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderMode);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, CornerHarris, testing::Combine(
- ALL_DEVICES,
- testing::Values(MatType(CV_8UC1), MatType(CV_32FC1)),
- testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)),
- testing::Values(BlockSize(3), BlockSize(5), BlockSize(7)),
- testing::Values(ApertureSize(0), ApertureSize(3), ApertureSize(5), ApertureSize(7))));
-
//////////////////////////////////////////////////////////////////////
// CornerMinEigenVal
-GPU_PERF_TEST(CornerMinEigenVal, cv::gpu::DeviceInfo, MatType, BorderMode, BlockSize, ApertureSize)
+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)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
+ string fileName = GET_PARAM(0);
int type = GET_PARAM(1);
- int borderType = GET_PARAM(2);
+ int borderMode = GET_PARAM(2);
int blockSize = GET_PARAM(3);
int apertureSize = GET_PARAM(4);
- cv::Mat img = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
+ 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);
- cv::gpu::GpuMat src(img);
- cv::gpu::GpuMat dst;
- cv::gpu::GpuMat Dx;
- cv::gpu::GpuMat Dy;
- cv::gpu::GpuMat buf;
-
- cv::gpu::cornerMinEigenVal(src, dst, Dx, Dy, buf, blockSize, apertureSize, borderType);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::cornerMinEigenVal(src, dst, Dx, Dy, buf, blockSize, apertureSize, borderType);
+ cv::gpu::GpuMat d_img(img);
+ cv::gpu::GpuMat d_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, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderMode);
+
+ TEST_CYCLE()
+ {
+ cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderMode);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, CornerMinEigenVal, testing::Combine(
- ALL_DEVICES,
- testing::Values(MatType(CV_8UC1), MatType(CV_32FC1)),
- testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)),
- testing::Values(BlockSize(3), BlockSize(5), BlockSize(7)),
- testing::Values(ApertureSize(0), ApertureSize(3), ApertureSize(5), ApertureSize(7))));
-
//////////////////////////////////////////////////////////////////////
// BuildWarpPlaneMaps
-GPU_PERF_TEST(BuildWarpPlaneMaps, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, ImgProc_BuildWarpPlaneMaps, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Size size = GET_PARAM(1);
+ 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);
- 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, map_x, map_y);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, map_x, map_y);
+ cv::gpu::GpuMat d_map_x;
+ cv::gpu::GpuMat d_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, d_map_x, d_map_y);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpPlaneMaps, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
// BuildWarpCylindricalMaps
-GPU_PERF_TEST(BuildWarpCylindricalMaps, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, ImgProc_BuildWarpCylindricalMaps, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Size size = GET_PARAM(1);
+ 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::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, map_x, map_y);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y);
+ cv::gpu::GpuMat d_map_x;
+ cv::gpu::GpuMat d_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, d_map_x, d_map_y);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpCylindricalMaps, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
// BuildWarpSphericalMaps
-GPU_PERF_TEST(BuildWarpSphericalMaps, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, ImgProc_BuildWarpSphericalMaps, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Size size = GET_PARAM(1);
+ 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::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, map_x, map_y);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y);
+ cv::gpu::GpuMat d_map_x;
+ cv::gpu::GpuMat d_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);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpSphericalMaps, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
// Rotate
-GPU_PERF_TEST(Rotate, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation)
-{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+DEF_PARAM_TEST(Sz_Depth_Cn_Inter, cv::Size, MatDepth, int, Interpolation);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+PERF_TEST_P(Sz_Depth_Cn_Inter, ImgProc_Rotate, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F),
+ Values(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);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::rotate(src, dst, size, 30.0, 0, 0, interpolation);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::rotate(src, dst, size, 30.0, 0, 0, interpolation);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::rotate(d_src, d_dst, size, 30.0, 0, 0, interpolation);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::rotate(d_src, d_dst, size, 30.0, 0, 0, interpolation);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, Rotate, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
- testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC))));
-
//////////////////////////////////////////////////////////////////////
// PyrDown
-GPU_PERF_TEST(PyrDown, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Depth_Cn, ImgProc_PyrDown, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F),
+ Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::pyrDown(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::pyrDown(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::pyrDown(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::pyrDown(d_src, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::pyrDown(src, dst);
+
+ TEST_CYCLE()
+ {
+ cv::pyrDown(src, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, PyrDown, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
-
//////////////////////////////////////////////////////////////////////
// PyrUp
-GPU_PERF_TEST(PyrUp, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Depth_Cn, ImgProc_PyrUp, Combine(
+ GPU_TYPICAL_MAT_SIZES,
+ Values(CV_8U, CV_16U, CV_32F),
+ Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::pyrUp(src, dst);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::pyrUp(src, dst);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::pyrUp(d_src, d_dst);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::pyrUp(d_src, d_dst);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::pyrUp(src, dst);
+
+ TEST_CYCLE()
+ {
+ cv::pyrUp(src, dst);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, PyrUp, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
-
//////////////////////////////////////////////////////////////////////
// CvtColor
-GPU_PERF_TEST(CvtColor, cv::gpu::DeviceInfo, cv::Size, MatDepth, CvtColorInfo)
+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))))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ CvtColorInfo info = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- CvtColorInfo info = GET_PARAM(3);
+ cv::Mat src(size, CV_MAKETYPE(depth, info.scn));
+ fillRandom(src);
- cv::Mat src_host(size, CV_MAKETYPE(depth, info.scn));
- fill(src_host, 0, 255);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- if (info.code >= cv::COLOR_BayerBG2BGR && info.code <= cv::COLOR_BayerGR2BGR)
- info.dcn = 4;
-
- cv::gpu::cvtColor(src, dst, info.code, info.dcn);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::cvtColor(src, dst, info.code, info.dcn);
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::cvtColor(d_src, d_dst, info.code, info.dcn);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::cvtColor(d_src, d_dst, info.code, info.dcn);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
+ cv::cvtColor(src, dst, info.code, info.dcn);
+
+ TEST_CYCLE()
+ {
+ cv::cvtColor(src, dst, info.code, info.dcn);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F)),
- testing::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))));
-
//////////////////////////////////////////////////////////////////////
// SwapChannels
-GPU_PERF_TEST(SwapChannels, cv::gpu::DeviceInfo, cv::Size)
+PERF_TEST_P(Sz, ImgProc_SwapChannels, GPU_TYPICAL_MAT_SIZES)
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GetParam();
- cv::Size size = GET_PARAM(1);
-
- cv::Mat src_host(size, CV_8UC4);
- fill(src_host, 0, 255);
-
- cv::gpu::GpuMat src(src_host);
+ cv::Mat src(size, CV_8UC4);
+ fillRandom(src);
const int dstOrder[] = {2, 1, 0, 3};
- cv::gpu::swapChannels(src, dstOrder);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::swapChannels(src, dstOrder);
+ cv::gpu::GpuMat d_src(src);
+
+ cv::gpu::swapChannels(d_src, dstOrder);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::swapChannels(d_src, dstOrder);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, SwapChannels, testing::Combine(ALL_DEVICES, GPU_TYPICAL_MAT_SIZES));
-
//////////////////////////////////////////////////////////////////////
// AlphaComp
CV_ENUM(AlphaOp, cv::gpu::ALPHA_OVER, cv::gpu::ALPHA_IN, cv::gpu::ALPHA_OUT, cv::gpu::ALPHA_ATOP, cv::gpu::ALPHA_XOR, cv::gpu::ALPHA_PLUS, cv::gpu::ALPHA_OVER_PREMUL, cv::gpu::ALPHA_IN_PREMUL, cv::gpu::ALPHA_OUT_PREMUL, cv::gpu::ALPHA_ATOP_PREMUL, cv::gpu::ALPHA_XOR_PREMUL, cv::gpu::ALPHA_PLUS_PREMUL, cv::gpu::ALPHA_PREMUL)
+#define ALL_ALPHA_OPS ValuesIn(AlphaOp::all())
-GPU_PERF_TEST(AlphaComp, cv::gpu::DeviceInfo, cv::Size, MatType, AlphaOp)
+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))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int type = GET_PARAM(1);
+ int alpha_op = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
- int alpha_op = GET_PARAM(3);
+ cv::Mat img1(size, type);
+ fillRandom(img1);
- cv::Mat img1_host(size, type);
- fill(img1_host, 0, 255);
+ cv::Mat img2(size, type);
+ fillRandom(img2);
- cv::Mat img2_host(size, type);
- fill(img2_host, 0, 255);
-
- cv::gpu::GpuMat img1(img1_host);
- cv::gpu::GpuMat img2(img2_host);
- cv::gpu::GpuMat dst;
-
- cv::gpu::alphaComp(img1, img2, dst, alpha_op);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::alphaComp(img1, img2, dst, alpha_op);
+ cv::gpu::GpuMat d_img1(img1);
+ cv::gpu::GpuMat d_img2(img2);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::alphaComp(d_img1, d_img2, d_dst, alpha_op);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::alphaComp(d_img1, d_img2, d_dst, alpha_op);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, AlphaComp, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC4), MatType(CV_16UC4), MatType(CV_32SC4), MatType(CV_32FC4)),
- testing::Values(AlphaOp(cv::gpu::ALPHA_OVER),
- AlphaOp(cv::gpu::ALPHA_IN),
- AlphaOp(cv::gpu::ALPHA_OUT),
- AlphaOp(cv::gpu::ALPHA_ATOP),
- AlphaOp(cv::gpu::ALPHA_XOR),
- AlphaOp(cv::gpu::ALPHA_PLUS),
- AlphaOp(cv::gpu::ALPHA_OVER_PREMUL),
- AlphaOp(cv::gpu::ALPHA_IN_PREMUL),
- AlphaOp(cv::gpu::ALPHA_OUT_PREMUL),
- AlphaOp(cv::gpu::ALPHA_ATOP_PREMUL),
- AlphaOp(cv::gpu::ALPHA_XOR_PREMUL),
- AlphaOp(cv::gpu::ALPHA_PLUS_PREMUL),
- AlphaOp(cv::gpu::ALPHA_PREMUL))));
-
//////////////////////////////////////////////////////////////////////
-// ImagePyramid
+// ImagePyramidBuild
-GPU_PERF_TEST(ImagePyramid_build, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Depth_Cn, ImgProc_ImagePyramidBuild, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
-
- cv::gpu::ImagePyramid pyr;
-
- pyr.build(src, 5);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- pyr.build(src, 5);
+ cv::gpu::GpuMat d_src(src);
+
+ cv::gpu::ImagePyramid d_pyr;
+
+ d_pyr.build(d_src, 5);
+
+ TEST_CYCLE()
+ {
+ d_pyr.build(d_src, 5);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, ImagePyramid_build, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
+//////////////////////////////////////////////////////////////////////
+// ImagePyramidGetLayer
-GPU_PERF_TEST(ImagePyramid_getLayer, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Depth_Cn, ImgProc_ImagePyramidGetLayer, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
+ cv::Size dstSize(size.width / 2 + 10, size.height / 2 + 10);
- cv::gpu::ImagePyramid pyr(src, 3);
-
- pyr.getLayer(dst, cv::Size(size.width / 2 + 10, size.height / 2 + 10));
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- pyr.getLayer(dst, cv::Size(size.width / 2 + 10, size.height / 2 + 10));
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ cv::gpu::ImagePyramid d_pyr(d_src, 3);
+
+ d_pyr.getLayer(d_dst, dstSize);
+
+ TEST_CYCLE()
+ {
+ d_pyr.getLayer(d_dst, dstSize);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, ImagePyramid_getLayer, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
-
//////////////////////////////////////////////////////////////////////
// HoughLines
-IMPLEMENT_PARAM_CLASS(DoSort, bool)
+DEF_PARAM_TEST(Sz_DoSort, cv::Size, bool);
-GPU_PERF_TEST(HoughLines, cv::gpu::DeviceInfo, cv::Size, DoSort)
+PERF_TEST_P(Sz_DoSort, ImgProc_HoughLines, Combine(GPU_TYPICAL_MAT_SIZES, Bool()))
{
declare.time(30.0);
- const cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
- const cv::Size size = GET_PARAM(1);
- const bool doSort = GET_PARAM(2);
+ const cv::Size size = GET_PARAM(0);
+ const bool doSort = GET_PARAM(1);
const float rho = 1.0f;
- const float theta = CV_PI / 180.0f;
+ 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(500, 2000);
+ 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));
@@ -1361,21 +1634,30 @@ GPU_PERF_TEST(HoughLines, cv::gpu::DeviceInfo, cv::Size, DoSort)
cv::line(src, p1, p2, cv::Scalar::all(255), 2);
}
- cv::gpu::GpuMat d_src(src);
- cv::gpu::GpuMat d_lines;
- cv::gpu::GpuMat d_accum;
- cv::gpu::GpuMat d_buf;
- cv::gpu::HoughLines(d_src, d_lines, d_accum, d_buf, rho, theta, threshold, doSort);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_lines;
+ cv::gpu::GpuMat d_accum;
+ cv::gpu::GpuMat d_buf;
+
cv::gpu::HoughLines(d_src, d_lines, d_accum, d_buf, rho, theta, threshold, doSort);
+
+ TEST_CYCLE()
+ {
+ cv::gpu::HoughLines(d_src, d_lines, d_accum, d_buf, rho, theta, threshold, doSort);
+ }
+ }
+ else
+ {
+ std::vector lines;
+ cv::HoughLines(src, lines, rho, theta, threshold);
+
+ TEST_CYCLE()
+ {
+ cv::HoughLines(src, lines, rho, theta, threshold);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ImgProc, HoughLines, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(DoSort(false), DoSort(true))));
-
-#endif
+} // namespace
diff --git a/modules/gpu/perf/perf_labeling.cpp b/modules/gpu/perf/perf_labeling.cpp
index 2c537ebbe..bbab5ecfa 100644
--- a/modules/gpu/perf/perf_labeling.cpp
+++ b/modules/gpu/perf/perf_labeling.cpp
@@ -1,75 +1,141 @@
-/*M///////////////////////////////////////////////////////////////////////////////////////
-//
-// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
-//
-// By downloading, copying, installing or using the software you agree to this license.
-// If you do not agree to this license, do not download, install,
-// copy or use the software.
-//
-//
-// License Agreement
-// For Open Source Computer Vision Library
-//
-// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
-// Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved.
-// Third party copyrights are property of their respective owners.
-//
-// Redistribution and use in source and binary forms, with or without modification,
-// are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// * The name of the copyright holders may not be used to endorse or promote products
-// derived from this software without specific prior written permission.
-//
-// This software is provided by the copyright holders and contributors "as is" and
-// any express or implied warranties, including, but not limited to, the implied
-// warranties of merchantability and fitness for a particular purpose are disclaimed.
-// In no event shall the Intel Corporation or contributors be liable for any direct,
-// indirect, incidental, special, exemplary, or consequential damages
-// (including, but not limited to, procurement of substitute goods or services;
-// loss of use, data, or profits; or business interruption) however caused
-// and on any theory of liability, whether in contract, strict liability,
-// or tort (including negligence or otherwise) arising in any way out of
-// the use of this software, even if advised of the possibility of such damage.
-//M*/
-
#include "perf_precomp.hpp"
-#ifdef HAVE_CUDA
+using namespace std;
+using namespace testing;
-GPU_PERF_TEST(ConnectedComponents, cv::gpu::DeviceInfo, cv::Size)
+namespace {
+
+DEF_PARAM_TEST_1(Image, string);
+
+struct GreedyLabeling
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ struct dot
+ {
+ int x;
+ int y;
- cv::Mat image = readImage("gpu/labeling/aloe-disp.png", cv::IMREAD_GRAYSCALE);
+ static dot make(int i, int j)
+ {
+ dot d; d.x = i; d.y = j;
+ return d;
+ }
+ };
- // cv::threshold(image, image, 150, 255, CV_THRESH_BINARY);
+ struct InInterval
+ {
+ InInterval(const int& _lo, const int& _hi) : lo(-_lo), hi(_hi) {};
+ const int lo, hi;
- cv::gpu::GpuMat mask;
- mask.create(image.rows, image.cols, CV_8UC1);
+ bool operator() (const unsigned char a, const unsigned char b) const
+ {
+ int d = a - b;
+ return lo <= d && d <= hi;
+ }
- cv::gpu::GpuMat components;
- components.create(image.rows, image.cols, CV_32SC1);
+ private:
+ InInterval& operator=(const InInterval&);
- cv::gpu::connectivityMask(cv::gpu::GpuMat(image), mask, cv::Scalar::all(0), cv::Scalar::all(2));
- ASSERT_NO_THROW(cv::gpu::labelComponents(mask, components));
+ };
+ GreedyLabeling(cv::Mat img)
+ : image(img), _labels(image.size(), CV_32SC1, cv::Scalar::all(-1)) {stack = new dot[image.cols * image.rows];}
+
+ ~GreedyLabeling(){delete[] stack;}
+
+ void operator() (cv::Mat labels) const
+ {
+ labels.setTo(cv::Scalar::all(-1));
+ InInterval inInt(0, 2);
+ int cc = -1;
+
+ int* dist_labels = (int*)labels.data;
+ int pitch = static_cast(labels.step1());
+
+ unsigned char* source = (unsigned char*)image.data;
+ int width = image.cols;
+ int height = image.rows;
+
+ for (int j = 0; j < image.rows; ++j)
+ for (int i = 0; i < image.cols; ++i)
+ {
+ if (dist_labels[j * pitch + i] != -1) continue;
+
+ dot* top = stack;
+ dot p = dot::make(i, j);
+ cc++;
+
+ dist_labels[j * pitch + i] = cc;
+
+ while (top >= stack)
+ {
+ int* dl = &dist_labels[p.y * pitch + p.x];
+ unsigned char* sp = &source[p.y * image.step1() + p.x];
+
+ dl[0] = cc;
+
+ //right
+ if( p.x < (width - 1) && dl[ +1] == -1 && inInt(sp[0], sp[+1]))
+ *top++ = dot::make(p.x + 1, p.y);
+
+ //left
+ if( p.x > 0 && dl[-1] == -1 && inInt(sp[0], sp[-1]))
+ *top++ = dot::make(p.x - 1, p.y);
+
+ //bottom
+ if( p.y < (height - 1) && dl[+pitch] == -1 && inInt(sp[0], sp[+image.step1()]))
+ *top++ = dot::make(p.x, p.y + 1);
+
+ //top
+ if( p.y > 0 && dl[-pitch] == -1 && inInt(sp[0], sp[-static_cast(image.step1())]))
+ *top++ = dot::make(p.x, p.y - 1);
+
+ p = *--top;
+ }
+ }
+ }
+
+ cv::Mat image;
+ cv::Mat _labels;
+ dot* stack;
+};
+
+PERF_TEST_P(Image, Labeling_ConnectedComponents, Values("gpu/labeling/aloe-disp.png"))
+{
declare.time(1.0);
- TEST_CYCLE()
+ cv::Mat image = readImage(GetParam(), cv::IMREAD_GRAYSCALE);
+
+ if (runOnGpu)
{
- cv::gpu::labelComponents(mask, components);
+ cv::gpu::GpuMat mask;
+ mask.create(image.rows, image.cols, CV_8UC1);
+
+ 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);
+ }
+ }
+ else
+ {
+ GreedyLabeling host(image);
+
+ host(host._labels);
+
+ declare.time(1.0);
+
+ TEST_CYCLE()
+ {
+ host(host._labels);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Labeling, ConnectedComponents, testing::Combine(ALL_DEVICES, testing::Values(cv::Size(261, 262))));
-
-#endif
\ No newline at end of file
+} // namespace
diff --git a/modules/gpu/perf/perf_main.cpp b/modules/gpu/perf/perf_main.cpp
deleted file mode 100644
index 0cd400277..000000000
--- a/modules/gpu/perf/perf_main.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "perf_precomp.hpp"
-
-#ifdef HAVE_CUDA
-
-int main(int argc, char **argv)
-{
- testing::InitGoogleTest(&argc, argv);
- perf::TestBase::Init(argc, argv);
- return RUN_ALL_TESTS();
-}
-
-#else
-
-int main()
-{
- printf("OpenCV was built without CUDA support\n");
- return 0;
-}
-
-#endif
diff --git a/modules/gpu/perf/perf_matop.cpp b/modules/gpu/perf/perf_matop.cpp
index 5cc24402c..cdae962f2 100644
--- a/modules/gpu/perf/perf_matop.cpp
+++ b/modules/gpu/perf/perf_matop.cpp
@@ -1,141 +1,169 @@
#include "perf_precomp.hpp"
-#ifdef HAVE_CUDA
+using namespace std;
+using namespace testing;
+
+namespace {
//////////////////////////////////////////////////////////////////////
// SetTo
-GPU_PERF_TEST(SetTo, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Depth_Cn, MatOp_SetTo, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F, CV_64F), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::gpu::GpuMat src(size, type);
cv::Scalar val(1, 2, 3, 4);
- src.setTo(val);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
+ cv::gpu::GpuMat d_src(size, type);
+
+ d_src.setTo(val);
+
+ TEST_CYCLE()
+ {
+ d_src.setTo(val);
+ }
+ }
+ else
+ {
+ cv::Mat src(size, type);
+
src.setTo(val);
+
+ TEST_CYCLE()
+ {
+ src.setTo(val);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(MatOp, SetTo, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4),
- MatType(CV_64FC1), MatType(CV_64FC3), MatType(CV_64FC4))));
-
//////////////////////////////////////////////////////////////////////
// SetToMasked
-GPU_PERF_TEST(SetToMasked, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Depth_Cn, MatOp_SetToMasked, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F, CV_64F), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::Mat mask_host(size, CV_8UC1);
- fill(mask_host, 0, 2);
+ cv::Mat mask(size, CV_8UC1);
+ fillRandom(mask, 0, 2);
- cv::gpu::GpuMat src(src_host);
cv::Scalar val(1, 2, 3, 4);
- cv::gpu::GpuMat mask(mask_host);
- src.setTo(val, mask);
+ if (runOnGpu)
+ {
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_mask(mask);
- TEST_CYCLE()
+ d_src.setTo(val, d_mask);
+
+ TEST_CYCLE()
+ {
+ d_src.setTo(val, d_mask);
+ }
+ }
+ else
{
src.setTo(val, mask);
+
+ TEST_CYCLE()
+ {
+ src.setTo(val, mask);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(MatOp, SetToMasked, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4),
- MatType(CV_64FC1), MatType(CV_64FC3), MatType(CV_64FC4))));
-
//////////////////////////////////////////////////////////////////////
// CopyToMasked
-GPU_PERF_TEST(CopyToMasked, cv::gpu::DeviceInfo, cv::Size, MatType)
+PERF_TEST_P(Sz_Depth_Cn, MatOp_CopyToMasked, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F, CV_64F), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth = GET_PARAM(1);
+ int channels = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int type = GET_PARAM(2);
+ int type = CV_MAKE_TYPE(depth, channels);
- cv::Mat src_host(size, type);
- fill(src_host, 0, 255);
+ cv::Mat src(size, type);
+ fillRandom(src);
- cv::Mat mask_host(size, CV_8UC1);
- fill(mask_host, 0, 2);
+ cv::Mat mask(size, CV_8UC1);
+ fillRandom(mask, 0, 2);
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat mask(mask_host);
- cv::gpu::GpuMat dst;
-
- src.copyTo(dst, mask);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_mask(mask);
+ cv::gpu::GpuMat d_dst;
+
+ d_src.copyTo(d_dst, d_mask);
+
+ TEST_CYCLE()
+ {
+ d_src.copyTo(d_dst, d_mask);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
src.copyTo(dst, mask);
+
+ TEST_CYCLE()
+ {
+ src.copyTo(dst, mask);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(MatOp, CopyToMasked, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4),
- MatType(CV_64FC1), MatType(CV_64FC3), MatType(CV_64FC4))));
-
//////////////////////////////////////////////////////////////////////
// ConvertTo
-GPU_PERF_TEST(ConvertTo, cv::gpu::DeviceInfo, cv::Size, MatDepth, MatDepth)
+DEF_PARAM_TEST(Sz_2Depth, cv::Size, MatDepth, MatDepth);
+
+PERF_TEST_P(Sz_2Depth, MatOp_ConvertTo, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F, CV_64F), Values(CV_8U, CV_16U, CV_32F, CV_64F)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Size size = GET_PARAM(0);
+ int depth1 = GET_PARAM(1);
+ int depth2 = GET_PARAM(2);
- cv::Size size = GET_PARAM(1);
- int depth1 = GET_PARAM(2);
- int depth2 = GET_PARAM(3);
+ cv::Mat src(size, depth1);
+ fillRandom(src);
- cv::Mat src_host(size, depth1);
- fill(src_host, 0, 255);
-
- cv::gpu::GpuMat src(src_host);
- cv::gpu::GpuMat dst;
-
- src.convertTo(dst, depth2, 0.5, 1.0);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
+ cv::gpu::GpuMat d_src(src);
+ cv::gpu::GpuMat d_dst;
+
+ d_src.convertTo(d_dst, depth2, 0.5, 1.0);
+
+ TEST_CYCLE()
+ {
+ d_src.convertTo(d_dst, depth2, 0.5, 1.0);
+ }
+ }
+ else
+ {
+ cv::Mat dst;
+
src.convertTo(dst, depth2, 0.5, 1.0);
+
+ TEST_CYCLE()
+ {
+ src.convertTo(dst, depth2, 0.5, 1.0);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(MatOp, ConvertTo, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F), MatDepth(CV_64F)),
- testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F), MatDepth(CV_64F))));
-
-#endif
+} // namespace
diff --git a/modules/gpu/perf/perf_objdetect.cpp b/modules/gpu/perf/perf_objdetect.cpp
index c376586c9..0c4cd5e4c 100644
--- a/modules/gpu/perf/perf_objdetect.cpp
+++ b/modules/gpu/perf/perf_objdetect.cpp
@@ -1,85 +1,131 @@
#include "perf_precomp.hpp"
-#ifdef HAVE_CUDA
+using namespace std;
+using namespace testing;
+
+namespace {
///////////////////////////////////////////////////////////////
// HOG
-GPU_PERF_TEST_1(HOG, cv::gpu::DeviceInfo)
+DEF_PARAM_TEST_1(Image, string);
+
+PERF_TEST_P(Image, ObjDetect_HOG, Values("gpu/hog/road.png"))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(img.empty());
- cv::Mat img_host = readImage("gpu/hog/road.png", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_host.empty());
-
- cv::gpu::GpuMat img(img_host);
std::vector found_locations;
- cv::gpu::HOGDescriptor hog;
- hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector());
-
- hog.detectMultiScale(img, found_locations);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
+ 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);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ObjDetect, HOG, ALL_DEVICES);
-
///////////////////////////////////////////////////////////////
// HaarClassifier
-GPU_PERF_TEST_1(HaarClassifier, cv::gpu::DeviceInfo)
+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")))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(img.empty());
- cv::Mat img_host = readImage("gpu/haarcascade/group_1_640x480_VGA.pgm", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_host.empty());
-
- cv::gpu::CascadeClassifier_GPU cascade;
-
- ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/perf/haarcascade_frontalface_alt.xml")));
-
- cv::gpu::GpuMat img(img_host);
- cv::gpu::GpuMat objects_buffer;
-
- cascade.detectMultiScale(img, objects_buffer);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cascade.detectMultiScale(img, objects_buffer);
+ 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;
+
+ d_cascade.detectMultiScale(d_img, d_objects_buffer);
+
+ TEST_CYCLE()
+ {
+ d_cascade.detectMultiScale(d_img, d_objects_buffer);
+ }
+ }
+ else
+ {
+ cv::CascadeClassifier cascade;
+ ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/perf/haarcascade_frontalface_alt.xml")));
+
+ std::vector rects;
+
+ cascade.detectMultiScale(img, rects);
+
+ TEST_CYCLE()
+ {
+ cascade.detectMultiScale(img, rects);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ObjDetect, HaarClassifier, ALL_DEVICES);
+///////////////////////////////////////////////////////////////
+// LBP cascade
-//===================== LBP cascade ==========================//
-GPU_PERF_TEST_1(LBPClassifier, cv::gpu::DeviceInfo)
+PERF_TEST_P(ImageAndCascade, ObjDetect_LBPClassifier,
+ Values(make_pair("gpu/haarcascade/group_1_640x480_VGA.pgm", "gpu/lbpcascade/lbpcascade_frontalface.xml")))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(img.empty());
- cv::Mat img_host = readImage("gpu/haarcascade/group_1_640x480_VGA.pgm", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_host.empty());
-
-
-
- cv::gpu::GpuMat img(img_host);
- cv::gpu::GpuMat gpu_rects;
- cv::gpu::CascadeClassifier_GPU cascade;
- ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/lbpcascade/lbpcascade_frontalface.xml")));
-
- cascade.detectMultiScale(img, gpu_rects);
- TEST_CYCLE()
+ if (runOnGpu)
{
- cascade.detectMultiScale(img, gpu_rects);
+ 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;
+
+ d_cascade.detectMultiScale(d_img, d_gpu_rects);
+
+ TEST_CYCLE()
+ {
+ d_cascade.detectMultiScale(d_img, d_gpu_rects);
+ }
+ }
+ else
+ {
+ cv::CascadeClassifier cascade;
+ ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/lbpcascade/lbpcascade_frontalface.xml")));
+
+ std::vector rects;
+
+ cascade.detectMultiScale(img, rects);
+
+ TEST_CYCLE()
+ {
+ cascade.detectMultiScale(img, rects);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(ObjDetect, LBPClassifier, ALL_DEVICES);
-
-#endif
+} // namespace
diff --git a/modules/gpu/perf/perf_precomp.hpp b/modules/gpu/perf/perf_precomp.hpp
index 19608bde1..837859947 100644
--- a/modules/gpu/perf/perf_precomp.hpp
+++ b/modules/gpu/perf/perf_precomp.hpp
@@ -11,6 +11,10 @@
#include "cvconfig.h"
+#ifdef HAVE_CUDA
+#include
+#endif
+
#include "opencv2/ts/ts.hpp"
#include "opencv2/ts/ts_perf.hpp"
@@ -18,8 +22,12 @@
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/gpu/gpu.hpp"
#include "opencv2/calib3d/calib3d.hpp"
+#include "opencv2/imgproc/imgproc.hpp"
+#include "opencv2/video/video.hpp"
+#include "opencv2/nonfree/nonfree.hpp"
+#include "opencv2/legacy/legacy.hpp"
-#include "perf_utility.hpp"
+#include "utility.hpp"
#ifdef GTEST_CREATE_SHARED_LIBRARY
#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined
diff --git a/modules/gpu/perf/perf_utility.hpp b/modules/gpu/perf/perf_utility.hpp
deleted file mode 100644
index 8693cfc3c..000000000
--- a/modules/gpu/perf/perf_utility.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef __OPENCV_PERF_GPU_UTILITY_HPP__
-#define __OPENCV_PERF_GPU_UTILITY_HPP__
-
-void fill(cv::Mat& m, double a, double b);
-
-using perf::MatType;
-using perf::MatDepth;
-
-CV_ENUM(BorderMode, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP)
- CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC, cv::INTER_AREA)
-CV_ENUM(NormType, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2, cv::NORM_HAMMING)
-
-struct CvtColorInfo
-{
- int scn;
- int dcn;
- int code;
-
- explicit CvtColorInfo(int scn_=0, int dcn_=0, int code_=0) : scn(scn_), dcn(dcn_), code(code_) {}
-};
-
-void PrintTo(const CvtColorInfo& info, std::ostream* os);
-
-#define IMPLEMENT_PARAM_CLASS(name, type) \
- class name \
- { \
- public: \
- name ( type arg = type ()) : val_(arg) {} \
- operator type () const {return val_;} \
- private: \
- type val_; \
- }; \
- inline void PrintTo( name param, std::ostream* os) \
- { \
- *os << #name << " = " << testing::PrintToString(static_cast< type >(param)); \
- }
-
-IMPLEMENT_PARAM_CLASS(Channels, int)
-
-namespace cv { namespace gpu
-{
- void PrintTo(const cv::gpu::DeviceInfo& info, std::ostream* os);
-}}
-
-#define GPU_PERF_TEST(name, ...) \
- struct name : perf::TestBaseWithParam< std::tr1::tuple< __VA_ARGS__ > > \
- { \
- public: \
- name() {} \
- protected: \
- void PerfTestBody(); \
- }; \
- TEST_P(name, perf){ RunPerfTestBody(); } \
- void name :: PerfTestBody()
-
-#define GPU_PERF_TEST_1(name, param_type) \
- struct name : perf::TestBaseWithParam< param_type > \
- { \
- public: \
- name() {} \
- protected: \
- void PerfTestBody(); \
- }; \
- TEST_P(name, perf){ RunPerfTestBody(); } \
- void name :: PerfTestBody()
-
-#define GPU_TYPICAL_MAT_SIZES testing::Values(perf::szSXGA, perf::sz1080p, cv::Size(1800, 1500))
-
-cv::Mat readImage(const std::string& fileName, int flags = cv::IMREAD_COLOR);
-
-const std::vector& devices();
-
-#define ALL_DEVICES testing::ValuesIn(devices())
-
-#define GET_PARAM(k) std::tr1::get< k >(GetParam())
-
-#endif // __OPENCV_PERF_GPU_UTILITY_HPP__
diff --git a/modules/gpu/perf/perf_video.cpp b/modules/gpu/perf/perf_video.cpp
index 6e577a4a4..8346d25f4 100644
--- a/modules/gpu/perf/perf_video.cpp
+++ b/modules/gpu/perf/perf_video.cpp
@@ -1,305 +1,377 @@
#include "perf_precomp.hpp"
-#ifdef HAVE_CUDA
+using namespace std;
+using namespace testing;
+
+namespace cv
+{
+ template<> void Ptr::delete_obj()
+ {
+ cvReleaseBGStatModel(&obj);
+ }
+}
+
+namespace {
//////////////////////////////////////////////////////
// BroxOpticalFlow
-GPU_PERF_TEST_1(BroxOpticalFlow, cv::gpu::DeviceInfo)
+typedef pair pair_string;
+
+DEF_PARAM_TEST_1(ImagePair, pair_string);
+
+PERF_TEST_P(ImagePair, Video_BroxOpticalFlow, Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Mat frame0_host = readImage("gpu/opticalflow/frame0.png", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(frame0_host.empty());
-
- cv::Mat frame1_host = readImage("gpu/opticalflow/frame1.png", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(frame1_host.empty());
-
- frame0_host.convertTo(frame0_host, CV_32FC1, 1.0 / 255.0);
- frame1_host.convertTo(frame1_host, CV_32FC1, 1.0 / 255.0);
-
- cv::gpu::GpuMat frame0(frame0_host);
- cv::gpu::GpuMat frame1(frame1_host);
- 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(frame0, frame1, u, v);
-
declare.time(10);
- TEST_CYCLE()
+ 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 (runOnGpu)
{
- d_flow(frame0, frame1, u, v);
+ 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);
+
+ TEST_CYCLE()
+ {
+ d_flow(d_frame0, d_frame1, d_u, d_v);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Video, BroxOpticalFlow, ALL_DEVICES);
-
//////////////////////////////////////////////////////
// InterpolateFrames
-GPU_PERF_TEST_1(InterpolateFrames, cv::gpu::DeviceInfo)
+PERF_TEST_P(ImagePair, Video_InterpolateFrames, Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(frame0.empty());
- cv::Mat frame0_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(frame0_host.empty());
+ cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(frame1.empty());
- cv::Mat frame1_host = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(frame1_host.empty());
+ frame0.convertTo(frame0, CV_32FC1, 1.0 / 255.0);
+ frame1.convertTo(frame1, CV_32FC1, 1.0 / 255.0);
- frame0_host.convertTo(frame0_host, CV_32FC1, 1.0 / 255.0);
- frame1_host.convertTo(frame1_host, CV_32FC1, 1.0 / 255.0);
-
- cv::gpu::GpuMat frame0(frame0_host);
- cv::gpu::GpuMat frame1(frame1_host);
- cv::gpu::GpuMat fu, fv;
- cv::gpu::GpuMat bu, 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(frame0, frame1, fu, fv);
- d_flow(frame1, frame0, bu, bv);
-
- cv::gpu::GpuMat newFrame;
- cv::gpu::GpuMat buf;
-
- cv::gpu::interpolateFrames(frame0, frame1, fu, fv, bu, bv, 0.5f, newFrame, buf);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::interpolateFrames(frame0, frame1, fu, fv, bu, bv, 0.5f, newFrame, buf);
+ 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);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Video, InterpolateFrames, ALL_DEVICES);
-
//////////////////////////////////////////////////////
// CreateOpticalFlowNeedleMap
-GPU_PERF_TEST_1(CreateOpticalFlowNeedleMap, cv::gpu::DeviceInfo)
+PERF_TEST_P(ImagePair, Video_CreateOpticalFlowNeedleMap, Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
+ cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(frame0.empty());
- cv::Mat frame0_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(frame0_host.empty());
+ cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(frame1.empty());
- cv::Mat frame1_host = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(frame1_host.empty());
+ frame0.convertTo(frame0, CV_32FC1, 1.0 / 255.0);
+ frame1.convertTo(frame1, CV_32FC1, 1.0 / 255.0);
- frame0_host.convertTo(frame0_host, CV_32FC1, 1.0 / 255.0);
- frame1_host.convertTo(frame1_host, CV_32FC1, 1.0 / 255.0);
-
- cv::gpu::GpuMat frame0(frame0_host);
- cv::gpu::GpuMat frame1(frame1_host);
- cv::gpu::GpuMat u, 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(frame0, frame1, u, v);
-
- cv::gpu::GpuMat vertex, colors;
-
- cv::gpu::createOpticalFlowNeedleMap(u, v, vertex, colors);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- cv::gpu::createOpticalFlowNeedleMap(u, v, vertex, colors);
+ 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);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Video, CreateOpticalFlowNeedleMap, ALL_DEVICES);
-
//////////////////////////////////////////////////////
// GoodFeaturesToTrack
-IMPLEMENT_PARAM_CLASS(MinDistance, double)
+DEF_PARAM_TEST(Image_MinDistance, string, double);
-GPU_PERF_TEST(GoodFeaturesToTrack, cv::gpu::DeviceInfo, MinDistance)
+PERF_TEST_P(Image_MinDistance, Video_GoodFeaturesToTrack, Combine(Values("gpu/perf/aloe.jpg"), Values(0.0, 3.0)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
+ string fileName = GET_PARAM(0);
double minDistance = GET_PARAM(1);
- cv::Mat image_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(image_host.empty());
+ cv::Mat image = readImage(fileName, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(image.empty());
- cv::gpu::GoodFeaturesToTrackDetector_GPU detector(8000, 0.01, minDistance);
-
- cv::gpu::GpuMat image(image_host);
- cv::gpu::GpuMat pts;
-
- detector(image, pts);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- detector(image, pts);
+ 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);
+ }
+ }
+ else
+ {
+ cv::Mat pts;
+
+ cv::goodFeaturesToTrack(image, pts, 8000, 0.01, minDistance);
+
+ TEST_CYCLE()
+ {
+ cv::goodFeaturesToTrack(image, pts, 8000, 0.01, minDistance);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Video, GoodFeaturesToTrack, testing::Combine(
- ALL_DEVICES,
- testing::Values(MinDistance(0.0), MinDistance(3.0))));
-
//////////////////////////////////////////////////////
// PyrLKOpticalFlowSparse
-IMPLEMENT_PARAM_CLASS(GraySource, bool)
-IMPLEMENT_PARAM_CLASS(Points, int)
-IMPLEMENT_PARAM_CLASS(WinSize, int)
-IMPLEMENT_PARAM_CLASS(Levels, int)
-IMPLEMENT_PARAM_CLASS(Iters, int)
+DEF_PARAM_TEST(ImagePair_Gray_NPts_WinSz_Levels_Iters, pair_string, bool, int, int, int, int);
-GPU_PERF_TEST(PyrLKOpticalFlowSparse, cv::gpu::DeviceInfo, GraySource, Points, WinSize, Levels, Iters)
+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)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+ 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);
- cv::Mat frame0_host = readImage("gpu/opticalflow/frame0.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
- ASSERT_FALSE(frame0_host.empty());
+ cv::Mat frame0 = readImage(imagePair.first, useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
+ ASSERT_FALSE(frame0.empty());
- cv::Mat frame1_host = readImage("gpu/opticalflow/frame1.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
- ASSERT_FALSE(frame1_host.empty());
+ cv::Mat frame1 = readImage(imagePair.second, useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
+ ASSERT_FALSE(frame1.empty());
cv::Mat gray_frame;
if (useGray)
- gray_frame = frame0_host;
+ gray_frame = frame0;
else
- cv::cvtColor(frame0_host, gray_frame, cv::COLOR_BGR2GRAY);
+ cv::cvtColor(frame0, gray_frame, cv::COLOR_BGR2GRAY);
- cv::gpu::GpuMat pts;
+ cv::Mat pts;
+ cv::goodFeaturesToTrack(gray_frame, pts, points, 0.01, 0.0);
- cv::gpu::GoodFeaturesToTrackDetector_GPU detector(points, 0.01, 0.0);
- detector(cv::gpu::GpuMat(gray_frame), pts);
-
- cv::gpu::PyrLKOpticalFlow pyrLK;
- pyrLK.winSize = cv::Size(winSize, winSize);
- pyrLK.maxLevel = levels - 1;
- pyrLK.iters = iters;
-
- cv::gpu::GpuMat frame0(frame0_host);
- cv::gpu::GpuMat frame1(frame1_host);
- cv::gpu::GpuMat nextPts;
- cv::gpu::GpuMat status;
-
- pyrLK.sparse(frame0, frame1, pts, nextPts, status);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- pyrLK.sparse(frame0, frame1, pts, nextPts, status);
+ cv::gpu::GpuMat d_pts(pts);
+
+ 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;
+
+ d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status);
+
+ TEST_CYCLE()
+ {
+ d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_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(),
+ cv::Size(winSize, winSize), levels - 1,
+ cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, iters, 0.01));
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Video, PyrLKOpticalFlowSparse, testing::Combine(
- ALL_DEVICES,
- testing::Values(GraySource(true), GraySource(false)),
- testing::Values(Points(1000), Points(2000), Points(4000), Points(8000)),
- testing::Values(WinSize(9), WinSize(13), WinSize(17), WinSize(21)),
- testing::Values(Levels(1), Levels(2), Levels(3)),
- testing::Values(Iters(1), Iters(10), Iters(30))));
-
//////////////////////////////////////////////////////
// PyrLKOpticalFlowDense
-GPU_PERF_TEST(PyrLKOpticalFlowDense, cv::gpu::DeviceInfo, WinSize, Levels, Iters)
-{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+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)))
+{
+ declare.time(30);
+
+ pair_string imagePair = GET_PARAM(0);
int winSize = GET_PARAM(1);
int levels = GET_PARAM(2);
int iters = GET_PARAM(3);
- cv::Mat frame0_host = readImage("gpu/opticalflow/frame0.png", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(frame0_host.empty());
+ cv::Mat frame0 = readImage(imagePair.first, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(frame0.empty());
- cv::Mat frame1_host = readImage("gpu/opticalflow/frame1.png", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(frame1_host.empty());
+ cv::Mat frame1 = readImage(imagePair.second, cv::IMREAD_GRAYSCALE);
+ ASSERT_FALSE(frame1.empty());
- cv::gpu::GpuMat frame0(frame0_host);
- cv::gpu::GpuMat frame1(frame1_host);
- cv::gpu::GpuMat u;
- cv::gpu::GpuMat v;
-
- cv::gpu::PyrLKOpticalFlow pyrLK;
-
- pyrLK.winSize = cv::Size(winSize, winSize);
- pyrLK.maxLevel = levels - 1;
- pyrLK.iters = iters;
-
- pyrLK.dense(frame0, frame1, u, v);
-
- declare.time(30);
-
- TEST_CYCLE()
+ if (runOnGpu)
{
- pyrLK.dense(frame0, frame1, u, v);
+ cv::gpu::GpuMat d_frame0(frame0);
+ cv::gpu::GpuMat d_frame1(frame1);
+ cv::gpu::GpuMat d_u;
+ cv::gpu::GpuMat d_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, d_u, d_v);
+ }
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Video, PyrLKOpticalFlowDense, testing::Combine(
- ALL_DEVICES,
- testing::Values(WinSize(3), WinSize(5), WinSize(7), WinSize(9), WinSize(13), WinSize(17), WinSize(21)),
- testing::Values(Levels(1), Levels(2), Levels(3)),
- testing::Values(Iters(1), Iters(10))));
-
//////////////////////////////////////////////////////
-// FarnebackOpticalFlowTest
+// FarnebackOpticalFlow
-GPU_PERF_TEST_1(FarnebackOpticalFlowTest, cv::gpu::DeviceInfo)
+PERF_TEST_P(ImagePair, Video_FarnebackOpticalFlow, Values(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")))
{
- cv::gpu::DeviceInfo devInfo = GetParam();
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Mat frame0_host = readImage("gpu/opticalflow/frame0.png", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(frame0_host.empty());
-
- cv::Mat frame1_host = readImage("gpu/opticalflow/frame1.png", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(frame1_host.empty());
-
- cv::gpu::GpuMat frame0(frame0_host);
- cv::gpu::GpuMat frame1(frame1_host);
- cv::gpu::GpuMat u;
- cv::gpu::GpuMat v;
-
- cv::gpu::FarnebackOpticalFlow farneback;
-
- farneback(frame0, frame1, u, v);
-
declare.time(10);
- TEST_CYCLE()
+ 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());
+
+ int numLevels = 5;
+ double pyrScale = 0.5;
+ int winSize = 13;
+ int numIters = 10;
+ int polyN = 5;
+ double polySigma = 1.1;
+ int flags = 0;
+
+ if (runOnGpu)
{
- farneback(frame0, frame1, u, v);
+ cv::gpu::GpuMat d_frame0(frame0);
+ cv::gpu::GpuMat d_frame1(frame1);
+ cv::gpu::GpuMat d_u;
+ cv::gpu::GpuMat d_v;
+
+ cv::gpu::FarnebackOpticalFlow d_farneback;
+ d_farneback.numLevels = numLevels;
+ d_farneback.pyrScale = pyrScale;
+ d_farneback.winSize = winSize;
+ d_farneback.numIters = numIters;
+ d_farneback.polyN = polyN;
+ 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, d_u, d_v);
+ }
+ }
+ 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);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Video, FarnebackOpticalFlowTest, ALL_DEVICES);
-
//////////////////////////////////////////////////////
// FGDStatModel
-GPU_PERF_TEST(FGDStatModel, cv::gpu::DeviceInfo, std::string)
-{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+DEF_PARAM_TEST_1(Video, string);
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));
+PERF_TEST_P(Video, Video_FGDStatModel, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"))
+{
+ declare.time(60);
+
+ string inputFile = perf::TestBase::getDataPath(GetParam());
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
@@ -308,52 +380,60 @@ GPU_PERF_TEST(FGDStatModel, cv::gpu::DeviceInfo, std::string)
cap >> frame;
ASSERT_FALSE(frame.empty());
- cv::gpu::GpuMat d_frame(frame);
- cv::gpu::FGDStatModel d_model(4);
- d_model.create(d_frame);
-
- declare.time(10);
-
- for (int i = 0; i < 10; ++i)
+ if (runOnGpu)
{
- cap >> frame;
- ASSERT_FALSE(frame.empty());
+ cv::gpu::GpuMat d_frame(frame);
- d_frame.upload(frame);
+ cv::gpu::FGDStatModel d_model(4);
+ d_model.create(d_frame);
- startTimer(); next();
- d_model.update(d_frame);
- stopTimer();
+ for (int i = 0; i < 10; ++i)
+ {
+ cap >> frame;
+ ASSERT_FALSE(frame.empty());
+
+ d_frame.upload(frame);
+
+ startTimer(); next();
+ d_model.update(d_frame);
+ stopTimer();
+ }
+ }
+ else
+ {
+ IplImage ipl_frame = frame;
+ cv::Ptr model(cvCreateFGDStatModel(&ipl_frame));
+
+ for (int i = 0; i < 10; ++i)
+ {
+ cap >> frame;
+ ASSERT_FALSE(frame.empty());
+
+ ipl_frame = frame;
+
+ startTimer(); next();
+ cvUpdateBGStatModel(&ipl_frame, model);
+ stopTimer();
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Video, FGDStatModel, testing::Combine(
- ALL_DEVICES,
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi"))));
-
//////////////////////////////////////////////////////
// MOG
-IMPLEMENT_PARAM_CLASS(LearningRate, double)
+DEF_PARAM_TEST(Video_Cn_LearningRate, string, int, double);
-GPU_PERF_TEST(MOG, cv::gpu::DeviceInfo, std::string, Channels, LearningRate)
+PERF_TEST_P(Video_Cn_LearningRate, Video_MOG, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), Values(1, 3, 4), Values(0.0, 0.01)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));
- int cn = GET_PARAM(2);
- double learningRate = GET_PARAM(3);
+ string inputFile = perf::TestBase::getDataPath(GET_PARAM(0));
+ int cn = GET_PARAM(1);
+ float learningRate = static_cast(GET_PARAM(2));
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
cv::Mat frame;
- cv::gpu::GpuMat d_frame;
- cv::gpu::MOG_GPU mog;
- cv::gpu::GpuMat foreground;
-
cap >> frame;
ASSERT_FALSE(frame.empty());
@@ -367,59 +447,80 @@ GPU_PERF_TEST(MOG, cv::gpu::DeviceInfo, std::string, Channels, LearningRate)
cv::swap(temp, frame);
}
- d_frame.upload(frame);
-
- mog(d_frame, foreground, learningRate);
-
- for (int i = 0; i < 10; ++i)
+ if (runOnGpu)
{
- cap >> frame;
- ASSERT_FALSE(frame.empty());
+ cv::gpu::GpuMat d_frame(frame);
+ cv::gpu::MOG_GPU d_mog;
+ cv::gpu::GpuMat d_foreground;
- if (cn != 3)
+ d_mog(d_frame, d_foreground, learningRate);
+
+ for (int i = 0; i < 10; ++i)
{
- cv::Mat temp;
- if (cn == 1)
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
- else
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
- cv::swap(temp, frame);
+ cap >> frame;
+ ASSERT_FALSE(frame.empty());
+
+ if (cn != 3)
+ {
+ cv::Mat temp;
+ if (cn == 1)
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
+ else
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
+ cv::swap(temp, frame);
+ }
+
+ d_frame.upload(frame);
+
+ startTimer(); next();
+ d_mog(d_frame, d_foreground, learningRate);
+ stopTimer();
}
+ }
+ else
+ {
+ cv::BackgroundSubtractorMOG mog;
+ cv::Mat foreground;
- d_frame.upload(frame);
+ mog(frame, foreground, learningRate);
- startTimer(); next();
- mog(d_frame, foreground, learningRate);
- stopTimer();
+ for (int i = 0; i < 10; ++i)
+ {
+ cap >> frame;
+ ASSERT_FALSE(frame.empty());
+
+ if (cn != 3)
+ {
+ cv::Mat temp;
+ if (cn == 1)
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
+ else
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
+ cv::swap(temp, frame);
+ }
+
+ startTimer(); next();
+ mog(frame, foreground, learningRate);
+ stopTimer();
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Video, MOG, testing::Combine(
- ALL_DEVICES,
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi")),
- testing::Values(Channels(1), Channels(3), Channels(4)),
- testing::Values(LearningRate(0.0), LearningRate(0.01))));
-
//////////////////////////////////////////////////////
// MOG2
-GPU_PERF_TEST(MOG2_update, cv::gpu::DeviceInfo, std::string, Channels)
-{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
+DEF_PARAM_TEST(Video_Cn, string, int);
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));
- int cn = GET_PARAM(2);
+PERF_TEST_P(Video_Cn, Video_MOG2, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), Values(1, 3, 4)))
+{
+ string inputFile = perf::TestBase::getDataPath(GET_PARAM(0));
+ int cn = GET_PARAM(1);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
cv::Mat frame;
- cv::gpu::GpuMat d_frame;
- cv::gpu::MOG2_GPU mog2;
- cv::gpu::GpuMat foreground;
-
cap >> frame;
ASSERT_FALSE(frame.empty());
@@ -433,99 +534,152 @@ GPU_PERF_TEST(MOG2_update, cv::gpu::DeviceInfo, std::string, Channels)
cv::swap(temp, frame);
}
- d_frame.upload(frame);
-
- mog2(d_frame, foreground);
-
- for (int i = 0; i < 10; ++i)
+ if (runOnGpu)
{
- cap >> frame;
- ASSERT_FALSE(frame.empty());
+ cv::gpu::GpuMat d_frame(frame);
+ cv::gpu::MOG2_GPU d_mog2;
+ cv::gpu::GpuMat d_foreground;
- if (cn != 3)
+ d_mog2(d_frame, d_foreground);
+
+ for (int i = 0; i < 10; ++i)
{
- cv::Mat temp;
- if (cn == 1)
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
- else
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
- cv::swap(temp, frame);
+ cap >> frame;
+ ASSERT_FALSE(frame.empty());
+
+ if (cn != 3)
+ {
+ cv::Mat temp;
+ if (cn == 1)
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
+ else
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
+ cv::swap(temp, frame);
+ }
+
+ d_frame.upload(frame);
+
+ startTimer(); next();
+ d_mog2(d_frame, d_foreground);
+ stopTimer();
}
+ }
+ else
+ {
+ cv::BackgroundSubtractorMOG2 mog2;
+ cv::Mat foreground;
- d_frame.upload(frame);
+ mog2(frame, foreground);
- startTimer(); next();
- mog2(d_frame, foreground);
- stopTimer();
+ for (int i = 0; i < 10; ++i)
+ {
+ cap >> frame;
+ ASSERT_FALSE(frame.empty());
+
+ if (cn != 3)
+ {
+ cv::Mat temp;
+ if (cn == 1)
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
+ else
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
+ cv::swap(temp, frame);
+ }
+
+ startTimer(); next();
+ mog2(frame, foreground);
+ stopTimer();
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Video, MOG2_update, testing::Combine(
- ALL_DEVICES,
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi")),
- testing::Values(Channels(1), Channels(3), Channels(4))));
+//////////////////////////////////////////////////////
+// MOG2GetBackgroundImage
-GPU_PERF_TEST(MOG2_getBackgroundImage, cv::gpu::DeviceInfo, std::string, Channels)
+PERF_TEST_P(Video_Cn, Video_MOG2GetBackgroundImage, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));
- int cn = GET_PARAM(2);
+ string inputFile = perf::TestBase::getDataPath(GET_PARAM(0));
+ int cn = GET_PARAM(1);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
cv::Mat frame;
- cv::gpu::GpuMat d_frame;
- cv::gpu::MOG2_GPU mog2;
- cv::gpu::GpuMat foreground;
-
- for (int i = 0; i < 10; ++i)
+ if (runOnGpu)
{
- cap >> frame;
- ASSERT_FALSE(frame.empty());
+ cv::gpu::GpuMat d_frame;
+ cv::gpu::MOG2_GPU d_mog2;
+ cv::gpu::GpuMat d_foreground;
- if (cn != 3)
+ for (int i = 0; i < 10; ++i)
{
- cv::Mat temp;
- if (cn == 1)
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
- else
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
- cv::swap(temp, frame);
+ cap >> frame;
+ ASSERT_FALSE(frame.empty());
+
+ if (cn != 3)
+ {
+ cv::Mat temp;
+ if (cn == 1)
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
+ else
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
+ cv::swap(temp, frame);
+ }
+
+ d_frame.upload(frame);
+
+ d_mog2(d_frame, d_foreground);
}
- d_frame.upload(frame);
+ cv::gpu::GpuMat d_background;
+ d_mog2.getBackgroundImage(d_background);
- mog2(d_frame, foreground);
+ TEST_CYCLE()
+ {
+ d_mog2.getBackgroundImage(d_background);
+ }
}
-
- cv::gpu::GpuMat background;
- mog2.getBackgroundImage(background);
-
- TEST_CYCLE()
+ else
{
+ cv::BackgroundSubtractorMOG2 mog2;
+ cv::Mat foreground;
+
+ for (int i = 0; i < 10; ++i)
+ {
+ cap >> frame;
+ ASSERT_FALSE(frame.empty());
+
+ if (cn != 3)
+ {
+ cv::Mat temp;
+ if (cn == 1)
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
+ else
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
+ cv::swap(temp, frame);
+ }
+
+ mog2(frame, foreground);
+ }
+
+ cv::Mat background;
mog2.getBackgroundImage(background);
+
+ TEST_CYCLE()
+ {
+ mog2.getBackgroundImage(background);
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Video, MOG2_getBackgroundImage, testing::Combine(
- ALL_DEVICES,
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi")),
- testing::Values(Channels(1), Channels(3), Channels(4))));
-
//////////////////////////////////////////////////////
// VIBE
-GPU_PERF_TEST(VIBE, cv::gpu::DeviceInfo, std::string, Channels)
+PERF_TEST_P(Video_Cn, Video_VIBE, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), Values(1, 3, 4)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));
- int cn = GET_PARAM(2);
+ string inputFile = perf::TestBase::getDataPath(GET_PARAM(0));
+ int cn = GET_PARAM(1);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
@@ -544,52 +698,52 @@ GPU_PERF_TEST(VIBE, cv::gpu::DeviceInfo, std::string, Channels)
cv::swap(temp, frame);
}
- cv::gpu::GpuMat d_frame(frame);
- cv::gpu::VIBE_GPU vibe;
- cv::gpu::GpuMat foreground;
-
- vibe(d_frame, foreground);
-
- for (int i = 0; i < 10; ++i)
+ if (runOnGpu)
{
- cap >> frame;
- ASSERT_FALSE(frame.empty());
+ cv::gpu::GpuMat d_frame(frame);
+ cv::gpu::VIBE_GPU d_vibe;
+ cv::gpu::GpuMat d_foreground;
- if (cn != 3)
+ d_vibe(d_frame, d_foreground);
+
+ for (int i = 0; i < 10; ++i)
{
- cv::Mat temp;
- if (cn == 1)
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
- else
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
- cv::swap(temp, frame);
+ cap >> frame;
+ ASSERT_FALSE(frame.empty());
+
+ if (cn != 3)
+ {
+ cv::Mat temp;
+ if (cn == 1)
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
+ else
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
+ cv::swap(temp, frame);
+ }
+
+ d_frame.upload(frame);
+
+ startTimer(); next();
+ d_vibe(d_frame, d_foreground);
+ stopTimer();
}
-
- d_frame.upload(frame);
-
- startTimer(); next();
- vibe(d_frame, foreground);
- stopTimer();
+ }
+ else
+ {
+ FAIL();
}
}
-INSTANTIATE_TEST_CASE_P(Video, VIBE, testing::Combine(
- ALL_DEVICES,
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi")),
- testing::Values(Channels(1), Channels(3), Channels(4))));
-
//////////////////////////////////////////////////////
// GMG
-IMPLEMENT_PARAM_CLASS(MaxFeatures, int)
+DEF_PARAM_TEST(Video_Cn_MaxFeatures, string, int, int);
-GPU_PERF_TEST(GMG, cv::gpu::DeviceInfo, std::string, Channels, MaxFeatures)
+PERF_TEST_P(Video_Cn_MaxFeatures, Video_GMG, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), Values(1, 3, 4), Values(20, 40, 60)))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));
- int cn = GET_PARAM(2);
- int maxFeatures = GET_PARAM(3);
+ std::string inputFile = perf::TestBase::getDataPath(GET_PARAM(0));
+ int cn = GET_PARAM(1);
+ int maxFeatures = GET_PARAM(2);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
@@ -608,121 +762,173 @@ GPU_PERF_TEST(GMG, cv::gpu::DeviceInfo, std::string, Channels, MaxFeatures)
cv::swap(temp, frame);
}
- cv::gpu::GpuMat d_frame(frame);
- cv::gpu::GpuMat d_fgmask;
-
- cv::gpu::GMG_GPU gmg;
- gmg.maxFeatures = maxFeatures;
-
- gmg(d_frame, d_fgmask);
-
- for (int i = 0; i < 150; ++i)
+ if (runOnGpu)
{
- cap >> frame;
- if (frame.empty())
+ cv::gpu::GpuMat d_frame(frame);
+ cv::gpu::GpuMat d_fgmask;
+
+ cv::gpu::GMG_GPU d_gmg;
+ d_gmg.maxFeatures = maxFeatures;
+
+ d_gmg(d_frame, d_fgmask);
+
+ for (int i = 0; i < 150; ++i)
{
- cap.open(inputFile);
cap >> frame;
- }
+ if (frame.empty())
+ {
+ cap.open(inputFile);
+ cap >> frame;
+ }
- if (cn != 3)
+ if (cn != 3)
+ {
+ cv::Mat temp;
+ if (cn == 1)
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
+ else
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
+ cv::swap(temp, frame);
+ }
+
+ d_frame.upload(frame);
+
+ startTimer(); next();
+ d_gmg(d_frame, d_fgmask);
+ stopTimer();
+ }
+ }
+ else
+ {
+ cv::Mat fgmask;
+ 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);
+
+ for (int i = 0; i < 150; ++i)
{
- cv::Mat temp;
- if (cn == 1)
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
- else
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
- cv::swap(temp, frame);
+ cap >> frame;
+ if (frame.empty())
+ {
+ cap.open(inputFile);
+ cap >> frame;
+ }
+
+ if (cn != 3)
+ {
+ cv::Mat temp;
+ if (cn == 1)
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);
+ else
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);
+ cv::swap(temp, frame);
+ }
+
+ startTimer(); next();
+ gmg(frame, fgmask);
+ stopTimer();
}
-
- d_frame.upload(frame);
-
- startTimer(); next();
- gmg(d_frame, d_fgmask);
- stopTimer();
}
}
-INSTANTIATE_TEST_CASE_P(Video, GMG, testing::Combine(
- ALL_DEVICES,
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi")),
- testing::Values(Channels(1), Channels(3), Channels(4)),
- testing::Values(MaxFeatures(20), MaxFeatures(40), MaxFeatures(60))));
-
//////////////////////////////////////////////////////
// VideoWriter
-#ifdef WIN32
-
-GPU_PERF_TEST(VideoWriter, cv::gpu::DeviceInfo, std::string)
+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 double FPS = 25.0;
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));
- std::string outputFile = cv::tempfile(".avi");
-
cv::VideoCapture reader(inputFile);
ASSERT_TRUE( reader.isOpened() );
- cv::gpu::VideoWriter_GPU d_writer;
-
cv::Mat frame;
- cv::gpu::GpuMat d_frame;
- declare.time(10);
-
- for (int i = 0; i < 10; ++i)
+ if (runOnGpu)
{
- reader >> frame;
- ASSERT_FALSE(frame.empty());
+ cv::gpu::VideoWriter_GPU d_writer;
- d_frame.upload(frame);
+ cv::gpu::GpuMat d_frame;
- if (!d_writer.isOpened())
- d_writer.open(outputFile, frame.size(), FPS);
+ for (int i = 0; i < 10; ++i)
+ {
+ reader >> frame;
+ ASSERT_FALSE(frame.empty());
- startTimer(); next();
- d_writer.write(d_frame);
- stopTimer();
+ d_frame.upload(frame);
+
+ if (!d_writer.isOpened())
+ d_writer.open(outputFile, frame.size(), FPS);
+
+ startTimer(); next();
+ d_writer.write(d_frame);
+ stopTimer();
+ }
+ }
+ else
+ {
+ cv::VideoWriter writer;
+
+ for (int i = 0; i < 10; ++i)
+ {
+ reader >> frame;
+ ASSERT_FALSE(frame.empty());
+
+ if (!writer.isOpened())
+ writer.open(outputFile, CV_FOURCC('X', 'V', 'I', 'D'), FPS, frame.size());
+
+ startTimer(); next();
+ writer.write(frame);
+ stopTimer();
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Video, VideoWriter, testing::Combine(
- ALL_DEVICES,
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi"))));
-
-#endif // WIN32
-
//////////////////////////////////////////////////////
// VideoReader
-GPU_PERF_TEST(VideoReader, cv::gpu::DeviceInfo, std::string)
+PERF_TEST_P(Video, Video_VideoReader, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"))
{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));
-
- cv::gpu::VideoReader_GPU reader(inputFile);
- ASSERT_TRUE( reader.isOpened() );
-
- cv::gpu::GpuMat frame;
-
- reader.read(frame);
-
declare.time(20);
- TEST_CYCLE_N(10)
+ string inputFile = perf::TestBase::getDataPath(GetParam());
+
+ if (runOnGpu)
{
- reader.read(frame);
+ 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);
+ }
+ }
+ else
+ {
+ cv::VideoCapture reader(inputFile);
+ ASSERT_TRUE( reader.isOpened() );
+
+ cv::Mat frame;
+
+ reader >> frame;
+
+ TEST_CYCLE_N(10)
+ {
+ reader >> frame;
+ }
}
}
-INSTANTIATE_TEST_CASE_P(Video, VideoReader, testing::Combine(
- ALL_DEVICES,
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi"))));
-
-#endif
+} // namespace
diff --git a/modules/gpu/perf/perf_utility.cpp b/modules/gpu/perf/utility.cpp
similarity index 81%
rename from modules/gpu/perf/perf_utility.cpp
rename to modules/gpu/perf/utility.cpp
index bf6bdfe73..3be162b93 100644
--- a/modules/gpu/perf/perf_utility.cpp
+++ b/modules/gpu/perf/utility.cpp
@@ -4,12 +4,19 @@ using namespace std;
using namespace cv;
using namespace cv::gpu;
-void fill(Mat& m, double a, double b)
+bool runOnGpu = true;
+
+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)
+{
+ return imread(perf::TestBase::getDataPath(fileName), flags);
+}
+
void PrintTo(const CvtColorInfo& info, ostream* os)
{
static const char* str[] =
@@ -184,37 +191,3 @@ void PrintTo(const CvtColorInfo& info, ostream* os)
*os << str[info.code];
}
-
-void cv::gpu::PrintTo(const DeviceInfo& info, ostream* os)
-{
- *os << info.name();
-}
-
-Mat readImage(const string& fileName, int flags)
-{
- return imread(perf::TestBase::getDataPath(fileName), flags);
-}
-
-const vector& devices()
-{
- static vector devs;
- static bool first = true;
-
- if (first)
- {
- int deviceCount = getCudaEnabledDeviceCount();
-
- devs.reserve(deviceCount);
-
- for (int i = 0; i < deviceCount; ++i)
- {
- DeviceInfo info(i);
- if (info.isCompatible())
- devs.push_back(info);
- }
-
- first = false;
- }
-
- return devs;
-}
diff --git a/modules/gpu/perf/utility.hpp b/modules/gpu/perf/utility.hpp
new file mode 100644
index 000000000..2d21fffb5
--- /dev/null
+++ b/modules/gpu/perf/utility.hpp
@@ -0,0 +1,45 @@
+#ifndef __OPENCV_PERF_GPU_UTILITY_HPP__
+#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"
+
+extern bool runOnGpu;
+
+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;
+using perf::MatDepth;
+
+CV_ENUM(BorderMode, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP)
+#define ALL_BORDER_MODES testing::ValuesIn(BorderMode::all())
+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)
+
+struct CvtColorInfo
+{
+ int scn;
+ int dcn;
+ int code;
+
+ explicit CvtColorInfo(int scn_=0, int dcn_=0, int code_=0) : scn(scn_), dcn(dcn_), code(code_) {}
+};
+void PrintTo(const CvtColorInfo& info, std::ostream* os);
+
+#define GET_PARAM(k) std::tr1::get< k >(GetParam())
+
+#define DEF_PARAM_TEST(name, ...) typedef ::perf::TestBaseWithParam< std::tr1::tuple< __VA_ARGS__ > > name
+#define DEF_PARAM_TEST_1(name, param_type) typedef ::perf::TestBaseWithParam< param_type > name
+
+DEF_PARAM_TEST_1(Sz, cv::Size);
+typedef perf::Size_MatType Sz_Type;
+DEF_PARAM_TEST(Sz_Depth, cv::Size, MatDepth);
+DEF_PARAM_TEST(Sz_Depth_Cn, cv::Size, MatDepth, int);
+
+#define GPU_TYPICAL_MAT_SIZES testing::Values(perf::szSXGA, perf::sz720p, perf::sz1080p)
+
+#endif // __OPENCV_PERF_GPU_UTILITY_HPP__
diff --git a/modules/gpu/perf_cpu/perf_calib3d.cpp b/modules/gpu/perf_cpu/perf_calib3d.cpp
deleted file mode 100644
index 8124b808a..000000000
--- a/modules/gpu/perf_cpu/perf_calib3d.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-#include "perf_cpu_precomp.hpp"
-
-#ifdef HAVE_CUDA
-
-//////////////////////////////////////////////////////////////////////
-// StereoBM
-
-GPU_PERF_TEST_1(StereoBM, cv::gpu::DeviceInfo)
-{
- cv::Mat img_l = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_l.empty());
-
- cv::Mat img_r = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
- ASSERT_FALSE(img_r.empty());
-
- cv::StereoBM bm(0, 256);
-
- cv::Mat dst;
-
- bm(img_l, img_r, dst);
-
- declare.time(5.0);
-
- TEST_CYCLE()
- {
- bm(img_l, img_r, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Calib3D, StereoBM, ALL_DEVICES);
-
-//////////////////////////////////////////////////////////////////////
-// ProjectPoints
-
-IMPLEMENT_PARAM_CLASS(Count, int)
-
-GPU_PERF_TEST(ProjectPoints, cv::gpu::DeviceInfo, Count)
-{
- int count = GET_PARAM(1);
-
- cv::Mat src(1, count, CV_32FC3);
- fill(src, -100, 100);
-
- cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);
- cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);
- cv::Mat camera_mat = cv::Mat::ones(3, 3, CV_32FC1);
- 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);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Calib3D, ProjectPoints, testing::Combine(
- ALL_DEVICES,
- testing::Values(5000, 10000, 20000)));
-
-//////////////////////////////////////////////////////////////////////
-// SolvePnPRansac
-
-GPU_PERF_TEST(SolvePnPRansac, cv::gpu::DeviceInfo, Count)
-{
- int count = GET_PARAM(1);
-
- cv::Mat object(1, count, CV_32FC3);
- fill(object, -100, 100);
-
- cv::Mat camera_mat(3, 3, CV_32FC1);
- fill(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;
- camera_mat.at(2, 1) = 0.f;
-
- cv::Mat dist_coef(1, 8, CV_32F, cv::Scalar::all(0));
-
- std::vector image_vec;
- cv::Mat rvec_gold(1, 3, CV_32FC1);
- fill(rvec_gold, 0, 1);
- cv::Mat tvec_gold(1, 3, CV_32FC1);
- fill(tvec_gold, 0, 1);
- cv::projectPoints(object, rvec_gold, tvec_gold, camera_mat, dist_coef, image_vec);
-
- cv::Mat image(1, count, CV_32FC2, &image_vec[0]);
-
- cv::Mat rvec;
- cv::Mat tvec;
-
- cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
-
- declare.time(10.0);
-
- TEST_CYCLE()
- {
- cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Calib3D, SolvePnPRansac, testing::Combine(
- ALL_DEVICES,
- testing::Values(5000, 10000, 20000)));
-
-//////////////////////////////////////////////////////////////////////
-// ReprojectImageTo3D
-
-GPU_PERF_TEST(ReprojectImageTo3D, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 5.0, 30.0);
-
- cv::Mat Q(4, 4, CV_32FC1);
- fill(Q, 0.1, 1.0);
-
- cv::Mat dst;
-
- cv::reprojectImageTo3D(src, dst, Q);
-
- TEST_CYCLE()
- {
- cv::reprojectImageTo3D(src, dst, Q);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Calib3D, ReprojectImageTo3D, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16S)));
-
-#endif
-
diff --git a/modules/gpu/perf_cpu/perf_core.cpp b/modules/gpu/perf_cpu/perf_core.cpp
deleted file mode 100644
index fb8700958..000000000
--- a/modules/gpu/perf_cpu/perf_core.cpp
+++ /dev/null
@@ -1,1388 +0,0 @@
-#include "perf_cpu_precomp.hpp"
-
-#ifdef HAVE_CUDA
-
-//////////////////////////////////////////////////////////////////////
-// Merge
-
-GPU_PERF_TEST(Merge, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
-
- std::vector src(channels);
- for (int i = 0; i < channels; ++i)
- src[i] = cv::Mat(size, depth, cv::Scalar::all(i));
-
- cv::Mat dst;
-
- cv::merge(src, dst);
-
- TEST_CYCLE()
- {
- cv::merge(src, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Merge, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F),
- testing::Values(2, 3, 4)));
-
-//////////////////////////////////////////////////////////////////////
-// Split
-
-GPU_PERF_TEST(Split, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
-
- cv::Mat src(size, CV_MAKE_TYPE(depth, channels), cv::Scalar(1, 2, 3, 4));
-
- std::vector dst;
-
- cv::split(src, dst);
-
- TEST_CYCLE()
- {
- cv::split(src, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Split, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F),
- testing::Values(2, 3, 4)));
-
-//////////////////////////////////////////////////////////////////////
-// Add_Mat
-
-GPU_PERF_TEST(Add_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src1(size, depth);
- fill(src1, 0.0, 100.0);
-
- cv::Mat src2(size, depth);
- fill(src2, 0.0, 100.0);
-
- cv::Mat dst;
-
- cv::add(src1, src2, dst);
-
- TEST_CYCLE()
- {
- cv::add(src1, src2, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Add_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
-//////////////////////////////////////////////////////////////////////
-// Add_Scalar
-
-GPU_PERF_TEST(Add_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 0.0, 100.0);
-
- cv::Scalar s(1, 2, 3, 4);
- cv::Mat dst;
-
- cv::add(src, s, dst);
-
- TEST_CYCLE()
- {
- cv::add(src, s, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Add_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
-//////////////////////////////////////////////////////////////////////
-// Subtract_Mat
-
-GPU_PERF_TEST(Subtract_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src1(size, depth);
- fill(src1, 0.0, 100.0);
-
- cv::Mat src2(size, depth);
- fill(src2, 0.0, 100.0);
-
- cv::Mat dst;
-
- cv::subtract(src1, src2, dst);
-
- TEST_CYCLE()
- {
- cv::subtract(src1, src2, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Subtract_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
-//////////////////////////////////////////////////////////////////////
-// Subtract_Scalar
-
-GPU_PERF_TEST(Subtract_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 0.0, 100.0);
-
- cv::Scalar s(1, 2, 3, 4);
- cv::Mat dst;
-
- cv::subtract(src, s, dst);
-
- TEST_CYCLE()
- {
- cv::subtract(src, s, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Subtract_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
-//////////////////////////////////////////////////////////////////////
-// Multiply_Mat
-
-GPU_PERF_TEST(Multiply_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src1(size, depth);
- fill(src1, 0.0, 100.0);
-
- cv::Mat src2(size, depth);
- fill(src2, 0.0, 100.0);
-
- cv::Mat dst;
-
- cv::multiply(src1, src2, dst);
-
- TEST_CYCLE()
- {
- cv::multiply(src1, src2, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Multiply_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
-//////////////////////////////////////////////////////////////////////
-// Multiply_Scalar
-
-GPU_PERF_TEST(Multiply_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 0.0, 100.0);
-
- cv::Scalar s(1, 2, 3, 4);
- cv::Mat dst;
-
- cv::multiply(src, s, dst);
-
- TEST_CYCLE()
- {
- cv::multiply(src, s, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Multiply_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
-//////////////////////////////////////////////////////////////////////
-// Divide_Mat
-
-GPU_PERF_TEST(Divide_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src1(size, depth);
- fill(src1, 0.0, 100.0);
-
- cv::Mat src2(size, depth);
- fill(src2, 0.0, 100.0);
-
- cv::Mat dst;
-
- cv::divide(src1, src2, dst);
-
- TEST_CYCLE()
- {
- cv::divide(src1, src2, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Divide_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
-//////////////////////////////////////////////////////////////////////
-// Divide_Scalar
-
-GPU_PERF_TEST(Divide_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 0.0, 100.0);
-
- cv::Scalar s(1, 2, 3, 4);
- cv::Mat dst;
-
- cv::divide(src, s, dst);
-
- TEST_CYCLE()
- {
- cv::divide(src, s, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Divide_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
-//////////////////////////////////////////////////////////////////////
-// Divide_Scalar_Inv
-
-GPU_PERF_TEST(Divide_Scalar_Inv, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 0.0, 100.0);
-
- double scale = 100.0;
- cv::Mat dst;
-
- cv::divide(scale, src, dst);
-
- TEST_CYCLE()
- {
- cv::divide(scale, src, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Divide_Scalar_Inv, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
-//////////////////////////////////////////////////////////////////////
-// AbsDiff_Mat
-
-GPU_PERF_TEST(AbsDiff_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src1(size, depth);
- fill(src1, 0.0, 100.0);
-
- cv::Mat src2(size, depth);
- fill(src2, 0.0, 100.0);
-
- cv::Mat dst;
-
- cv::absdiff(src1, src2, dst);
-
- TEST_CYCLE()
- {
- cv::absdiff(src1, src2, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, AbsDiff_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
-//////////////////////////////////////////////////////////////////////
-// AbsDiff_Scalar
-
-GPU_PERF_TEST(AbsDiff_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 0.0, 100.0);
-
- cv::Scalar s(1, 2, 3, 4);
- cv::Mat dst;
-
- cv::absdiff(src, s, dst);
-
- TEST_CYCLE()
- {
- cv::absdiff(src, s, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, AbsDiff_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F)));
-
-//////////////////////////////////////////////////////////////////////
-// Sqrt
-
-GPU_PERF_TEST(Sqrt, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 0.0, 100.0);
-
- cv::Mat dst;
-
- cv::sqrt(src, dst);
-
- TEST_CYCLE()
- {
- cv::sqrt(src, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Sqrt, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16S, CV_32F)));
-
-//////////////////////////////////////////////////////////////////////
-// Log
-
-GPU_PERF_TEST(Log, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 1.0, 100.0);
-
- cv::Mat dst;
-
- cv::log(src, dst);
-
- TEST_CYCLE()
- {
- cv::log(src, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Log, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16S, CV_32F)));
-
-//////////////////////////////////////////////////////////////////////
-// Exp
-
-GPU_PERF_TEST(Exp, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 1.0, 10.0);
-
- cv::Mat dst;
-
- cv::exp(src, dst);
-
- TEST_CYCLE()
- {
- cv::exp(src, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Exp, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16S, CV_32F)));
-
-//////////////////////////////////////////////////////////////////////
-// Pow
-
-GPU_PERF_TEST(Pow, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 1.0, 10.0);
-
- cv::Mat dst;
-
- cv::pow(src, 2.3, dst);
-
- TEST_CYCLE()
- {
- cv::pow(src, 2.3, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Pow, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16S, CV_32F)));
-
-//////////////////////////////////////////////////////////////////////
-// Compare_Mat
-
-CV_ENUM(CmpCode, cv::CMP_EQ, cv::CMP_GT, cv::CMP_GE, cv::CMP_LT, cv::CMP_LE, cv::CMP_NE)
-#define ALL_CMP_CODES testing::Values(CmpCode(cv::CMP_EQ), CmpCode(cv::CMP_NE), CmpCode(cv::CMP_GT), CmpCode(cv::CMP_GE), CmpCode(cv::CMP_LT), CmpCode(cv::CMP_LE))
-
-GPU_PERF_TEST(Compare_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth, CmpCode)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int cmp_code = GET_PARAM(3);
-
- cv::Mat src1(size, depth);
- fill(src1, 0, 100.0);
-
- cv::Mat src2(size, depth);
- fill(src2, 0, 100.0);
-
- cv::Mat dst;
-
- cv::compare(src1, src2, dst, cmp_code);
-
- TEST_CYCLE()
- {
- cv::compare(src1, src2, dst, cmp_code);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Compare_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F),
- ALL_CMP_CODES));
-
-//////////////////////////////////////////////////////////////////////
-// Compare_Scalar
-
-GPU_PERF_TEST(Compare_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, CmpCode)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int cmp_code = GET_PARAM(3);
-
- cv::Mat src(size, depth);
- fill(src, 0, 100.0);
-
- cv::Scalar s = cv::Scalar::all(50);
- cv::Mat dst;
-
- cv::compare(src, s, dst, cmp_code);
-
- TEST_CYCLE()
- {
- cv::compare(src, s, dst, cmp_code);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Compare_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F),
- ALL_CMP_CODES));
-
-//////////////////////////////////////////////////////////////////////
-// Bitwise_Not
-
-GPU_PERF_TEST(Bitwise_Not, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 0, 100.0);
-
- cv::Mat dst;
-
- cv::bitwise_not(src, dst);
-
- TEST_CYCLE()
- {
- cv::bitwise_not(src, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Not, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S)));
-
-//////////////////////////////////////////////////////////////////////
-// Bitwise_And_Mat
-
-GPU_PERF_TEST(Bitwise_And_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src1(size, depth);
- fill(src1, 0, 100.0);
-
- cv::Mat src2(size, depth);
- fill(src2, 0, 100.0);
-
- cv::Mat dst;
-
- cv::bitwise_and(src1, src2, dst);
-
- TEST_CYCLE()
- {
- cv::bitwise_and(src1, src2, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_And_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S)));
-
-//////////////////////////////////////////////////////////////////////
-// Bitwise_And_Scalar
-
-GPU_PERF_TEST(Bitwise_And_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
-
- int type = CV_MAKE_TYPE(depth, channels);
-
- cv::Mat src(size, type);
- fill(src, 0, 100.0);
-
- cv::Scalar s = cv::Scalar(50, 50, 50, 50);
- cv::Mat dst;
-
- cv::bitwise_and(src, s, dst);
-
- TEST_CYCLE()
- {
- cv::bitwise_and(src, s, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_And_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S),
- testing::Values(1, 3, 4)));
-
-//////////////////////////////////////////////////////////////////////
-// Bitwise_Or_Mat
-
-GPU_PERF_TEST(Bitwise_Or_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src1(size, depth);
- fill(src1, 0, 100.0);
-
- cv::Mat src2(size, depth);
- fill(src2, 0, 100.0);
-
- cv::Mat dst;
-
- cv::bitwise_or(src1, src2, dst);
-
- TEST_CYCLE()
- {
- cv::bitwise_or(src1, src2, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Or_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S)));
-
-//////////////////////////////////////////////////////////////////////
-// Bitwise_Or_Scalar
-
-GPU_PERF_TEST(Bitwise_Or_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
-
- int type = CV_MAKE_TYPE(depth, channels);
-
- cv::Mat src(size, type);
- fill(src, 0, 100.0);
-
- cv::Scalar s = cv::Scalar(50, 50, 50, 50);
- cv::Mat dst;
-
- cv::bitwise_or(src, s, dst);
-
- TEST_CYCLE()
- {
- cv::bitwise_or(src, s, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Or_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S),
- testing::Values(1, 3, 4)));
-
-//////////////////////////////////////////////////////////////////////
-// Bitwise_Xor_Mat
-
-GPU_PERF_TEST(Bitwise_Xor_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src1(size, depth);
- fill(src1, 0, 100.0);
-
- cv::Mat src2(size, depth);
- fill(src2, 0, 100.0);
-
- cv::Mat dst;
-
- cv::bitwise_xor(src1, src2, dst);
-
- TEST_CYCLE()
- {
- cv::bitwise_xor(src1, src2, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Xor_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S)));
-
-//////////////////////////////////////////////////////////////////////
-// Bitwise_Xor_Scalar
-
-GPU_PERF_TEST(Bitwise_Xor_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
- int channels = GET_PARAM(3);
-
- int type = CV_MAKE_TYPE(depth, channels);
-
- cv::Mat src(size, type);
- fill(src, 0, 100.0);
-
- cv::Scalar s = cv::Scalar(50, 50, 50, 50);
- cv::Mat dst;
-
- cv::bitwise_xor(src, s, dst);
-
- TEST_CYCLE()
- {
- cv::bitwise_xor(src, s, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Xor_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32S),
- testing::Values(1, 3, 4)));
-
-//////////////////////////////////////////////////////////////////////
-// Min_Mat
-
-GPU_PERF_TEST(Min_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src1(size, depth);
- fill(src1, 0, 255.0);
-
- cv::Mat src2(size, depth);
- fill(src2, 0, 255.0);
-
- cv::Mat dst;
-
- cv::min(src1, src2, dst);
-
- TEST_CYCLE()
- {
- cv::min(src1, src2, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Min_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F)));
-
-//////////////////////////////////////////////////////////////////////
-// Min_Scalar
-
-GPU_PERF_TEST(Min_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 0, 255.0);
-
- double val = 50.0;
- cv::Mat dst;
-
- cv::min(src, val, dst);
-
- TEST_CYCLE()
- {
- cv::min(src, val, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Min_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F)));
-
-//////////////////////////////////////////////////////////////////////
-// Max_Mat
-
-GPU_PERF_TEST(Max_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src1(size, depth);
- fill(src1, 0, 255.0);
-
- cv::Mat src2(size, depth);
- fill(src2, 0, 255.0);
-
- cv::Mat dst;
-
- cv::max(src1, src2, dst);
-
- TEST_CYCLE()
- {
- cv::max(src1, src2, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Max_Mat, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F)));
-
-//////////////////////////////////////////////////////////////////////
-// Max_Scalar
-
-GPU_PERF_TEST(Max_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth = GET_PARAM(2);
-
- cv::Mat src(size, depth);
- fill(src, 0, 255.0);
-
- double val = 50.0;
- cv::Mat dst;
-
- cv::max(src, val, dst);
-
- TEST_CYCLE()
- {
- cv::max(src, val, dst);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, Max_Scalar, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F)));
-
-//////////////////////////////////////////////////////////////////////
-// AddWeighted
-
-GPU_PERF_TEST(AddWeighted, cv::gpu::DeviceInfo, cv::Size, MatDepth, MatDepth, MatDepth)
-{
- cv::Size size = GET_PARAM(1);
- int depth1 = GET_PARAM(2);
- int depth2 = GET_PARAM(3);
- int dst_depth = GET_PARAM(4);
-
- cv::Mat src1(size, depth1);
- fill(src1, 0, 100.0);
-
- cv::Mat src2(size, depth2);
- fill(src2, 0, 100.0);
-
- cv::Mat dst;
-
- cv::addWeighted(src1, 0.5, src2, 0.5, 10.0, dst, dst_depth);
-
- TEST_CYCLE()
- {
- cv::addWeighted(src1, 0.5, src2, 0.5, 10.0, dst, dst_depth);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Core, AddWeighted, testing::Combine(
- ALL_DEVICES,
- GPU_TYPICAL_MAT_SIZES,
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F),
- testing::Values(CV_8U, CV_16U, CV_32F, CV_64F),
- testing::Values