gapi_video_tests_cpu.cpp 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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) 2020 Intel Corporation
  6. #include "../test_precomp.hpp"
  7. #include "../common/gapi_video_tests.hpp"
  8. #include <opencv2/gapi/cpu/video.hpp>
  9. namespace
  10. {
  11. #define VIDEO_CPU [] () { return cv::compile_args(cv::gapi::video::cpu::kernels()); }
  12. #ifdef HAVE_OPENCV_VIDEO
  13. #define WITH_VIDEO(X) X
  14. #else
  15. #define WITH_VIDEO(X) DISABLED_##X
  16. #endif // HAVE_OPENCV_VIDEO
  17. #define INSTANTIATE_TEST_CASE_MACRO_P(prefix, test_case_name, generator, ...) \
  18. INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, __VA_ARGS__)
  19. } // anonymous namespace
  20. namespace opencv_test
  21. {
  22. INSTANTIATE_TEST_CASE_MACRO_P(WITH_VIDEO(BuildOptFlowPyramidTestCPU), BuildOptFlowPyramidTest,
  23. Combine(Values(VIDEO_CPU),
  24. Values("cv/optflow/rock_1.bmp",
  25. "cv/optflow/frames/1080p_01.png"),
  26. Values(7, 11),
  27. Values(1000),
  28. testing::Bool(),
  29. Values(BORDER_DEFAULT, BORDER_TRANSPARENT),
  30. Values(BORDER_DEFAULT, BORDER_TRANSPARENT),
  31. testing::Bool()));
  32. INSTANTIATE_TEST_CASE_MACRO_P(WITH_VIDEO(BuildOptFlowPyramidInternalTestCPU),
  33. BuildOptFlowPyramidTest,
  34. Combine(Values(VIDEO_CPU),
  35. Values("cv/optflow/rock_1.bmp"),
  36. Values(15),
  37. Values(3),
  38. Values(true),
  39. Values(BORDER_REFLECT_101),
  40. Values(BORDER_CONSTANT),
  41. Values(true)));
  42. INSTANTIATE_TEST_CASE_MACRO_P(WITH_VIDEO(OptFlowLKTestCPU), OptFlowLKTest,
  43. Combine(Values(VIDEO_CPU),
  44. Values("cv/optflow/rock_%01d.bmp",
  45. "cv/optflow/frames/1080p_%02d.png"),
  46. Values(1, 3, 4),
  47. Values(std::make_tuple(9, 9), std::make_tuple(15, 15)),
  48. Values(7, 11),
  49. Values(cv::TermCriteria(cv::TermCriteria::COUNT |
  50. cv::TermCriteria::EPS,
  51. 30, 0.01))));
  52. INSTANTIATE_TEST_CASE_MACRO_P(WITH_VIDEO(OptFlowLKTestForPyrCPU), OptFlowLKTestForPyr,
  53. Combine(Values(VIDEO_CPU),
  54. Values("cv/optflow/rock_%01d.bmp",
  55. "cv/optflow/frames/1080p_%02d.png"),
  56. Values(1, 3, 4),
  57. Values(std::make_tuple(9, 9), std::make_tuple(15, 15)),
  58. Values(7, 11),
  59. Values(cv::TermCriteria(cv::TermCriteria::COUNT |
  60. cv::TermCriteria::EPS,
  61. 30, 0.01)),
  62. testing::Bool()));
  63. INSTANTIATE_TEST_CASE_MACRO_P(WITH_VIDEO(OptFlowLKInternalTestCPU), OptFlowLKTestForPyr,
  64. Combine(Values(VIDEO_CPU),
  65. Values("cv/optflow/rock_%01d.bmp"),
  66. Values(1),
  67. Values(std::make_tuple(10, 10)),
  68. Values(15),
  69. Values(cv::TermCriteria(cv::TermCriteria::COUNT |
  70. cv::TermCriteria::EPS,
  71. 21, 0.05)),
  72. Values(true)));
  73. INSTANTIATE_TEST_CASE_MACRO_P(WITH_VIDEO(BuildPyr_CalcOptFlow_PipelineTestCPU),
  74. BuildPyr_CalcOptFlow_PipelineTest,
  75. Combine(Values(VIDEO_CPU),
  76. Values("cv/optflow/frames/1080p_%02d.png"),
  77. Values(7, 11),
  78. Values(1000),
  79. testing::Bool()));
  80. INSTANTIATE_TEST_CASE_MACRO_P(WITH_VIDEO(BuildPyr_CalcOptFlow_PipelineInternalTestCPU),
  81. BuildPyr_CalcOptFlow_PipelineTest,
  82. Combine(Values(VIDEO_CPU),
  83. Values("cv/optflow/rock_%01d.bmp"),
  84. Values(15),
  85. Values(3),
  86. Values(true)));
  87. INSTANTIATE_TEST_CASE_MACRO_P(WITH_VIDEO(BackgroundSubtractorTestCPU),
  88. BackgroundSubtractorTest,
  89. Combine(Values(VIDEO_CPU),
  90. Values(std::make_tuple(cv::gapi::video::TYPE_BS_MOG2, 16),
  91. std::make_tuple(cv::gapi::video::TYPE_BS_MOG2, 8),
  92. std::make_tuple(cv::gapi::video::TYPE_BS_KNN, 400),
  93. std::make_tuple(cv::gapi::video::TYPE_BS_KNN, 200)),
  94. Values(500, 50),
  95. testing::Bool(),
  96. Values(-1, 0, 0.5, 1),
  97. Values("cv/video/768x576.avi"),
  98. Values(3)));
  99. INSTANTIATE_TEST_CASE_MACRO_P(KalmanFilterTestCPU,
  100. KalmanFilterTest,
  101. Combine(Values(VIDEO_CPU),
  102. Values(CV_32FC1, CV_64FC1),
  103. Values(2,5),
  104. Values(2,5),
  105. Values(2),
  106. Values(5)));
  107. INSTANTIATE_TEST_CASE_MACRO_P(KalmanFilterTestCPU,
  108. KalmanFilterNoControlTest,
  109. Combine(Values(VIDEO_CPU),
  110. Values(CV_32FC1, CV_64FC1),
  111. Values(3),
  112. Values(4),
  113. Values(3)));
  114. INSTANTIATE_TEST_CASE_MACRO_P(KalmanFilterTestCPU,
  115. KalmanFilterCircleSampleTest,
  116. Combine(Values(VIDEO_CPU),
  117. Values(CV_32FC1, CV_64FC1),
  118. Values(5)));
  119. } // opencv_test