perf_run_length_morphology.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. #include "perf_precomp.hpp"
  5. namespace opencv_test {
  6. namespace {
  7. typedef tuple<int, Size, int> RLParams;
  8. typedef TestBaseWithParam<RLParams> RLMorphologyPerfTest;
  9. PERF_TEST_P(RLMorphologyPerfTest, perf, Combine(Values(1,7, 21), Values(sz720p, sz2160p),
  10. Values(MORPH_ERODE, MORPH_DILATE, MORPH_OPEN, MORPH_CLOSE, MORPH_GRADIENT,MORPH_TOPHAT, MORPH_BLACKHAT)))
  11. {
  12. RLParams params = GetParam();
  13. int seSize = get<0>(params);
  14. Size sz = get<1>(params);
  15. int op = get<2>(params);
  16. Mat src(sz, CV_8U);
  17. Mat thresholded, dstRLE;
  18. Mat se = rl::getStructuringElement(MORPH_ELLIPSE, cv::Size(2 * seSize + 1, 2 * seSize + 1));
  19. declare.in(src, WARMUP_RNG);
  20. TEST_CYCLE_N(4)
  21. {
  22. rl::threshold(src, thresholded, 100.0, THRESH_BINARY);
  23. rl::morphologyEx(thresholded, dstRLE, op, se);
  24. }
  25. SANITY_CHECK_NOTHING();
  26. }
  27. }
  28. } // namespace