opencv::xfeatures2d

Struct SURF_CUDA

Source
pub struct SURF_CUDA { /* private fields */ }
Expand 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 inline formula 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 inline formula 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

Implementations§

Source§

impl SURF_CUDA

Source

pub fn default() -> Result<SURF_CUDA>

the default constructor

Source

pub fn new( _hessian_threshold: f64, _n_octaves: i32, _n_octave_layers: i32, _extended: bool, _keypoints_ratio: f32, _upright: bool, ) -> Result<SURF_CUDA>

the full constructor taking all the necessary parameters

§C++ default parameters
  • _n_octaves: 4
  • _n_octave_layers: 2
  • _extended: false
  • _keypoints_ratio: 0.01f
  • _upright: false
Source

pub fn new_def(_hessian_threshold: f64) -> Result<SURF_CUDA>

the full constructor taking all the necessary parameters

§Note

This alternative version of [new] function uses the following default values for its arguments:

  • _n_octaves: 4
  • _n_octave_layers: 2
  • _extended: false
  • _keypoints_ratio: 0.01f
  • _upright: false
Source

pub fn create( _hessian_threshold: f64, _n_octaves: i32, _n_octave_layers: i32, _extended: bool, _keypoints_ratio: f32, _upright: bool, ) -> Result<Ptr<SURF_CUDA>>

§Parameters
  • _hessianThreshold: Threshold for hessian keypoint detector used in SURF.
  • _nOctaves: Number of pyramid octaves the keypoint detector will use.
  • _nOctaveLayers: Number of octave layers within each octave.
  • _extended: Extended descriptor flag (true - use extended 128-element descriptors; false - use 64-element descriptors).
  • _keypointsRatio: Limits a maximum number of features
  • _upright: Up-right or rotated features flag (true - do not compute orientation of features; false - compute orientation).
§C++ default parameters
  • _n_octaves: 4
  • _n_octave_layers: 2
  • _extended: false
  • _keypoints_ratio: 0.01f
  • _upright: false
Source

pub fn create_def(_hessian_threshold: f64) -> Result<Ptr<SURF_CUDA>>

§Parameters
  • _hessianThreshold: Threshold for hessian keypoint detector used in SURF.
  • _nOctaves: Number of pyramid octaves the keypoint detector will use.
  • _nOctaveLayers: Number of octave layers within each octave.
  • _extended: Extended descriptor flag (true - use extended 128-element descriptors; false - use 64-element descriptors).
  • _keypointsRatio: Limits a maximum number of features
  • _upright: Up-right or rotated features flag (true - do not compute orientation of features; false - compute orientation).
§Note

This alternative version of SURF_CUDA::create function uses the following default values for its arguments:

  • _n_octaves: 4
  • _n_octave_layers: 2
  • _extended: false
  • _keypoints_ratio: 0.01f
  • _upright: false

Trait Implementations§

Source§

impl Boxed for SURF_CUDA

Source§

unsafe fn from_raw(ptr: <SURF_CUDA as OpenCVFromExtern>::ExternReceive) -> Self

Wrap the specified raw pointer Read more
Source§

fn into_raw(self) -> <SURF_CUDA as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying raw pointer while consuming this wrapper. Read more
Source§

fn as_raw(&self) -> <SURF_CUDA as OpenCVTypeExternContainer>::ExternSend

Return the underlying raw pointer. Read more
Source§

fn as_raw_mut( &mut self, ) -> <SURF_CUDA as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying mutable raw pointer Read more
Source§

impl Debug for SURF_CUDA

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for SURF_CUDA

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl SURF_CUDATrait for SURF_CUDA

Source§

fn as_raw_mut_SURF_CUDA(&mut self) -> *mut c_void

Source§

fn set_hessian_threshold(&mut self, val: f64)

Source§

fn set_n_octaves(&mut self, val: i32)

Source§

fn set_n_octave_layers(&mut self, val: i32)

Source§

fn set_extended(&mut self, val: bool)

Source§

fn set_upright(&mut self, val: bool)

Source§

fn set_keypoints_ratio(&mut self, val: f32)

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

fn set_sum(&mut self, val: GpuMat)

Source§

fn set_mask1(&mut self, val: GpuMat)

Source§

fn set_mask_sum(&mut self, val: GpuMat)

Source§

fn set_det(&mut self, val: GpuMat)

Source§

fn set_trace(&mut self, val: GpuMat)

Source§

fn set_max_pos_buffer(&mut self, val: GpuMat)

Source§

fn upload_keypoints( &mut self, keypoints: &Vector<KeyPoint>, keypoints_gpu: &mut impl GpuMatTrait, ) -> Result<()>

upload host keypoints to device memory
Source§

