2011-09-07 14:50:56 +02:00
|
|
|
#include "perf_precomp.hpp"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace cv;
|
|
|
|
using namespace perf;
|
2011-12-29 17:46:16 +01:00
|
|
|
using std::tr1::make_tuple;
|
|
|
|
using std::tr1::get;
|
2011-09-07 14:50:56 +02:00
|
|
|
|
|
|
|
typedef std::tr1::tuple<Size, MatType, MatDepth> Size_MatType_OutMatDepth_t;
|
|
|
|
typedef perf::TestBaseWithParam<Size_MatType_OutMatDepth_t> Size_MatType_OutMatDepth;
|
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
PERF_TEST_P(Size_MatType_OutMatDepth, integral,
|
|
|
|
testing::Combine(
|
|
|
|
testing::Values(TYPICAL_MAT_SIZES),
|
|
|
|
testing::Values(CV_8UC1, CV_8UC4),
|
|
|
|
testing::Values(CV_32S, CV_32F, CV_64F)
|
|
|
|
)
|
|
|
|
)
|
2011-09-07 14:50:56 +02:00
|
|
|
{
|
2011-12-29 17:46:16 +01:00
|
|
|
Size sz = get<0>(GetParam());
|
|
|
|
int matType = get<1>(GetParam());
|
|
|
|
int sdepth = get<2>(GetParam());
|
2011-09-07 14:50:56 +02:00
|
|
|
|
|
|
|
Mat src(sz, matType);
|
|
|
|
Mat sum(sz, sdepth);
|
|
|
|
|
|
|
|
declare.in(src, WARMUP_RNG).out(sum);
|
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
TEST_CYCLE() integral(src, sum, sdepth);
|
2011-09-07 14:50:56 +02:00
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
SANITY_CHECK(sum, 1e-6);
|
2011-09-07 14:50:56 +02:00
|
|
|
}
|
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
PERF_TEST_P(Size_MatType_OutMatDepth, integral_sqsum,
|
|
|
|
testing::Combine(
|
|
|
|
testing::Values(TYPICAL_MAT_SIZES),
|
|
|
|
testing::Values(CV_8UC1, CV_8UC4),
|
|
|
|
testing::Values(CV_32S, CV_32F, CV_64F)
|
|
|
|
)
|
|
|
|
)
|
2011-09-07 14:50:56 +02:00
|
|
|
{
|
2011-12-29 17:46:16 +01:00
|
|
|
Size sz = get<0>(GetParam());
|
|
|
|
int matType = get<1>(GetParam());
|
|
|
|
int sdepth = get<2>(GetParam());
|
2011-09-06 17:30:28 +02:00
|
|
|
|
2011-09-07 14:50:56 +02:00
|
|
|
Mat src(sz, matType);
|
|
|
|
Mat sum(sz, sdepth);
|
|
|
|
Mat sqsum(sz, sdepth);
|
2011-09-06 17:30:28 +02:00
|
|
|
|
2011-09-07 14:50:56 +02:00
|
|
|
declare.in(src, WARMUP_RNG).out(sum, sqsum);
|
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
TEST_CYCLE() integral(src, sum, sqsum, sdepth);
|
2011-09-07 14:50:56 +02:00
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
SANITY_CHECK(sum, 1e-6);
|
|
|
|
SANITY_CHECK(sqsum, 1e-6);
|
2011-09-07 14:50:56 +02:00
|
|
|
}
|
|
|
|
|
2011-11-07 14:06:48 +01:00
|
|
|
PERF_TEST_P( Size_MatType_OutMatDepth, integral_sqsum_tilted,
|
2011-12-29 17:46:16 +01:00
|
|
|
testing::Combine(
|
|
|
|
testing::Values( TYPICAL_MAT_SIZES ),
|
|
|
|
testing::Values( CV_8UC1, CV_8UC4 ),
|
|
|
|
testing::Values( CV_32S, CV_32F, CV_64F )
|
|
|
|
)
|
|
|
|
)
|
2011-09-07 14:50:56 +02:00
|
|
|
{
|
2011-12-29 17:46:16 +01:00
|
|
|
Size sz = get<0>(GetParam());
|
|
|
|
int matType = get<1>(GetParam());
|
|
|
|
int sdepth = get<2>(GetParam());
|
2011-09-07 14:50:56 +02:00
|
|
|
|
|
|
|
Mat src(sz, matType);
|
|
|
|
Mat sum(sz, sdepth);
|
|
|
|
Mat sqsum(sz, sdepth);
|
|
|
|
Mat tilted(sz, sdepth);
|
|
|
|
|
|
|
|
declare.in(src, WARMUP_RNG).out(sum, sqsum, tilted);
|
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
TEST_CYCLE() integral(src, sum, sqsum, tilted, sdepth);
|
2011-09-07 14:50:56 +02:00
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
SANITY_CHECK(sum, 1e-6);
|
|
|
|
SANITY_CHECK(sqsum, 1e-6);
|
2012-04-30 16:33:52 +02:00
|
|
|
SANITY_CHECK(tilted, 1e-6, tilted.depth() > CV_32S ? ERROR_RELATIVE : ERROR_ABSOLUTE);
|
2011-09-07 14:50:56 +02:00
|
|
|
}
|