2012-05-22 18:29:58 +08:00
|
|
|
#include "perf_cpu_precomp.hpp"
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
#ifdef HAVE_CUDA
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Remap
|
|
|
|
|
|
|
|
GPU_PERF_TEST(Remap, cv::gpu::DeviceInfo, cv::Size, perf::MatType, Interpolation, BorderMode)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
int interpolation = GET_PARAM(3);
|
|
|
|
int borderMode = GET_PARAM(4);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, type);
|
|
|
|
cv::Mat xmap(size, CV_32FC1);
|
|
|
|
cv::Mat ymap(size, CV_32FC1);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, xmap, ymap, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.time(10.0);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::remap(src, dst, xmap, ymap, interpolation, borderMode);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, Remap, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_32FC1),
|
|
|
|
testing::Values((int) cv::INTER_NEAREST, (int) cv::INTER_LINEAR, (int) cv::INTER_CUBIC),
|
|
|
|
testing::Values((int) cv::BORDER_REFLECT101, (int) cv::BORDER_REPLICATE, (int) cv::BORDER_CONSTANT)));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// MeanShiftFiltering
|
|
|
|
|
|
|
|
GPU_PERF_TEST_1(MeanShiftFiltering, cv::gpu::DeviceInfo)
|
|
|
|
{
|
|
|
|
cv::Mat img = readImage("gpu/meanshift/cones.png");
|
|
|
|
ASSERT_FALSE(img.empty());
|
|
|
|
|
|
|
|
cv::Mat dst;
|
|
|
|
|
2012-05-22 19:27:45 +08:00
|
|
|
declare.time(100.0);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::pyrMeanShiftFiltering(img, dst, 50, 50);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftFiltering, ALL_DEVICES);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// ReprojectImageTo3D
|
|
|
|
|
|
|
|
GPU_PERF_TEST(ReprojectImageTo3D, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, type);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::reprojectImageTo3D(src, dst, cv::Mat::ones(4, 4, CV_32FC1));
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, ReprojectImageTo3D, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_16SC1)));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// CvtColor
|
|
|
|
|
|
|
|
GPU_PERF_TEST(CvtColor, cv::gpu::DeviceInfo, cv::Size, perf::MatType, CvtColorInfo)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
CvtColorInfo info = GET_PARAM(3);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, CV_MAKETYPE(type, info.scn));
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::cvtColor(src, dst, info.code, info.dcn);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1),
|
|
|
|
testing::Values(
|
|
|
|
CvtColorInfo(4, 4, cv::COLOR_RGBA2BGRA), CvtColorInfo(4, 1, cv::COLOR_BGRA2GRAY), CvtColorInfo(1, 4, cv::COLOR_GRAY2BGRA),
|
2012-05-22 18:29:58 +08:00
|
|
|
CvtColorInfo(3, 3, cv::COLOR_BGR2XYZ), CvtColorInfo(3, 3, cv::COLOR_BGR2YCrCb), CvtColorInfo(3, 3, cv::COLOR_YCrCb2BGR),
|
|
|
|
CvtColorInfo(3, 3, cv::COLOR_BGR2HSV), CvtColorInfo(3, 3, cv::COLOR_HSV2BGR))));
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Threshold
|
|
|
|
|
|
|
|
GPU_PERF_TEST(Threshold, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, type);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst(size, type);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::threshold(src, dst, 100.0, 255.0, cv::THRESH_BINARY);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, Threshold, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
2012-05-22 19:27:45 +08:00
|
|
|
testing::Values(CV_8UC1, CV_32FC1)));
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Resize
|
|
|
|
|
|
|
|
GPU_PERF_TEST(Resize, cv::gpu::DeviceInfo, cv::Size, perf::MatType, Interpolation, double)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
int interpolation = GET_PARAM(3);
|
|
|
|
double f = GET_PARAM(4);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, type);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
declare.time(1.0);
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::resize(src, dst, cv::Size(), f, f, interpolation);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, Resize, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
testing::Values(perf::szSXGA, perf::sz1080p),
|
|
|
|
testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_32FC1),
|
|
|
|
testing::Values((int) cv::INTER_NEAREST, (int) cv::INTER_LINEAR, (int) cv::INTER_CUBIC),
|
|
|
|
testing::Values(0.5, 2.0)));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// WarpAffine
|
|
|
|
|
|
|
|
GPU_PERF_TEST(WarpAffine, cv::gpu::DeviceInfo, cv::Size, perf::MatType, Interpolation)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
int interpolation = GET_PARAM(3);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, type);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
const double aplha = CV_PI / 4;
|
|
|
|
double mat[2][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2},
|
|
|
|
{std::sin(aplha), std::cos(aplha), 0}};
|
|
|
|
cv::Mat M(2, 3, CV_64F, (void*) mat);
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::warpAffine(src, dst, M, size, interpolation, cv::BORDER_CONSTANT, cv::Scalar());
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, WarpAffine, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4),
|
|
|
|
testing::Values((int) cv::INTER_NEAREST, (int) cv::INTER_LINEAR, (int) cv::INTER_CUBIC)));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// WarpPerspective
|
|
|
|
|
|
|
|
GPU_PERF_TEST(WarpPerspective, cv::gpu::DeviceInfo, cv::Size, perf::MatType, Interpolation)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
int interpolation = GET_PARAM(3);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, type);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
const double aplha = CV_PI / 4;
|
|
|
|
double mat[3][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2},
|
|
|
|
{std::sin(aplha), std::cos(aplha), 0},
|
|
|
|
{0.0, 0.0, 1.0}};
|
|
|
|
cv::Mat M(3, 3, CV_64F, (void*) mat);
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::warpPerspective(src, dst, M, size, interpolation, cv::BORDER_CONSTANT, cv::Scalar());
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, WarpPerspective, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4),
|
|
|
|
testing::Values((int) cv::INTER_NEAREST, (int) cv::INTER_LINEAR, (int) cv::INTER_CUBIC)));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// CopyMakeBorder
|
|
|
|
|
|
|
|
GPU_PERF_TEST(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, perf::MatType, BorderMode)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
int borderType = GET_PARAM(3);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, type);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderType);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, CopyMakeBorder, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_8UC4, CV_32FC1),
|
|
|
|
testing::Values((int) cv::BORDER_REPLICATE, (int) cv::BORDER_REFLECT, (int) cv::BORDER_WRAP, (int) cv::BORDER_CONSTANT)));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Integral
|
|
|
|
|
|
|
|
GPU_PERF_TEST(Integral, cv::gpu::DeviceInfo, cv::Size)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, CV_8UC1);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::integral(src, dst);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, Integral, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// CornerHarris
|
|
|
|
|
|
|
|
GPU_PERF_TEST(CornerHarris, cv::gpu::DeviceInfo, perf::MatType)
|
|
|
|
{
|
|
|
|
int type = GET_PARAM(1);
|
|
|
|
|
|
|
|
cv::Mat img = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
|
|
|
|
ASSERT_FALSE(img.empty());
|
|
|
|
|
|
|
|
img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
int blockSize = 3;
|
|
|
|
int ksize = 7;
|
|
|
|
double k = 0.5;
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::cornerHarris(img, dst, blockSize, ksize, k);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, CornerHarris, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
testing::Values(CV_8UC1, CV_32FC1)));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// CornerMinEigenVal
|
|
|
|
|
|
|
|
GPU_PERF_TEST(CornerMinEigenVal, cv::gpu::DeviceInfo, perf::MatType)
|
|
|
|
{
|
|
|
|
int type = GET_PARAM(1);
|
|
|
|
|
|
|
|
cv::Mat img = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
|
|
|
|
ASSERT_FALSE(img.empty());
|
|
|
|
|
|
|
|
img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
int blockSize = 3;
|
|
|
|
int ksize = 7;
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::cornerMinEigenVal(img, dst, blockSize, ksize);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, CornerMinEigenVal, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
testing::Values(CV_8UC1, CV_32FC1)));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// MulSpectrums
|
|
|
|
|
|
|
|
GPU_PERF_TEST(MulSpectrums, cv::gpu::DeviceInfo, cv::Size)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat a(size, CV_32FC2);
|
|
|
|
cv::Mat b(size, CV_32FC2);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(a, b, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::mulSpectrums(a, b, dst, 0);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, MulSpectrums, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Dft
|
|
|
|
|
|
|
|
GPU_PERF_TEST(Dft, cv::gpu::DeviceInfo, cv::Size)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, CV_32FC2);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
declare.time(2.0);
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::dft(src, dst);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, Dft, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Convolve
|
|
|
|
|
|
|
|
GPU_PERF_TEST(Convolve, cv::gpu::DeviceInfo, cv::Size, int, bool)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int templ_size = GET_PARAM(2);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat image(size, CV_32FC1);
|
|
|
|
cv::Mat templ(templ_size, templ_size, CV_32FC1);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
image.setTo(cv::Scalar(1.0));
|
|
|
|
templ.setTo(cv::Scalar(1.0));
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
declare.time(2.0);
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::filter2D(image, dst, image.depth(), templ);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, Convolve, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(3, 9, 27, 32, 64),
|
|
|
|
testing::Bool()));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// PyrDown
|
|
|
|
|
|
|
|
GPU_PERF_TEST(PyrDown, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, type);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::pyrDown(src, dst);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, PyrDown, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_8UC4, CV_16SC3, CV_32FC1)));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// PyrUp
|
|
|
|
|
|
|
|
GPU_PERF_TEST(PyrUp, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, type);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::pyrUp(src, dst);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, PyrUp, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_8UC4, CV_16SC3, CV_32FC1)));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Canny
|
|
|
|
|
|
|
|
GPU_PERF_TEST_1(Canny, cv::gpu::DeviceInfo)
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat image = readImage("perf/1280x1024.jpg", cv::IMREAD_GRAYSCALE);
|
|
|
|
ASSERT_FALSE(image.empty());
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Canny(image, dst, 50.0, 100.0);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, Canny, ALL_DEVICES);
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// CalcHist
|
|
|
|
|
|
|
|
GPU_PERF_TEST(CalcHist, cv::gpu::DeviceInfo, cv::Size)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, CV_8UC1);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat hist;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
int histSize = 256;
|
|
|
|
float range[] = { 0, 256 } ;
|
|
|
|
const float* histRange = { range };
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::calcHist(&src, 1, 0, cv::noArray(), hist, 1, &histSize, &histRange);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, CalcHist, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// EqualizeHist
|
|
|
|
|
|
|
|
GPU_PERF_TEST(EqualizeHist, cv::gpu::DeviceInfo, cv::Size)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat src(size, CV_8UC1);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
declare.in(src, WARMUP_RNG);
|
2012-05-22 16:29:08 +08:00
|
|
|
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::Mat dst;
|
2012-05-22 16:29:08 +08:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-22 18:29:58 +08:00
|
|
|
cv::equalizeHist(src, dst);
|
2012-05-22 16:29:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, EqualizeHist, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
|
|
|
|
2012-05-23 02:58:01 +08:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// MulAndScaleSpectrums
|
|
|
|
|
|
|
|
|
|
|
|
GPU_PERF_TEST(MulAndScaleSpectrums, cv::gpu::DeviceInfo, cv::Size)
|
|
|
|
{
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
|
|
|
|
int type = CV_32FC2;
|
|
|
|
|
|
|
|
cv::Mat src1(size, type);
|
|
|
|
cv::Mat src2(size, type);
|
|
|
|
cv::Mat dst(size, type);
|
|
|
|
declare.in(src1, src2, WARMUP_RNG);
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
|
|
|
cv::mulSpectrums(src1, src2, dst, cv::DFT_ROWS, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, MulAndScaleSpectrums, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
|
|
|
|
|
|
|
|
2012-05-22 16:29:08 +08:00
|
|
|
#endif
|