OpenCV  5.0.0alpha
Open Source Computer Vision
Loading...
Searching...
No Matches
cv::cuda::SURF_CUDA Class Reference

Class used for extracting Speeded Up Robust Features (SURF) from an image. : More...

#include <opencv2/xfeatures2d/cuda.hpp>

Collaboration diagram for cv::cuda::SURF_CUDA:

Public Types

enum  KeypointLayout {
  X_ROW = 0 ,
  Y_ROW ,
  LAPLACIAN_ROW ,
  OCTAVE_ROW ,
  SIZE_ROW ,
  ANGLE_ROW ,
  HESSIAN_ROW ,
  ROWS_COUNT
}
 

Public Member Functions

 SURF_CUDA ()
 the default constructor
 
 SURF_CUDA (double _hessianThreshold, int _nOctaves=4, int _nOctaveLayers=2, bool _extended=false, float _keypointsRatio=0.01f, bool _upright=false)
 the full constructor taking all the necessary parameters
 
int defaultNorm () const
 returns the default norm type
 
int descriptorSize () const
 returns the descriptor size in float's (64 or 128)
 
void detect (const GpuMat &img, const GpuMat &mask, GpuMat &keypoints)
 Finds the keypoints using fast hessian detector used in SURF.
 
void detectWithDescriptors (const GpuMat &img, const GpuMat &mask, GpuMat &keypoints, GpuMat &descriptors, bool useProvidedKeypoints=false)
 Finds the keypoints and computes their descriptors using fast hessian detector used in SURF.
 
void downloadDescriptors (const GpuMat &descriptorsGPU, std::vector< float > &descriptors)
 download descriptors from device to host memory
 
void downloadKeypoints (const GpuMat &keypointsGPU, std::vector< KeyPoint > &keypoints)
 download keypoints from device to host memory
 
void operator() (const GpuMat &img, const GpuMat &mask, GpuMat &keypoints)
 
void operator() (const GpuMat &img, const GpuMat &mask, GpuMat &keypoints, GpuMat &descriptors, bool useProvidedKeypoints=false)
 
void operator() (const GpuMat &img, const GpuMat &mask, std::vector< KeyPoint > &keypoints)
 
void operator() (const GpuMat &img, const GpuMat &mask, std::vector< KeyPoint > &keypoints, GpuMat &descriptors, bool useProvidedKeypoints=false)
 
void operator() (const GpuMat &img, const GpuMat &mask, std::vector< KeyPoint > &keypoints, std::vector< float > &descriptors, bool useProvidedKeypoints=false)
 
void releaseMemory ()
 
void uploadKeypoints (const std::vector< KeyPoint > &keypoints, GpuMat &keypointsGPU)
 upload host keypoints to device memory
 

Static Public Member Functions

static Ptr< SURF_CUDAcreate (double _hessianThreshold, int _nOctaves=4, int _nOctaveLayers=2, bool _extended=false, float _keypointsRatio=0.01f, bool _upright=false)
 

Public Attributes

GpuMat det
 
bool extended
 
double hessianThreshold
 
float keypointsRatio
 max keypoints = min(keypointsRatio * img.size().area(), 65535)
 
GpuMat mask1
 
GpuMat maskSum
 
GpuMat maxPosBuffer
 
int nOctaveLayers
 
int nOctaves
 
GpuMat sum
 
GpuMat trace
 
bool upright
 

Detailed Description

Class used for extracting Speeded Up Robust Features (SURF) from an image. :

The class SURF_CUDA implements Speeded Up Robust Features descriptor. There is a fast multi-scale Hessian keypoint detector that can be used to find the keypoints (which is the default option). But the descriptors can also be computed for the user-specified keypoints. Only 8-bit grayscale images are supported.

The class SURF_CUDA can store results in the GPU and CPU memory. It provides functions to convert results between CPU and GPU version ( uploadKeypoints, downloadKeypoints, downloadDescriptors ). The format of CPU results is the same as SURF results. GPU results are stored in GpuMat. The keypoints matrix is \(\texttt{nFeatures} \times 7\) matrix with the CV_32FC1 type.

  • keypoints.ptr<float>(X_ROW)[i] contains x coordinate of the i-th feature.
  • keypoints.ptr<float>(Y_ROW)[i] contains y coordinate of the i-th feature.
  • keypoints.ptr<float>(LAPLACIAN_ROW)[i] contains the laplacian sign of the i-th feature.
  • keypoints.ptr<float>(OCTAVE_ROW)[i] contains the octave of the i-th feature.
  • keypoints.ptr<float>(SIZE_ROW)[i] contains the size of the i-th feature.
  • keypoints.ptr<float>(ANGLE_ROW)[i] contain orientation of the i-th feature.
  • keypoints.ptr<float>(HESSIAN_ROW)[i] contains the response of the i-th feature.

