Commit e29cfabd authored by Michele Adduci's avatar Michele Adduci

Adjusted test cases for SURF_CUDA, using new APIs

parent a9f4e2f4
......@@ -86,11 +86,12 @@ PERF_TEST_P(Image, CUDA_SURF,
}
else
{
cv::xfeatures2d::SURF surf;
cv::Ptr<cv::Feature2D> surf = cv::xfeatures2d::SURF::create();
std::vector<cv::KeyPoint> cpu_keypoints;
cv::Mat cpu_descriptors;
TEST_CYCLE() surf(img, cv::noArray(), cpu_keypoints, cpu_descriptors);
TEST_CYCLE() surf->detect(img, cpu_keypoints);
TEST_CYCLE() surf->compute(img, cpu_keypoints, cpu_descriptors);
SANITY_CHECK_KEYPOINTS(cpu_keypoints);
SANITY_CHECK(cpu_descriptors);
......
......@@ -94,15 +94,10 @@ CUDA_TEST_P(SURF, Detector)
std::vector<cv::KeyPoint> keypoints;
surf(loadMat(image), cv::cuda::GpuMat(), keypoints);
cv::xfeatures2d::SURF surf_gold;
surf_gold.hessianThreshold = hessianThreshold;
surf_gold.nOctaves = nOctaves;
surf_gold.nOctaveLayers = nOctaveLayers;
surf_gold.extended = extended;
surf_gold.upright = upright;
cv::Ptr<cv::Feature2D> surf_gold = cv::xfeatures2d::SURF::create(hessianThreshold, nOctaves, nOctaveLayers, extended, upright);
std::vector<cv::KeyPoint> keypoints_gold;
surf_gold(image, cv::noArray(), keypoints_gold);
surf_gold->detect(image, keypoints_gold);
ASSERT_EQ(keypoints_gold.size(), keypoints.size());
int matchedCount = getMatchedPointsCount(keypoints_gold, keypoints);
......@@ -130,15 +125,10 @@ CUDA_TEST_P(SURF, Detector_Masked)
std::vector<cv::KeyPoint> keypoints;
surf(loadMat(image), loadMat(mask), keypoints);
cv::xfeatures2d::SURF surf_gold;
surf_gold.hessianThreshold = hessianThreshold;
surf_gold.nOctaves = nOctaves;
surf_gold.nOctaveLayers = nOctaveLayers;
surf_gold.extended = extended;
surf_gold.upright = upright;
cv::Ptr<cv::Feature2D> surf_gold = cv::xfeatures2d::SURF::create(hessianThreshold, nOctaves, nOctaveLayers, extended, upright);
std::vector<cv::KeyPoint> keypoints_gold;
surf_gold(image, mask, keypoints_gold);
surf_gold->detect(image, keypoints_gold, mask);
ASSERT_EQ(keypoints_gold.size(), keypoints.size());
int matchedCount = getMatchedPointsCount(keypoints_gold, keypoints);
......@@ -160,21 +150,16 @@ CUDA_TEST_P(SURF, Descriptor)
surf.upright = upright;
surf.keypointsRatio = 0.05f;
cv::xfeatures2d::SURF surf_gold;
surf_gold.hessianThreshold = hessianThreshold;
surf_gold.nOctaves = nOctaves;
surf_gold.nOctaveLayers = nOctaveLayers;
surf_gold.extended = extended;
surf_gold.upright = upright;
cv::Ptr<cv::Feature2D> surf_gold = cv::xfeatures2d::SURF::create(hessianThreshold, nOctaves, nOctaveLayers, extended, upright);
std::vector<cv::KeyPoint> keypoints;
surf_gold(image, cv::noArray(), keypoints);
surf_gold->detect(image, keypoints);
cv::cuda::GpuMat descriptors;
surf(loadMat(image), cv::cuda::GpuMat(), keypoints, descriptors, true);
cv::Mat descriptors_gold;
surf_gold(image, cv::noArray(), keypoints, descriptors_gold, true);
surf_gold->compute(image, keypoints, descriptors_gold);
cv::BFMatcher matcher(surf.defaultNorm());
std::vector<cv::DMatch> matches;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment