perf_retina.ocl.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #include "opencv2/ts/ocl_perf.hpp"
  6. namespace opencv_test { namespace {
  7. ///////////////////////// Retina ////////////////////////
  8. typedef tuple<bool, int, double, double> RetinaParams;
  9. typedef TestBaseWithParam<RetinaParams> RetinaFixture;
  10. OCL_PERF_TEST_P(RetinaFixture, Retina,
  11. ::testing::Combine(testing::Bool(), testing::Values((int)cv::bioinspired::RETINA_COLOR_BAYER),
  12. testing::Values(1.0, 0.5), testing::Values(10.0, 5.0)))
  13. {
  14. RetinaParams params = GetParam();
  15. bool colorMode = get<0>(params), useLogSampling = false;
  16. int colorSamplingMethod = get<1>(params);
  17. float reductionFactor = static_cast<float>(get<2>(params));
  18. float samplingStrength = static_cast<float>(get<3>(params));
  19. Mat input = imread(getDataPath("cv/shared/lena.png"), colorMode);
  20. ASSERT_FALSE(input.empty());
  21. UMat ocl_parvo, ocl_magno;
  22. {
  23. Ptr<cv::bioinspired::Retina> retina = cv::bioinspired::Retina::create(
  24. input.size(), colorMode, colorSamplingMethod, useLogSampling,
  25. reductionFactor, samplingStrength);
  26. OCL_TEST_CYCLE()
  27. {
  28. retina->run(input);
  29. retina->getParvo(ocl_parvo);
  30. retina->getMagno(ocl_magno);
  31. }
  32. }
  33. SANITY_CHECK_NOTHING();
  34. }
  35. }} // namespace