opencv/modules/gpu/perf/perf_imgproc.cpp

1284 lines
39 KiB
C++
Raw Normal View History

2011-09-07 21:16:07 +08:00
#include "perf_precomp.hpp"
2011-12-28 20:53:08 +08:00
#ifdef HAVE_CUDA
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
// Remap
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(Remap, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode)
2011-12-28 20:53:08 +08:00
{
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2012-05-23 20:58:01 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-12-28 20:53:08 +08:00
cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2);
int interpolation = GET_PARAM(3);
int borderMode = GET_PARAM(4);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::Mat src_host(size, type);
2012-05-23 20:58:01 +08:00
fill(src_host, 0, 255);
2011-12-28 20:53:08 +08:00
cv::Mat xmap_host(size, CV_32FC1);
2012-05-23 20:58:01 +08:00
fill(xmap_host, 0, size.width);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat ymap_host(size, CV_32FC1);
fill(ymap_host, 0, size.height);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat xmap(xmap_host);
cv::gpu::GpuMat ymap(ymap_host);
cv::gpu::GpuMat dst;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::remap(src, dst, xmap, ymap, interpolation, borderMode);
2011-11-15 15:03:44 +08:00
declare.time(3.0);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::remap(src, dst, xmap, ymap, interpolation, borderMode);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, Remap, testing::Combine(
2012-05-23 20:58:01 +08:00
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// Resize
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
IMPLEMENT_PARAM_CLASS(Scale, double)
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(Resize, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, Scale)
{
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2011-12-28 20:53:08 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2);
int interpolation = GET_PARAM(3);
double f = GET_PARAM(4);
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, type);
fill(src_host, 0, 255);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat src(src_host);
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat dst;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);
declare.time(1.0);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, Resize, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
testing::Values(Scale(0.5), Scale(2.0))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// WarpAffine
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(WarpAffine, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode)
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2011-12-28 20:53:08 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2);
int interpolation = GET_PARAM(3);
int borderMode = GET_PARAM(4);
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, type);
fill(src_host, 0, 255);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +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);
cv::gpu::warpAffine(src, dst, M, size, interpolation, borderMode);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::warpAffine(src, dst, M, size, interpolation, borderMode);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, WarpAffine, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// WarpPerspective
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(WarpPerspective, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode)
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2011-12-28 20:53:08 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2);
int interpolation = GET_PARAM(3);
int borderMode = GET_PARAM(4);
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, type);
fill(src_host, 0, 255);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +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);
cv::gpu::warpPerspective(src, dst, M, size, interpolation, borderMode);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::warpPerspective(src, dst, M, size, interpolation, borderMode);
2011-09-07 21:16:07 +08:00
}
}
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, WarpPerspective, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// CopyMakeBorder
2011-12-28 20:53:08 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, MatType, BorderMode)
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2012-05-23 20:58:01 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-12-28 20:53:08 +08:00
cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2);
2012-05-23 20:58:01 +08:00
int borderType = GET_PARAM(3);
2011-12-28 20:53:08 +08:00
cv::Mat src_host(size, type);
fill(src_host, 0, 255);
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
2012-05-23 20:58:01 +08:00
cv::gpu::copyMakeBorder(src, dst, 5, 5, 5, 5, borderType);
TEST_CYCLE()
{
2012-05-23 20:58:01 +08:00
cv::gpu::copyMakeBorder(src, dst, 5, 5, 5, 5, borderType);
}
2011-12-28 20:53:08 +08:00
}
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, CopyMakeBorder, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// Threshold
CV_ENUM(ThreshOp, cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV)
#define ALL_THRESH_OPS testing::Values(ThreshOp(cv::THRESH_BINARY), ThreshOp(cv::THRESH_BINARY_INV), ThreshOp(cv::THRESH_TRUNC), ThreshOp(cv::THRESH_TOZERO), ThreshOp(cv::THRESH_TOZERO_INV))
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(Threshold, cv::gpu::DeviceInfo, cv::Size, MatDepth, ThreshOp)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
int depth = GET_PARAM(2);
int threshOp = GET_PARAM(3);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, depth);
fill(src_host, 0, 255);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::threshold(src, dst, 100.0, 255.0, threshOp);
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::threshold(src, dst, 100.0, 255.0, threshOp);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, Threshold, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F), MatDepth(CV_64F)),
ALL_THRESH_OPS));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// Integral
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(Integral, cv::gpu::DeviceInfo, cv::Size)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, CV_8UC1);
fill(src_host, 0, 255);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat buf;
cv::gpu::integralBuffered(src, dst, buf);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::integralBuffered(src, dst, buf);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, Integral, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES));
2011-09-07 21:16:07 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// Integral_Sqr
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(Integral_Sqr, cv::gpu::DeviceInfo, cv::Size)
{
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, CV_8UC1);
fill(src_host, 0, 255);
cv::gpu::GpuMat src(src_host);
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat dst;
2012-05-23 20:58:01 +08:00
cv::gpu::sqrIntegral(src, dst);
TEST_CYCLE()
{
2012-05-23 20:58:01 +08:00
cv::gpu::sqrIntegral(src, dst);
}
}
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, Integral_Sqr, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES));
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// HistEven_OneChannel
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(HistEven_OneChannel, cv::gpu::DeviceInfo, cv::Size, MatDepth)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
int depth = GET_PARAM(2);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, depth);
fill(src_host, 0, 255);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat hist;
cv::gpu::GpuMat buf;
cv::gpu::histEven(src, hist, buf, 30, 0, 180);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::histEven(src, hist, buf, 30, 0, 180);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, HistEven_OneChannel, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_16S))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// HistEven_FourChannel
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(HistEven_FourChannel, cv::gpu::DeviceInfo, cv::Size, MatDepth)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
int depth = GET_PARAM(2);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, CV_MAKE_TYPE(depth, 4));
fill(src_host, 0, 255);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat hist[4];
cv::gpu::GpuMat buf;
int histSize[] = {30, 30, 30, 30};
int lowerLevel[] = {0, 0, 0, 0};
int upperLevel[] = {180, 180, 180, 180};
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::histEven(src, hist, buf, histSize, lowerLevel, upperLevel);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::histEven(src, hist, buf, histSize, lowerLevel, upperLevel);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, HistEven_FourChannel, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_16S))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// CalcHist
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(CalcHist, cv::gpu::DeviceInfo, cv::Size)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, CV_8UC1);
fill(src_host, 0, 255);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat hist;
cv::gpu::GpuMat buf;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::calcHist(src, hist, buf);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::calcHist(src, hist, buf);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, CalcHist, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// EqualizeHist
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(EqualizeHist, cv::gpu::DeviceInfo, cv::Size)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, CV_8UC1);
fill(src_host, 0, 255);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat hist;
cv::gpu::GpuMat buf;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::equalizeHist(src, dst, hist, buf);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::equalizeHist(src, dst, hist, buf);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, EqualizeHist, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// ColumnSum
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(ColumnSum, cv::gpu::DeviceInfo, cv::Size)
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2012-05-23 20:58:01 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-12-28 20:53:08 +08:00
cv::Size size = GET_PARAM(1);
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, CV_32FC1);
fill(src_host, 0, 255);
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
cv::gpu::columnSum(src, dst);
TEST_CYCLE()
{
2012-05-23 20:58:01 +08:00
cv::gpu::columnSum(src, dst);
}
2011-12-28 20:53:08 +08:00
}
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, ColumnSum, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES));
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// Canny
2012-05-23 20:58:01 +08:00
IMPLEMENT_PARAM_CLASS(AppertureSize, int)
IMPLEMENT_PARAM_CLASS(L2gradient, bool)
GPU_PERF_TEST(Canny, cv::gpu::DeviceInfo, AppertureSize, L2gradient)
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2012-05-23 20:58:01 +08:00
cv::gpu::setDevice(devInfo.deviceID());
int apperture_size = GET_PARAM(1);
bool useL2gradient = GET_PARAM(2);
cv::Mat image_host = readImage("perf/1280x1024.jpg", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(image_host.empty());
cv::gpu::GpuMat image(image_host);
cv::gpu::GpuMat dst;
cv::gpu::CannyBuf buf;
cv::gpu::Canny(image, buf, dst, 50.0, 100.0, apperture_size, useL2gradient);
TEST_CYCLE()
{
cv::gpu::Canny(image, buf, dst, 50.0, 100.0, apperture_size, useL2gradient);
}
}
INSTANTIATE_TEST_CASE_P(ImgProc, Canny, testing::Combine(
ALL_DEVICES,
testing::Values(AppertureSize(3), AppertureSize(5)),
testing::Values(L2gradient(false), L2gradient(true))));
2012-05-23 20:58:01 +08:00
//////////////////////////////////////////////////////////////////////
// MeanShiftFiltering
GPU_PERF_TEST_1(MeanShiftFiltering, cv::gpu::DeviceInfo)
{
cv::gpu::DeviceInfo devInfo = GetParam();
2011-12-28 20:53:08 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2012-05-23 20:58:01 +08:00
cv::Mat img = readImage("gpu/meanshift/cones.png");
ASSERT_FALSE(img.empty());
cv::Mat rgba;
cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
cv::gpu::GpuMat src(rgba);
cv::gpu::GpuMat dst;
cv::gpu::meanShiftFiltering(src, dst, 50, 50);
declare.time(5.0);
TEST_CYCLE()
{
2012-05-23 20:58:01 +08:00
cv::gpu::meanShiftFiltering(src, dst, 50, 50);
}
2011-12-28 20:53:08 +08:00
}
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftFiltering, ALL_DEVICES);
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// MeanShiftProc
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST_1(MeanShiftProc, cv::gpu::DeviceInfo)
{
2012-05-23 20:58:01 +08:00
cv::gpu::DeviceInfo devInfo = GetParam();
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat img = readImage("gpu/meanshift/cones.png");
ASSERT_FALSE(img.empty());
cv::Mat rgba;
cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
cv::gpu::GpuMat src(rgba);
cv::gpu::GpuMat dstr;
cv::gpu::GpuMat dstsp;
cv::gpu::meanShiftProc(src, dstr, dstsp, 50, 50);
declare.time(5.0);
TEST_CYCLE()
{
cv::gpu::meanShiftProc(src, dstr, dstsp, 50, 50);
}
}
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftProc, ALL_DEVICES);
//////////////////////////////////////////////////////////////////////
// MeanShiftSegmentation
GPU_PERF_TEST_1(MeanShiftSegmentation, cv::gpu::DeviceInfo)
{
cv::gpu::DeviceInfo devInfo = GetParam();
2011-12-28 20:53:08 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2012-05-23 20:58:01 +08:00
cv::Mat img = readImage("gpu/meanshift/cones.png");
ASSERT_FALSE(img.empty());
cv::Mat rgba;
cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
cv::gpu::GpuMat src(rgba);
cv::Mat dst;
meanShiftSegmentation(src, dst, 10, 10, 20);
declare.time(5.0);
TEST_CYCLE()
{
2012-05-23 20:58:01 +08:00
meanShiftSegmentation(src, dst, 10, 10, 20);
}
2011-12-28 20:53:08 +08:00
}
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftSegmentation, ALL_DEVICES);
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// BlendLinear
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(BlendLinear, cv::gpu::DeviceInfo, cv::Size, MatType)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2012-05-23 20:58:01 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-12-28 20:53:08 +08:00
cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat img1_host(size, type);
fill(img1_host, 0, 255);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat img2_host(size, type);
fill(img2_host, 0, 255);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat img1(img1_host);
cv::gpu::GpuMat img2(img2_host);
cv::gpu::GpuMat weights1(size, CV_32FC1, cv::Scalar::all(0.5));
cv::gpu::GpuMat weights2(size, CV_32FC1, cv::Scalar::all(0.5));
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat dst;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::blendLinear(img1, img2, weights1, weights2, dst);
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::blendLinear(img1, img2, weights1, weights2, dst);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, BlendLinear, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// Convolve
IMPLEMENT_PARAM_CLASS(KSize, int)
IMPLEMENT_PARAM_CLASS(Ccorr, bool)
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(Convolve, cv::gpu::DeviceInfo, cv::Size, KSize, Ccorr)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2012-05-23 20:58:01 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-12-28 20:53:08 +08:00
cv::Size size = GET_PARAM(1);
2012-05-23 20:58:01 +08:00
int templ_size = GET_PARAM(2);
bool ccorr = GET_PARAM(3);
cv::gpu::GpuMat image = cv::gpu::createContinuous(size, CV_32FC1);
image.setTo(cv::Scalar(1.0));
cv::gpu::GpuMat templ = cv::gpu::createContinuous(templ_size, templ_size, CV_32FC1);
templ.setTo(cv::Scalar(1.0));
cv::gpu::GpuMat dst;
cv::gpu::ConvolveBuf buf;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::convolve(image, templ, dst, ccorr, buf);
declare.time(2.0);
TEST_CYCLE()
{
cv::gpu::convolve(image, templ, dst, ccorr, buf);
}
}
INSTANTIATE_TEST_CASE_P(ImgProc, Convolve, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(KSize(3), KSize(9), KSize(17), KSize(27), KSize(32), KSize(64)),
testing::Values(Ccorr(false), Ccorr(true))));
////////////////////////////////////////////////////////////////////////////////
// MatchTemplate_8U
CV_ENUM(TemplateMethod, cv::TM_SQDIFF, cv::TM_SQDIFF_NORMED, cv::TM_CCORR, cv::TM_CCORR_NORMED, cv::TM_CCOEFF, cv::TM_CCOEFF_NORMED)
#define ALL_TEMPLATE_METHODS testing::Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_SQDIFF_NORMED), TemplateMethod(cv::TM_CCORR), TemplateMethod(cv::TM_CCORR_NORMED), TemplateMethod(cv::TM_CCOEFF), TemplateMethod(cv::TM_CCOEFF_NORMED))
IMPLEMENT_PARAM_CLASS(TemplateSize, cv::Size)
GPU_PERF_TEST(MatchTemplate_8U, cv::gpu::DeviceInfo, cv::Size, TemplateSize, Channels, TemplateMethod)
{
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2011-12-28 20:53:08 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
cv::Size templ_size = GET_PARAM(2);
int cn = GET_PARAM(3);
int method = GET_PARAM(4);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat image_host(size, CV_MAKE_TYPE(CV_8U, cn));
fill(image_host, 0, 255);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat templ_host(templ_size, CV_MAKE_TYPE(CV_8U, cn));
fill(templ_host, 0, 255);
cv::gpu::GpuMat image(image_host);
cv::gpu::GpuMat templ(templ_host);
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat dst;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::matchTemplate(image, templ, dst, method);
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::matchTemplate(image, templ, dst, method);
2011-09-07 21:16:07 +08:00
}
2012-05-23 20:58:01 +08:00
};
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, MatchTemplate_8U, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16)), TemplateSize(cv::Size(30, 30))),
testing::Values(Channels(1), Channels(3), Channels(4)),
ALL_TEMPLATE_METHODS));
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
////////////////////////////////////////////////////////////////////////////////
// MatchTemplate_32F
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(MatchTemplate_32F, cv::gpu::DeviceInfo, cv::Size, TemplateSize, Channels, TemplateMethod)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2012-05-23 20:58:01 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-12-28 20:53:08 +08:00
cv::Size size = GET_PARAM(1);
2012-05-23 20:58:01 +08:00
cv::Size templ_size = GET_PARAM(2);
int cn = GET_PARAM(3);
int method = GET_PARAM(4);
cv::Mat image_host(size, CV_MAKE_TYPE(CV_32F, cn));
fill(image_host, 0, 255);
cv::Mat templ_host(templ_size, CV_MAKE_TYPE(CV_32F, cn));
fill(templ_host, 0, 255);
cv::gpu::GpuMat image(image_host);
cv::gpu::GpuMat templ(templ_host);
cv::gpu::GpuMat dst;
cv::gpu::matchTemplate(image, templ, dst, method);
TEST_CYCLE()
{
cv::gpu::matchTemplate(image, templ, dst, method);
}
};
INSTANTIATE_TEST_CASE_P(ImgProc, MatchTemplate_32F, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16)), TemplateSize(cv::Size(30, 30))),
testing::Values(Channels(1), Channels(3), Channels(4)),
testing::Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_CCORR))));
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
//////////////////////////////////////////////////////////////////////
// MulSpectrums
CV_FLAGS(DftFlags, 0, cv::DFT_INVERSE, cv::DFT_SCALE, cv::DFT_ROWS, cv::DFT_COMPLEX_OUTPUT, cv::DFT_REAL_OUTPUT)
GPU_PERF_TEST(MulSpectrums, cv::gpu::DeviceInfo, cv::Size, DftFlags)
{
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2011-12-28 20:53:08 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
int flag = GET_PARAM(2);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat a_host(size, CV_32FC2);
fill(a_host, 0, 100);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat b_host(size, CV_32FC2);
fill(b_host, 0, 100);
cv::gpu::GpuMat a(a_host);
cv::gpu::GpuMat b(b_host);
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat dst;
2012-05-23 20:58:01 +08:00
cv::gpu::mulSpectrums(a, b, dst, flag);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::mulSpectrums(a, b, dst, flag);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, MulSpectrums, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(DftFlags(0), DftFlags(cv::DFT_ROWS))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// MulAndScaleSpectrums
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(MulAndScaleSpectrums, cv::gpu::DeviceInfo, cv::Size)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2012-05-23 20:58:01 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-12-28 20:53:08 +08:00
cv::Size size = GET_PARAM(1);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
float scale = 1.f / size.area();
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat src1_host(size, CV_32FC2);
fill(src1_host, 0, 100);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat src2_host(size, CV_32FC2);
fill(src2_host, 0, 100);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat src1(src1_host);
cv::gpu::GpuMat src2(src2_host);
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat dst;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::mulAndScaleSpectrums(src1, src2, dst, cv::DFT_ROWS, scale, false);
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::mulAndScaleSpectrums(src1, src2, dst, cv::DFT_ROWS, scale, false);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, MulAndScaleSpectrums, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// Dft
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(Dft, cv::gpu::DeviceInfo, cv::Size, DftFlags)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
int flag = GET_PARAM(2);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, CV_32FC2);
fill(src_host, 0, 100);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::dft(src, dst, size, flag);
declare.time(2.0);
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::dft(src, dst, size, flag);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, Dft, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(DftFlags(0), DftFlags(cv::DFT_ROWS), DftFlags(cv::DFT_INVERSE))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
// CornerHarris
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
IMPLEMENT_PARAM_CLASS(BlockSize, int)
IMPLEMENT_PARAM_CLASS(ApertureSize, int)
GPU_PERF_TEST(CornerHarris, cv::gpu::DeviceInfo, MatType, BorderMode, BlockSize, ApertureSize)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2012-05-23 20:58:01 +08:00
int type = GET_PARAM(1);
int borderType = GET_PARAM(2);
int blockSize = GET_PARAM(3);
int apertureSize = GET_PARAM(4);
2011-12-28 20:53:08 +08:00
cv::Mat img = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
2011-09-07 21:16:07 +08:00
ASSERT_FALSE(img.empty());
img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(img);
cv::gpu::GpuMat dst;
cv::gpu::GpuMat Dx;
cv::gpu::GpuMat Dy;
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat buf;
2011-09-07 21:16:07 +08:00
double k = 0.5;
2012-05-23 20:58:01 +08:00
cv::gpu::cornerHarris(src, dst, Dx, Dy, buf, blockSize, apertureSize, k, borderType);
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::cornerHarris(src, dst, Dx, Dy, buf, blockSize, apertureSize, k, borderType);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, CornerHarris, testing::Combine(
2012-05-23 20:58:01 +08:00
ALL_DEVICES,
testing::Values(MatType(CV_8UC1), MatType(CV_32FC1)),
testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)),
testing::Values(BlockSize(3), BlockSize(5), BlockSize(7)),
testing::Values(ApertureSize(0), ApertureSize(3), ApertureSize(5), ApertureSize(7))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
// CornerMinEigenVal
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(CornerMinEigenVal, cv::gpu::DeviceInfo, MatType, BorderMode, BlockSize, ApertureSize)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2012-05-23 20:58:01 +08:00
int type = GET_PARAM(1);
int borderType = GET_PARAM(2);
int blockSize = GET_PARAM(3);
int apertureSize = GET_PARAM(4);
2011-12-28 20:53:08 +08:00
cv::Mat img = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
2011-09-07 21:16:07 +08:00
ASSERT_FALSE(img.empty());
img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(img);
cv::gpu::GpuMat dst;
cv::gpu::GpuMat Dx;
cv::gpu::GpuMat Dy;
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat buf;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::cornerMinEigenVal(src, dst, Dx, Dy, buf, blockSize, apertureSize, borderType);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::cornerMinEigenVal(src, dst, Dx, Dy, buf, blockSize, apertureSize, borderType);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, CornerMinEigenVal, testing::Combine(
2012-05-23 20:58:01 +08:00
ALL_DEVICES,
testing::Values(MatType(CV_8UC1), MatType(CV_32FC1)),
testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)),
testing::Values(BlockSize(3), BlockSize(5), BlockSize(7)),
testing::Values(ApertureSize(0), ApertureSize(3), ApertureSize(5), ApertureSize(7))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// BuildWarpPlaneMaps
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(BuildWarpPlaneMaps, cv::gpu::DeviceInfo, cv::Size)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);
cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);
cv::Mat T = cv::Mat::zeros(1, 3, CV_32F);
cv::gpu::GpuMat map_x;
cv::gpu::GpuMat map_y;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, map_x, map_y);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, map_x, map_y);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpPlaneMaps, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// BuildWarpCylindricalMaps
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(BuildWarpCylindricalMaps, cv::gpu::DeviceInfo, cv::Size)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);
cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);
cv::gpu::GpuMat map_x;
cv::gpu::GpuMat map_y;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpCylindricalMaps, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// BuildWarpSphericalMaps
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(BuildWarpSphericalMaps, cv::gpu::DeviceInfo, cv::Size)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);
cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);
cv::gpu::GpuMat map_x;
cv::gpu::GpuMat map_y;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpSphericalMaps, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// Rotate
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(Rotate, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2012-05-23 20:58:01 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-12-28 20:53:08 +08:00
cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2);
2012-05-23 20:58:01 +08:00
int interpolation = GET_PARAM(3);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::Mat src_host(size, type);
2012-05-23 20:58:01 +08:00
fill(src_host, 0, 255);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::rotate(src, dst, size, 30.0, 0, 0, interpolation);
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::rotate(src, dst, size, 30.0, 0, 0, interpolation);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, Rotate, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// PyrDown
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(PyrDown, cv::gpu::DeviceInfo, cv::Size, MatType)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2012-05-23 20:58:01 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-12-28 20:53:08 +08:00
cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::Mat src_host(size, type);
2012-05-23 20:58:01 +08:00
fill(src_host, 0, 255);
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::pyrDown(src, dst);
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::pyrDown(src, dst);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, PyrDown, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// PyrUp
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(PyrUp, cv::gpu::DeviceInfo, cv::Size, MatType)
2011-09-07 21:16:07 +08:00
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, type);
fill(src_host, 0, 255);
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat src(src_host);
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat dst;
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
cv::gpu::pyrUp(src, dst);
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::pyrUp(src, dst);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, PyrUp, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
2011-09-07 21:16:07 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// CvtColor
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(CvtColor, cv::gpu::DeviceInfo, cv::Size, MatDepth, CvtColorInfo)
{
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
int depth = GET_PARAM(2);
CvtColorInfo info = GET_PARAM(3);
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, CV_MAKETYPE(depth, info.scn));
fill(src_host, 0, 255);
2012-05-23 20:58:01 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
2012-05-23 20:58:01 +08:00
cv::gpu::cvtColor(src, dst, info.code, info.dcn);
2011-09-07 21:16:07 +08:00
TEST_CYCLE()
2011-09-07 21:16:07 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::cvtColor(src, dst, info.code, info.dcn);
2011-09-07 21:16:07 +08:00
}
2011-12-28 20:53:08 +08:00
}
2011-09-07 21:16:07 +08:00
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F)),
testing::Values(CvtColorInfo(4, 4, cv::COLOR_RGBA2BGRA),
CvtColorInfo(4, 1, cv::COLOR_BGRA2GRAY),
CvtColorInfo(1, 4, cv::COLOR_GRAY2BGRA),
CvtColorInfo(3, 3, cv::COLOR_BGR2XYZ),
CvtColorInfo(3, 3, cv::COLOR_XYZ2BGR),
CvtColorInfo(3, 3, cv::COLOR_BGR2YCrCb),
CvtColorInfo(3, 3, cv::COLOR_YCrCb2BGR),
CvtColorInfo(3, 3, cv::COLOR_BGR2YUV),
CvtColorInfo(3, 3, cv::COLOR_YUV2BGR),
CvtColorInfo(3, 3, cv::COLOR_BGR2HSV),
CvtColorInfo(3, 3, cv::COLOR_HSV2BGR),
CvtColorInfo(3, 3, cv::COLOR_BGR2HLS),
CvtColorInfo(3, 3, cv::COLOR_HLS2BGR))));
2011-09-07 21:16:07 +08:00
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// SwapChannels
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(SwapChannels, cv::gpu::DeviceInfo, cv::Size)
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
2012-05-23 20:58:01 +08:00
cv::Mat src_host(size, CV_8UC4);
fill(src_host, 0, 255);
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
2012-05-23 20:58:01 +08:00
const int dstOrder[] = {2, 1, 0, 3};
cv::gpu::swapChannels(src, dstOrder);
TEST_CYCLE()
{
2012-05-23 20:58:01 +08:00
cv::gpu::swapChannels(src, dstOrder);
}
2011-12-28 20:53:08 +08:00
}
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, SwapChannels, testing::Combine(ALL_DEVICES, GPU_TYPICAL_MAT_SIZES));
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
2012-05-23 20:58:01 +08:00
// AlphaComp
2011-12-28 20:53:08 +08:00
2012-05-23 20:58:01 +08:00
CV_ENUM(AlphaOp, cv::gpu::ALPHA_OVER, cv::gpu::ALPHA_IN, cv::gpu::ALPHA_OUT, cv::gpu::ALPHA_ATOP, cv::gpu::ALPHA_XOR, cv::gpu::ALPHA_PLUS, cv::gpu::ALPHA_OVER_PREMUL, cv::gpu::ALPHA_IN_PREMUL, cv::gpu::ALPHA_OUT_PREMUL, cv::gpu::ALPHA_ATOP_PREMUL, cv::gpu::ALPHA_XOR_PREMUL, cv::gpu::ALPHA_PLUS_PREMUL, cv::gpu::ALPHA_PREMUL)
GPU_PERF_TEST(AlphaComp, cv::gpu::DeviceInfo, cv::Size, MatType, AlphaOp)
2011-12-28 20:53:08 +08:00
{
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::gpu::setDevice(devInfo.deviceID());
2012-05-23 20:58:01 +08:00
cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2);
int alpha_op = GET_PARAM(3);
2012-05-23 20:58:01 +08:00
cv::Mat img1_host(size, type);
fill(img1_host, 0, 255);
2011-12-28 20:53:08 +08:00
2012-05-23 20:58:01 +08:00
cv::Mat img2_host(size, type);
fill(img2_host, 0, 255);
cv::gpu::GpuMat img1(img1_host);
cv::gpu::GpuMat img2(img2_host);
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat dst;
2012-05-23 20:58:01 +08:00
cv::gpu::alphaComp(img1, img2, dst, alpha_op);
2011-12-28 20:53:08 +08:00
TEST_CYCLE()
2011-12-28 20:53:08 +08:00
{
2012-05-23 20:58:01 +08:00
cv::gpu::alphaComp(img1, img2, dst, alpha_op);
2011-12-28 20:53:08 +08:00
}
}
2012-05-23 20:58:01 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, AlphaComp, testing::Combine(
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatType(CV_8UC4), MatType(CV_16UC4), MatType(CV_32SC4), MatType(CV_32FC4)),
testing::Values(AlphaOp(cv::gpu::ALPHA_OVER),
AlphaOp(cv::gpu::ALPHA_IN),
AlphaOp(cv::gpu::ALPHA_OUT),
AlphaOp(cv::gpu::ALPHA_ATOP),
AlphaOp(cv::gpu::ALPHA_XOR),
AlphaOp(cv::gpu::ALPHA_PLUS),
AlphaOp(cv::gpu::ALPHA_OVER_PREMUL),
AlphaOp(cv::gpu::ALPHA_IN_PREMUL),
AlphaOp(cv::gpu::ALPHA_OUT_PREMUL),
AlphaOp(cv::gpu::ALPHA_ATOP_PREMUL),
AlphaOp(cv::gpu::ALPHA_XOR_PREMUL),
AlphaOp(cv::gpu::ALPHA_PLUS_PREMUL),
AlphaOp(cv::gpu::ALPHA_PREMUL))));
2011-12-28 20:53:08 +08:00
//////////////////////////////////////////////////////////////////////
// ImagePyramid
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(ImagePyramid_build, cv::gpu::DeviceInfo, cv::Size, MatType)
{
2011-12-28 20:53:08 +08:00
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2012-05-23 20:58:01 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-12-28 20:53:08 +08:00
cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2);
2011-12-28 20:53:08 +08:00
cv::Mat src_host(size, type);
2012-05-23 20:58:01 +08:00
fill(src_host, 0, 255);
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
2011-12-28 20:53:08 +08:00
cv::gpu::ImagePyramid pyr;
2012-05-23 20:58:01 +08:00
pyr.build(src, 5);
TEST_CYCLE()
{
2011-12-28 20:53:08 +08:00
pyr.build(src, 5);
}
2011-12-28 20:53:08 +08:00
}
INSTANTIATE_TEST_CASE_P(ImgProc, ImagePyramid_build, testing::Combine(
2012-05-23 20:58:01 +08:00
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
2012-05-23 20:58:01 +08:00
GPU_PERF_TEST(ImagePyramid_getLayer, cv::gpu::DeviceInfo, cv::Size, MatType)
2011-12-28 20:53:08 +08:00
{
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
2012-05-23 20:58:01 +08:00
cv::gpu::setDevice(devInfo.deviceID());
2011-12-28 20:53:08 +08:00
cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2);
2011-12-28 20:53:08 +08:00
cv::Mat src_host(size, type);
2012-05-23 20:58:01 +08:00
fill(src_host, 0, 255);
2011-12-28 20:53:08 +08:00
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
cv::gpu::ImagePyramid pyr(src, 3);
2012-05-23 20:58:01 +08:00
pyr.getLayer(dst, cv::Size(size.width / 2 + 10, size.height / 2 + 10));
TEST_CYCLE()
2011-12-28 20:53:08 +08:00
{
pyr.getLayer(dst, cv::Size(size.width / 2 + 10, size.height / 2 + 10));
}
}
2011-12-28 20:53:08 +08:00
INSTANTIATE_TEST_CASE_P(ImgProc, ImagePyramid_getLayer, testing::Combine(
2012-05-23 20:58:01 +08:00
ALL_DEVICES,
GPU_TYPICAL_MAT_SIZES,
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
2011-12-28 20:53:08 +08:00
#endif