2011-09-12 09:48:09 +02:00
|
|
|
#include "perf_precomp.hpp"
|
|
|
|
|
2011-12-28 13:53:08 +01:00
|
|
|
#ifdef HAVE_CUDA
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2012-05-23 14:58:01 +02:00
|
|
|
// SURF
|
2011-12-28 13:53:08 +01:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
GPU_PERF_TEST_1(SURF, cv::gpu::DeviceInfo)
|
2011-09-12 09:48:09 +02:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::gpu::DeviceInfo devInfo = GetParam();
|
2011-12-28 13:53:08 +01:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat img_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
|
|
|
ASSERT_FALSE(img_host.empty());
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::gpu::SURF_GPU surf;
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::gpu::GpuMat img(img_host);
|
|
|
|
cv::gpu::GpuMat keypoints, descriptors;
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
surf(img, cv::gpu::GpuMat(), keypoints, descriptors);
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
declare.time(2.0);
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
TEST_CYCLE()
|
2011-09-12 09:48:09 +02:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
surf(img, cv::gpu::GpuMat(), keypoints, descriptors);
|
2011-09-12 09:48:09 +02:00
|
|
|
}
|
2011-12-28 13:53:08 +01:00
|
|
|
}
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(Features2D, SURF, ALL_DEVICES);
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2011-12-28 13:53:08 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
2012-05-23 14:58:01 +02:00
|
|
|
// FAST
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
GPU_PERF_TEST_1(FAST, cv::gpu::DeviceInfo)
|
2011-09-12 09:48:09 +02:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::gpu::DeviceInfo devInfo = GetParam();
|
2011-12-28 13:53:08 +01:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat img_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
|
|
|
ASSERT_FALSE(img_host.empty());
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::gpu::FAST_GPU fast(20);
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::gpu::GpuMat img(img_host);
|
|
|
|
cv::gpu::GpuMat keypoints;
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
fast(img, cv::gpu::GpuMat(), keypoints);
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
TEST_CYCLE()
|
2011-09-12 09:48:09 +02:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
fast(img, cv::gpu::GpuMat(), keypoints);
|
2011-09-12 09:48:09 +02:00
|
|
|
}
|
2011-12-28 13:53:08 +01:00
|
|
|
}
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(Features2D, FAST, ALL_DEVICES);
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2011-12-28 13:53:08 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
2012-05-23 14:58:01 +02:00
|
|
|
// ORB
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
GPU_PERF_TEST_1(ORB, cv::gpu::DeviceInfo)
|
2011-09-12 09:48:09 +02:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::gpu::DeviceInfo devInfo = GetParam();
|
2011-12-28 13:53:08 +01:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat img_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
|
|
|
ASSERT_FALSE(img_host.empty());
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::gpu::ORB_GPU orb(4000);
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::gpu::GpuMat img(img_host);
|
|
|
|
cv::gpu::GpuMat keypoints, descriptors;
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
TEST_CYCLE()
|
2011-09-12 09:48:09 +02:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
orb(img, cv::gpu::GpuMat(), keypoints, descriptors);
|
2011-09-12 09:48:09 +02:00
|
|
|
}
|
2011-12-28 13:53:08 +01:00
|
|
|
}
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(Features2D, ORB, ALL_DEVICES);
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2011-12-28 13:53:08 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
2012-05-23 14:58:01 +02:00
|
|
|
// BruteForceMatcher_match
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
IMPLEMENT_PARAM_CLASS(DescriptorSize, int)
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
GPU_PERF_TEST(BruteForceMatcher_match, cv::gpu::DeviceInfo, DescriptorSize, NormType)
|
|
|
|
{
|
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
2011-12-28 13:53:08 +01:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
int desc_size = GET_PARAM(1);
|
|
|
|
int normType = GET_PARAM(2);
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat query_host(3000, desc_size, type);
|
|
|
|
fill(query_host, 0.0, 10.0);
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat train_host(3000, desc_size, type);
|
|
|
|
fill(train_host, 0.0, 10.0);
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::gpu::BFMatcher_GPU matcher(normType);
|
|
|
|
|
|
|
|
cv::gpu::GpuMat query(query_host);
|
|
|
|
cv::gpu::GpuMat train(train_host);
|
|
|
|
cv::gpu::GpuMat trainIdx, distance;
|
|
|
|
|
|
|
|
matcher.matchSingle(query, train, trainIdx, distance);
|
|
|
|
|
|
|
|
declare.time(3.0);
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
TEST_CYCLE()
|
2011-09-12 09:48:09 +02:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
matcher.matchSingle(query, train, trainIdx, distance);
|
2011-09-12 09:48:09 +02:00
|
|
|
}
|
2011-12-27 10:33:20 +01:00
|
|
|
}
|
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_match, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
testing::Values(DescriptorSize(64), DescriptorSize(128), DescriptorSize(256)),
|
|
|
|
testing::Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))));
|
2011-12-28 13:53:08 +01:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2012-05-23 14:58:01 +02:00
|
|
|
// BruteForceMatcher_knnMatch
|
2011-12-28 13:53:08 +01:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
IMPLEMENT_PARAM_CLASS(K, int)
|
2011-12-27 10:33:20 +01:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
GPU_PERF_TEST(BruteForceMatcher_knnMatch, cv::gpu::DeviceInfo, DescriptorSize, K, NormType)
|
|
|
|
{
|
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
2011-12-28 13:53:08 +01:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-12-27 10:33:20 +01:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
int desc_size = GET_PARAM(1);
|
|
|
|
int k = GET_PARAM(2);
|
|
|
|
int normType = GET_PARAM(3);
|
2011-12-27 10:33:20 +01:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;
|
2011-09-12 09:48:09 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat query_host(3000, desc_size, type);
|
|
|
|
fill(query_host, 0.0, 10.0);
|
2011-12-27 10:33:20 +01:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat train_host(3000, desc_size, type);
|
|
|
|
fill(train_host, 0.0, 10.0);
|
|
|
|
|
|
|
|
cv::gpu::BFMatcher_GPU matcher(normType);
|
|
|
|
|
|
|
|
cv::gpu::GpuMat query(query_host);
|
|
|
|
cv::gpu::GpuMat train(train_host);
|
|
|
|
cv::gpu::GpuMat trainIdx, distance, allDist;
|
|
|
|
|
|
|
|
matcher.knnMatchSingle(query, train, trainIdx, distance, allDist, k);
|
|
|
|
|
|
|
|
declare.time(3.0);
|
2011-12-27 10:33:20 +01:00
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
TEST_CYCLE()
|
2011-12-27 10:33:20 +01:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
matcher.knnMatchSingle(query, train, trainIdx, distance, allDist, k);
|
2011-12-27 10:33:20 +01:00
|
|
|
}
|
2011-09-12 09:48:09 +02:00
|
|
|
}
|
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_knnMatch, testing::Combine(
|
|
|
|
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))));
|
2011-12-28 13:53:08 +01:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2012-05-23 14:58:01 +02:00
|
|
|
// BruteForceMatcher_radiusMatch
|
2011-12-28 13:53:08 +01:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
GPU_PERF_TEST(BruteForceMatcher_radiusMatch, cv::gpu::DeviceInfo, DescriptorSize, NormType)
|
2011-12-27 10:33:20 +01:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
|
2011-12-28 13:53:08 +01:00
|
|
|
cv::gpu::setDevice(devInfo.deviceID());
|
2011-12-27 10:33:20 +01:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
int desc_size = GET_PARAM(1);
|
|
|
|
int normType = GET_PARAM(2);
|
2011-12-27 10:33:20 +01:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;
|
2011-12-27 10:33:20 +01:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat query_host(3000, desc_size, type);
|
|
|
|
fill(query_host, 0.0, 1.0);
|
|
|
|
|
|
|
|
cv::Mat train_host(3000, desc_size, type);
|
|
|
|
fill(train_host, 0.0, 1.0);
|
2011-12-27 10:33:20 +01:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::gpu::BFMatcher_GPU matcher(normType);
|
|
|
|
|
|
|
|
cv::gpu::GpuMat query(query_host);
|
|
|
|
cv::gpu::GpuMat train(train_host);
|
|
|
|
cv::gpu::GpuMat trainIdx, nMatches, distance;
|
|
|
|
|
|
|
|
matcher.radiusMatchSingle(query, train, trainIdx, distance, nMatches, 2.0);
|
|
|
|
|
|
|
|
declare.time(3.0);
|
2011-12-27 10:33:20 +01:00
|
|
|
|
2011-12-29 17:46:16 +01:00
|
|
|
TEST_CYCLE()
|
2011-12-27 10:33:20 +01:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
matcher.radiusMatchSingle(query, train, trainIdx, distance, nMatches, 2.0);
|
2011-12-27 10:33:20 +01:00
|
|
|
}
|
|
|
|
}
|
2011-12-28 13:53:08 +01:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_radiusMatch, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
testing::Values(DescriptorSize(64), DescriptorSize(128), DescriptorSize(256)),
|
|
|
|
testing::Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))));
|
2011-12-28 13:53:08 +01:00
|
|
|
|
|
|
|
#endif
|