The descriptors matrix is \(\texttt{nFeatures} \times \texttt{descriptorSize}\) matrix with the CV_32FC1 type.

The class SURF_CUDA uses some buffers and provides access to it. All buffers can be safely released between function calls.

See also
SURF
Note
  • An example for using the SURF keypoint matcher on GPU can be found at opencv_source_code/samples/gpu/surf_keypoint_matcher.cpp

Member Enumeration Documentation

◆ KeypointLayout

Enumerator
X_ROW 
Y_ROW 
LAPLACIAN_ROW 
OCTAVE_ROW 
SIZE_ROW 
ANGLE_ROW 
HESSIAN_ROW 
ROWS_COUNT 

Constructor & Destructor Documentation

◆ SURF_CUDA() [1/2]

cv::cuda::SURF_CUDA::SURF_CUDA ( )

the default constructor

◆ SURF_CUDA() [2/2]

cv::cuda::SURF_CUDA::SURF_CUDA ( double _hessianThreshold,
int _nOctaves = 4,
int _nOctaveLayers = 2,
bool _extended = false,
float _keypointsRatio = 0.01f,
bool _upright = false )
explicit

the full constructor taking all the necessary parameters

Member Function Documentation

◆ create()

static Ptr< SURF_CUDA > cv::cuda::SURF_CUDA::create ( double _hessianThreshold,
int _nOctaves = 4,
int _nOctaveLayers = 2,
bool _extended = false,
float _keypointsRatio = 0.01f,
bool _upright = false )
static
Python:
cv.cuda.SURF_CUDA.create(_hessianThreshold[, _nOctaves[, _nOctaveLayers[, _extended[, _keypointsRatio[, _upright]]]]]) -> retval
cv.cuda.SURF_CUDA_create(_hessianThreshold[, _nOctaves[, _nOctaveLayers[, _extended[, _keypointsRatio[, _upright]]]]]) -> retval
Parameters
_hessianThresholdThreshold for hessian keypoint detector used in SURF.
_nOctavesNumber of pyramid octaves the keypoint detector will use.
_nOctaveLayersNumber of octave layers within each octave.
_extendedExtended descriptor flag (true - use extended 128-element descriptors; false - use 64-element descriptors).
_keypointsRatioLimits a maximum number of features
_uprightUp-right or rotated features flag (true - do not compute orientation of features; false - compute orientation).

◆ defaultNorm()

int cv::cuda::SURF_CUDA::defaultNorm ( ) const
Python:
cv.cuda.SURF_CUDA.defaultNorm() -> retval

returns the default norm type

◆ descriptorSize()

int cv::cuda::SURF_CUDA::descriptorSize ( ) const
Python:
cv.cuda.SURF_CUDA.descriptorSize() -> retval

returns the descriptor size in float's (64 or 128)

◆ detect()

void cv::cuda::SURF_CUDA::detect ( const GpuMat & img,
const GpuMat & mask,
GpuMat & keypoints )
inline
Python:
cv.cuda.SURF_CUDA.detect(img, mask[, keypoints]) -> keypoints

Finds the keypoints using fast hessian detector used in SURF.

Parameters
imgSource image, currently supports only CV_8UC1 images.
maskA mask image same size as src and of type CV_8UC1.
keypointsDetected keypoints.

◆ detectWithDescriptors()

void cv::cuda::SURF_CUDA::detectWithDescriptors ( const GpuMat & img,
const GpuMat & mask,
GpuMat & keypoints,
GpuMat & descriptors,
bool useProvidedKeypoints = false )
inline
Python:
cv.cuda.SURF_CUDA.detectWithDescriptors(img, mask[, keypoints[, descriptors[, useProvidedKeypoints]]]) -> keypoints, descriptors

Finds the keypoints and computes their descriptors using fast hessian detector used in SURF.

