|
| 1 | +/* |
| 2 | + * By downloading, copying, installing or using the software you agree to this license. |
| 3 | + * If you do not agree to this license, do not download, install, |
| 4 | + * copy or use the software. |
| 5 | + * |
| 6 | + * |
| 7 | + * License Agreement |
| 8 | + * For Open Source Computer Vision Library |
| 9 | + * (3 - clause BSD License) |
| 10 | + * |
| 11 | + * Redistribution and use in source and binary forms, with or without modification, |
| 12 | + * are permitted provided that the following conditions are met : |
| 13 | + * |
| 14 | + * *Redistributions of source code must retain the above copyright notice, |
| 15 | + * this list of conditions and the following disclaimer. |
| 16 | + * |
| 17 | + * * Redistributions in binary form must reproduce the above copyright notice, |
| 18 | + * this list of conditions and the following disclaimer in the documentation |
| 19 | + * and / or other materials provided with the distribution. |
| 20 | + * |
| 21 | + * * Neither the names of the copyright holders nor the names of the contributors |
| 22 | + * may be used to endorse or promote products derived from this software |
| 23 | + * without specific prior written permission. |
| 24 | + * |
| 25 | + * This software is provided by the copyright holders and contributors "as is" and |
| 26 | + * any express or implied warranties, including, but not limited to, the implied |
| 27 | + * warranties of merchantability and fitness for a particular purpose are disclaimed. |
| 28 | + * In no event shall copyright holders or contributors be liable for any direct, |
| 29 | + * indirect, incidental, special, exemplary, or consequential damages |
| 30 | + * (including, but not limited to, procurement of substitute goods or services; |
| 31 | + * loss of use, data, or profits; or business interruption) however caused |
| 32 | + * and on any theory of liability, whether in contract, strict liability, |
| 33 | + * or tort(including negligence or otherwise) arising in any way out of |
| 34 | + * the use of this software, even if advised of the possibility of such damage. |
| 35 | + */ |
| 36 | + |
| 37 | +#include "perf_precomp.hpp" |
| 38 | + |
| 39 | +namespace cvtest |
| 40 | +{ |
| 41 | + |
| 42 | +using std::tr1::tuple; |
| 43 | +using std::tr1::get; |
| 44 | +using namespace perf; |
| 45 | +using namespace testing; |
| 46 | +using namespace cv; |
| 47 | +using namespace cv::ximgproc; |
| 48 | + |
| 49 | +typedef tuple<Size, MatType, int> L0SmoothTestParam; |
| 50 | +typedef TestBaseWithParam<L0SmoothTestParam> L0SmoothTest; |
| 51 | + |
| 52 | +PERF_TEST_P(L0SmoothTest, perf, |
| 53 | + Combine( |
| 54 | + SZ_TYPICAL, |
| 55 | + Values(CV_8U, CV_16U, CV_32F, CV_64F), |
| 56 | + Values(1, 3)) |
| 57 | +) |
| 58 | +{ |
| 59 | + L0SmoothTestParam params = GetParam(); |
| 60 | + Size sz = get<0>(params); |
| 61 | + int depth = get<1>(params); |
| 62 | + int srcCn = get<2>(params); |
| 63 | + |
| 64 | + Mat src(sz, CV_MAKE_TYPE(depth, srcCn)); |
| 65 | + Mat dst(sz, src.type()); |
| 66 | + |
| 67 | + cv::setNumThreads(cv::getNumberOfCPUs()); |
| 68 | + declare.in(src, WARMUP_RNG).out(dst).tbb_threads(cv::getNumberOfCPUs()); |
| 69 | + |
| 70 | + RNG rnd(sz.height + depth + srcCn); |
| 71 | + double lambda = rnd.uniform(0.01, 0.05); |
| 72 | + double kappa = rnd.uniform(1.0, 3.0); |
| 73 | + |
| 74 | + TEST_CYCLE_N(1) |
| 75 | + { |
| 76 | + l0Smooth(src, dst, lambda, kappa); |
| 77 | + } |
| 78 | + |
| 79 | + SANITY_CHECK_NOTHING(); |
| 80 | +} |
| 81 | +} |
0 commit comments