pub struct PerspectiveTransform {
pub matrix: Array2<f64>,
}Expand description
3x3 Perspective transformation matrix
Fields§
§matrix: Array2<f64>Homography matrix
Implementations§
Source§impl PerspectiveTransform
impl PerspectiveTransform
Sourcepub fn new(data: [f64; 9]) -> Self
pub fn new(data: [f64; 9]) -> Self
Create a new perspective transformation matrix from raw data
Sourcepub fn from_points(
srcpoints: &[(f64, f64)],
dst_points: &[(f64, f64)],
) -> Result<Self>
pub fn from_points( srcpoints: &[(f64, f64)], dst_points: &[(f64, f64)], ) -> Result<Self>
Compute a perspective transformation from point correspondences
Sourcepub fn from_quad(
x: f64,
y: f64,
width: f64,
height: f64,
dst_points: &[(f64, f64)],
) -> Result<Self>
pub fn from_quad( x: f64, y: f64, width: f64, height: f64, dst_points: &[(f64, f64)], ) -> Result<Self>
Create a perspective transformation to map a rectangle to a quadrilateral
Sourcepub fn transform_points_simd(&self, points: &[(f64, f64)]) -> Vec<(f64, f64)>
pub fn transform_points_simd(&self, points: &[(f64, f64)]) -> Vec<(f64, f64)>
Transform multiple points using SIMD operations for better performance
§Arguments
points- Slice of points to transform [(x, y), …]
§Returns
- Vector of transformed points
§Performance
Uses SIMD operations for batch transformation, providing 2-4x speedup for large point sets compared to individual point transformation.
Sourcepub fn reprojection_errors(
&self,
srcpoints: &[(f64, f64)],
dst_points: &[(f64, f64)],
) -> Vec<f64>
pub fn reprojection_errors( &self, srcpoints: &[(f64, f64)], dst_points: &[(f64, f64)], ) -> Vec<f64>
Sourcepub fn compute_determinant(&self) -> f64
pub fn compute_determinant(&self) -> f64
Compute the determinant of the transformation matrix
Trait Implementations§
Source§impl Clone for PerspectiveTransform
impl Clone for PerspectiveTransform
Source§fn clone(&self) -> PerspectiveTransform
fn clone(&self) -> PerspectiveTransform
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PerspectiveTransform
impl RefUnwindSafe for PerspectiveTransform
impl Send for PerspectiveTransform
impl Sync for PerspectiveTransform
impl Unpin for PerspectiveTransform
impl UnwindSafe for PerspectiveTransform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.