updated gpu module API

This commit is contained in:
Vladislav Vinogradov
2013-02-21 16:12:33 +04:00
parent afa993316f
commit 8b1f88c40f
15 changed files with 221 additions and 209 deletions

View File

@@ -583,8 +583,7 @@ PARAM_TEST_CASE(BruteForceMatcher, cv::gpu::DeviceInfo, NormCode, DescriptorSize
GPU_TEST_P(BruteForceMatcher, Match_Single)
{
cv::gpu::BruteForceMatcher_GPU_base matcher(
cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2));
cv::gpu::BFMatcher_GPU matcher(normCode);
cv::gpu::GpuMat mask;
if (useMask)
@@ -611,8 +610,7 @@ GPU_TEST_P(BruteForceMatcher, Match_Single)
GPU_TEST_P(BruteForceMatcher, Match_Collection)
{
cv::gpu::BruteForceMatcher_GPU_base matcher(
cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2));
cv::gpu::BFMatcher_GPU matcher(normCode);
cv::gpu::GpuMat d_train(train);
@@ -666,8 +664,7 @@ GPU_TEST_P(BruteForceMatcher, Match_Collection)
GPU_TEST_P(BruteForceMatcher, KnnMatch_2_Single)
{
cv::gpu::BruteForceMatcher_GPU_base matcher(
cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2));
cv::gpu::BFMatcher_GPU matcher(normCode);
const int knn = 2;
@@ -706,8 +703,7 @@ GPU_TEST_P(BruteForceMatcher, KnnMatch_2_Single)
GPU_TEST_P(BruteForceMatcher, KnnMatch_3_Single)
{
cv::gpu::BruteForceMatcher_GPU_base matcher(
cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2));
cv::gpu::BFMatcher_GPU matcher(normCode);
const int knn = 3;
@@ -746,8 +742,7 @@ GPU_TEST_P(BruteForceMatcher, KnnMatch_3_Single)
GPU_TEST_P(BruteForceMatcher, KnnMatch_2_Collection)
{
cv::gpu::BruteForceMatcher_GPU_base matcher(
cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2));
cv::gpu::BFMatcher_GPU matcher(normCode);
const int knn = 2;
@@ -809,8 +804,7 @@ GPU_TEST_P(BruteForceMatcher, KnnMatch_2_Collection)
GPU_TEST_P(BruteForceMatcher, KnnMatch_3_Collection)
{
cv::gpu::BruteForceMatcher_GPU_base matcher(
cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2));
cv::gpu::BFMatcher_GPU matcher(normCode);
const int knn = 3;
@@ -872,8 +866,7 @@ GPU_TEST_P(BruteForceMatcher, KnnMatch_3_Collection)
GPU_TEST_P(BruteForceMatcher, RadiusMatch_Single)
{
cv::gpu::BruteForceMatcher_GPU_base matcher(
cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2));
cv::gpu::BFMatcher_GPU matcher(normCode);
const float radius = 1.f / countFactor;
@@ -922,8 +915,7 @@ GPU_TEST_P(BruteForceMatcher, RadiusMatch_Single)
GPU_TEST_P(BruteForceMatcher, RadiusMatch_Collection)
{
cv::gpu::BruteForceMatcher_GPU_base matcher(
cv::gpu::BruteForceMatcher_GPU_base::DistType((normCode -2) / 2));
cv::gpu::BFMatcher_GPU matcher(normCode);
const int n = 3;
const float radius = 1.f / countFactor * n;

View File

@@ -322,4 +322,38 @@ INSTANTIATE_TEST_CASE_P(GPU_GpuMat, ConvertTo, testing::Combine(
ALL_DEPTH,
WHOLE_SUBMAT));
////////////////////////////////////////////////////////////////////////////////
// ensureSizeIsEnough
struct EnsureSizeIsEnough : testing::TestWithParam<cv::gpu::DeviceInfo>
{
virtual void SetUp()
{
cv::gpu::DeviceInfo devInfo = GetParam();
cv::gpu::setDevice(devInfo.deviceID());
}
};
GPU_TEST_P(EnsureSizeIsEnough, BufferReuse)
{
cv::gpu::GpuMat buffer(100, 100, CV_8U);
cv::gpu::GpuMat old = buffer;
// don't reallocate memory
cv::gpu::ensureSizeIsEnough(10, 20, CV_8U, buffer);
EXPECT_EQ(10, buffer.rows);
EXPECT_EQ(20, buffer.cols);
EXPECT_EQ(CV_8UC1, buffer.type());
EXPECT_EQ(reinterpret_cast<intptr_t>(old.data), reinterpret_cast<intptr_t>(buffer.data));
// don't reallocate memory
cv::gpu::ensureSizeIsEnough(20, 30, CV_8U, buffer);
EXPECT_EQ(20, buffer.rows);
EXPECT_EQ(30, buffer.cols);
EXPECT_EQ(CV_8UC1, buffer.type());
EXPECT_EQ(reinterpret_cast<intptr_t>(old.data), reinterpret_cast<intptr_t>(buffer.data));
}
INSTANTIATE_TEST_CASE_P(GPU_GpuMat, EnsureSizeIsEnough, ALL_DEVICES);
#endif // HAVE_CUDA