perf_variational_refinement.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 { namespace {
  6. typedef tuple<Size, int, int> VarRefParams;
  7. typedef TestBaseWithParam<VarRefParams> DenseOpticalFlow_VariationalRefinement;
  8. PERF_TEST_P(DenseOpticalFlow_VariationalRefinement, perf, Combine(Values(szQVGA, szVGA), Values(5, 10), Values(5, 10)))
  9. {
  10. VarRefParams params = GetParam();
  11. Size sz = get<0>(params);
  12. int sorIter = get<1>(params);
  13. int fixedPointIter = get<2>(params);
  14. Mat frame1(sz, CV_8U);
  15. Mat frame2(sz, CV_8U);
  16. Mat flow(sz, CV_32FC2);
  17. randu(frame1, 0, 255);
  18. randu(frame2, 0, 255);
  19. flow.setTo(0.0f);
  20. TEST_CYCLE_N(10)
  21. {
  22. Ptr<VariationalRefinement> var = VariationalRefinement::create();
  23. var->setAlpha(20.0f);
  24. var->setGamma(10.0f);
  25. var->setDelta(5.0f);
  26. var->setSorIterations(sorIter);
  27. var->setFixedPointIterations(fixedPointIter);
  28. var->calc(frame1, frame2, flow);
  29. }
  30. SANITY_CHECK_NOTHING();
  31. }
  32. }} // namespace