~paparazzi-uav/paparazzi/v5.0-manual

« back to all changes in this revision

Viewing changes to sw/ext/opencv_bebop/opencv/modules/photo/perf/opencl/perf_denoising.cpp

  • Committer: Paparazzi buildbot
  • Date: 2016-05-18 15:00:29 UTC
  • Revision ID: felix.ruess+docbot@gmail.com-20160518150029-e8lgzi5kvb4p7un9
Manual import commit 4b8bbb730080dac23cf816b98908dacfabe2a8ec from v5.0 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
5
// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
 
6
// Third party copyrights are property of their respective owners.
 
7
 
 
8
#include "../perf_precomp.hpp"
 
9
#include "opencv2/ts/ocl_perf.hpp"
 
10
 
 
11
#ifdef HAVE_OPENCL
 
12
 
 
13
namespace cvtest {
 
14
namespace ocl {
 
15
 
 
16
OCL_PERF_TEST(Photo, DenoisingGrayscale)
 
17
{
 
18
    Mat _original = imread(getDataPath("cv/denoising/lena_noised_gaussian_sigma=10.png"), IMREAD_GRAYSCALE);
 
19
    ASSERT_FALSE(_original.empty()) << "Could not load input image";
 
20
 
 
21
    UMat result(_original.size(), _original.type()), original;
 
22
    _original.copyTo(original);
 
23
 
 
24
    declare.in(original).out(result).iterations(10);
 
25
 
 
26
    OCL_TEST_CYCLE()
 
27
            cv::fastNlMeansDenoising(original, result, 10);
 
28
 
 
29
    SANITY_CHECK(result, 1);
 
30
}
 
31
 
 
32
OCL_PERF_TEST(Photo, DenoisingColored)
 
33
{
 
34
    Mat _original = imread(getDataPath("cv/denoising/lena_noised_gaussian_sigma=10.png"));
 
35
    ASSERT_FALSE(_original.empty()) << "Could not load input image";
 
36
 
 
37
    UMat result(_original.size(), _original.type()), original;
 
38
    _original.copyTo(original);
 
39
 
 
40
    declare.in(original).out(result).iterations(10);
 
41
 
 
42
    OCL_TEST_CYCLE()
 
43
            cv::fastNlMeansDenoisingColored(original, result, 10, 10);
 
44
 
 
45
    SANITY_CHECK(result, 2);
 
46
}
 
47
 
 
48
OCL_PERF_TEST(Photo, DISABLED_DenoisingGrayscaleMulti)
 
49
{
 
50
    const int imgs_count = 3;
 
51
 
 
52
    vector<UMat> original(imgs_count);
 
53
    Mat tmp;
 
54
    for (int i = 0; i < imgs_count; i++)
 
55
    {
 
56
        string original_path = format("cv/denoising/lena_noised_gaussian_sigma=20_multi_%d.png", i);
 
57
        tmp = imread(getDataPath(original_path), IMREAD_GRAYSCALE);
 
58
        ASSERT_FALSE(tmp.empty()) << "Could not load input image " << original_path;
 
59
        tmp.copyTo(original[i]);
 
60
        declare.in(original[i]);
 
61
    }
 
62
    UMat result(tmp.size(), tmp.type());
 
63
    declare.out(result).iterations(10);
 
64
 
 
65
    OCL_TEST_CYCLE()
 
66
            cv::fastNlMeansDenoisingMulti(original, result, imgs_count / 2, imgs_count, 15);
 
67
 
 
68
    SANITY_CHECK(result);
 
69
}
 
70
 
 
71
OCL_PERF_TEST(Photo, DISABLED_DenoisingColoredMulti)
 
72
{
 
73
    const int imgs_count = 3;
 
74
 
 
75
    vector<UMat> original(imgs_count);
 
76
    Mat tmp;
 
77
    for (int i = 0; i < imgs_count; i++)
 
78
    {
 
79
        string original_path = format("cv/denoising/lena_noised_gaussian_sigma=20_multi_%d.png", i);
 
80
        tmp = imread(getDataPath(original_path), IMREAD_COLOR);
 
81
        ASSERT_FALSE(tmp.empty()) << "Could not load input image " << original_path;
 
82
 
 
83
        tmp.copyTo(original[i]);
 
84
        declare.in(original[i]);
 
85
    }
 
86
    UMat result(tmp.size(), tmp.type());
 
87
    declare.out(result).iterations(10);
 
88
 
 
89
    OCL_TEST_CYCLE()
 
90
            cv::fastNlMeansDenoisingColoredMulti(original, result, imgs_count / 2, imgs_count, 10, 15);
 
91
 
 
92
    SANITY_CHECK(result);
 
93
}
 
94
 
 
95
} } // namespace cvtest::ocl
 
96
 
 
97
#endif // HAVE_OPENCL