test_anisodiff.cpp 973 B

1234567891011121314151617181920212223242526272829
  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. namespace opencv_test { namespace {
  6. TEST(ximgproc_AnisotropicDiffusion, regression)
  7. {
  8. string folder = string(cvtest::TS::ptr()->get_data_path()) + "cv/shared/";
  9. string original_path = folder + "fruits.png";
  10. Mat original = imread(original_path, IMREAD_COLOR);
  11. ASSERT_FALSE(original.empty()) << "Could not load input image " << original_path;
  12. ASSERT_EQ(3, original.channels()) << "Load color input image " << original_path;
  13. Mat result;
  14. float alpha = 1.0f;
  15. float K = 0.02f;
  16. int niters = 10;
  17. ximgproc::anisotropicDiffusion(original, result, alpha, K, niters);
  18. double adiff_psnr = cvtest::PSNR(original, result);
  19. //printf("psnr=%.2f\n", adiff_psnr);
  20. ASSERT_GT(adiff_psnr, 25.0);
  21. }
  22. }} // namespace