fn download_keypoints( &mut self, keypoints_gpu: &impl GpuMatTraitConst, keypoints: &mut Vector<KeyPoint>, ) -> Result<()>

download keypoints from device to host memory
Source§

fn download_descriptors( &mut self, descriptors_gpu: &impl GpuMatTraitConst, descriptors: &mut Vector<f32>, ) -> Result<()>

download descriptors from device to host memory
Source§

fn apply( &mut self, img: &impl GpuMatTraitConst, mask: &impl GpuMatTraitConst, keypoints: &mut impl GpuMatTrait, ) -> Result<()>

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

fn apply_1( &mut self, img: &impl GpuMatTraitConst, mask: &impl GpuMatTraitConst, keypoints: &mut impl GpuMatTrait, descriptors: &mut impl GpuMatTrait, use_provided_keypoints: bool, ) -> Result<()>

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

fn apply_def( &mut self, img: &impl GpuMatTraitConst, mask: &impl GpuMatTraitConst, keypoints: &mut impl GpuMatTrait, descriptors: &mut impl GpuMatTrait, ) -> Result<()>

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

fn detect( &mut self, img: &impl GpuMatTraitConst, mask: &impl GpuMatTraitConst, keypoints: &mut impl GpuMatTrait, ) -> Result<()>

Finds the keypoints using fast hessian detector used in SURF Read more
Source§

fn apply_2( &mut self, img: &impl GpuMatTraitConst, mask: &impl GpuMatTraitConst, keypoints: &mut Vector<KeyPoint>, ) -> Result<()>

Source§

fn apply_3( &mut self, img: &impl GpuMatTraitConst, mask: &impl GpuMatTraitConst, keypoints: &mut Vector<KeyPoint>, descriptors: &mut impl GpuMatTrait, use_provided_keypoints: bool, ) -> Result<()>

C++ default parameters Read more
Source§

fn apply_def_1( &mut self, img: &impl GpuMatTraitConst, mask: &impl GpuMatTraitConst, keypoints: &mut Vector<KeyPoint>, descriptors: &mut impl GpuMatTrait, ) -> Result<()>

Source§

fn detect_with_descriptors( &mut self, img: &impl GpuMatTraitConst, mask: &impl GpuMatTraitConst, keypoints: &mut impl GpuMatTrait, descriptors: &mut impl GpuMatTrait, use_provided_keypoints: bool, ) -> Result<()>

Finds the keypoints and computes their descriptors using fast hessian detector used in SURF Read more
Source§

fn detect_with_descriptors_def( &mut self, img: &impl GpuMatTraitConst, mask: &impl GpuMatTraitConst, keypoints: &mut impl GpuMatTrait, descriptors: &mut impl GpuMatTrait, ) -> Result<()>

Finds the keypoints and computes their descriptors using fast hessian detector used in SURF Read more
Source§

fn apply_4( &mut self, img: &impl GpuMatTraitConst, mask: &impl GpuMatTraitConst, keypoints: &mut Vector<KeyPoint>, descriptors: &mut Vector<f32>, use_provided_keypoints: bool, ) -> Result<()>

C++ default parameters Read more
Source§

fn apply_def_2( &mut self, img: &impl GpuMatTraitConst, mask: &impl GpuMatTraitConst, keypoints: &mut Vector<KeyPoint>, descriptors: &mut Vector<f32>, ) -> Result<()>

Source§

fn release_memory(&mut self) -> Result<()>

Source§

impl SURF_CUDATraitConst for SURF_CUDA

Source§

fn as_raw_SURF_CUDA(&self) -> *const c_void

Source§

fn hessian_threshold(&self) -> f64

Source§

fn n_octaves(&self) -> i32

Source§

fn n_octave_layers(&self) -> i32

Source§

fn extended(&self) -> bool

Source§

fn upright(&self) -> bool

Source§

fn keypoints_ratio(&self) -> f32

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

fn sum(&self) -> GpuMat

Source§

fn mask1(&self) -> GpuMat

Source§

fn mask_sum(&self) -> GpuMat

Source§

fn det(&self) -> GpuMat

Source§

fn trace(&self) -> GpuMat

Source§

fn max_pos_buffer(&self) -> GpuMat

Source§

fn descriptor_size(&self) -> Result<i32>

returns the descriptor size in float’s (64 or 128)
Source§

fn default_norm(&self) -> Result<i32>

returns the default norm type
Source§

impl Send for SURF_CUDA

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Mat> ModifyInplace for Mat
where Mat: Boxed,

Source§

unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res, ) -> Res

Helper function to call OpenCV functions that allow in-place modification of a Mat or another similar object. By passing a mutable reference to the Mat to this function your closure will get called with the read reference and a write references to the same Mat. This is unsafe in a general case as it leads to having non-exclusive mutable access to the internal data, but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place modification is imgproc::threshold. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.