This commit is contained in:
Ilya Lavrenov
2014-03-03 19:37:47 +04:00
parent af8aa8a2fa
commit 099ea91823
30 changed files with 78 additions and 78 deletions

View File

@@ -24,7 +24,7 @@ Class used for corner detection using the FAST algorithm. ::
// all features have same size
static const int FEATURE_SIZE = 7;
explicit FAST_GPU(int threshold, bool nonmaxSupression = true,
explicit FAST_GPU(int threshold, bool nonmaxSuppression = true,
double keypointsRatio = 0.05);
void operator ()(const GpuMat& image, const GpuMat& mask, GpuMat& keypoints);
@@ -39,7 +39,7 @@ Class used for corner detection using the FAST algorithm. ::
void release();
bool nonmaxSupression;
bool nonmaxSuppression;
int threshold;
@@ -61,11 +61,11 @@ gpu::FAST_GPU::FAST_GPU
-------------------------------------
Constructor.
.. ocv:function:: gpu::FAST_GPU::FAST_GPU(int threshold, bool nonmaxSupression = true, double keypointsRatio = 0.05)
.. ocv:function:: gpu::FAST_GPU::FAST_GPU(int threshold, bool nonmaxSuppression = true, double keypointsRatio = 0.05)
:param threshold: Threshold on difference between intensity of the central pixel and pixels on a circle around this pixel.
:param nonmaxSupression: If it is true, non-maximum suppression is applied to detected corners (keypoints).
:param nonmaxSuppression: If it is true, non-maximum suppression is applied to detected corners (keypoints).
:param keypointsRatio: Inner buffer size for keypoints store is determined as (keypointsRatio * image_width * image_height).
@@ -115,7 +115,7 @@ Releases inner buffer memory.
gpu::FAST_GPU::calcKeyPointsLocation
-------------------------------------
Find keypoints and compute it's response if ``nonmaxSupression`` is true.
Find keypoints and compute it's response if ``nonmaxSuppression`` is true.
.. ocv:function:: int gpu::FAST_GPU::calcKeyPointsLocation(const GpuMat& image, const GpuMat& mask)
@@ -185,7 +185,7 @@ Class for extracting ORB features and descriptors from an image. ::
int descriptorSize() const;
void setParams(size_t n_features, const ORB::CommonParams& detector_params);
void setFastParams(int threshold, bool nonmaxSupression = true);
void setFastParams(int threshold, bool nonmaxSuppression = true);
void release();

View File

@@ -1580,7 +1580,7 @@ public:
// all features have same size
static const int FEATURE_SIZE = 7;
explicit FAST_GPU(int threshold, bool nonmaxSupression = true, double keypointsRatio = 0.05);
explicit FAST_GPU(int threshold, bool nonmaxSuppression = true, double keypointsRatio = 0.05);
//! finds the keypoints using FAST detector
//! supports only CV_8UC1 images
@@ -1596,19 +1596,19 @@ public:
//! release temporary buffer's memory
void release();
bool nonmaxSupression;
bool nonmaxSuppression;
int threshold;
//! max keypoints = keypointsRatio * img.size().area()
double keypointsRatio;
//! find keypoints and compute it's response if nonmaxSupression is true
//! find keypoints and compute it's response if nonmaxSuppression is true
//! return count of detected keypoints
int calcKeyPointsLocation(const GpuMat& image, const GpuMat& mask);
//! get final array of keypoints
//! performs nonmax supression if needed
//! performs nonmax suppression if needed
//! return final count of keypoints
int getKeyPoints(GpuMat& keypoints);
@@ -1670,10 +1670,10 @@ public:
//! returns the descriptor size in bytes
inline int descriptorSize() const { return kBytes; }
inline void setFastParams(int threshold, bool nonmaxSupression = true)
inline void setFastParams(int threshold, bool nonmaxSuppression = true)
{
fastDetector_.threshold = threshold;
fastDetector_.nonmaxSupression = nonmaxSupression;
fastDetector_.nonmaxSuppression = nonmaxSuppression;
}
//! release temporary buffer's memory

View File

@@ -49,9 +49,9 @@ using namespace perf;
//////////////////////////////////////////////////////////////////////
// FAST
DEF_PARAM_TEST(Image_Threshold_NonMaxSupression, string, int, bool);
DEF_PARAM_TEST(Image_Threshold_NonMaxSuppression, string, int, bool);
PERF_TEST_P(Image_Threshold_NonMaxSupression, Features2D_FAST,
PERF_TEST_P(Image_Threshold_NonMaxSuppression, Features2D_FAST,
Combine(Values<string>("gpu/perf/aloe.png"),
Values(20),
Bool()))

View File

@@ -1746,7 +1746,7 @@ PERF_TEST_P(Image, ImgProc_HoughLinesP,
const float rho = 1.0f;
const float theta = static_cast<float>(CV_PI / 180.0);
const int threshold = 100;
const int minLineLenght = 50;
const int minLineLength = 50;
const int maxLineGap = 5;
const cv::Mat image = cv::imread(fileName, cv::IMREAD_GRAYSCALE);
@@ -1761,7 +1761,7 @@ PERF_TEST_P(Image, ImgProc_HoughLinesP,
cv::gpu::GpuMat d_lines;
cv::gpu::HoughLinesBuf d_buf;
TEST_CYCLE() cv::gpu::HoughLinesP(d_mask, d_lines, d_buf, rho, theta, minLineLenght, maxLineGap);
TEST_CYCLE() cv::gpu::HoughLinesP(d_mask, d_lines, d_buf, rho, theta, minLineLength, maxLineGap);
cv::Mat gpu_lines(d_lines);
cv::Vec4i* begin = gpu_lines.ptr<cv::Vec4i>();
@@ -1773,7 +1773,7 @@ PERF_TEST_P(Image, ImgProc_HoughLinesP,
{
std::vector<cv::Vec4i> cpu_lines;
TEST_CYCLE() cv::HoughLinesP(mask, cpu_lines, rho, theta, threshold, minLineLenght, maxLineGap);
TEST_CYCLE() cv::HoughLinesP(mask, cpu_lines, rho, theta, threshold, minLineLength, maxLineGap);
SANITY_CHECK(cpu_lines);
}

View File

@@ -74,7 +74,7 @@ PERF_TEST_P(Image, HoughLinesP, testing::Values(std::string("im1_1280x800.jpg"))
const float rho = 1.f;
const float theta = 1.f;
const int threshold = 40;
const int minLineLenght = 20;
const int minLineLength = 20;
const int maxLineGap = 5;
cv::Mat image = cv::imread(fileName, cv::IMREAD_GRAYSCALE);
@@ -85,11 +85,11 @@ PERF_TEST_P(Image, HoughLinesP, testing::Values(std::string("im1_1280x800.jpg"))
cv::gpu::GpuMat d_lines;
cv::gpu::HoughLinesBuf d_buf;
cv::gpu::HoughLinesP(d_image, d_lines, d_buf, rho, theta, minLineLenght, maxLineGap);
cv::gpu::HoughLinesP(d_image, d_lines, d_buf, rho, theta, minLineLength, maxLineGap);
TEST_CYCLE()
{
cv::gpu::HoughLinesP(d_image, d_lines, d_buf, rho, theta, minLineLenght, maxLineGap);
cv::gpu::HoughLinesP(d_image, d_lines, d_buf, rho, theta, minLineLength, maxLineGap);
}
}
else
@@ -98,11 +98,11 @@ PERF_TEST_P(Image, HoughLinesP, testing::Values(std::string("im1_1280x800.jpg"))
cv::Canny(image, mask, 50, 100);
std::vector<cv::Vec4i> lines;
cv::HoughLinesP(mask, lines, rho, theta, threshold, minLineLenght, maxLineGap);
cv::HoughLinesP(mask, lines, rho, theta, threshold, minLineLength, maxLineGap);
TEST_CYCLE()
{
cv::HoughLinesP(mask, lines, rho, theta, threshold, minLineLenght, maxLineGap);
cv::HoughLinesP(mask, lines, rho, theta, threshold, minLineLength, maxLineGap);
}
}

View File

@@ -318,9 +318,9 @@ namespace cv { namespace gpu { namespace device
}
///////////////////////////////////////////////////////////////////////////
// nonmaxSupression
// nonmaxSuppression
__global__ void nonmaxSupression(const short2* kpLoc, int count, const PtrStepSzi scoreMat, short2* locFinal, float* responseFinal)
__global__ void nonmaxSuppression(const short2* kpLoc, int count, const PtrStepSzi scoreMat, short2* locFinal, float* responseFinal)
{
#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 110)
@@ -356,7 +356,7 @@ namespace cv { namespace gpu { namespace device
#endif
}
int nonmaxSupression_gpu(const short2* kpLoc, int count, PtrStepSzi score, short2* loc, float* response)
int nonmaxSuppression_gpu(const short2* kpLoc, int count, PtrStepSzi score, short2* loc, float* response)
{
void* counter_ptr;
cudaSafeCall( cudaGetSymbolAddress(&counter_ptr, g_counter) );
@@ -368,7 +368,7 @@ namespace cv { namespace gpu { namespace device
cudaSafeCall( cudaMemset(counter_ptr, 0, sizeof(unsigned int)) );
nonmaxSupression<<<grid, block>>>(kpLoc, count, score, loc, response);
nonmaxSuppression<<<grid, block>>>(kpLoc, count, score, loc, response);
cudaSafeCall( cudaGetLastError() );
cudaSafeCall( cudaDeviceSynchronize() );

View File

@@ -59,8 +59,8 @@ int cv::gpu::FAST_GPU::getKeyPoints(GpuMat&) { throw_nogpu(); return 0; }
#else /* !defined (HAVE_CUDA) */
cv::gpu::FAST_GPU::FAST_GPU(int _threshold, bool _nonmaxSupression, double _keypointsRatio) :
nonmaxSupression(_nonmaxSupression), threshold(_threshold), keypointsRatio(_keypointsRatio), count_(0)
cv::gpu::FAST_GPU::FAST_GPU(int _threshold, bool _nonmaxSuppression, double _keypointsRatio) :
nonmaxSuppression(_nonmaxSuppression), threshold(_threshold), keypointsRatio(_keypointsRatio), count_(0)
{
}
@@ -114,7 +114,7 @@ namespace cv { namespace gpu { namespace device
namespace fast
{
int calcKeypoints_gpu(PtrStepSzb img, PtrStepSzb mask, short2* kpLoc, int maxKeypoints, PtrStepSzi score, int threshold);
int nonmaxSupression_gpu(const short2* kpLoc, int count, PtrStepSzi score, short2* loc, float* response);
int nonmaxSuppression_gpu(const short2* kpLoc, int count, PtrStepSzi score, short2* loc, float* response);
}
}}}
@@ -129,13 +129,13 @@ int cv::gpu::FAST_GPU::calcKeyPointsLocation(const GpuMat& img, const GpuMat& ma
ensureSizeIsEnough(1, maxKeypoints, CV_16SC2, kpLoc_);
if (nonmaxSupression)
if (nonmaxSuppression)
{
ensureSizeIsEnough(img.size(), CV_32SC1, score_);
score_.setTo(Scalar::all(0));
}
count_ = calcKeypoints_gpu(img, mask, kpLoc_.ptr<short2>(), maxKeypoints, nonmaxSupression ? score_ : PtrStepSzi(), threshold);
count_ = calcKeypoints_gpu(img, mask, kpLoc_.ptr<short2>(), maxKeypoints, nonmaxSuppression ? score_ : PtrStepSzi(), threshold);
count_ = std::min(count_, maxKeypoints);
return count_;
@@ -150,8 +150,8 @@ int cv::gpu::FAST_GPU::getKeyPoints(GpuMat& keypoints)
ensureSizeIsEnough(ROWS_COUNT, count_, CV_32FC1, keypoints);
if (nonmaxSupression)
return nonmaxSupression_gpu(kpLoc_.ptr<short2>(), count_, score_, keypoints.ptr<short2>(LOCATION_ROW), keypoints.ptr<float>(RESPONSE_ROW));
if (nonmaxSuppression)
return nonmaxSuppression_gpu(kpLoc_.ptr<short2>(), count_, score_, keypoints.ptr<short2>(LOCATION_ROW), keypoints.ptr<float>(RESPONSE_ROW));
GpuMat locRow(1, count_, kpLoc_.type(), keypoints.ptr(0));
kpLoc_.colRange(0, count_).copyTo(locRow);

View File

@@ -52,20 +52,20 @@ using namespace cvtest;
namespace
{
IMPLEMENT_PARAM_CLASS(FAST_Threshold, int)
IMPLEMENT_PARAM_CLASS(FAST_NonmaxSupression, bool)
IMPLEMENT_PARAM_CLASS(FAST_NonmaxSuppression, bool)
}
PARAM_TEST_CASE(FAST, cv::gpu::DeviceInfo, FAST_Threshold, FAST_NonmaxSupression)
PARAM_TEST_CASE(FAST, cv::gpu::DeviceInfo, FAST_Threshold, FAST_NonmaxSuppression)
{
cv::gpu::DeviceInfo devInfo;
int threshold;
bool nonmaxSupression;
bool nonmaxSuppression;
virtual void SetUp()
{
devInfo = GET_PARAM(0);
threshold = GET_PARAM(1);
nonmaxSupression = GET_PARAM(2);
nonmaxSuppression = GET_PARAM(2);
cv::gpu::setDevice(devInfo.deviceID());
}
@@ -77,7 +77,7 @@ GPU_TEST_P(FAST, Accuracy)
ASSERT_FALSE(image.empty());
cv::gpu::FAST_GPU fast(threshold);
fast.nonmaxSupression = nonmaxSupression;
fast.nonmaxSuppression = nonmaxSuppression;
if (!supportFeature(devInfo, cv::gpu::GLOBAL_ATOMICS))
{
@@ -97,7 +97,7 @@ GPU_TEST_P(FAST, Accuracy)
fast(loadMat(image), cv::gpu::GpuMat(), keypoints);
std::vector<cv::KeyPoint> keypoints_gold;
cv::FAST(image, keypoints_gold, threshold, nonmaxSupression);
cv::FAST(image, keypoints_gold, threshold, nonmaxSuppression);
ASSERT_KEYPOINTS_EQ(keypoints_gold, keypoints);
}
@@ -106,7 +106,7 @@ GPU_TEST_P(FAST, Accuracy)
INSTANTIATE_TEST_CASE_P(GPU_Features2D, FAST, testing::Combine(
ALL_DEVICES,
testing::Values(FAST_Threshold(25), FAST_Threshold(50)),
testing::Values(FAST_NonmaxSupression(false), FAST_NonmaxSupression(true))));
testing::Values(FAST_NonmaxSuppression(false), FAST_NonmaxSuppression(true))));
/////////////////////////////////////////////////////////////////////////////////////////////////
// ORB