test_gmsd.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 "test_precomp.hpp"
  5. #define TEST_CASE_NAME CV_Quality_GMSD
  6. namespace opencv_test
  7. {
  8. namespace quality_test
  9. {
  10. // expected gmsd per channel
  11. const cv::Scalar
  12. GMSD_EXPECTED_1 = { .2393 }
  13. , GMSD_EXPECTED_2 = { .0942, .1016, .0995 }
  14. ;
  15. // static method
  16. TEST(TEST_CASE_NAME, static_)
  17. {
  18. cv::Mat qMat = {};
  19. quality_expect_near(quality::QualityGMSD::compute(get_testfile_1a(), get_testfile_1a(), qMat), cv::Scalar(0.)); // ref vs ref == 0.
  20. check_quality_map(qMat);
  21. }
  22. // single channel, with and without opencl
  23. TEST(TEST_CASE_NAME, single_channel)
  24. {
  25. auto fn = []() { quality_test(quality::QualityGMSD::create(get_testfile_1a()), get_testfile_1b(), GMSD_EXPECTED_1); };
  26. OCL_OFF(fn());
  27. OCL_ON(fn());
  28. }
  29. // multi-channel
  30. TEST(TEST_CASE_NAME, multi_channel)
  31. {
  32. quality_test(quality::QualityGMSD::create(get_testfile_2a()), get_testfile_2b(), GMSD_EXPECTED_2);
  33. }
  34. // internal A/B test
  35. /*
  36. TEST(TEST_CASE_NAME, performance)
  37. {
  38. auto ref = get_testfile_1a();
  39. auto cmp = get_testfile_1b();
  40. quality_performance_test("GMSD", [&]() { cv::quality::QualityGMSD::compute(ref, cmp, cv::noArray()); });
  41. }
  42. */
  43. }
  44. } // namespace