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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(Remap, cv::gpu::DeviceInfo, cv::Size, perf::MatType, Interpolation, BorderMode)
|
|
|
|
{
|
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
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::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, type);
|
|
|
|
cv::Mat xmap_host(size, CV_32FC1);
|
|
|
|
cv::Mat ymap_host(size, CV_32FC1);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
declare.in(src_host, xmap_host, ymap_host, WARMUP_RNG);
|
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
|
|
|
|
2011-11-15 15:03:44 +08:00
|
|
|
declare.time(3.0);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +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-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_32FC1),
|
2011-12-28 20:53:08 +08:00
|
|
|
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)));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// MeanShiftFiltering
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST_1(MeanShiftFiltering, cv::gpu::DeviceInfo)
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GetParam();
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat img = readImage("gpu/meanshift/cones.png");
|
2011-09-07 21:16:07 +08:00
|
|
|
ASSERT_FALSE(img.empty());
|
2012-03-14 23:54:17 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat rgba;
|
|
|
|
cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat src(rgba);
|
|
|
|
cv::gpu::GpuMat dst;
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-11-15 15:03:44 +08:00
|
|
|
declare.time(5.0);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::meanShiftFiltering(src, dst, 50, 50);
|
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, MeanShiftFiltering, ALL_DEVICES);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// MeanShiftProc
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST_1(MeanShiftProc, cv::gpu::DeviceInfo)
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GetParam();
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat img = readImage("gpu/meanshift/cones.png");
|
2011-09-07 21:16:07 +08:00
|
|
|
ASSERT_FALSE(img.empty());
|
2012-03-14 23:54:17 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat rgba;
|
|
|
|
cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat src(rgba);
|
|
|
|
cv::gpu::GpuMat dstr;
|
|
|
|
cv::gpu::GpuMat dstsp;
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-11-15 15:03:44 +08:00
|
|
|
declare.time(5.0);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::meanShiftProc(src, dstr, dstsp, 50, 50);
|
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, MeanShiftProc, ALL_DEVICES);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// MeanShiftSegmentation
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST_1(MeanShiftSegmentation, cv::gpu::DeviceInfo)
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GetParam();
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat img = readImage("gpu/meanshift/cones.png");
|
2011-09-07 21:16:07 +08:00
|
|
|
ASSERT_FALSE(img.empty());
|
2012-03-14 23:54:17 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat rgba;
|
|
|
|
cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat src(rgba);
|
|
|
|
cv::Mat dst;
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-11-15 15:03:44 +08:00
|
|
|
declare.time(5.0);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
|
|
|
meanShiftSegmentation(src, dst, 10, 10, 20);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftSegmentation, ALL_DEVICES);
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// DrawColorDisp
|
|
|
|
|
|
|
|
GPU_PERF_TEST(DrawColorDisp, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, type);
|
|
|
|
|
|
|
|
fill(src_host, 0, 255);
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat src(src_host);
|
|
|
|
cv::gpu::GpuMat dst;
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::drawColorDisp(src, dst, 255);
|
2011-09-12 15:48:09 +08:00
|
|
|
}
|
2011-12-28 20:53:08 +08:00
|
|
|
}
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, DrawColorDisp, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
2011-12-28 20:53:08 +08:00
|
|
|
testing::Values(CV_8UC1, CV_16SC1)));
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// ReprojectImageTo3D
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(ReprojectImageTo3D, cv::gpu::DeviceInfo, cv::Size, perf::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::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::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, type);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
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
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::reprojectImageTo3D(src, dst, cv::Mat::ones(4, 4, CV_32FC1));
|
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, ReprojectImageTo3D, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
2011-12-28 20:53:08 +08:00
|
|
|
testing::Values(CV_8UC1, CV_16SC1)));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// CvtColor
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(CvtColor, cv::gpu::DeviceInfo, cv::Size, perf::MatType, CvtColorInfo)
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
CvtColorInfo info = GET_PARAM(3);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, CV_MAKETYPE(type, info.scn));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat src(src_host);
|
2012-02-22 18:00:53 +08:00
|
|
|
cv::gpu::GpuMat dst;
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
2011-12-28 20:53:08 +08:00
|
|
|
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1),
|
|
|
|
testing::Values(
|
2012-03-14 23:54:17 +08:00
|
|
|
CvtColorInfo(4, 4, cv::COLOR_RGBA2BGRA), CvtColorInfo(4, 1, cv::COLOR_BGRA2GRAY), CvtColorInfo(1, 4, cv::COLOR_GRAY2BGRA),
|
|
|
|
CvtColorInfo(4, 4, cv::COLOR_BGR2XYZ), CvtColorInfo(4, 4, cv::COLOR_BGR2YCrCb), CvtColorInfo(4, 4, cv::COLOR_YCrCb2BGR),
|
2011-12-28 20:53:08 +08:00
|
|
|
CvtColorInfo(4, 4, cv::COLOR_BGR2HSV), CvtColorInfo(4, 4, cv::COLOR_HSV2BGR))));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2012-02-22 18:00:53 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// SwapChannels
|
|
|
|
|
|
|
|
GPU_PERF_TEST(SwapChannels, cv::gpu::DeviceInfo, cv::Size)
|
|
|
|
{
|
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
|
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
|
|
|
|
|
|
|
cv::Mat src_host(size, CV_8UC4);
|
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
|
|
|
cv::gpu::GpuMat src(src_host);
|
|
|
|
|
|
|
|
const int dstOrder[] = {2, 1, 0, 3};
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
|
|
|
cv::gpu::swapChannels(src, dstOrder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, SwapChannels, testing::Combine(ALL_DEVICES, GPU_TYPICAL_MAT_SIZES));
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Threshold
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(Threshold, cv::gpu::DeviceInfo, cv::Size, perf::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::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::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, type);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat src(src_host);
|
|
|
|
cv::gpu::GpuMat dst(size, type);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::threshold(src, dst, 100.0, 255.0, cv::THRESH_BINARY);
|
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, Threshold, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
2011-12-28 20:53:08 +08:00
|
|
|
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Resize
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(Resize, cv::gpu::DeviceInfo, cv::Size, perf::MatType, Interpolation, double)
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
int interpolation = GET_PARAM(3);
|
|
|
|
double f = GET_PARAM(4);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, type);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
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
|
|
|
|
2011-11-15 15:03:44 +08:00
|
|
|
declare.time(1.0);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, Resize, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
|
|
|
testing::Values(perf::szSXGA, perf::sz1080p),
|
2011-12-28 20:53:08 +08:00
|
|
|
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)));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// WarpAffine
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(WarpAffine, cv::gpu::DeviceInfo, cv::Size, perf::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);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
int interpolation = GET_PARAM(3);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, type);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
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-03-14 23:54:17 +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);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2012-03-14 23:54:17 +08:00
|
|
|
cv::gpu::warpAffine(src, dst, M, size, interpolation, cv::BORDER_CONSTANT, cv::Scalar());
|
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, WarpAffine, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
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),
|
2011-12-28 20:53:08 +08:00
|
|
|
testing::Values((int) cv::INTER_NEAREST, (int) cv::INTER_LINEAR, (int) cv::INTER_CUBIC)));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// WarpPerspective
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(WarpPerspective, cv::gpu::DeviceInfo, cv::Size, perf::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);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
int interpolation = GET_PARAM(3);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, type);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
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-03-14 23:54:17 +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);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2012-03-14 23:54:17 +08:00
|
|
|
cv::gpu::warpPerspective(src, dst, M, size, interpolation, cv::BORDER_CONSTANT, cv::Scalar());
|
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, WarpPerspective, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
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),
|
2011-12-28 20:53:08 +08:00
|
|
|
testing::Values((int) cv::INTER_NEAREST, (int) cv::INTER_LINEAR, (int) cv::INTER_CUBIC)));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// BuildWarpPlaneMaps
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(BuildWarpPlaneMaps, cv::gpu::DeviceInfo, cv::Size)
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat map_x;
|
|
|
|
cv::gpu::GpuMat map_y;
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2012-03-14 23:54:17 +08:00
|
|
|
cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), cv::Mat::eye(3, 3, CV_32FC1),
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat::ones(3, 3, CV_32FC1), cv::Mat::zeros(1, 3, CV_32F), 1.0, map_x, map_y);
|
2011-09-12 15:48:09 +08:00
|
|
|
}
|
2011-12-28 20:53:08 +08:00
|
|
|
}
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpPlaneMaps, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// BuildWarpCylindricalMaps
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(BuildWarpCylindricalMaps, cv::gpu::DeviceInfo, cv::Size)
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat map_x;
|
|
|
|
cv::gpu::GpuMat map_y;
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), cv::Mat::eye(3, 3, CV_32FC1),
|
|
|
|
cv::Mat::ones(3, 3, CV_32FC1), 1.0, map_x, map_y);
|
2011-09-12 15:48:09 +08:00
|
|
|
}
|
2011-12-28 20:53:08 +08:00
|
|
|
}
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpCylindricalMaps, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// BuildWarpSphericalMaps
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(BuildWarpSphericalMaps, cv::gpu::DeviceInfo, cv::Size)
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat map_x;
|
|
|
|
cv::gpu::GpuMat map_y;
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), cv::Mat::eye(3, 3, CV_32FC1),
|
|
|
|
cv::Mat::ones(3, 3, CV_32FC1), 1.0, map_x, map_y);
|
2011-09-12 15:48:09 +08:00
|
|
|
}
|
2011-12-28 20:53:08 +08:00
|
|
|
}
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpSphericalMaps, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Rotate
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(Rotate, cv::gpu::DeviceInfo, cv::Size, perf::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);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
int interpolation = GET_PARAM(3);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, type);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
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
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, Rotate, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
2012-02-22 18:00:53 +08:00
|
|
|
testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4),
|
2011-12-28 20:53:08 +08:00
|
|
|
testing::Values((int) cv::INTER_NEAREST, (int) cv::INTER_LINEAR, (int) cv::INTER_CUBIC)));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// CopyMakeBorder
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, perf::MatType, BorderMode)
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
int borderType = GET_PARAM(3);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, type);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
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
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::copyMakeBorder(src, dst, 5, 5, 5, 5, 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, CopyMakeBorder, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
2011-12-28 20:53:08 +08:00
|
|
|
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)));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Integral
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +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::Size size = GET_PARAM(1);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, CV_8UC1);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat src(src_host);
|
|
|
|
cv::gpu::GpuMat dst;
|
|
|
|
cv::gpu::GpuMat buf;
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, Integral, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// IntegralSqr
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(IntegralSqr, 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::Size size = GET_PARAM(1);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, CV_8UC1);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
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
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::sqrIntegral(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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, IntegralSqr, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// ColumnSum
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(ColumnSum, 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::Size size = GET_PARAM(1);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, CV_32FC1);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
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
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::columnSum(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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, ColumnSum, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(CornerHarris, cv::gpu::DeviceInfo, perf::MatType)
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
int type = GET_PARAM(1);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2012-03-14 23:54:17 +08:00
|
|
|
|
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;
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
int blockSize = 3;
|
2012-03-14 23:54:17 +08:00
|
|
|
int ksize = 7;
|
2011-09-07 21:16:07 +08:00
|
|
|
double k = 0.5;
|
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::cornerHarris(src, dst, Dx, Dy, blockSize, ksize, k);
|
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-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
testing::Values(CV_8UC1, CV_32FC1)));
|
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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(CornerMinEigenVal, cv::gpu::DeviceInfo, perf::MatType)
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
int type = GET_PARAM(1);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2012-03-14 23:54:17 +08:00
|
|
|
|
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;
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
int blockSize = 3;
|
2012-03-14 23:54:17 +08:00
|
|
|
int ksize = 7;
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::cornerMinEigenVal(src, dst, Dx, Dy, blockSize, ksize);
|
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-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
testing::Values(CV_8UC1, CV_32FC1)));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// MulSpectrums
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(MulSpectrums, 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::Size size = GET_PARAM(1);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat a_host(size, CV_32FC2);
|
|
|
|
cv::Mat b_host(size, CV_32FC2);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(a_host, b_host, WARMUP_RNG);
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat a(a_host);
|
|
|
|
cv::gpu::GpuMat b(b_host);
|
|
|
|
cv::gpu::GpuMat dst;
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::mulSpectrums(a, b, dst, 0);
|
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, MulSpectrums, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Dft
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(Dft, 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::Size size = GET_PARAM(1);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, CV_32FC2);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
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
|
|
|
|
2011-11-15 15:03:44 +08:00
|
|
|
declare.time(2.0);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::dft(src, dst, size);
|
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, Dft, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Convolve
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2012-03-07 17:49:24 +08:00
|
|
|
GPU_PERF_TEST(Convolve, cv::gpu::DeviceInfo, cv::Size, int, bool)
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int templ_size = GET_PARAM(2);
|
2012-03-07 17:49:24 +08:00
|
|
|
bool ccorr = GET_PARAM(3);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat image = cv::gpu::createContinuous(size, CV_32FC1);
|
|
|
|
cv::gpu::GpuMat templ = cv::gpu::createContinuous(templ_size, templ_size, CV_32FC1);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
image.setTo(cv::Scalar(1.0));
|
|
|
|
templ.setTo(cv::Scalar(1.0));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat dst;
|
|
|
|
cv::gpu::ConvolveBuf buf;
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-11-15 15:03:44 +08:00
|
|
|
declare.time(2.0);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2012-03-07 17:49:24 +08:00
|
|
|
cv::gpu::convolve(image, templ, dst, ccorr, 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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, Convolve, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
2012-03-07 17:49:24 +08:00
|
|
|
testing::Values(3, 9, 27, 32, 64),
|
|
|
|
testing::Bool()));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// PyrDown
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(PyrDown, cv::gpu::DeviceInfo, cv::Size, perf::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::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::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, type);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
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
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, PyrDown, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_8UC4, CV_16SC3, CV_32FC1)));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// PyrUp
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(PyrUp, cv::gpu::DeviceInfo, cv::Size, perf::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::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::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, type);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
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
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, PyrUp, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_8UC4, CV_16SC3, CV_32FC1)));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// BlendLinear
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(BlendLinear, cv::gpu::DeviceInfo, cv::Size, perf::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::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::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat img1_host(size, type);
|
|
|
|
cv::Mat img2_host(size, type);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
|
|
|
declare.in(img1_host, img2_host, WARMUP_RNG);
|
|
|
|
|
2011-12-28 20:53:08 +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));
|
|
|
|
cv::gpu::GpuMat dst;
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +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
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, BlendLinear, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_32FC1)));
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2012-02-22 18:00:53 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// AlphaComp
|
|
|
|
|
|
|
|
GPU_PERF_TEST(AlphaComp, cv::gpu::DeviceInfo, cv::Size, perf::MatType, AlphaOp)
|
|
|
|
{
|
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
|
|
|
int alpha_op = GET_PARAM(3);
|
|
|
|
|
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
|
|
|
|
|
|
|
cv::Mat img1_host(size, type);
|
|
|
|
cv::Mat img2_host(size, type);
|
|
|
|
|
|
|
|
declare.in(img1_host, img2_host, WARMUP_RNG);
|
|
|
|
|
|
|
|
cv::gpu::GpuMat img1(img1_host);
|
|
|
|
cv::gpu::GpuMat img2(img2_host);
|
|
|
|
cv::gpu::GpuMat dst;
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
|
|
|
cv::gpu::alphaComp(img1, img2, dst, alpha_op);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, AlphaComp, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2012-02-22 18:00:53 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC4, CV_16UC4, CV_32SC4, CV_32FC4),
|
|
|
|
testing::Values((int)cv::gpu::ALPHA_OVER, (int)cv::gpu::ALPHA_IN, (int)cv::gpu::ALPHA_OUT, (int)cv::gpu::ALPHA_ATOP, (int)cv::gpu::ALPHA_XOR, (int)cv::gpu::ALPHA_PLUS, (int)cv::gpu::ALPHA_OVER_PREMUL, (int)cv::gpu::ALPHA_IN_PREMUL, (int)cv::gpu::ALPHA_OUT_PREMUL, (int)cv::gpu::ALPHA_ATOP_PREMUL, (int)cv::gpu::ALPHA_XOR_PREMUL, (int)cv::gpu::ALPHA_PLUS_PREMUL, (int)cv::gpu::ALPHA_PREMUL)));
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Canny
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST_1(Canny, cv::gpu::DeviceInfo)
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GetParam();
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat image_host = readImage("perf/1280x1024.jpg", cv::IMREAD_GRAYSCALE);
|
2011-09-07 21:16:07 +08:00
|
|
|
ASSERT_FALSE(image_host.empty());
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat image(image_host);
|
|
|
|
cv::gpu::GpuMat dst;
|
|
|
|
cv::gpu::CannyBuf buf;
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::Canny(image, buf, dst, 50.0, 100.0);
|
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, Canny, ALL_DEVICES);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// CalcHist
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(CalcHist, cv::gpu::DeviceInfo, cv::Size)
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, CV_8UC1);
|
2011-09-12 15:48:09 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat src(src_host);
|
|
|
|
cv::gpu::GpuMat hist;
|
|
|
|
cv::gpu::GpuMat buf;
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::calcHist(src, hist, buf);
|
2011-09-12 15:48:09 +08:00
|
|
|
}
|
2011-12-28 20:53:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, CalcHist, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// EqualizeHist
|
|
|
|
|
|
|
|
GPU_PERF_TEST(EqualizeHist, cv::gpu::DeviceInfo, cv::Size)
|
|
|
|
{
|
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
|
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, CV_8UC1);
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
|
|
|
cv::gpu::GpuMat src(src_host);
|
|
|
|
cv::gpu::GpuMat dst;
|
|
|
|
cv::gpu::GpuMat hist;
|
|
|
|
cv::gpu::GpuMat buf;
|
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-12-28 20:53:08 +08:00
|
|
|
{
|
|
|
|
cv::gpu::equalizeHist(src, dst, hist, buf);
|
|
|
|
}
|
2011-09-12 15:48:09 +08:00
|
|
|
}
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, EqualizeHist, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// ImagePyramid
|
|
|
|
|
|
|
|
GPU_PERF_TEST(ImagePyramid_build, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::Mat src_host(size, type);
|
2011-09-12 15:48:09 +08:00
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::GpuMat src(src_host);
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::ImagePyramid pyr;
|
2012-03-14 23:54:17 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-09-12 15:48:09 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
pyr.build(src, 5);
|
2011-09-12 15:48:09 +08:00
|
|
|
}
|
2011-12-28 20:53:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, ImagePyramid_build, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4)));
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_PERF_TEST(ImagePyramid_getLayer, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
|
|
|
{
|
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int type = GET_PARAM(2);
|
2011-09-12 15:48:09 +08:00
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
|
|
|
|
|
|
|
cv::Mat src_host(size, type);
|
|
|
|
|
|
|
|
declare.in(src_host, WARMUP_RNG);
|
|
|
|
|
|
|
|
cv::gpu::GpuMat src(src_host);
|
|
|
|
cv::gpu::GpuMat dst;
|
|
|
|
|
|
|
|
cv::gpu::ImagePyramid pyr(src, 3);
|
2012-03-14 23:54:17 +08:00
|
|
|
|
2011-12-30 00:46:16 +08:00
|
|
|
TEST_CYCLE()
|
2011-12-28 20:53:08 +08:00
|
|
|
{
|
|
|
|
pyr.getLayer(dst, cv::Size(size.width / 2 + 10, size.height / 2 + 10));
|
|
|
|
}
|
2011-09-12 15:48:09 +08:00
|
|
|
}
|
2011-12-28 20:53:08 +08:00
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, ImagePyramid_getLayer, testing::Combine(
|
2012-03-14 23:54:17 +08:00
|
|
|
ALL_DEVICES,
|
2011-12-28 20:53:08 +08:00
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4)));
|
|
|
|
|
2012-05-23 02:58:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// MulAndScaleSpectrums
|
|
|
|
|
|
|
|
GPU_PERF_TEST(MulAndScaleSpectrums, cv::gpu::DeviceInfo, cv::Size)
|
|
|
|
{
|
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
|
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
|
|
|
|
|
|
|
int type = CV_32FC2;
|
|
|
|
|
|
|
|
cv::Mat src1_host(size, type);
|
|
|
|
cv::Mat src2_host(size, type);
|
|
|
|
declare.in(src1_host, src2_host, WARMUP_RNG);
|
|
|
|
|
|
|
|
cv::gpu::GpuMat src1(src1_host);
|
|
|
|
cv::gpu::GpuMat src2(src2_host);
|
|
|
|
cv::gpu::GpuMat dst(size, type);
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
|
|
|
cv::gpu::mulSpectrums(src1, src2, dst, cv::DFT_ROWS, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, MulAndScaleSpectrums, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// MulAndScaleSpectrumsScale
|
|
|
|
|
|
|
|
|
|
|
|
GPU_PERF_TEST(MulAndScaleSpectrumsScale, cv::gpu::DeviceInfo, cv::Size)
|
|
|
|
{
|
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
|
|
|
|
float scale = 1.f / size.area();
|
|
|
|
int type = CV_32FC2;
|
|
|
|
|
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
|
|
|
|
|
|
|
cv::Mat src1_host(size, type);
|
|
|
|
cv::Mat src2_host(size, type);
|
|
|
|
declare.in(src1_host, src2_host, WARMUP_RNG);
|
|
|
|
|
|
|
|
cv::gpu::GpuMat src1(src1_host);
|
|
|
|
cv::gpu::GpuMat src2(src2_host);
|
|
|
|
cv::gpu::GpuMat dst(size, type);
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
|
|
|
cv::gpu::mulAndScaleSpectrums(src1, src2, dst, cv::DFT_ROWS, scale, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(ImgProc, MulAndScaleSpectrumsScale, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
#endif
|