opencv::core

Struct KeyPoint

Source
pub struct KeyPoint { /* private fields */ }
Expand description

Data structure for salient point detectors.

The class instance stores a keypoint, i.e. a point feature found by one of many available keypoint detectors, such as Harris corner detector, #FAST, %StarDetector, %SURF, %SIFT etc.

The keypoint is characterized by the 2D position, scale (proportional to the diameter of the neighborhood that needs to be taken into account), orientation and some other parameters. The keypoint neighborhood is then analyzed by another algorithm that builds a descriptor (usually represented as a feature vector). The keypoints representing the same object in different images can then be matched using %KDTree or another method.

Implementations§

Source§

impl KeyPoint

Source

pub fn default() -> Result<KeyPoint>

the default constructor

Source

pub fn new_point( pt: Point2f, size: f32, angle: f32, response: f32, octave: i32, class_id: i32, ) -> Result<KeyPoint>

§Parameters
  • pt: x & y coordinates of the keypoint
  • size: keypoint diameter
  • angle: keypoint orientation
  • response: keypoint detector response on the keypoint (that is, strength of the keypoint)
  • octave: pyramid octave in which the keypoint has been detected
  • class_id: object id
§C++ default parameters
  • angle: -1
  • response: 0
  • octave: 0
  • class_id: -1
Source

pub fn new_point_def(pt: Point2f, size: f32) -> Result<KeyPoint>

§Parameters
  • pt: x & y coordinates of the keypoint
  • size: keypoint diameter
  • angle: keypoint orientation
  • response: keypoint detector response on the keypoint (that is, strength of the keypoint)
  • octave: pyramid octave in which the keypoint has been detected
  • class_id: object id
§Note

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

  • angle: -1
  • response: 0
  • octave: 0
  • class_id: -1
Source

pub fn new_coords( x: f32, y: f32, size: f32, angle: f32, response: f32, octave: i32, class_id: i32, ) -> Result<KeyPoint>

§Parameters
  • x: x-coordinate of the keypoint
  • y: y-coordinate of the keypoint
  • size: keypoint diameter
  • angle: keypoint orientation
  • response: keypoint detector response on the keypoint (that is, strength of the keypoint)
  • octave: pyramid octave in which the keypoint has been detected
  • class_id: object id
§C++ default parameters
  • angle: -1
  • response: 0
  • octave: 0
  • class_id: -1
Source

pub fn new_coords_def(x: f32, y: f32, size: f32) -> Result<KeyPoint>

§Parameters
  • x: x-coordinate of the keypoint
  • y: y-coordinate of the keypoint
  • size: keypoint diameter
  • angle: keypoint orientation
  • response: keypoint detector response on the keypoint (that is, strength of the keypoint)
  • octave: pyramid octave in which the keypoint has been detected
  • class_id: object id
§Note

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

  • angle: -1
  • response: 0
  • octave: 0
  • class_id: -1
Source

pub fn convert( keypoints: &Vector<KeyPoint>, points2f: &mut Vector<Point2f>, keypoint_indexes: &Vector<i32>, ) -> Result<()>

This method converts vector of keypoints to vector of points or the reverse, where each keypoint is assigned the same size and the same orientation.

§Parameters
  • keypoints: Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB
  • points2f: Array of (x,y) coordinates of each keypoint
  • keypointIndexes: Array of indexes of keypoints to be converted to points. (Acts like a mask to convert only specified keypoints)
§C++ default parameters
  • keypoint_indexes: std::vector()
Source

pub fn convert_def( keypoints: &Vector<KeyPoint>, points2f: &mut Vector<Point2f>, ) -> Result<()>

This method converts vector of keypoints to vector of points or the reverse, where each keypoint is assigned the same size and the same orientation.

§Parameters
  • keypoints: Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB
  • points2f: Array of (x,y) coordinates of each keypoint
  • keypointIndexes: Array of indexes of keypoints to be converted to points. (Acts like a mask to convert only specified keypoints)
§Note

This alternative version of KeyPoint::convert function uses the following default values for its arguments:

  • keypoint_indexes: std::vector()
Source

