test_anisodiff.cpp 973 Bytes
Newer Older
1 2 3
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
4 5
#include "test_precomp.hpp"

6
namespace opencv_test { namespace {
7 8 9

TEST(ximgproc_AnisotropicDiffusion, regression)
{
10
    string folder = string(cvtest::TS::ptr()->get_data_path()) + "cv/shared/";
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
    string original_path = folder + "fruits.png";

    Mat original = imread(original_path, IMREAD_COLOR);

    ASSERT_FALSE(original.empty()) << "Could not load input image " << original_path;
    ASSERT_EQ(3, original.channels()) << "Load color input image " << original_path;

    Mat result;
    float alpha = 1.0f;
    float K = 0.02f;
    int niters = 10;
    ximgproc::anisotropicDiffusion(original, result, alpha, K, niters);

    double adiff_psnr = cvtest::PSNR(original, result);
    //printf("psnr=%.2f\n", adiff_psnr);
    ASSERT_GT(adiff_psnr, 25.0);
}
28 29

}} // namespace