update gpu perf tests
This commit is contained in:
parent
eccfc90b77
commit
457b8d7bff
File diff suppressed because it is too large
Load Diff
@ -1,93 +1,101 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
PERF_TEST_P(DevInfo, transformPoints, testing::ValuesIn(devices()))
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// TransformPoints
|
||||
|
||||
GPU_PERF_TEST_1(TransformPoints, cv::gpu::DeviceInfo)
|
||||
{
|
||||
DeviceInfo devInfo = GetParam();
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat src_host(1, 10000, CV_32FC3);
|
||||
cv::Mat src_host(1, 10000, CV_32FC3);
|
||||
|
||||
declare.in(src_host, WARMUP_RNG);
|
||||
|
||||
GpuMat src(src_host);
|
||||
GpuMat dst;
|
||||
cv::gpu::GpuMat src(src_host);
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
transformPoints(src, Mat::ones(1, 3, CV_32FC1), Mat::ones(1, 3, CV_32FC1), dst);
|
||||
cv::gpu::transformPoints(src, cv::Mat::ones(1, 3, CV_32FC1), cv::Mat::ones(1, 3, CV_32FC1), dst);
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo, projectPoints, testing::ValuesIn(devices()))
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, TransformPoints, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// ProjectPoints
|
||||
|
||||
GPU_PERF_TEST_1(ProjectPoints, cv::gpu::DeviceInfo)
|
||||
{
|
||||
DeviceInfo devInfo = GetParam();
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat src_host(1, 10000, CV_32FC3);
|
||||
cv::Mat src_host(1, 10000, CV_32FC3);
|
||||
|
||||
declare.in(src_host, WARMUP_RNG);
|
||||
|
||||
GpuMat src(src_host);
|
||||
GpuMat dst;
|
||||
cv::gpu::GpuMat src(src_host);
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
projectPoints(src, Mat::ones(1, 3, CV_32FC1), Mat::ones(1, 3, CV_32FC1), Mat::ones(3, 3, CV_32FC1), Mat(), dst);
|
||||
cv::gpu::projectPoints(src, cv::Mat::ones(1, 3, CV_32FC1), cv::Mat::ones(1, 3, CV_32FC1), cv::Mat::ones(3, 3, CV_32FC1), cv::Mat(), dst);
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo, solvePnPRansac, testing::ValuesIn(devices()))
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, ProjectPoints, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// SolvePnPRansac
|
||||
|
||||
GPU_PERF_TEST_1(SolvePnPRansac, cv::gpu::DeviceInfo)
|
||||
{
|
||||
DeviceInfo devInfo = GetParam();
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat object(1, 10000, CV_32FC3);
|
||||
Mat image(1, 10000, CV_32FC2);
|
||||
cv::Mat object(1, 10000, CV_32FC3);
|
||||
cv::Mat image(1, 10000, CV_32FC2);
|
||||
|
||||
declare.in(object, image, WARMUP_RNG);
|
||||
|
||||
Mat rvec, tvec;
|
||||
cv::Mat rvec, tvec;
|
||||
|
||||
declare.time(3.0);
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
solvePnPRansac(object, image, Mat::ones(3, 3, CV_32FC1), Mat(1, 8, CV_32F, Scalar::all(0)), rvec, tvec);
|
||||
cv::gpu::solvePnPRansac(object, image, cv::Mat::ones(3, 3, CV_32FC1), cv::Mat(1, 8, CV_32F, cv::Scalar::all(0)), rvec, tvec);
|
||||
}
|
||||
|
||||
SANITY_CHECK(rvec);
|
||||
SANITY_CHECK(tvec);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo, StereoBM, testing::ValuesIn(devices()))
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, SolvePnPRansac, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// StereoBM
|
||||
|
||||
GPU_PERF_TEST_1(StereoBM, cv::gpu::DeviceInfo)
|
||||
{
|
||||
DeviceInfo devInfo = GetParam();
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat img_l_host = readImage("gpu/perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE);
|
||||
Mat img_r_host = readImage("gpu/perf/aloeR.jpg", CV_LOAD_IMAGE_GRAYSCALE);
|
||||
cv::Mat img_l_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
cv::Mat img_r_host = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(img_l_host.empty());
|
||||
ASSERT_FALSE(img_r_host.empty());
|
||||
|
||||
GpuMat img_l(img_l_host);
|
||||
GpuMat img_r(img_r_host);
|
||||
cv::gpu::GpuMat img_l(img_l_host);
|
||||
cv::gpu::GpuMat img_r(img_r_host);
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
GpuMat dst;
|
||||
|
||||
StereoBM_GPU bm(0, 256);
|
||||
cv::gpu::StereoBM_GPU bm(0, 256);
|
||||
|
||||
declare.time(5.0);
|
||||
|
||||
@ -95,30 +103,30 @@ PERF_TEST_P(DevInfo, StereoBM, testing::ValuesIn(devices()))
|
||||
{
|
||||
bm(img_l, img_r, dst);
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo, StereoBeliefPropagation, testing::ValuesIn(devices()))
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, StereoBM, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// StereoBeliefPropagation
|
||||
|
||||
GPU_PERF_TEST_1(StereoBeliefPropagation, cv::gpu::DeviceInfo)
|
||||
{
|
||||
DeviceInfo devInfo = GetParam();
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat img_l_host = readImage("gpu/stereobp/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||
Mat img_r_host = readImage("gpu/stereobp/aloe-R.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||
cv::Mat img_l_host = readImage("gpu/stereobp/aloe-L.png");
|
||||
cv::Mat img_r_host = readImage("gpu/stereobp/aloe-R.png");
|
||||
|
||||
ASSERT_FALSE(img_l_host.empty());
|
||||
ASSERT_FALSE(img_r_host.empty());
|
||||
|
||||
GpuMat img_l(img_l_host);
|
||||
GpuMat img_r(img_r_host);
|
||||
cv::gpu::GpuMat img_l(img_l_host);
|
||||
cv::gpu::GpuMat img_r(img_r_host);
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
GpuMat dst;
|
||||
|
||||
StereoBeliefPropagation bp(128);
|
||||
cv::gpu::StereoBeliefPropagation bp(64);
|
||||
|
||||
declare.time(10.0);
|
||||
|
||||
@ -126,30 +134,30 @@ PERF_TEST_P(DevInfo, StereoBeliefPropagation, testing::ValuesIn(devices()))
|
||||
{
|
||||
bp(img_l, img_r, dst);
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo, StereoConstantSpaceBP, testing::ValuesIn(devices()))
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, StereoBeliefPropagation, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// StereoConstantSpaceBP
|
||||
|
||||
GPU_PERF_TEST_1(StereoConstantSpaceBP, cv::gpu::DeviceInfo)
|
||||
{
|
||||
DeviceInfo devInfo = GetParam();
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat img_l_host = readImage("gpu/stereocsbp/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE);
|
||||
Mat img_r_host = readImage("gpu/stereocsbp/aloeR.jpg", CV_LOAD_IMAGE_GRAYSCALE);
|
||||
cv::Mat img_l_host = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
|
||||
cv::Mat img_r_host = readImage("gpu/stereobm/aloe-R.png", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(img_l_host.empty());
|
||||
ASSERT_FALSE(img_r_host.empty());
|
||||
|
||||
GpuMat img_l(img_l_host);
|
||||
GpuMat img_r(img_r_host);
|
||||
cv::gpu::GpuMat img_l(img_l_host);
|
||||
cv::gpu::GpuMat img_r(img_r_host);
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
GpuMat dst;
|
||||
|
||||
StereoConstantSpaceBP bp(128);
|
||||
cv::gpu::StereoConstantSpaceBP bp(128);
|
||||
|
||||
declare.time(10.0);
|
||||
|
||||
@ -157,37 +165,38 @@ PERF_TEST_P(DevInfo, StereoConstantSpaceBP, testing::ValuesIn(devices()))
|
||||
{
|
||||
bp(img_l, img_r, dst);
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo, DisparityBilateralFilter, testing::ValuesIn(devices()))
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, StereoConstantSpaceBP, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// DisparityBilateralFilter
|
||||
|
||||
GPU_PERF_TEST_1(DisparityBilateralFilter, cv::gpu::DeviceInfo)
|
||||
{
|
||||
DeviceInfo devInfo = GetParam();
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat img_host = readImage("gpu/stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||
Mat disp_host = readImage("gpu/stereobm/aloe-disp.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||
cv::Mat img_host = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
|
||||
cv::Mat disp_host = readImage("gpu/stereobm/aloe-disp.png", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(img_host.empty());
|
||||
ASSERT_FALSE(disp_host.empty());
|
||||
|
||||
GpuMat img(img_host);
|
||||
GpuMat disp(disp_host);
|
||||
cv::gpu::GpuMat img(img_host);
|
||||
cv::gpu::GpuMat disp(disp_host);
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
GpuMat dst;
|
||||
|
||||
DisparityBilateralFilter f(128);
|
||||
cv::gpu::DisparityBilateralFilter f(128);
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
f(disp, img, dst);
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, DisparityBilateralFilter, ALL_DEVICES);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,23 +1,27 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
PERF_TEST_P(DevInfo_DescSize, BruteForceMatcher_match, testing::Combine(testing::ValuesIn(devices()),
|
||||
testing::Values(64, 128, 256)))
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// BruteForceMatcher_match
|
||||
|
||||
GPU_PERF_TEST(BruteForceMatcher_match, cv::gpu::DeviceInfo, int)
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
int desc_size = std::tr1::get<1>(GetParam());
|
||||
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
||||
int desc_size = GET_PARAM(1);
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat query_host(3000, desc_size, CV_32FC1);
|
||||
Mat train_host(3000, desc_size, CV_32FC1);
|
||||
cv::Mat query_host(3000, desc_size, CV_32FC1);
|
||||
cv::Mat train_host(3000, desc_size, CV_32FC1);
|
||||
|
||||
declare.in(query_host, train_host, WARMUP_RNG);
|
||||
|
||||
GpuMat query(query_host);
|
||||
GpuMat train(train_host);
|
||||
GpuMat trainIdx, distance;
|
||||
cv::gpu::GpuMat query(query_host);
|
||||
cv::gpu::GpuMat train(train_host);
|
||||
cv::gpu::GpuMat trainIdx, distance;
|
||||
|
||||
BruteForceMatcher_GPU< L2<float> > matcher;
|
||||
cv::gpu::BruteForceMatcher_GPU< cv::L2<float> > matcher;
|
||||
|
||||
declare.time(3.0);
|
||||
|
||||
@ -25,34 +29,33 @@ PERF_TEST_P(DevInfo_DescSize, BruteForceMatcher_match, testing::Combine(testing:
|
||||
{
|
||||
matcher.matchSingle(query, train, trainIdx, distance);
|
||||
}
|
||||
|
||||
Mat trainIdx_host(trainIdx);
|
||||
Mat distance_host(distance);
|
||||
|
||||
SANITY_CHECK(trainIdx_host);
|
||||
SANITY_CHECK(distance_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo_K_DescSize, BruteForceMatcher_knnMatch, testing::Combine(testing::ValuesIn(devices()),
|
||||
testing::Values(2, 3),
|
||||
testing::Values(64, 128, 256)))
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_match, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Values(64, 128, 256)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// BruteForceMatcher_knnMatch
|
||||
|
||||
GPU_PERF_TEST(BruteForceMatcher_knnMatch, cv::gpu::DeviceInfo, int, int)
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
int k = std::tr1::get<1>(GetParam());
|
||||
int desc_size = std::tr1::get<2>(GetParam());
|
||||
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
||||
int desc_size = GET_PARAM(1);
|
||||
int k = GET_PARAM(2);
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat query_host(3000, desc_size, CV_32FC1);
|
||||
Mat train_host(3000, desc_size, CV_32FC1);
|
||||
cv::Mat query_host(3000, desc_size, CV_32FC1);
|
||||
cv::Mat train_host(3000, desc_size, CV_32FC1);
|
||||
|
||||
declare.in(query_host, train_host, WARMUP_RNG);
|
||||
|
||||
GpuMat query(query_host);
|
||||
GpuMat train(train_host);
|
||||
GpuMat trainIdx, distance, allDist;
|
||||
cv::gpu::GpuMat query(query_host);
|
||||
cv::gpu::GpuMat train(train_host);
|
||||
cv::gpu::GpuMat trainIdx, distance, allDist;
|
||||
|
||||
BruteForceMatcher_GPU< L2<float> > matcher;
|
||||
cv::gpu::BruteForceMatcher_GPU< cv::L2<float> > matcher;
|
||||
|
||||
declare.time(3.0);
|
||||
|
||||
@ -60,30 +63,34 @@ PERF_TEST_P(DevInfo_K_DescSize, BruteForceMatcher_knnMatch, testing::Combine(tes
|
||||
{
|
||||
matcher.knnMatchSingle(query, train, trainIdx, distance, allDist, k);
|
||||
}
|
||||
|
||||
Mat trainIdx_host(trainIdx);
|
||||
Mat distance_host(distance);
|
||||
|
||||
SANITY_CHECK(trainIdx_host);
|
||||
SANITY_CHECK(distance_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo_DescSize, BruteForceMatcher_radiusMatch, testing::Combine(testing::ValuesIn(devices(SHARED_ATOMICS)),
|
||||
testing::Values(64, 128, 256)))
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_knnMatch, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Values(64, 128, 256),
|
||||
testing::Values(2, 3)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// BruteForceMatcher_radiusMatch
|
||||
|
||||
GPU_PERF_TEST(BruteForceMatcher_radiusMatch, cv::gpu::DeviceInfo, int)
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
int desc_size = std::tr1::get<1>(GetParam());
|
||||
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
||||
int desc_size = GET_PARAM(1);
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat query_host = cvtest::randomMat(theRNG(), Size(desc_size, 3000), CV_32FC1, 0, 1, false);
|
||||
Mat train_host = cvtest::randomMat(theRNG(), Size(desc_size, 3000), CV_32FC1, 0, 1, false);
|
||||
cv::Mat query_host(3000, desc_size, CV_32FC1);
|
||||
cv::Mat train_host(3000, desc_size, CV_32FC1);
|
||||
|
||||
GpuMat query(query_host);
|
||||
GpuMat train(train_host);
|
||||
GpuMat trainIdx, nMatches, distance;
|
||||
fill(query_host, 0, 1);
|
||||
fill(train_host, 0, 1);
|
||||
|
||||
BruteForceMatcher_GPU< L2<float> > matcher;
|
||||
cv::gpu::GpuMat query(query_host);
|
||||
cv::gpu::GpuMat train(train_host);
|
||||
cv::gpu::GpuMat trainIdx, nMatches, distance;
|
||||
|
||||
cv::gpu::BruteForceMatcher_GPU< cv::L2<float> > matcher;
|
||||
|
||||
declare.time(3.0);
|
||||
|
||||
@ -91,81 +98,90 @@ PERF_TEST_P(DevInfo_DescSize, BruteForceMatcher_radiusMatch, testing::Combine(te
|
||||
{
|
||||
matcher.radiusMatchSingle(query, train, trainIdx, distance, nMatches, 2.0);
|
||||
}
|
||||
|
||||
Mat trainIdx_host(trainIdx);
|
||||
Mat nMatches_host(nMatches);
|
||||
Mat distance_host(distance);
|
||||
|
||||
SANITY_CHECK(trainIdx_host);
|
||||
SANITY_CHECK(nMatches_host);
|
||||
SANITY_CHECK(distance_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo, SURF, testing::ValuesIn(devices()))
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_radiusMatch, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Values(64, 128, 256)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// SURF
|
||||
|
||||
GPU_PERF_TEST_1(SURF, cv::gpu::DeviceInfo)
|
||||
{
|
||||
DeviceInfo devInfo = GetParam();
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat img_host = readImage("gpu/perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE);
|
||||
cv::Mat img_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(img_host.empty());
|
||||
|
||||
GpuMat img(img_host);
|
||||
GpuMat keypoints, descriptors;
|
||||
cv::gpu::GpuMat img(img_host);
|
||||
cv::gpu::GpuMat keypoints, descriptors;
|
||||
|
||||
SURF_GPU surf;
|
||||
cv::gpu::SURF_GPU surf;
|
||||
|
||||
declare.time(2.0);
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
surf(img, GpuMat(), keypoints, descriptors);
|
||||
surf(img, cv::gpu::GpuMat(), keypoints, descriptors);
|
||||
}
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo, FAST, testing::ValuesIn(devices()))
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, SURF, DEVICES(cv::gpu::GLOBAL_ATOMICS));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// FAST
|
||||
|
||||
GPU_PERF_TEST_1(FAST, cv::gpu::DeviceInfo)
|
||||
{
|
||||
DeviceInfo devInfo = GetParam();
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat img_host = readImage("gpu/perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE);
|
||||
cv::Mat img_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(img_host.empty());
|
||||
|
||||
GpuMat img(img_host);
|
||||
GpuMat keypoints;
|
||||
cv::gpu::GpuMat img(img_host);
|
||||
cv::gpu::GpuMat keypoints, descriptors;
|
||||
|
||||
FAST_GPU fastGPU(20);
|
||||
|
||||
declare.time(2.0);
|
||||
cv::gpu::FAST_GPU fastGPU(20);
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
fastGPU(img, GpuMat(), keypoints);
|
||||
fastGPU(img, cv::gpu::GpuMat(), keypoints);
|
||||
}
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo, ORB, testing::ValuesIn(devices()))
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, FAST, DEVICES(cv::gpu::GLOBAL_ATOMICS));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// ORB
|
||||
|
||||
GPU_PERF_TEST_1(ORB, cv::gpu::DeviceInfo)
|
||||
{
|
||||
DeviceInfo devInfo = GetParam();
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat img_host = readImage("gpu/perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE);
|
||||
cv::Mat img_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(img_host.empty());
|
||||
|
||||
GpuMat img(img_host);
|
||||
GpuMat keypoints, descriptors;
|
||||
cv::gpu::GpuMat img(img_host);
|
||||
cv::gpu::GpuMat keypoints, descriptors;
|
||||
|
||||
ORB_GPU orbGPU(4000);
|
||||
|
||||
declare.time(2.0);
|
||||
cv::gpu::ORB_GPU orbGPU(4000);
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
orbGPU(img, GpuMat(), keypoints, descriptors);
|
||||
orbGPU(img, cv::gpu::GpuMat(), keypoints, descriptors);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, ORB, DEVICES(cv::gpu::GLOBAL_ATOMICS));
|
||||
|
||||
#endif
|
||||
|
@ -1,89 +1,95 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
PERF_TEST_P(DevInfo_Size_MatType_KernelSize, boxFilter, testing::Combine(testing::ValuesIn(devices()),
|
||||
testing::Values(GPU_TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_8UC4),
|
||||
testing::Values(3, 5)))
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// BoxFilter
|
||||
|
||||
GPU_PERF_TEST(BoxFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int)
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
Size size = std::tr1::get<1>(GetParam());
|
||||
int type = std::tr1::get<2>(GetParam());
|
||||
int ksize = std::tr1::get<3>(GetParam());
|
||||
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type = GET_PARAM(2);
|
||||
int ksize = GET_PARAM(3);
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat src_host(size, type);
|
||||
cv::Mat src_host(size, type);
|
||||
|
||||
declare.in(src_host, WARMUP_RNG);
|
||||
|
||||
GpuMat src(src_host);
|
||||
GpuMat dst(size, type);
|
||||
cv::gpu::GpuMat src(src_host);
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
Ptr<FilterEngine_GPU> filter = createBoxFilter_GPU(type, type, Size(ksize, ksize));
|
||||
cv::Ptr<cv::gpu::FilterEngine_GPU> filter = cv::gpu::createBoxFilter_GPU(type, type, cv::Size(ksize, ksize));
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
filter->apply(src, dst);
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo_Size_MatType_MorphOp_KernelSize, morphologyFilter, testing::Combine(testing::ValuesIn(devices()),
|
||||
testing::Values(GPU_TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_8UC4),
|
||||
testing::Values((int)MORPH_ERODE, (int)MORPH_DILATE),
|
||||
testing::Values(3, 5)))
|
||||
INSTANTIATE_TEST_CASE_P(Filter, BoxFilter, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(CV_8UC1, CV_8UC4),
|
||||
testing::Values(3, 5)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// MorphologyFilter
|
||||
|
||||
GPU_PERF_TEST(MorphologyFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, MorphOp, int)
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
Size size = std::tr1::get<1>(GetParam());
|
||||
int type = std::tr1::get<2>(GetParam());
|
||||
int op = std::tr1::get<3>(GetParam());
|
||||
int ksize = std::tr1::get<4>(GetParam());
|
||||
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type = GET_PARAM(2);
|
||||
int op = GET_PARAM(3);
|
||||
int ksize = GET_PARAM(4);
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat src_host(size, type);
|
||||
cv::Mat src_host(size, type);
|
||||
|
||||
declare.in(src_host, WARMUP_RNG);
|
||||
|
||||
GpuMat src(src_host);
|
||||
GpuMat dst(size, type);
|
||||
cv::gpu::GpuMat src(src_host);
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
Ptr<FilterEngine_GPU> filter = createMorphologyFilter_GPU(op, type, Mat::ones(ksize, ksize, CV_8U));
|
||||
cv::Ptr<cv::gpu::FilterEngine_GPU> filter = cv::gpu::createMorphologyFilter_GPU(op, type, cv::Mat::ones(ksize, ksize, CV_8U));
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
filter->apply(src, dst);
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo_Size_MatType_KernelSize, linearFilter, testing::Combine(testing::ValuesIn(devices()),
|
||||
testing::Values(GPU_TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_8UC4),
|
||||
testing::Values(3, 5)))
|
||||
INSTANTIATE_TEST_CASE_P(Filter, MorphologyFilter, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(CV_8UC1, CV_8UC4),
|
||||
testing::Values((int) cv::MORPH_ERODE, (int) cv::MORPH_DILATE),
|
||||
testing::Values(3, 5)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// LinearFilter
|
||||
|
||||
GPU_PERF_TEST(LinearFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int)
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
Size size = std::tr1::get<1>(GetParam());
|
||||
int type = std::tr1::get<2>(GetParam());
|
||||
int ksize = std::tr1::get<3>(GetParam());
|
||||
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type = GET_PARAM(2);
|
||||
int ksize = GET_PARAM(3);
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat src_host(size, type);
|
||||
cv::Mat src_host(size, type);
|
||||
|
||||
declare.in(src_host, WARMUP_RNG);
|
||||
|
||||
GpuMat src(src_host);
|
||||
GpuMat dst(size, type);
|
||||
cv::gpu::GpuMat src(src_host);
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
Ptr<FilterEngine_GPU> filter = createLinearFilter_GPU(type, type, Mat::ones(ksize, ksize, CV_8U));
|
||||
cv::Ptr<cv::gpu::FilterEngine_GPU> filter = cv::gpu::createLinearFilter_GPU(type, type, cv::Mat::ones(ksize, ksize, CV_8U));
|
||||
|
||||
declare.time(1.0);
|
||||
|
||||
@ -91,42 +97,48 @@ PERF_TEST_P(DevInfo_Size_MatType_KernelSize, linearFilter, testing::Combine(test
|
||||
{
|
||||
filter->apply(src, dst);
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo_Size_MatType_KernelSize, separableLinearFilter, testing::Combine(testing::ValuesIn(devices()),
|
||||
testing::Values(GPU_TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_8UC4, CV_32FC1),
|
||||
testing::Values(3, 5)))
|
||||
INSTANTIATE_TEST_CASE_P(Filter, LinearFilter, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(CV_8UC1, CV_8UC4),
|
||||
testing::Values(3, 5)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// SeparableLinearFilter
|
||||
|
||||
GPU_PERF_TEST(SeparableLinearFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int)
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
Size size = std::tr1::get<1>(GetParam());
|
||||
int type = std::tr1::get<2>(GetParam());
|
||||
int ksize = std::tr1::get<3>(GetParam());
|
||||
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type = GET_PARAM(2);
|
||||
int ksize = GET_PARAM(3);
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat src_host(size, type);
|
||||
cv::Mat src_host(size, type);
|
||||
|
||||
declare.in(src_host, WARMUP_RNG);
|
||||
|
||||
GpuMat src(src_host);
|
||||
GpuMat dst(size, type);
|
||||
cv::gpu::GpuMat src(src_host);
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
Mat kernel = getGaussianKernel(ksize, 0.5, CV_32F);
|
||||
Ptr<FilterEngine_GPU> filter = createSeparableLinearFilter_GPU(type, type, kernel, kernel, Point(-1,-1));
|
||||
cv::Mat kernel = cv::getGaussianKernel(ksize, 0.5, CV_32F);
|
||||
cv::Ptr<cv::gpu::FilterEngine_GPU> filter = cv::gpu::createSeparableLinearFilter_GPU(type, type, kernel, kernel);
|
||||
|
||||
declare.time(1.0);
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
filter->apply(src, dst, Rect(0, 0, src.cols, src.rows));
|
||||
filter->apply(src, dst, cv::Rect(0, 0, src.cols, src.rows));
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter, SeparableLinearFilter, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(CV_8UC1, CV_8UC4, CV_32FC1),
|
||||
testing::Values(3, 5)));
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,8 +5,7 @@
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
Regression::Init("gpu");
|
||||
TestBase::Init(argc, argv);
|
||||
perf::TestBase::Init(argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
|
@ -1,176 +1,185 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
PERF_TEST_P(DevInfo_Size_MatType, merge, testing::Combine(testing::ValuesIn(devices()),
|
||||
testing::Values(GPU_TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)))
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
Size size = std::tr1::get<1>(GetParam());
|
||||
int type = std::tr1::get<2>(GetParam());
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Merge
|
||||
|
||||
GPU_PERF_TEST(Merge, 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);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
const int num_channels = 4;
|
||||
|
||||
vector<GpuMat> src(num_channels);
|
||||
std::vector<cv::gpu::GpuMat> src(num_channels);
|
||||
for (int i = 0; i < num_channels; ++i)
|
||||
src[i] = GpuMat(size, type, cv::Scalar::all(i));
|
||||
src[i] = cv::gpu::GpuMat(size, type, cv::Scalar::all(i));
|
||||
|
||||
GpuMat dst(size, CV_MAKETYPE(type, num_channels));
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
merge(src, dst);
|
||||
cv::gpu::merge(src, dst);
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo_Size_MatType, split, testing::Combine(testing::ValuesIn(devices()),
|
||||
testing::Values(GPU_TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)))
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
Size size = std::tr1::get<1>(GetParam());
|
||||
int type = std::tr1::get<2>(GetParam());
|
||||
INSTANTIATE_TEST_CASE_P(MatOp, Merge, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)));
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Split
|
||||
|
||||
GPU_PERF_TEST(Split, 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);
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
const int num_channels = 4;
|
||||
|
||||
GpuMat src(size, CV_MAKETYPE(type, num_channels), cv::Scalar(1, 2, 3, 4));
|
||||
cv::gpu::GpuMat src(size, CV_MAKETYPE(type, num_channels), cv::Scalar(1, 2, 3, 4));
|
||||
|
||||
vector<GpuMat> dst(num_channels);
|
||||
std::vector<cv::gpu::GpuMat> dst(num_channels);
|
||||
for (int i = 0; i < num_channels; ++i)
|
||||
dst[i] = GpuMat(size, type);
|
||||
dst[i] = cv::gpu::GpuMat(size, type);
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
split(src, dst);
|
||||
cv::gpu::split(src, dst);
|
||||
}
|
||||
|
||||
vector<Mat> dst_host(dst.size());
|
||||
for (size_t i = 0; i < dst.size(); ++i)
|
||||
dst[i].download(dst_host[i]);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo_Size_MatType, setTo, testing::Combine(testing::ValuesIn(devices()),
|
||||
testing::Values(GPU_TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_8UC4, CV_32FC1)))
|
||||
INSTANTIATE_TEST_CASE_P(MatOp, Split, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// SetTo
|
||||
|
||||
GPU_PERF_TEST(SetTo, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
Size size = std::tr1::get<1>(GetParam());
|
||||
int type = std::tr1::get<2>(GetParam());
|
||||
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type = GET_PARAM(2);
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
GpuMat src(size, type);
|
||||
Scalar val(1, 2, 3, 4);
|
||||
cv::gpu::GpuMat src(size, type);
|
||||
cv::Scalar val(1, 2, 3, 4);
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
src.setTo(val);
|
||||
}
|
||||
|
||||
Mat src_host(src);
|
||||
|
||||
SANITY_CHECK(src_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo_Size_MatType, setToMasked, testing::Combine(testing::ValuesIn(devices()),
|
||||
testing::Values(GPU_TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_8UC4, CV_32FC1)))
|
||||
INSTANTIATE_TEST_CASE_P(MatOp, SetTo, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// SetToMasked
|
||||
|
||||
GPU_PERF_TEST(SetToMasked, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
Size size = std::tr1::get<1>(GetParam());
|
||||
int type = std::tr1::get<2>(GetParam());
|
||||
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type = GET_PARAM(2);
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat src_host(size, type);
|
||||
cv::Mat src_host(size, type);
|
||||
cv::Mat mask_host(size, CV_8UC1);
|
||||
|
||||
declare.in(src_host, WARMUP_RNG);
|
||||
fill(mask_host, 0, 2);
|
||||
|
||||
GpuMat src(src_host);
|
||||
Scalar val(1, 2, 3, 4);
|
||||
|
||||
Mat mask_host(size, CV_8UC1);
|
||||
randu(mask_host, 0.0, 2.0);
|
||||
GpuMat mask(mask_host);
|
||||
cv::gpu::GpuMat src(src_host);
|
||||
cv::Scalar val(1, 2, 3, 4);
|
||||
cv::gpu::GpuMat mask(mask_host);
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
src.setTo(val, mask);
|
||||
}
|
||||
|
||||
src.download(src_host);
|
||||
|
||||
SANITY_CHECK(src_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo_Size_MatType, copyToMasked, testing::Combine(testing::ValuesIn(devices()),
|
||||
testing::Values(GPU_TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_8UC4, CV_32FC1)))
|
||||
INSTANTIATE_TEST_CASE_P(MatOp, SetToMasked, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CopyToMasked
|
||||
|
||||
GPU_PERF_TEST(CopyToMasked, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
Size size = std::tr1::get<1>(GetParam());
|
||||
int type = std::tr1::get<2>(GetParam());
|
||||
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type = GET_PARAM(2);
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat src_host(size, type);
|
||||
cv::Mat src_host(size, type);
|
||||
cv::Mat mask_host(size, CV_8UC1);
|
||||
|
||||
declare.in(src_host, WARMUP_RNG);
|
||||
fill(mask_host, 0, 2);
|
||||
|
||||
GpuMat src(src_host);
|
||||
GpuMat dst(size, type);
|
||||
|
||||
Mat mask_host(size, CV_8UC1);
|
||||
randu(mask_host, 0.0, 2.0);
|
||||
GpuMat mask(mask_host);
|
||||
cv::gpu::GpuMat src(src_host);
|
||||
cv::gpu::GpuMat mask(mask_host);
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
src.copyTo(dst, mask);
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
PERF_TEST_P(DevInfo_Size_MatType_MatType, convertTo, testing::Combine(testing::ValuesIn(devices()),
|
||||
testing::Values(GPU_TYPICAL_MAT_SIZES),
|
||||
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1),
|
||||
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)))
|
||||
INSTANTIATE_TEST_CASE_P(MatOp, CopyToMasked, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// ConvertTo
|
||||
|
||||
GPU_PERF_TEST(ConvertTo, cv::gpu::DeviceInfo, cv::Size, perf::MatType, perf::MatType)
|
||||
{
|
||||
DeviceInfo devInfo = std::tr1::get<0>(GetParam());
|
||||
Size size = std::tr1::get<1>(GetParam());
|
||||
int type1 = std::tr1::get<2>(GetParam());
|
||||
int type2 = std::tr1::get<3>(GetParam());
|
||||
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type1 = GET_PARAM(2);
|
||||
int type2 = GET_PARAM(3);
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat src_host(size, type1);
|
||||
cv::Mat src_host(size, type1);
|
||||
|
||||
declare.in(src_host, WARMUP_RNG);
|
||||
|
||||
GpuMat src(src_host);
|
||||
GpuMat dst(size, type2);
|
||||
|
||||
double a = 0.5;
|
||||
double b = 1.0;
|
||||
cv::gpu::GpuMat src(src_host);
|
||||
cv::gpu::GpuMat dst;
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
src.convertTo(dst, type2, a, b);
|
||||
src.convertTo(dst, type2, 0.5, 1.0);
|
||||
}
|
||||
|
||||
Mat dst_host(dst);
|
||||
|
||||
SANITY_CHECK(dst_host);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MatOp, ConvertTo, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1),
|
||||
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)));
|
||||
|
||||
#endif
|
||||
|
@ -1,21 +1,27 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
PERF_TEST_P(DevInfo, HOGDescriptor, testing::ValuesIn(devices()))
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
GPU_PERF_TEST_1(HOG, cv::gpu::DeviceInfo)
|
||||
{
|
||||
DeviceInfo devInfo = GetParam();
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
setDevice(devInfo.deviceID());
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
Mat img_host = readImage("gpu/hog/road.png", CV_LOAD_IMAGE_GRAYSCALE);
|
||||
cv::Mat img_host = readImage("gpu/hog/road.png", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
GpuMat img(img_host);
|
||||
vector<Rect> found_locations;
|
||||
cv::gpu::GpuMat img(img_host);
|
||||
std::vector<cv::Rect> found_locations;
|
||||
|
||||
gpu::HOGDescriptor hog;
|
||||
hog.setSVMDetector(gpu::HOGDescriptor::getDefaultPeopleDetector());
|
||||
cv::gpu::HOGDescriptor hog;
|
||||
hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector());
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
hog.detectMultiScale(img, found_locations);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ObjDetect, HOG, ALL_DEVICES);
|
||||
|
||||
#endif
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <iostream>
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/ts/ts.hpp"
|
||||
#include "opencv2/ts/ts_perf.hpp"
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/gpu/gpu.hpp"
|
||||
|
@ -1,70 +1,16 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::gpu;
|
||||
|
||||
Mat readImage(const string& fileName, int flags)
|
||||
void fill(Mat& m, double a, double b)
|
||||
{
|
||||
return imread(::perf::TestBase::getDataPath(fileName), flags);
|
||||
RNG rng(123456789);
|
||||
rng.fill(m, RNG::UNIFORM, a, b);
|
||||
}
|
||||
|
||||
bool supportFeature(const DeviceInfo& info, FeatureSet feature)
|
||||
{
|
||||
return TargetArchs::builtWith(feature) && info.supports(feature);
|
||||
}
|
||||
|
||||
const vector<DeviceInfo>& devices()
|
||||
{
|
||||
static vector<DeviceInfo> devs;
|
||||
static bool first = true;
|
||||
|
||||
if (first)
|
||||
{
|
||||
int deviceCount = getCudaEnabledDeviceCount();
|
||||
|
||||
devs.reserve(deviceCount);
|
||||
|
||||
for (int i = 0; i < deviceCount; ++i)
|
||||
{
|
||||
DeviceInfo info(i);
|
||||
if (info.isCompatible())
|
||||
devs.push_back(info);
|
||||
}
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
return devs;
|
||||
}
|
||||
|
||||
vector<DeviceInfo> devices(FeatureSet feature)
|
||||
{
|
||||
const vector<DeviceInfo>& d = devices();
|
||||
|
||||
vector<DeviceInfo> devs_filtered;
|
||||
|
||||
if (TargetArchs::builtWith(feature))
|
||||
{
|
||||
devs_filtered.reserve(d.size());
|
||||
|
||||
for (size_t i = 0, size = d.size(); i < size; ++i)
|
||||
{
|
||||
const DeviceInfo& info = d[i];
|
||||
|
||||
if (info.supports(feature))
|
||||
devs_filtered.push_back(info);
|
||||
}
|
||||
}
|
||||
|
||||
return devs_filtered;
|
||||
}
|
||||
|
||||
void cv::gpu::PrintTo(const DeviceInfo& info, ostream* os)
|
||||
{
|
||||
*os << info.name();
|
||||
}
|
||||
|
||||
void PrintTo(const CvtColorInfo& info, ::std::ostream* os)
|
||||
void PrintTo(const CvtColorInfo& info, ostream* os)
|
||||
{
|
||||
static const char* str[] =
|
||||
{
|
||||
@ -190,3 +136,66 @@ void PrintTo(const CvtColorInfo& info, ::std::ostream* os)
|
||||
|
||||
*os << str[info.code];
|
||||
}
|
||||
|
||||
void cv::gpu::PrintTo(const DeviceInfo& info, ostream* os)
|
||||
{
|
||||
*os << info.name();
|
||||
}
|
||||
|
||||
Mat readImage(const string& fileName, int flags)
|
||||
{
|
||||
return imread(perf::TestBase::getDataPath(fileName), flags);
|
||||
}
|
||||
|
||||
bool supportFeature(const DeviceInfo& info, FeatureSet feature)
|
||||
{
|
||||
return TargetArchs::builtWith(feature) && info.supports(feature);
|
||||
}
|
||||
|
||||
const vector<DeviceInfo>& devices()
|
||||
{
|
||||
static vector<DeviceInfo> devs;
|
||||
static bool first = true;
|
||||
|
||||
if (first)
|
||||
{
|
||||
int deviceCount = getCudaEnabledDeviceCount();
|
||||
|
||||
devs.reserve(deviceCount);
|
||||
|
||||
for (int i = 0; i < deviceCount; ++i)
|
||||
{
|
||||
DeviceInfo info(i);
|
||||
if (info.isCompatible())
|
||||
devs.push_back(info);
|
||||
}
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
return devs;
|
||||
}
|
||||
|
||||
vector<DeviceInfo> devices(FeatureSet feature)
|
||||
{
|
||||
const vector<DeviceInfo>& d = devices();
|
||||
|
||||
vector<DeviceInfo> devs_filtered;
|
||||
|
||||
if (TargetArchs::builtWith(feature))
|
||||
{
|
||||
devs_filtered.reserve(d.size());
|
||||
|
||||
for (size_t i = 0, size = d.size(); i < size; ++i)
|
||||
{
|
||||
const DeviceInfo& info = d[i];
|
||||
|
||||
if (info.supports(feature))
|
||||
devs_filtered.push_back(info);
|
||||
}
|
||||
}
|
||||
|
||||
return devs_filtered;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,25 +1,16 @@
|
||||
#ifndef __OPENCV_PERF_GPU_UTILITY_HPP__
|
||||
#define __OPENCV_PERF_GPU_UTILITY_HPP__
|
||||
|
||||
#include <iosfwd>
|
||||
#include "opencv2/ts/ts.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/gpu/gpu.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::gpu;
|
||||
using namespace perf;
|
||||
void fill(cv::Mat& m, double a, double b);
|
||||
|
||||
enum {HORIZONTAL_AXIS = 0, VERTICAL_AXIS = 1, BOTH_AXIS = -1};
|
||||
|
||||
CV_ENUM(MorphOp, MORPH_ERODE, MORPH_DILATE)
|
||||
CV_ENUM(BorderMode, BORDER_REFLECT101, BORDER_REPLICATE, BORDER_CONSTANT, BORDER_REFLECT, BORDER_WRAP)
|
||||
CV_ENUM(MorphOp, cv::MORPH_ERODE, cv::MORPH_DILATE)
|
||||
CV_ENUM(BorderMode, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP)
|
||||
CV_ENUM(FlipCode, HORIZONTAL_AXIS, VERTICAL_AXIS, BOTH_AXIS)
|
||||
CV_ENUM(CmpOp, CMP_EQ, CMP_GT, CMP_GE, CMP_LT, CMP_LE, CMP_NE)
|
||||
CV_ENUM(Interpolation, INTER_NEAREST, INTER_LINEAR, INTER_CUBIC)
|
||||
CV_ENUM(MatchMethod, TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_CCOEFF, TM_CCOEFF_NORMED)
|
||||
CV_ENUM(NormType, NORM_INF, NORM_L1, NORM_L2)
|
||||
CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC)
|
||||
CV_ENUM(MatchMethod, cv::TM_SQDIFF, cv::TM_SQDIFF_NORMED, cv::TM_CCORR, cv::TM_CCORR_NORMED, cv::TM_CCOEFF, cv::TM_CCOEFF_NORMED)
|
||||
CV_ENUM(NormType, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2)
|
||||
|
||||
struct CvtColorInfo
|
||||
{
|
||||
@ -30,53 +21,48 @@ struct CvtColorInfo
|
||||
explicit CvtColorInfo(int scn_=0, int dcn_=0, int code_=0) : scn(scn_), dcn(dcn_), code(code_) {}
|
||||
};
|
||||
|
||||
typedef TestBaseWithParam<DeviceInfo> DevInfo;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size> > DevInfo_Size;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, int, int> > DevInfo_Int_Int;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, MatType> > DevInfo_MatType;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType> > DevInfo_Size_MatType;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, MatType> > DevInfo_Size_MatType_MatType;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, int> > DevInfo_Size_MatType_KernelSize;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, MorphOp, int> > DevInfo_Size_MatType_MorphOp_KernelSize;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, int, BorderMode> > DevInfo_Size_MatType_KernelSize_BorderMode;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, FlipCode> > DevInfo_Size_MatType_FlipCode;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, CmpOp> > DevInfo_Size_MatType_CmpOp;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, Interpolation> > DevInfo_Size_MatType_Interpolation;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, Interpolation, double> > DevInfo_Size_MatType_Interpolation_SizeCoeff;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, Interpolation, BorderMode> > DevInfo_Size_MatType_Interpolation_BorderMode;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, CvtColorInfo> > DevInfo_Size_MatType_CvtColorInfo;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, MatchMethod> > DevInfo_Size_MatType_MatchMethod;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, NormType> > DevInfo_Size_NormType;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, NormType> > DevInfo_Size_MatType_NormType;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, int> > DevInfo_DescSize;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, int, int> > DevInfo_K_DescSize;
|
||||
typedef TestBaseWithParam< std::tr1::tuple<DeviceInfo, Size, MatType, BorderMode> > DevInfo_Size_MatType_BorderMode;
|
||||
void PrintTo(const CvtColorInfo& info, std::ostream* os);
|
||||
|
||||
const cv::Size sz1800x1500 = cv::Size(1800, 1500);
|
||||
const cv::Size sz4700x3000 = cv::Size(4700, 3000);
|
||||
namespace cv { namespace gpu
|
||||
{
|
||||
void PrintTo(const cv::gpu::DeviceInfo& info, std::ostream* os);
|
||||
}}
|
||||
|
||||
//#define GPU_TYPICAL_MAT_SIZES szXGA, szSXGA, sz720p, sz1080p, sz1800x1500, sz4700x3000
|
||||
#define GPU_TYPICAL_MAT_SIZES szSXGA, sz1080p, sz4700x3000
|
||||
#define GPU_PERF_TEST(name, ...) \
|
||||
struct name : perf::TestBaseWithParam< std::tr1::tuple< __VA_ARGS__ > > \
|
||||
{ \
|
||||
public: \
|
||||
name() {} \
|
||||
protected: \
|
||||
void PerfTestBody(); \
|
||||
}; \
|
||||
TEST_P(name, perf){ RunPerfTestBody(); } \
|
||||
void name :: PerfTestBody()
|
||||
|
||||
//! read image from testdata folder.
|
||||
Mat readImage(const string& fileName, int flags = CV_LOAD_IMAGE_COLOR);
|
||||
#define GPU_PERF_TEST_1(name, param_type) \
|
||||
struct name : perf::TestBaseWithParam< param_type > \
|
||||
{ \
|
||||
public: \
|
||||
name() {} \
|
||||
protected: \
|
||||
void PerfTestBody(); \
|
||||
}; \
|
||||
TEST_P(name, perf){ RunPerfTestBody(); } \
|
||||
void name :: PerfTestBody()
|
||||
|
||||
#define GPU_TYPICAL_MAT_SIZES testing::Values(perf::szSXGA, perf::sz1080p, cv::Size(1800, 1500))
|
||||
|
||||
cv::Mat readImage(const std::string& fileName, int flags = cv::IMREAD_COLOR);
|
||||
|
||||
//! return true if device supports specified feature and gpu module was built with support the feature.
|
||||
bool supportFeature(const cv::gpu::DeviceInfo& info, cv::gpu::FeatureSet feature);
|
||||
|
||||
//! return all devices compatible with current gpu module build.
|
||||
const std::vector<cv::gpu::DeviceInfo>& devices();
|
||||
//! return all devices compatible with current gpu module build which support specified feature.
|
||||
|
||||
std::vector<cv::gpu::DeviceInfo> devices(cv::gpu::FeatureSet feature);
|
||||
|
||||
namespace cv
|
||||
{
|
||||
namespace gpu
|
||||
{
|
||||
void PrintTo(const DeviceInfo& info, ::std::ostream* os);
|
||||
}
|
||||
}
|
||||
#define ALL_DEVICES testing::ValuesIn(devices())
|
||||
#define DEVICES(feature) testing::ValuesIn(devices(feature))
|
||||
|
||||
void PrintTo(const CvtColorInfo& info, ::std::ostream* os);
|
||||
#define GET_PARAM(k) std::tr1::get< k >(GetParam())
|
||||
|
||||
#endif // __OPENCV_PERF_GPU_UTILITY_HPP__
|
||||
|
81
modules/gpu/perf/perf_video.cpp
Normal file
81
modules/gpu/perf/perf_video.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
#include "perf_precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// BroxOpticalFlow
|
||||
|
||||
GPU_PERF_TEST_1(BroxOpticalFlow, cv::gpu::DeviceInfo)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
cv::Mat frame0_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
cv::Mat frame1_host = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(frame0_host.empty());
|
||||
ASSERT_FALSE(frame1_host.empty());
|
||||
|
||||
frame0_host.convertTo(frame0_host, CV_32FC1, 1.0 / 255.0);
|
||||
frame1_host.convertTo(frame1_host, CV_32FC1, 1.0 / 255.0);
|
||||
|
||||
cv::gpu::GpuMat frame0(frame0_host);
|
||||
cv::gpu::GpuMat frame1(frame1_host);
|
||||
cv::gpu::GpuMat u;
|
||||
cv::gpu::GpuMat v;
|
||||
|
||||
cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,
|
||||
10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);
|
||||
|
||||
declare.time(10);
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
d_flow(frame0, frame1, u, v);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Video, BroxOpticalFlow, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// InterpolateFrames
|
||||
|
||||
GPU_PERF_TEST_1(InterpolateFrames, cv::gpu::DeviceInfo)
|
||||
{
|
||||
cv::gpu::DeviceInfo devInfo = GetParam();
|
||||
|
||||
cv::gpu::setDevice(devInfo.deviceID());
|
||||
|
||||
cv::Mat frame0_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
cv::Mat frame1_host = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(frame0_host.empty());
|
||||
ASSERT_FALSE(frame1_host.empty());
|
||||
|
||||
frame0_host.convertTo(frame0_host, CV_32FC1, 1.0 / 255.0);
|
||||
frame1_host.convertTo(frame1_host, CV_32FC1, 1.0 / 255.0);
|
||||
|
||||
cv::gpu::GpuMat frame0(frame0_host);
|
||||
cv::gpu::GpuMat frame1(frame1_host);
|
||||
cv::gpu::GpuMat fu, fv;
|
||||
cv::gpu::GpuMat bu, bv;
|
||||
|
||||
cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,
|
||||
10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);
|
||||
|
||||
d_flow(frame0, frame1, fu, fv);
|
||||
d_flow(frame1, frame0, bu, bv);
|
||||
|
||||
cv::gpu::GpuMat newFrame;
|
||||
cv::gpu::GpuMat buf;
|
||||
|
||||
TEST_CYCLE(100)
|
||||
{
|
||||
cv::gpu::interpolateFrames(frame0, frame1, fu, fv, bu, bv, 0.5f, newFrame, buf);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Video, InterpolateFrames, ALL_DEVICES);
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user