Path: blob/master/modules/imgproc/perf/perf_integral.cpp
16344 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.3#include "perf_precomp.hpp"45namespace opencv_test {67typedef tuple<Size, MatType, MatDepth> Size_MatType_OutMatDepth_t;8typedef perf::TestBaseWithParam<Size_MatType_OutMatDepth_t> Size_MatType_OutMatDepth;910PERF_TEST_P(Size_MatType_OutMatDepth, integral,11testing::Combine(12testing::Values(TYPICAL_MAT_SIZES),13testing::Values(CV_8UC1, CV_8UC4),14testing::Values(CV_32S, CV_32F, CV_64F)15)16)17{18Size sz = get<0>(GetParam());19int matType = get<1>(GetParam());20int sdepth = get<2>(GetParam());2122Mat src(sz, matType);23Mat sum(sz, sdepth);2425declare.in(src, WARMUP_RNG).out(sum);2627TEST_CYCLE() integral(src, sum, sdepth);2829SANITY_CHECK(sum, 1e-6);30}3132PERF_TEST_P(Size_MatType_OutMatDepth, integral_sqsum,33testing::Combine(34testing::Values(::perf::szVGA, ::perf::sz1080p),35testing::Values(CV_8UC1, CV_8UC4),36testing::Values(CV_32S, CV_32F)37)38)39{40Size sz = get<0>(GetParam());41int matType = get<1>(GetParam());42int sdepth = get<2>(GetParam());4344Mat src(sz, matType);45Mat sum(sz, sdepth);46Mat sqsum(sz, sdepth);4748declare.in(src, WARMUP_RNG).out(sum, sqsum);49declare.time(100);5051TEST_CYCLE() integral(src, sum, sqsum, sdepth);5253SANITY_CHECK(sum, 1e-6);54SANITY_CHECK(sqsum, 1e-6);55}5657PERF_TEST_P( Size_MatType_OutMatDepth, integral_sqsum_tilted,58testing::Combine(59testing::Values( ::perf::szVGA, ::perf::szODD , ::perf::sz1080p ),60testing::Values( CV_8UC1, CV_8UC4 ),61testing::Values( CV_32S, CV_32F )62)63)64{65Size sz = get<0>(GetParam());66int matType = get<1>(GetParam());67int sdepth = get<2>(GetParam());6869Mat src(sz, matType);70Mat sum(sz, sdepth);71Mat sqsum(sz, sdepth);72Mat tilted(sz, sdepth);7374declare.in(src, WARMUP_RNG).out(sum, sqsum, tilted);75declare.time(100);7677TEST_CYCLE() integral(src, sum, sqsum, tilted, sdepth);7879SANITY_CHECK(sum, 1e-6);80SANITY_CHECK(sqsum, 1e-6);81SANITY_CHECK(tilted, 1e-6, tilted.depth() > CV_32S ? ERROR_RELATIVE : ERROR_ABSOLUTE);82}8384} // namespace858687