gapi_imgproc_tests_gpu.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. //
  5. // Copyright (C) 2018-2019 Intel Corporation
  6. #include "../test_precomp.hpp"
  7. #include "../common/gapi_imgproc_tests.hpp"
  8. namespace
  9. {
  10. #define IMGPROC_GPU [] () { return cv::compile_args(cv::gapi::use_only{cv::gapi::imgproc::gpu::kernels()}); }
  11. } // anonymous namespace
  12. namespace opencv_test
  13. {
  14. INSTANTIATE_TEST_CASE_P(ResizeTestGPU, ResizeTest,
  15. Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
  16. Values(cv::Size(1280, 720),
  17. cv::Size(640, 480),
  18. cv::Size(128, 128)),
  19. Values(-1),
  20. Values(IMGPROC_GPU),
  21. Values(AbsSimilarPoints(2, 0.05).to_compare_obj()),
  22. Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
  23. Values(cv::Size(64,64),
  24. cv::Size(30,30))));
  25. INSTANTIATE_TEST_CASE_P(ResizeTestGPU, ResizeTestFxFy,
  26. Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
  27. Values(cv::Size(1280, 720),
  28. cv::Size(640, 480),
  29. cv::Size(128, 128)),
  30. Values(-1),
  31. Values(IMGPROC_GPU),
  32. Values(AbsSimilarPoints(2, 0.05).to_compare_obj()),
  33. Values(cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_AREA),
  34. Values(0.5, 0.1),
  35. Values(0.5, 0.1)));
  36. INSTANTIATE_TEST_CASE_P(Filter2DTestGPU, Filter2DTest,
  37. Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
  38. Values(cv::Size(1280, 720),
  39. cv::Size(640, 480),
  40. cv::Size(128, 128)),
  41. Values(-1, CV_32F),
  42. Values(IMGPROC_GPU),
  43. Values(Tolerance_FloatRel_IntAbs(1e-5, 2).to_compare_obj()),
  44. Values(cv::Size(3, 3),
  45. cv::Size(4, 4),
  46. cv::Size(5, 5),
  47. cv::Size(7, 7)),
  48. Values(cv::BORDER_DEFAULT)));
  49. INSTANTIATE_TEST_CASE_P(BoxFilterTestGPU, BoxFilterTest,
  50. Combine(Values(/*CV_8UC1,*/ CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
  51. Values(cv::Size(1280, 720),
  52. cv::Size(640, 480)),
  53. Values(-1, CV_32F),
  54. Values(IMGPROC_GPU),
  55. Values(Tolerance_FloatRel_IntAbs(1e-5, 2).to_compare_obj()),
  56. Values(3,5),
  57. Values(cv::BORDER_DEFAULT))); //TODO: 8UC1 doesn't work
  58. INSTANTIATE_TEST_CASE_P(SepFilterTestGPU_8U, SepFilterTest,
  59. Combine(Values(CV_8UC1, CV_8UC3),
  60. Values(cv::Size(1280, 720),
  61. cv::Size(640, 480)),
  62. Values(-1, CV_16S, CV_32F),
  63. Values(IMGPROC_GPU),
  64. Values(ToleranceFilter(1e-4f, 0.01).to_compare_obj()),
  65. Values(3)));
  66. INSTANTIATE_TEST_CASE_P(SepFilterTestGPU_other, SepFilterTest,
  67. Combine(Values(CV_16UC1, CV_16SC1, CV_32FC1),
  68. Values(cv::Size(1280, 720),
  69. cv::Size(640, 480)),
  70. Values(-1, CV_32F),
  71. Values(IMGPROC_GPU),
  72. Values(ToleranceFilter(1e-4f, 0.01).to_compare_obj()),
  73. Values(3)));
  74. INSTANTIATE_TEST_CASE_P(BlurTestGPU, BlurTest,
  75. Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
  76. Values(cv::Size(1280, 720),
  77. cv::Size(640, 480)),
  78. Values(-1),
  79. Values(IMGPROC_GPU),
  80. Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_obj()),
  81. Values(3,5),
  82. Values(cv::BORDER_DEFAULT)));
  83. INSTANTIATE_TEST_CASE_P(gaussBlurTestGPU, GaussianBlurTest,
  84. Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
  85. Values(cv::Size(1280, 720),
  86. cv::Size(640, 480)),
  87. Values(-1),
  88. Values(IMGPROC_GPU),
  89. Values(ToleranceFilter(1e-5f, 0.01).to_compare_obj()),
  90. Values(3))); // FIXIT 5
  91. INSTANTIATE_TEST_CASE_P(MedianBlurTestGPU, MedianBlurTest,
  92. Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
  93. Values(cv::Size(1280, 720),
  94. cv::Size(640, 480)),
  95. Values(-1),
  96. Values(IMGPROC_GPU),
  97. Values(AbsExact().to_compare_obj()),
  98. Values(3, 5)));
  99. INSTANTIATE_TEST_CASE_P(ErodeTestGPU, ErodeTest,
  100. Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
  101. Values(cv::Size(1280, 720),
  102. cv::Size(640, 480)),
  103. Values(-1),
  104. Values(IMGPROC_GPU),
  105. Values(AbsExact().to_compare_obj()),
  106. Values(3, 5),
  107. Values(cv::MorphShapes::MORPH_RECT,
  108. cv::MorphShapes::MORPH_CROSS,
  109. cv::MorphShapes::MORPH_ELLIPSE)));
  110. INSTANTIATE_TEST_CASE_P(Erode3x3TestGPU, Erode3x3Test,
  111. Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
  112. Values(cv::Size(1280, 720),
  113. cv::Size(640, 480)),
  114. Values(-1),
  115. Values(IMGPROC_GPU),
  116. Values(AbsExact().to_compare_obj()),
  117. Values(1,2,4)));
  118. INSTANTIATE_TEST_CASE_P(DilateTestGPU, DilateTest,
  119. Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
  120. Values(cv::Size(1280, 720),
  121. cv::Size(640, 480)),
  122. Values(-1),
  123. Values(IMGPROC_GPU),
  124. Values(AbsExact().to_compare_obj()),
  125. Values(3, 5),
  126. Values(cv::MorphShapes::MORPH_RECT,
  127. cv::MorphShapes::MORPH_CROSS,
  128. cv::MorphShapes::MORPH_ELLIPSE)));
  129. INSTANTIATE_TEST_CASE_P(Dilate3x3TestGPU, Dilate3x3Test,
  130. Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1),
  131. Values(cv::Size(1280, 720),
  132. cv::Size(640, 480)),
  133. Values(-1),
  134. Values(IMGPROC_GPU),
  135. Values(AbsExact().to_compare_obj()),
  136. Values(1,2,4)));
  137. INSTANTIATE_TEST_CASE_P(SobelTestGPU, SobelTest,
  138. Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
  139. Values(cv::Size(1280, 720),
  140. cv::Size(640, 480)),
  141. Values(-1, CV_16S, CV_32F),
  142. Values(IMGPROC_GPU),
  143. Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_obj()),
  144. Values(3, 5),
  145. Values(0, 1),
  146. Values(1, 2)));
  147. INSTANTIATE_TEST_CASE_P(SobelTestGPU32F, SobelTest,
  148. Combine(Values(CV_32FC1),
  149. Values(cv::Size(1280, 720),
  150. cv::Size(640, 480)),
  151. Values(CV_32F),
  152. Values(IMGPROC_GPU),
  153. Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_obj()),
  154. Values(3, 5),
  155. Values(0, 1),
  156. Values(1, 2)));
  157. INSTANTIATE_TEST_CASE_P(LaplacianTestGPU, LaplacianTest,
  158. Combine(Values(CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1),
  159. Values(cv::Size(1280, 720),
  160. cv::Size(640, 480)),
  161. Values(-1),
  162. Values(IMGPROC_GPU),
  163. Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_obj()),
  164. Values(5),
  165. Values(3.0),
  166. Values(BORDER_DEFAULT)));
  167. INSTANTIATE_TEST_CASE_P(BilateralFilterTestGPU, BilateralFilterTest,
  168. Combine(Values(CV_32FC1, CV_32FC3, CV_8UC1, CV_8UC3),
  169. Values(cv::Size(1280, 720),
  170. cv::Size(640, 480)),
  171. Values(-1),
  172. Values(IMGPROC_GPU),
  173. Values(Tolerance_FloatRel_IntAbs(1e-4, 2).to_compare_obj()),
  174. Values(9),
  175. Values(100),
  176. Values(40),
  177. Values(BORDER_DEFAULT)));
  178. INSTANTIATE_TEST_CASE_P(EqHistTestGPU, EqHistTest,
  179. Combine(Values(CV_8UC1),
  180. Values(cv::Size(1280, 720),
  181. cv::Size(640, 480)),
  182. Values(-1),
  183. Values(IMGPROC_GPU),
  184. Values(AbsExact().to_compare_obj()))); // FIXIT Non reliable check
  185. INSTANTIATE_TEST_CASE_P(CannyTestGPU, CannyTest,
  186. Combine(Values(CV_8UC1, CV_8UC3),
  187. Values(cv::Size(1280, 720),
  188. cv::Size(640, 480)),
  189. Values(CV_8UC1),
  190. Values(IMGPROC_GPU),
  191. Values(AbsSimilarPoints(0, 0.05).to_compare_obj()),
  192. Values(3.0, 120.0),
  193. Values(125.0, 240.0),
  194. Values(3, 5),
  195. testing::Bool()));
  196. INSTANTIATE_TEST_CASE_P(RGB2GrayTestGPU, RGB2GrayTest,
  197. Combine(Values(CV_8UC3),
  198. Values(cv::Size(1280, 720),
  199. cv::Size(640, 480)),
  200. Values(CV_8UC1),
  201. Values(IMGPROC_GPU),
  202. Values(ToleranceColor(1e-3).to_compare_obj())));
  203. INSTANTIATE_TEST_CASE_P(BGR2GrayTestGPU, BGR2GrayTest,
  204. Combine(Values(CV_8UC3),
  205. Values(cv::Size(1280, 720),
  206. cv::Size(640, 480)),
  207. Values(CV_8UC1),
  208. Values(IMGPROC_GPU),
  209. Values(ToleranceColor(1e-3).to_compare_obj())));
  210. INSTANTIATE_TEST_CASE_P(RGB2YUVTestGPU, RGB2YUVTest,
  211. Combine(Values(CV_8UC3),
  212. Values(cv::Size(1280, 720),
  213. cv::Size(640, 480)),
  214. Values(CV_8UC3),
  215. Values(IMGPROC_GPU),
  216. Values(ToleranceColor(1e-3).to_compare_obj())));
  217. INSTANTIATE_TEST_CASE_P(YUV2RGBTestGPU, YUV2RGBTest,
  218. Combine(Values(CV_8UC3),
  219. Values(cv::Size(1280, 720),
  220. cv::Size(640, 480)),
  221. Values(CV_8UC3),
  222. Values(IMGPROC_GPU),
  223. Values(ToleranceColor(1e-3).to_compare_obj())));
  224. INSTANTIATE_TEST_CASE_P(RGB2LabTestGPU, RGB2LabTest,
  225. Combine(Values(CV_8UC3),
  226. Values(cv::Size(1280, 720),
  227. cv::Size(640, 480)),
  228. Values(CV_8UC3),
  229. Values(IMGPROC_GPU),
  230. Values(AbsSimilarPoints(1, 0.05).to_compare_obj())));
  231. INSTANTIATE_TEST_CASE_P(BGR2LUVTestGPU, BGR2LUVTest,
  232. Combine(Values(CV_8UC3),
  233. Values(cv::Size(1280, 720),
  234. cv::Size(640, 480)),
  235. Values(CV_8UC3),
  236. Values(IMGPROC_GPU),
  237. Values(ToleranceColor(5e-3, 6).to_compare_obj())));
  238. INSTANTIATE_TEST_CASE_P(LUV2BGRTestGPU, LUV2BGRTest,
  239. Combine(Values(CV_8UC3),
  240. Values(cv::Size(1280, 720),
  241. cv::Size(640, 480)),
  242. Values(CV_8UC3),
  243. Values(IMGPROC_GPU),
  244. Values(ToleranceColor(1e-3).to_compare_obj())));
  245. INSTANTIATE_TEST_CASE_P(BGR2YUVTestGPU, BGR2YUVTest,
  246. Combine(Values(CV_8UC3),
  247. Values(cv::Size(1280, 720),
  248. cv::Size(640, 480)),
  249. Values(CV_8UC3),
  250. Values(IMGPROC_GPU),
  251. Values(ToleranceColor(1e-3).to_compare_obj())));
  252. INSTANTIATE_TEST_CASE_P(YUV2BGRTestGPU, YUV2BGRTest,
  253. Combine(Values(CV_8UC3),
  254. Values(cv::Size(1280, 720),
  255. cv::Size(640, 480)),
  256. Values(CV_8UC3),
  257. Values(IMGPROC_GPU),
  258. Values(ToleranceColor(1e-3).to_compare_obj())));
  259. } // opencv_test