updated gpu performance tests
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2,61 +2,22 @@
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// ProjectPoints
|
||||
|
||||
GPU_PERF_TEST_1(ProjectPoints, cv::gpu::DeviceInfo)
|
||||
{
|
||||
cv::Mat src(1, 10000, CV_32FC3);
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::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);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, ProjectPoints, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// SolvePnPRansac
|
||||
|
||||
GPU_PERF_TEST_1(SolvePnPRansac, cv::gpu::DeviceInfo)
|
||||
{
|
||||
cv::Mat object(1, 10000, CV_32FC3);
|
||||
cv::Mat image(1, 10000, CV_32FC2);
|
||||
|
||||
declare.in(object, image, WARMUP_RNG);
|
||||
|
||||
cv::Mat rvec, tvec;
|
||||
|
||||
declare.time(3.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::solvePnPRansac(object, image, cv::Mat::ones(3, 3, CV_32FC1), cv::Mat(1, 8, CV_32F, cv::Scalar::all(0)), rvec, tvec);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, SolvePnPRansac, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// StereoBM
|
||||
|
||||
GPU_PERF_TEST_1(StereoBM, cv::gpu::DeviceInfo)
|
||||
{
|
||||
cv::Mat img_l = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
cv::Mat img_r = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(img_l.empty());
|
||||
|
||||
cv::Mat img_r = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(img_r.empty());
|
||||
|
||||
cv::StereoBM bm(0, 256);
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
cv::StereoBM bm(0, 256);
|
||||
bm(img_l, img_r, dst);
|
||||
|
||||
declare.time(5.0);
|
||||
|
||||
@@ -68,5 +29,108 @@ GPU_PERF_TEST_1(StereoBM, cv::gpu::DeviceInfo)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, StereoBM, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// ProjectPoints
|
||||
|
||||
IMPLEMENT_PARAM_CLASS(Count, int)
|
||||
|
||||
GPU_PERF_TEST(ProjectPoints, cv::gpu::DeviceInfo, Count)
|
||||
{
|
||||
int count = GET_PARAM(1);
|
||||
|
||||
cv::Mat src(1, count, CV_32FC3);
|
||||
fill(src, -100, 100);
|
||||
|
||||
cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);
|
||||
cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);
|
||||
cv::Mat camera_mat = cv::Mat::ones(3, 3, CV_32FC1);
|
||||
cv::Mat dst;
|
||||
|
||||
cv::projectPoints(src, rvec, tvec, camera_mat, cv::noArray(), dst);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::projectPoints(src, rvec, tvec, camera_mat, cv::noArray(), dst);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, ProjectPoints, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Values<Count>(5000, 10000, 20000)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// SolvePnPRansac
|
||||
|
||||
GPU_PERF_TEST(SolvePnPRansac, cv::gpu::DeviceInfo, Count)
|
||||
{
|
||||
int count = GET_PARAM(1);
|
||||
|
||||
cv::Mat object(1, count, CV_32FC3);
|
||||
fill(object, -100, 100);
|
||||
|
||||
cv::Mat camera_mat(3, 3, CV_32FC1);
|
||||
fill(camera_mat, 0.5, 1);
|
||||
camera_mat.at<float>(0, 1) = 0.f;
|
||||
camera_mat.at<float>(1, 0) = 0.f;
|
||||
camera_mat.at<float>(2, 0) = 0.f;
|
||||
camera_mat.at<float>(2, 1) = 0.f;
|
||||
|
||||
cv::Mat dist_coef(1, 8, CV_32F, cv::Scalar::all(0));
|
||||
|
||||
std::vector<cv::Point2f> image_vec;
|
||||
cv::Mat rvec_gold(1, 3, CV_32FC1);
|
||||
fill(rvec_gold, 0, 1);
|
||||
cv::Mat tvec_gold(1, 3, CV_32FC1);
|
||||
fill(tvec_gold, 0, 1);
|
||||
cv::projectPoints(object, rvec_gold, tvec_gold, camera_mat, dist_coef, image_vec);
|
||||
|
||||
cv::Mat image(1, count, CV_32FC2, &image_vec[0]);
|
||||
|
||||
cv::Mat rvec;
|
||||
cv::Mat tvec;
|
||||
|
||||
cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
|
||||
|
||||
declare.time(10.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, SolvePnPRansac, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Values<Count>(5000, 10000, 20000)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// ReprojectImageTo3D
|
||||
|
||||
GPU_PERF_TEST(ReprojectImageTo3D, cv::gpu::DeviceInfo, cv::Size, MatDepth)
|
||||
{
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int depth = GET_PARAM(2);
|
||||
|
||||
cv::Mat src(size, depth);
|
||||
fill(src, 5.0, 30.0);
|
||||
|
||||
cv::Mat Q(4, 4, CV_32FC1);
|
||||
fill(Q, 0.1, 1.0);
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
cv::reprojectImageTo3D(src, dst, Q);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::reprojectImageTo3D(src, dst, Q);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Calib3D, ReprojectImageTo3D, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values<MatDepth>(CV_8U, CV_16S)));
|
||||
|
||||
#endif
|
||||
|
||||
|
1388
modules/gpu/perf_cpu/perf_core.cpp
Normal file
1388
modules/gpu/perf_cpu/perf_core.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,22 +2,99 @@
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// SURF
|
||||
|
||||
GPU_PERF_TEST_1(SURF, cv::gpu::DeviceInfo)
|
||||
{
|
||||
cv::Mat img = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(img.empty());
|
||||
|
||||
cv::SURF surf;
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints;
|
||||
cv::Mat descriptors;
|
||||
|
||||
surf(img, cv::noArray(), keypoints, descriptors);
|
||||
|
||||
declare.time(50.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
surf(img, cv::noArray(), keypoints, descriptors);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, SURF, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// FAST
|
||||
|
||||
GPU_PERF_TEST_1(FAST, cv::gpu::DeviceInfo)
|
||||
{
|
||||
cv::Mat img = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(img.empty());
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints;
|
||||
|
||||
cv::FAST(img, keypoints, 20);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::FAST(img, keypoints, 20);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, FAST, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// ORB
|
||||
|
||||
GPU_PERF_TEST_1(ORB, cv::gpu::DeviceInfo)
|
||||
{
|
||||
cv::Mat img = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(img.empty());
|
||||
|
||||
cv::ORB orb(4000);
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints;
|
||||
cv::Mat descriptors;
|
||||
|
||||
orb(img, cv::noArray(), keypoints, descriptors);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
orb(img, cv::noArray(), keypoints, descriptors);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, ORB, ALL_DEVICES);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// BruteForceMatcher_match
|
||||
|
||||
GPU_PERF_TEST(BruteForceMatcher_match, cv::gpu::DeviceInfo, int)
|
||||
IMPLEMENT_PARAM_CLASS(DescriptorSize, int)
|
||||
|
||||
GPU_PERF_TEST(BruteForceMatcher_match, cv::gpu::DeviceInfo, DescriptorSize, NormType)
|
||||
{
|
||||
int desc_size = GET_PARAM(1);
|
||||
int normType = GET_PARAM(2);
|
||||
|
||||
cv::Mat query(3000, desc_size, CV_32FC1);
|
||||
cv::Mat train(3000, desc_size, CV_32FC1);
|
||||
int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;
|
||||
|
||||
declare.in(query, train, WARMUP_RNG);
|
||||
cv::Mat query(3000, desc_size, type);
|
||||
fill(query, 0.0, 10.0);
|
||||
|
||||
cv::Mat train(3000, desc_size, type);
|
||||
fill(train, 0.0, 10.0);
|
||||
|
||||
cv::BFMatcher matcher(normType);
|
||||
|
||||
cv::BFMatcher matcher(cv::NORM_L2);
|
||||
std::vector<cv::DMatch> matches;
|
||||
|
||||
declare.time(10.0);
|
||||
matcher.match(query, train, matches);
|
||||
|
||||
declare.time(20.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
@@ -26,26 +103,36 @@ GPU_PERF_TEST(BruteForceMatcher_match, cv::gpu::DeviceInfo, int)
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_match, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Values(64, 128, 256)));
|
||||
ALL_DEVICES,
|
||||
testing::Values(DescriptorSize(64), DescriptorSize(128), DescriptorSize(256)),
|
||||
testing::Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// BruteForceMatcher_knnMatch
|
||||
|
||||
GPU_PERF_TEST(BruteForceMatcher_knnMatch, cv::gpu::DeviceInfo, int, int)
|
||||
IMPLEMENT_PARAM_CLASS(K, int)
|
||||
|
||||
GPU_PERF_TEST(BruteForceMatcher_knnMatch, cv::gpu::DeviceInfo, DescriptorSize, K, NormType)
|
||||
{
|
||||
int desc_size = GET_PARAM(1);
|
||||
int k = GET_PARAM(2);
|
||||
int normType = GET_PARAM(3);
|
||||
|
||||
cv::Mat query(3000, desc_size, CV_32FC1);
|
||||
cv::Mat train(3000, desc_size, CV_32FC1);
|
||||
int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;
|
||||
|
||||
declare.in(query, train, WARMUP_RNG);
|
||||
cv::Mat query(3000, desc_size, type);
|
||||
fill(query, 0.0, 10.0);
|
||||
|
||||
cv::Mat train(3000, desc_size, type);
|
||||
fill(train, 0.0, 10.0);
|
||||
|
||||
cv::BFMatcher matcher(normType);
|
||||
|
||||
cv::BFMatcher matcher(cv::NORM_L2);
|
||||
std::vector< std::vector<cv::DMatch> > matches;
|
||||
|
||||
declare.time(10.0);
|
||||
matcher.knnMatch(query, train, matches, k);
|
||||
|
||||
declare.time(30.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
@@ -54,27 +141,34 @@ GPU_PERF_TEST(BruteForceMatcher_knnMatch, cv::gpu::DeviceInfo, int, int)
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_knnMatch, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Values(64, 128, 256),
|
||||
testing::Values(2, 3)));
|
||||
ALL_DEVICES,
|
||||
testing::Values(DescriptorSize(64), DescriptorSize(128), DescriptorSize(256)),
|
||||
testing::Values(K(2), K(3)),
|
||||
testing::Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// BruteForceMatcher_radiusMatch
|
||||
|
||||
GPU_PERF_TEST(BruteForceMatcher_radiusMatch, cv::gpu::DeviceInfo, int)
|
||||
GPU_PERF_TEST(BruteForceMatcher_radiusMatch, cv::gpu::DeviceInfo, DescriptorSize, NormType)
|
||||
{
|
||||
int desc_size = GET_PARAM(1);
|
||||
int normType = GET_PARAM(2);
|
||||
|
||||
cv::Mat query(3000, desc_size, CV_32FC1);
|
||||
cv::Mat train(3000, desc_size, CV_32FC1);
|
||||
int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;
|
||||
|
||||
fill(query, 0, 1);
|
||||
fill(train, 0, 1);
|
||||
cv::Mat query(3000, desc_size, type);
|
||||
fill(query, 0.0, 1.0);
|
||||
|
||||
cv::Mat train(3000, desc_size, type);
|
||||
fill(train, 0.0, 1.0);
|
||||
|
||||
cv::BFMatcher matcher(normType);
|
||||
|
||||
cv::BFMatcher matcher(cv::NORM_L2);
|
||||
std::vector< std::vector<cv::DMatch> > matches;
|
||||
|
||||
declare.time(10.0);
|
||||
matcher.radiusMatch(query, train, matches, 2.0);
|
||||
|
||||
declare.time(30.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
@@ -83,72 +177,8 @@ GPU_PERF_TEST(BruteForceMatcher_radiusMatch, cv::gpu::DeviceInfo, int)
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
cv::Mat img = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(img.empty());
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints;
|
||||
cv::Mat descriptors;
|
||||
|
||||
cv::SURF surf;
|
||||
|
||||
declare.time(30.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
surf(img, cv::noArray(), keypoints, descriptors);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, SURF, DEVICES(cv::gpu::GLOBAL_ATOMICS));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// FAST
|
||||
|
||||
GPU_PERF_TEST_1(FAST, cv::gpu::DeviceInfo)
|
||||
{
|
||||
cv::Mat img = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(img.empty());
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints;
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::FAST(img, keypoints, 20);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, FAST, DEVICES(cv::gpu::GLOBAL_ATOMICS));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// ORB
|
||||
|
||||
GPU_PERF_TEST_1(ORB, cv::gpu::DeviceInfo)
|
||||
{
|
||||
cv::Mat img = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(img.empty());
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints;
|
||||
cv::Mat descriptors;
|
||||
|
||||
cv::ORB orb(4000);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
orb(img, cv::noArray(), keypoints, descriptors);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Features2D, ORB, DEVICES(cv::gpu::GLOBAL_ATOMICS));
|
||||
ALL_DEVICES,
|
||||
testing::Values(DescriptorSize(64), DescriptorSize(128), DescriptorSize(256)),
|
||||
testing::Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))));
|
||||
|
||||
#endif
|
||||
|
@@ -14,11 +14,12 @@ GPU_PERF_TEST(Blur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
|
||||
int ksize = GET_PARAM(3);
|
||||
|
||||
cv::Mat src(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
fill(src, 0.0, 255.0);
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
cv::blur(src, dst, cv::Size(ksize, ksize));
|
||||
|
||||
declare.time(20.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
@@ -27,7 +28,7 @@ GPU_PERF_TEST(Blur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter, Blur, testing::Combine(
|
||||
INSTANTIATE_TEST_CASE_P(Filters, Blur, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)),
|
||||
@@ -43,11 +44,12 @@ GPU_PERF_TEST(Sobel, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
|
||||
int ksize = GET_PARAM(3);
|
||||
|
||||
cv::Mat src(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
fill(src, 0.0, 255.0);
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
cv::Sobel(src, dst, -1, 1, 1, ksize);
|
||||
|
||||
declare.time(20.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
@@ -56,7 +58,7 @@ GPU_PERF_TEST(Sobel, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter, Sobel, testing::Combine(
|
||||
INSTANTIATE_TEST_CASE_P(Filters, Sobel, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1)),
|
||||
@@ -71,11 +73,12 @@ GPU_PERF_TEST(Scharr, cv::gpu::DeviceInfo, cv::Size, MatType)
|
||||
int type = GET_PARAM(2);
|
||||
|
||||
cv::Mat src(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
fill(src, 0.0, 255.0);
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
cv::Scharr(src, dst, -1, 1, 0);
|
||||
|
||||
declare.time(20.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
@@ -84,7 +87,7 @@ GPU_PERF_TEST(Scharr, cv::gpu::DeviceInfo, cv::Size, MatType)
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter, Scharr, testing::Combine(
|
||||
INSTANTIATE_TEST_CASE_P(Filters, Scharr, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1))));
|
||||
@@ -99,11 +102,12 @@ GPU_PERF_TEST(GaussianBlur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
|
||||
int ksize = GET_PARAM(3);
|
||||
|
||||
cv::Mat src(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
fill(src, 0.0, 255.0);
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
cv::GaussianBlur(src, dst, cv::Size(ksize, ksize), 0.5);
|
||||
|
||||
declare.time(20.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
@@ -112,7 +116,7 @@ GPU_PERF_TEST(GaussianBlur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter, GaussianBlur, testing::Combine(
|
||||
INSTANTIATE_TEST_CASE_P(Filters, GaussianBlur, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1)),
|
||||
@@ -128,11 +132,12 @@ GPU_PERF_TEST(Laplacian, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
|
||||
int ksize = GET_PARAM(3);
|
||||
|
||||
cv::Mat src(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
fill(src, 0.0, 255.0);
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
cv::Laplacian(src, dst, -1, ksize);
|
||||
|
||||
declare.time(20.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
@@ -141,7 +146,7 @@ GPU_PERF_TEST(Laplacian, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter, Laplacian, testing::Combine(
|
||||
INSTANTIATE_TEST_CASE_P(Filters, Laplacian, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4)),
|
||||
@@ -156,13 +161,14 @@ GPU_PERF_TEST(Erode, cv::gpu::DeviceInfo, cv::Size, MatType)
|
||||
int type = GET_PARAM(2);
|
||||
|
||||
cv::Mat src(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
fill(src, 0.0, 255.0);
|
||||
|
||||
cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
cv::erode(src, dst, ker);
|
||||
|
||||
declare.time(20.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
@@ -171,7 +177,7 @@ GPU_PERF_TEST(Erode, cv::gpu::DeviceInfo, cv::Size, MatType)
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter, Erode, testing::Combine(
|
||||
INSTANTIATE_TEST_CASE_P(Filters, Erode, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC4))));
|
||||
@@ -185,13 +191,14 @@ GPU_PERF_TEST(Dilate, cv::gpu::DeviceInfo, cv::Size, MatType)
|
||||
int type = GET_PARAM(2);
|
||||
|
||||
cv::Mat src(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
fill(src, 0.0, 255.0);
|
||||
|
||||
cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
cv::dilate(src, dst, ker);
|
||||
|
||||
declare.time(20.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
@@ -200,7 +207,7 @@ GPU_PERF_TEST(Dilate, cv::gpu::DeviceInfo, cv::Size, MatType)
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter, Dilate, testing::Combine(
|
||||
INSTANTIATE_TEST_CASE_P(Filters, Dilate, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC4))));
|
||||
@@ -218,13 +225,14 @@ GPU_PERF_TEST(MorphologyEx, cv::gpu::DeviceInfo, cv::Size, MatType, MorphOp)
|
||||
int morphOp = GET_PARAM(3);
|
||||
|
||||
cv::Mat src(size, type);
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
fill(src, 0.0, 255.0);
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));
|
||||
|
||||
cv::morphologyEx(src, dst, morphOp, ker);
|
||||
|
||||
declare.time(20.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
@@ -233,7 +241,7 @@ GPU_PERF_TEST(MorphologyEx, cv::gpu::DeviceInfo, cv::Size, MatType, MorphOp)
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter, MorphologyEx, testing::Combine(
|
||||
INSTANTIATE_TEST_CASE_P(Filters, MorphologyEx, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)),
|
||||
@@ -249,12 +257,15 @@ GPU_PERF_TEST(Filter2D, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
|
||||
int ksize = GET_PARAM(3);
|
||||
|
||||
cv::Mat src(size, type);
|
||||
cv::Mat kernel(ksize, ksize, CV_32FC1);
|
||||
fill(src, 0.0, 255.0);
|
||||
|
||||
declare.in(src, kernel, WARMUP_RNG);
|
||||
cv::Mat kernel(ksize, ksize, CV_32FC1);
|
||||
fill(kernel, 0.0, 1.0);
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
cv::filter2D(src, dst, -1, kernel);
|
||||
|
||||
declare.time(20.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
@@ -263,7 +274,7 @@ GPU_PERF_TEST(Filter2D, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Filter, Filter2D, testing::Combine(
|
||||
INSTANTIATE_TEST_CASE_P(Filters, Filter2D, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4)),
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -2,64 +2,10 @@
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Merge
|
||||
|
||||
GPU_PERF_TEST(Merge, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
||||
{
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type = GET_PARAM(2);
|
||||
|
||||
const int num_channels = 4;
|
||||
|
||||
std::vector<cv::Mat> src(num_channels);
|
||||
for (int i = 0; i < num_channels; ++i)
|
||||
src[i] = cv::Mat(size, type, cv::Scalar::all(i));
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::merge(src, dst);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MatOp, Merge, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Split
|
||||
|
||||
GPU_PERF_TEST(Split, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
||||
{
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type = GET_PARAM(2);
|
||||
|
||||
const int num_channels = 4;
|
||||
|
||||
cv::Mat src(size, CV_MAKETYPE(type, num_channels), cv::Scalar(1, 2, 3, 4));
|
||||
|
||||
std::vector<cv::Mat> dst(num_channels);
|
||||
for (int i = 0; i < num_channels; ++i)
|
||||
dst[i] = cv::Mat(size, type);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::split(src, dst);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
GPU_PERF_TEST(SetTo, cv::gpu::DeviceInfo, cv::Size, MatType)
|
||||
{
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type = GET_PARAM(2);
|
||||
@@ -67,6 +13,8 @@ GPU_PERF_TEST(SetTo, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
||||
cv::Mat src(size, type);
|
||||
cv::Scalar val(1, 2, 3, 4);
|
||||
|
||||
src.setTo(val);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
src.setTo(val);
|
||||
@@ -74,26 +22,31 @@ GPU_PERF_TEST(SetTo, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
||||
}
|
||||
|
||||
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)));
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
|
||||
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
|
||||
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4),
|
||||
MatType(CV_64FC1), MatType(CV_64FC3), MatType(CV_64FC4))));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// SetToMasked
|
||||
|
||||
GPU_PERF_TEST(SetToMasked, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
||||
GPU_PERF_TEST(SetToMasked, cv::gpu::DeviceInfo, cv::Size, MatType)
|
||||
{
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type = GET_PARAM(2);
|
||||
|
||||
cv::Mat src(size, type);
|
||||
cv::Mat mask(size, CV_8UC1);
|
||||
fill(src, 0, 255);
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
cv::Mat mask(size, CV_8UC1);
|
||||
fill(mask, 0, 2);
|
||||
|
||||
cv::Scalar val(1, 2, 3, 4);
|
||||
|
||||
src.setTo(val, mask);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
src.setTo(val, mask);
|
||||
@@ -101,26 +54,31 @@ GPU_PERF_TEST(SetToMasked, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
||||
}
|
||||
|
||||
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)));
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
|
||||
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
|
||||
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4),
|
||||
MatType(CV_64FC1), MatType(CV_64FC3), MatType(CV_64FC4))));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CopyToMasked
|
||||
|
||||
GPU_PERF_TEST(CopyToMasked, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
||||
GPU_PERF_TEST(CopyToMasked, cv::gpu::DeviceInfo, cv::Size, MatType)
|
||||
{
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type = GET_PARAM(2);
|
||||
|
||||
cv::Mat src(size, type);
|
||||
cv::Mat mask(size, CV_8UC1);
|
||||
fill(src, 0, 255);
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
cv::Mat mask(size, CV_8UC1);
|
||||
fill(mask, 0, 2);
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
src.copyTo(dst, mask);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
src.copyTo(dst, mask);
|
||||
@@ -128,35 +86,39 @@ GPU_PERF_TEST(CopyToMasked, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
|
||||
}
|
||||
|
||||
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)));
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
|
||||
MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
|
||||
MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4),
|
||||
MatType(CV_64FC1), MatType(CV_64FC3), MatType(CV_64FC4))));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// ConvertTo
|
||||
|
||||
GPU_PERF_TEST(ConvertTo, cv::gpu::DeviceInfo, cv::Size, perf::MatType, perf::MatType)
|
||||
GPU_PERF_TEST(ConvertTo, cv::gpu::DeviceInfo, cv::Size, MatDepth, MatDepth)
|
||||
{
|
||||
cv::Size size = GET_PARAM(1);
|
||||
int type1 = GET_PARAM(2);
|
||||
int type2 = GET_PARAM(3);
|
||||
int depth1 = GET_PARAM(2);
|
||||
int depth2 = GET_PARAM(3);
|
||||
|
||||
cv::Mat src(size, type1);
|
||||
|
||||
declare.in(src, WARMUP_RNG);
|
||||
cv::Mat src(size, depth1);
|
||||
fill(src, 0, 255);
|
||||
|
||||
cv::Mat dst;
|
||||
|
||||
src.convertTo(dst, depth2, 0.5, 1.0);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
src.convertTo(dst, type2, 0.5, 1.0);
|
||||
src.convertTo(dst, depth2, 0.5, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
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)));
|
||||
ALL_DEVICES,
|
||||
GPU_TYPICAL_MAT_SIZES,
|
||||
testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F), MatDepth(CV_64F)),
|
||||
testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F), MatDepth(CV_64F))));
|
||||
|
||||
#endif
|
||||
|
@@ -2,15 +2,21 @@
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// HOG
|
||||
|
||||
GPU_PERF_TEST_1(HOG, cv::gpu::DeviceInfo)
|
||||
{
|
||||
cv::Mat img = readImage("gpu/hog/road.png", cv::IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(img.empty());
|
||||
|
||||
std::vector<cv::Rect> found_locations;
|
||||
|
||||
cv::HOGDescriptor hog;
|
||||
hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector());
|
||||
|
||||
hog.detectMultiScale(img, found_locations);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
hog.detectMultiScale(img, found_locations);
|
||||
@@ -19,27 +25,28 @@ GPU_PERF_TEST_1(HOG, cv::gpu::DeviceInfo)
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ObjDetect, HOG, ALL_DEVICES);
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// HaarClassifier
|
||||
|
||||
GPU_PERF_TEST_1(HaarClassifier, cv::gpu::DeviceInfo)
|
||||
{
|
||||
{
|
||||
cv::Mat img = readImage("gpu/haarcascade/group_1_640x480_VGA.pgm", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(img.empty());
|
||||
|
||||
cv::CascadeClassifier cascade;
|
||||
|
||||
if (!cascade.load("haarcascade_frontalface_alt.xml"))
|
||||
CV_Error(0, "Can't load cascade");
|
||||
|
||||
|
||||
ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/perf/haarcascade_frontalface_alt.xml")));
|
||||
|
||||
std::vector<cv::Rect> rects;
|
||||
rects.reserve(1000);
|
||||
|
||||
cascade.detectMultiScale(img, rects);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cascade.detectMultiScale(img, rects);
|
||||
cascade.detectMultiScale(img, rects);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ObjDetect, HaarClassifier, ALL_DEVICES);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -147,11 +147,6 @@ 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;
|
||||
@@ -175,27 +170,3 @@ const vector<DeviceInfo>& devices()
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -3,17 +3,23 @@
|
||||
|
||||
void fill(cv::Mat& m, double a, double b);
|
||||
|
||||
enum {HORIZONTAL_AXIS = 0, VERTICAL_AXIS = 1, BOTH_AXIS = -1};
|
||||
|
||||
using perf::MatType;
|
||||
using perf::MatDepth;
|
||||
|
||||
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(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)
|
||||
CV_ENUM(AlphaOp, cv::gpu::ALPHA_OVER, cv::gpu::ALPHA_IN, cv::gpu::ALPHA_OUT, cv::gpu::ALPHA_ATOP, cv::gpu::ALPHA_XOR, cv::gpu::ALPHA_PLUS, cv::gpu::ALPHA_OVER_PREMUL, cv::gpu::ALPHA_IN_PREMUL, cv::gpu::ALPHA_OUT_PREMUL, cv::gpu::ALPHA_ATOP_PREMUL, cv::gpu::ALPHA_XOR_PREMUL, cv::gpu::ALPHA_PLUS_PREMUL, cv::gpu::ALPHA_PREMUL)
|
||||
|
||||
struct CvtColorInfo
|
||||
{
|
||||
int scn;
|
||||
int dcn;
|
||||
int code;
|
||||
|
||||
explicit CvtColorInfo(int scn_=0, int dcn_=0, int code_=0) : scn(scn_), dcn(dcn_), code(code_) {}
|
||||
};
|
||||
|
||||
void PrintTo(const CvtColorInfo& info, std::ostream* os);
|
||||
|
||||
#define IMPLEMENT_PARAM_CLASS(name, type) \
|
||||
class name \
|
||||
@@ -29,16 +35,7 @@ CV_ENUM(AlphaOp, cv::gpu::ALPHA_OVER, cv::gpu::ALPHA_IN, cv::gpu::ALPHA_OUT, cv:
|
||||
*os << #name << "(" << testing::PrintToString(static_cast< type >(param)) << ")"; \
|
||||
}
|
||||
|
||||
struct CvtColorInfo
|
||||
{
|
||||
int scn;
|
||||
int dcn;
|
||||
int code;
|
||||
|
||||
explicit CvtColorInfo(int scn_=0, int dcn_=0, int code_=0) : scn(scn_), dcn(dcn_), code(code_) {}
|
||||
};
|
||||
|
||||
void PrintTo(const CvtColorInfo& info, std::ostream* os);
|
||||
IMPLEMENT_PARAM_CLASS(Channels, int)
|
||||
|
||||
namespace cv { namespace gpu
|
||||
{
|
||||
@@ -71,14 +68,9 @@ namespace cv { namespace gpu
|
||||
|
||||
cv::Mat readImage(const std::string& fileName, int flags = cv::IMREAD_COLOR);
|
||||
|
||||
bool supportFeature(const cv::gpu::DeviceInfo& info, cv::gpu::FeatureSet feature);
|
||||
|
||||
const std::vector<cv::gpu::DeviceInfo>& devices();
|
||||
|
||||
std::vector<cv::gpu::DeviceInfo> devices(cv::gpu::FeatureSet feature);
|
||||
|
||||
#define ALL_DEVICES testing::ValuesIn(devices())
|
||||
#define DEVICES(feature) testing::ValuesIn(devices(feature))
|
||||
|
||||
#define GET_PARAM(k) std::tr1::get< k >(GetParam())
|
||||
|
||||
|
@@ -5,37 +5,46 @@
|
||||
//////////////////////////////////////////////////////
|
||||
// GoodFeaturesToTrack
|
||||
|
||||
GPU_PERF_TEST(GoodFeaturesToTrack, cv::gpu::DeviceInfo, double)
|
||||
IMPLEMENT_PARAM_CLASS(MinDistance, double)
|
||||
|
||||
GPU_PERF_TEST(GoodFeaturesToTrack, cv::gpu::DeviceInfo, MinDistance)
|
||||
{
|
||||
double minDistance = GET_PARAM(1);
|
||||
|
||||
cv::Mat image = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(image.empty());
|
||||
|
||||
cv::Mat corners;
|
||||
|
||||
cv::goodFeaturesToTrack(image, corners, 8000, 0.01, minDistance);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::goodFeaturesToTrack(image, corners, 8000, 0.01, minDistance);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Video, GoodFeaturesToTrack, testing::Combine(ALL_DEVICES, testing::Values(0.0, 3.0)));
|
||||
INSTANTIATE_TEST_CASE_P(Video, GoodFeaturesToTrack, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Values(MinDistance(0.0), MinDistance(3.0))));
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// PyrLKOpticalFlowSparse
|
||||
|
||||
GPU_PERF_TEST(PyrLKOpticalFlowSparse, cv::gpu::DeviceInfo, bool, int, int)
|
||||
IMPLEMENT_PARAM_CLASS(GraySource, bool)
|
||||
IMPLEMENT_PARAM_CLASS(Points, int)
|
||||
IMPLEMENT_PARAM_CLASS(WinSize, int)
|
||||
|
||||
GPU_PERF_TEST(PyrLKOpticalFlowSparse, cv::gpu::DeviceInfo, GraySource, Points, WinSize)
|
||||
{
|
||||
bool useGray = GET_PARAM(1);
|
||||
int points = GET_PARAM(2);
|
||||
int win_size = GET_PARAM(3);
|
||||
|
||||
cv::Mat frame0 = readImage("gpu/opticalflow/frame0.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
|
||||
cv::Mat frame1 = readImage("gpu/opticalflow/frame1.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
|
||||
|
||||
ASSERT_FALSE(frame0.empty());
|
||||
|
||||
cv::Mat frame1 = readImage("gpu/opticalflow/frame1.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
|
||||
ASSERT_FALSE(frame1.empty());
|
||||
|
||||
cv::Mat gray_frame;
|
||||
@@ -50,6 +59,8 @@ GPU_PERF_TEST(PyrLKOpticalFlowSparse, cv::gpu::DeviceInfo, bool, int, int)
|
||||
cv::Mat nextPts;
|
||||
cv::Mat status;
|
||||
|
||||
cv::calcOpticalFlowPyrLK(frame0, frame1, pts, nextPts, status, cv::noArray(), cv::Size(win_size, win_size));
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::calcOpticalFlowPyrLK(frame0, frame1, pts, nextPts, status, cv::noArray(), cv::Size(win_size, win_size));
|
||||
@@ -57,10 +68,10 @@ GPU_PERF_TEST(PyrLKOpticalFlowSparse, cv::gpu::DeviceInfo, bool, int, int)
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Video, PyrLKOpticalFlowSparse, testing::Combine(
|
||||
ALL_DEVICES,
|
||||
testing::Bool(),
|
||||
testing::Values(1000, 2000, 4000, 8000),
|
||||
testing::Values(17, 21)));
|
||||
ALL_DEVICES,
|
||||
testing::Values(GraySource(true), GraySource(false)),
|
||||
testing::Values(Points(1000), Points(2000), Points(4000), Points(8000)),
|
||||
testing::Values(WinSize(17), WinSize(21))));
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// FarnebackOpticalFlowTest
|
||||
@@ -68,15 +79,13 @@ INSTANTIATE_TEST_CASE_P(Video, PyrLKOpticalFlowSparse, testing::Combine(
|
||||
GPU_PERF_TEST_1(FarnebackOpticalFlowTest, cv::gpu::DeviceInfo)
|
||||
{
|
||||
cv::Mat frame0 = readImage("gpu/opticalflow/frame0.png", cv::IMREAD_GRAYSCALE);
|
||||
cv::Mat frame1 = readImage("gpu/opticalflow/frame1.png", cv::IMREAD_GRAYSCALE);
|
||||
|
||||
ASSERT_FALSE(frame0.empty());
|
||||
|
||||
cv::Mat frame1 = readImage("gpu/opticalflow/frame1.png", cv::IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(frame1.empty());
|
||||
|
||||
cv::Mat flow;
|
||||
|
||||
declare.time(10);
|
||||
|
||||
int numLevels = 5;
|
||||
double pyrScale = 0.5;
|
||||
int winSize = 13;
|
||||
@@ -85,9 +94,12 @@ GPU_PERF_TEST_1(FarnebackOpticalFlowTest, cv::gpu::DeviceInfo)
|
||||
double polySigma = 1.1;
|
||||
int flags = 0;
|
||||
|
||||
cv::calcOpticalFlowFarneback(frame0, frame1, flow, pyrScale, numLevels, winSize, numIters, polyN, polySigma, flags);
|
||||
|
||||
declare.time(10);
|
||||
|
||||
TEST_CYCLE()
|
||||
{
|
||||
cv::calcOpticalFlowFarneback(frame0, frame1, flow, pyrScale, numLevels, winSize, numIters, polyN, polySigma, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user