pub fn convert_to( points2f: &Vector<Point2f>, keypoints: &mut Vector<KeyPoint>, size: f32, response: f32, octave: i32, class_id: i32, ) -> Result<()>

This method converts vector of keypoints to vector of points or the reverse, where each keypoint is assigned the same size and the same orientation.

§Parameters
  • keypoints: Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB
  • points2f: Array of (x,y) coordinates of each keypoint
  • keypointIndexes: Array of indexes of keypoints to be converted to points. (Acts like a mask to convert only specified keypoints)
§Overloaded parameters
  • points2f: Array of (x,y) coordinates of each keypoint
  • keypoints: Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB
  • size: keypoint diameter
  • response: keypoint detector response on the keypoint (that is, strength of the keypoint)
  • octave: pyramid octave in which the keypoint has been detected
  • class_id: object id
§C++ default parameters
  • size: 1
  • response: 1
  • octave: 0
  • class_id: -1
Source

pub fn convert_to_def( points2f: &Vector<Point2f>, keypoints: &mut Vector<KeyPoint>, ) -> Result<()>

@overload

§Parameters
  • points2f: Array of (x,y) coordinates of each keypoint
  • keypoints: Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB
  • size: keypoint diameter
  • response: keypoint detector response on the keypoint (that is, strength of the keypoint)
  • octave: pyramid octave in which the keypoint has been detected
  • class_id: object id
§Note

This alternative version of KeyPoint::convert_to function uses the following default values for its arguments:

  • size: 1
  • response: 1
  • octave: 0
  • class_id: -1
Source

pub fn overlap( kp1: &impl KeyPointTraitConst, kp2: &impl KeyPointTraitConst, ) -> Result<f32>

This method computes overlap for pair of keypoints. Overlap is the ratio between area of keypoint regions’ intersection and area of keypoint regions’ union (considering keypoint region as circle). If they don’t overlap, we get zero. If they coincide at same location with same size, we get 1.

§Parameters
  • kp1: First keypoint
  • kp2: Second keypoint

Trait Implementations§

Source§

impl Boxed for KeyPoint

Source§

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

Wrap the specified raw pointer Read more
Source§

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

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

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

Return the underlying raw pointer. Read more
Source§

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

Return the underlying mutable raw pointer Read more
Source§

impl Clone for KeyPoint

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KeyPoint

Source§

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

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

impl Drop for KeyPoint

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<Elliptic_KeyPoint> for KeyPoint

Source§

fn from(s: Elliptic_KeyPoint) -> Self

Converts to this type from the input type.
Source§

impl KeyPointTrait for KeyPoint

Source§

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

Source§

fn set_pt(&mut self, val: Point2f)

coordinates of the keypoints
Source§

fn set_size(&mut self, val: f32)

diameter of the meaningful keypoint neighborhood
Source§

fn set_angle(&mut self, val: f32)

computed orientation of the keypoint (-1 if not applicable); it’s in [0,360) degrees and measured relative to image coordinate system, ie in clockwise.
Source§

fn set_response(&mut self, val: f32)

the response by which the most strong keypoints have been selected. Can be used for the further sorting or subsampling
Source§

fn set_octave(&mut self, val: i32)

octave (pyramid layer) from which the keypoint has been extracted
Source§

fn set_class_id(&mut self, val: i32)

object class (if the keypoints need to be clustered by an object they belong to)
Source§

impl KeyPointTraitConst for KeyPoint

Source§

fn as_raw_KeyPoint(&self) -> *const c_void

Source§

fn pt(&self) -> Point2f

coordinates of the keypoints
Source§

fn size(&self) -> f32

diameter of the meaningful keypoint neighborhood
Source§

fn angle(&self) -> f32

computed orientation of the keypoint (-1 if not applicable); it’s in [0,360) degrees and measured relative to image coordinate system, ie in clockwise.
Source§

fn response(&self) -> f32

the response by which the most strong keypoints have been selected. Can be used for the further sorting or subsampling
Source§

fn octave(&self) -> i32

octave (pyramid layer) from which the keypoint has been extracted
Source§

fn class_id(&self) -> i32

object class (if the keypoints need to be clustered by an object they belong to)
Source§

fn hash(&self) -> Result<size_t>

Source§

impl Send for KeyPoint

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.