Path: blob/master/modules/photo/perf/opencl/perf_denoising.cpp
16339 views
// This file is part of OpenCV project.1// It is subject to the license terms in the LICENSE file found in the top-level directory2// of this distribution and at http://opencv.org/license.html.34// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.5// Third party copyrights are property of their respective owners.67#include "../perf_precomp.hpp"8#include "opencv2/ts/ocl_perf.hpp"910#ifdef HAVE_OPENCL1112namespace opencv_test {13namespace ocl {1415OCL_PERF_TEST(Photo, DenoisingGrayscale)16{17Mat _original = imread(getDataPath("cv/denoising/lena_noised_gaussian_sigma=10.png"), IMREAD_GRAYSCALE);18ASSERT_FALSE(_original.empty()) << "Could not load input image";1920UMat result(_original.size(), _original.type()), original;21_original.copyTo(original);2223declare.in(original).out(result).iterations(10);2425OCL_TEST_CYCLE()26cv::fastNlMeansDenoising(original, result, 10);2728SANITY_CHECK(result, 1);29}3031OCL_PERF_TEST(Photo, DenoisingColored)32{33Mat _original = imread(getDataPath("cv/denoising/lena_noised_gaussian_sigma=10.png"));34ASSERT_FALSE(_original.empty()) << "Could not load input image";3536UMat result(_original.size(), _original.type()), original;37_original.copyTo(original);3839declare.in(original).out(result).iterations(10);4041OCL_TEST_CYCLE()42cv::fastNlMeansDenoisingColored(original, result, 10, 10);4344SANITY_CHECK(result, 2);45}4647OCL_PERF_TEST(Photo, DISABLED_DenoisingGrayscaleMulti)48{49const int imgs_count = 3;5051vector<UMat> original(imgs_count);52Mat tmp;53for (int i = 0; i < imgs_count; i++)54{55string original_path = format("cv/denoising/lena_noised_gaussian_sigma=20_multi_%d.png", i);56tmp = imread(getDataPath(original_path), IMREAD_GRAYSCALE);57ASSERT_FALSE(tmp.empty()) << "Could not load input image " << original_path;58tmp.copyTo(original[i]);59declare.in(original[i]);60}61UMat result(tmp.size(), tmp.type());62declare.out(result).iterations(10);6364OCL_TEST_CYCLE()65cv::fastNlMeansDenoisingMulti(original, result, imgs_count / 2, imgs_count, 15);6667SANITY_CHECK(result);68}6970OCL_PERF_TEST(Photo, DISABLED_DenoisingColoredMulti)71{72const int imgs_count = 3;7374vector<UMat> original(imgs_count);75Mat tmp;76for (int i = 0; i < imgs_count; i++)77{78string original_path = format("cv/denoising/lena_noised_gaussian_sigma=20_multi_%d.png", i);79tmp = imread(getDataPath(original_path), IMREAD_COLOR);80ASSERT_FALSE(tmp.empty()) << "Could not load input image " << original_path;8182tmp.copyTo(original[i]);83declare.in(original[i]);84}85UMat result(tmp.size(), tmp.type());86declare.out(result).iterations(10);8788OCL_TEST_CYCLE()89cv::fastNlMeansDenoisingColoredMulti(original, result, imgs_count / 2, imgs_count, 10, 15);9091SANITY_CHECK(result);92}9394} } // namespace opencv_test::ocl9596#endif // HAVE_OPENCL979899