cv_core/keypoint.rs
1use derive_more::{AsMut, AsRef, Deref, DerefMut, From, Into};
2use nalgebra::Point2;
3
4/// Allows the retrieval of the point on the image the feature came from.
5pub trait ImagePoint {
6 /// Retrieves the point on the image
7 fn image_point(&self) -> Point2<f64>;
8}
9
10/// A point on an image frame. This type should be used when
11/// the point location is on the image frame in pixel coordinates.
12/// This means the keypoint is neither undistorted nor normalized.
13///
14/// For calibrated coordinates, use a type that implements [`Bearing`](crate::Bearing).
15/// This can be a type from a camera model crate (like `cv-pinhole`), or
16/// it can be the `Unit<Vector3<f64>>` type, which implements bearing.
17#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, AsMut, AsRef, Deref, DerefMut, From, Into)]
18pub struct KeyPoint(pub Point2<f64>);
19
20impl ImagePoint for KeyPoint {
21 fn image_point(&self) -> Point2<f64> {
22 self.0
23 }
24}