opencv/modules/photo/perf/opencl/perf_denoising.cpp

98 lines
2.9 KiB
C++
Raw Normal View History

2014-02-06 22:03:54 +08:00
// 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.
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
2014-08-01 22:11:20 +08:00
#include "../perf_precomp.hpp"
2014-02-06 22:03:54 +08:00
#include "opencv2/ts/ocl_perf.hpp"
#ifdef HAVE_OPENCL
namespace opencv_test {
2014-02-06 22:03:54 +08:00
namespace ocl {
OCL_PERF_TEST(Photo, DenoisingGrayscale)
{
Mat _original = imread(getDataPath("cv/denoising/lena_noised_gaussian_sigma=10.png"), IMREAD_GRAYSCALE);
ASSERT_FALSE(_original.empty()) << "Could not load input image";
UMat result(_original.size(), _original.type()), original;
_original.copyTo(original);
declare.in(original).out(result).iterations(10);
OCL_TEST_CYCLE()
cv::fastNlMeansDenoising(original, result, 10);
2014-02-18 23:38:50 +08:00
SANITY_CHECK(result, 1);
2014-02-06 22:03:54 +08:00
}
OCL_PERF_TEST(Photo, DenoisingColored)
{
Mat _original = imread(getDataPath("cv/denoising/lena_noised_gaussian_sigma=10.png"));
ASSERT_FALSE(_original.empty()) << "Could not load input image";
UMat result(_original.size(), _original.type()), original;
_original.copyTo(original);
declare.in(original).out(result).iterations(10);
OCL_TEST_CYCLE()
cv::fastNlMeansDenoisingColored(original, result, 10, 10);
2014-02-20 20:05:50 +08:00
SANITY_CHECK(result, 2);
2014-02-06 22:03:54 +08:00
}
2014-02-19 22:34:34 +08:00
OCL_PERF_TEST(Photo, DISABLED_DenoisingGrayscaleMulti)
2014-02-06 22:03:54 +08:00
{
const int imgs_count = 3;
vector<UMat> original(imgs_count);
Mat tmp;
for (int i = 0; i < imgs_count; i++)
{
string original_path = format("cv/denoising/lena_noised_gaussian_sigma=20_multi_%d.png", i);
tmp = imread(getDataPath(original_path), IMREAD_GRAYSCALE);
ASSERT_FALSE(tmp.empty()) << "Could not load input image " << original_path;
tmp.copyTo(original[i]);
declare.in(original[i]);
}
UMat result(tmp.size(), tmp.type());
declare.out(result).iterations(10);
OCL_TEST_CYCLE()
cv::fastNlMeansDenoisingMulti(original, result, imgs_count / 2, imgs_count, 15);
SANITY_CHECK(result);
}
2014-02-19 22:34:34 +08:00
OCL_PERF_TEST(Photo, DISABLED_DenoisingColoredMulti)
2014-02-06 22:03:54 +08:00
{
const int imgs_count = 3;
vector<UMat> original(imgs_count);
Mat tmp;
for (int i = 0; i < imgs_count; i++)
{
string original_path = format("cv/denoising/lena_noised_gaussian_sigma=20_multi_%d.png", i);
tmp = imread(getDataPath(original_path), IMREAD_COLOR);
ASSERT_FALSE(tmp.empty()) << "Could not load input image " << original_path;
tmp.copyTo(original[i]);
declare.in(original[i]);
}
UMat result(tmp.size(), tmp.type());
declare.out(result).iterations(10);
OCL_TEST_CYCLE()
cv::fastNlMeansDenoisingColoredMulti(original, result, imgs_count / 2, imgs_count, 10, 15);
SANITY_CHECK(result);
}
} } // namespace opencv_test::ocl
2014-02-06 22:03:54 +08:00
#endif // HAVE_OPENCL