mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 14:13:15 +08:00
Added perf tests for histogram
This commit is contained in:
parent
0b54739822
commit
b97b48ecb6
56
modules/imgproc/perf/perf_histogram.cpp
Normal file
56
modules/imgproc/perf/perf_histogram.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace perf;
|
||||
using namespace testing;
|
||||
using std::tr1::make_tuple;
|
||||
using std::tr1::get;
|
||||
|
||||
typedef tr1::tuple<Size, MatType> Size_Source_t;
|
||||
typedef TestBaseWithParam<Size_Source_t> Size_Source;
|
||||
|
||||
typedef TestBaseWithParam<Size> MatSize;
|
||||
|
||||
|
||||
PERF_TEST_P(Size_Source, calcHist,
|
||||
testing::Combine(testing::Values(TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8U, CV_32F)
|
||||
)
|
||||
)
|
||||
{
|
||||
Size size = get<0>(GetParam());
|
||||
MatType type = get<1>(GetParam());
|
||||
Mat source(size.height, size.width, type);
|
||||
Mat hist;
|
||||
int channels [] = {0};
|
||||
int histSize [] = {256};
|
||||
|
||||
const float r[] = {0.0f, 256.0f};
|
||||
const float* ranges[] = {r};
|
||||
|
||||
declare.in(source, WARMUP_RNG).time(20).iterations(1000);
|
||||
TEST_CYCLE()
|
||||
{
|
||||
calcHist(&source, 1, channels, Mat(), hist, 1, histSize, ranges);
|
||||
}
|
||||
|
||||
SANITY_CHECK(hist);
|
||||
}
|
||||
|
||||
PERF_TEST_P(MatSize, equalizeHist,
|
||||
testing::Values(TYPICAL_MAT_SIZES)
|
||||
)
|
||||
{
|
||||
Size size = GetParam();
|
||||
Mat source(size.height, size.width, CV_8U);
|
||||
Mat destination;
|
||||
declare.in(source, WARMUP_RNG);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
equalizeHist(source, destination);
|
||||
}
|
||||
|
||||
SANITY_CHECK(destination);
|
||||
}
|
Loading…
Reference in New Issue
Block a user