test_mse.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_MSE
  6. namespace opencv_test
  7. {
  8. namespace quality_test
  9. {
  10. // static method
  11. TEST(TEST_CASE_NAME, static_ )
  12. {
  13. cv::Mat qMat = {};
  14. quality_expect_near(quality::QualityMSE::compute(get_testfile_1a(), get_testfile_1a(), qMat), cv::Scalar(0.)); // ref vs ref == 0
  15. check_quality_map(qMat);
  16. }
  17. // single channel, with and without opencl
  18. TEST(TEST_CASE_NAME, single_channel )
  19. {
  20. auto fn = []() { quality_test(quality::QualityMSE::create(get_testfile_1a()), get_testfile_1b(), MSE_EXPECTED_1); };
  21. OCL_OFF( fn() );
  22. OCL_ON( fn() );
  23. }
  24. // multi-channel
  25. TEST(TEST_CASE_NAME, multi_channel)
  26. {
  27. quality_test(quality::QualityMSE::create(get_testfile_2a()), get_testfile_2b(), MSE_EXPECTED_2);
  28. }
  29. // internal a/b test
  30. /*
  31. TEST(TEST_CASE_NAME, performance)
  32. {
  33. auto ref = get_testfile_1a();
  34. auto cmp = get_testfile_1b();
  35. quality_performance_test("MSE", [&]() { cv::quality::QualityMSE::compute(ref, cmp, cv::noArray()); });
  36. }
  37. */
  38. }
  39. } // namespace