Parameters
imgSource image, currently supports only CV_8UC1 images.
maskA mask image same size as src and of type CV_8UC1.
keypointsDetected keypoints.
descriptorsKeypoint descriptors.
useProvidedKeypointsCompute descriptors for the user-provided keypoints and recompute keypoints direction.

◆ downloadDescriptors()

void cv::cuda::SURF_CUDA::downloadDescriptors ( const GpuMat & descriptorsGPU,
std::vector< float > & descriptors )

download descriptors from device to host memory

◆ downloadKeypoints()

void cv::cuda::SURF_CUDA::downloadKeypoints ( const GpuMat & keypointsGPU,
std::vector< KeyPoint > & keypoints )
Python:
cv.cuda.SURF_CUDA.downloadKeypoints(keypointsGPU) -> keypoints

download keypoints from device to host memory

◆ operator()() [1/5]

void cv::cuda::SURF_CUDA::operator() ( const GpuMat & img,
const GpuMat & mask,
GpuMat & keypoints )

finds the keypoints using fast hessian detector used in SURF supports CV_8UC1 images keypoints will have nFeature cols and 6 rows keypoints.ptr<float>(X_ROW)[i] will contain x coordinate of i'th feature keypoints.ptr<float>(Y_ROW)[i] will contain y coordinate of i'th feature keypoints.ptr<float>(LAPLACIAN_ROW)[i] will contain laplacian sign of i'th feature keypoints.ptr<float>(OCTAVE_ROW)[i] will contain octave of i'th feature keypoints.ptr<float>(SIZE_ROW)[i] will contain size of i'th feature keypoints.ptr<float>(ANGLE_ROW)[i] will contain orientation of i'th feature keypoints.ptr<float>(HESSIAN_ROW)[i] will contain response of i'th feature

◆ operator()() [2/5]

void cv::cuda::SURF_CUDA::operator() ( const GpuMat & img,
const GpuMat & mask,
GpuMat & keypoints,
GpuMat & descriptors,
bool useProvidedKeypoints = false )

finds the keypoints and computes their descriptors. Optionally it can compute descriptors for the user-provided keypoints and recompute keypoints direction

◆ operator()() [3/5]

void cv::cuda::SURF_CUDA::operator() ( const GpuMat & img,
const GpuMat & mask,
std::vector< KeyPoint > & keypoints )

◆ operator()() [4/5]

void cv::cuda::SURF_CUDA::operator() ( const GpuMat & img,
const GpuMat & mask,
std::vector< KeyPoint > & keypoints,
GpuMat & descriptors,
bool useProvidedKeypoints = false )

◆ operator()() [5/5]

void cv::cuda::SURF_CUDA::operator() ( const GpuMat & img,
const GpuMat & mask,
std::vector< KeyPoint > & keypoints,
std::vector< float > & descriptors,
bool useProvidedKeypoints = false )

◆ releaseMemory()

void cv::cuda::SURF_CUDA::releaseMemory ( )

◆ uploadKeypoints()

void cv::cuda::SURF_CUDA::uploadKeypoints ( const std::vector< KeyPoint > & keypoints,
GpuMat & keypointsGPU )

upload host keypoints to device memory

Member Data Documentation

◆ det

GpuMat cv::cuda::SURF_CUDA::det

◆ extended

bool cv::cuda::SURF_CUDA::extended

◆ hessianThreshold

double cv::cuda::SURF_CUDA::hessianThreshold

◆ keypointsRatio

float cv::cuda::SURF_CUDA::keypointsRatio

max keypoints = min(keypointsRatio * img.size().area(), 65535)

◆ mask1

GpuMat cv::cuda::SURF_CUDA::mask1

◆ maskSum

GpuMat cv::cuda::SURF_CUDA::maskSum

◆ maxPosBuffer

GpuMat cv::cuda::SURF_CUDA::maxPosBuffer

◆ nOctaveLayers

int cv::cuda::SURF_CUDA::nOctaveLayers

◆ nOctaves

int cv::cuda::SURF_CUDA::nOctaves

◆ sum

GpuMat cv::cuda::SURF_CUDA::sum

◆ trace

GpuMat cv::cuda::SURF_CUDA::trace

◆ upright

bool cv::cuda::SURF_CUDA::upright

The documentation for this class was generated from the following file: