[−][src]Struct imageproc::geometric_transformations::Projection
A 2d projective transformation, stored as a row major 3x3 matrix.
Transformations combine by pre-multiplication, i.e. applying P * Q
is equivalent to
applying Q
and then applying P
. For example, the following defines a rotation
about the point (320.0, 240.0).
use imageproc::geometric_transformations::*; use std::f32::consts::PI; let (cx, cy) = (320.0, 240.0); let c_rotation = Projection::translate(cx, cy) * Projection::rotate(PI / 6.0) * Projection::translate(-cx, -cy);
See ./examples/projection.rs for more examples.
Implementations
impl Projection
[src]
pub fn from_matrix(transform: [f32; 9]) -> Option<Projection>
[src]
Creates a 2d projective transform from a row-major 3x3 matrix in homogeneous coordinates.
Returns None
if the matrix is not invertible.
pub fn translate(tx: f32, ty: f32) -> Projection
[src]
A translation by (tx, ty).
pub fn rotate(theta: f32) -> Projection
[src]
A clockwise rotation around the top-left corner of the image by theta radians.
pub fn scale(sx: f32, sy: f32) -> Projection
[src]
An anisotropic scaling (sx, sy).
Note that the warp
function does not change the size of the input image.
If you want to resize an image then use the imageops
module in the image
crate.
pub fn invert(self) -> Projection
[src]
Inverts the transformation.
pub fn from_control_points(
from: [(f32, f32); 4],
to: [(f32, f32); 4]
) -> Option<Projection>
[src]
from: [(f32, f32); 4],
to: [(f32, f32); 4]
) -> Option<Projection>
Calculates a projection from a set of four control point pairs.
Trait Implementations
impl Clone for Projection
[src]
fn clone(&self) -> Projection
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Projection
[src]
impl Debug for Projection
[src]
impl<'a, 'b> Mul<&'b (f32, f32)> for &'a Projection
[src]
type Output = (f32, f32)
The resulting type after applying the *
operator.
fn mul(self, rhs: &(f32, f32)) -> (f32, f32)
[src]
impl<'a, 'b> Mul<&'b Projection> for &'a Projection
[src]
type Output = Projection
The resulting type after applying the *
operator.
fn mul(self, rhs: &Projection) -> Projection
[src]
impl Mul<(f32, f32)> for Projection
[src]
type Output = (f32, f32)
The resulting type after applying the *
operator.
fn mul(self, rhs: (f32, f32)) -> (f32, f32)
[src]
impl Mul<Projection> for Projection
[src]
type Output = Projection
The resulting type after applying the *
operator.
fn mul(self, rhs: Projection) -> Projection
[src]
Auto Trait Implementations
impl RefUnwindSafe for Projection
impl Send for Projection
impl Sync for Projection
impl Unpin for Projection
impl UnwindSafe for Projection
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src where
Scheme: ApproxScheme,
[src]
Scheme: ApproxScheme,
type Err = NoError
The error type produced by a failed conversion.
pub fn approx_from(
src: Src
) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
[src]
src: Src
) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src where
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
[src]
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
pub fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, Dst> ConvAsUtil<Dst> for T
[src]
fn approx(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
[src]
Self: ApproxInto<Dst, DefaultApprox>,
fn approx_by<Scheme>(self) -> Result<Dst, Self::Err> where
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
[src]
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
impl<T> ConvUtil for T
[src]
fn approx_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
[src]
Self: ApproxInto<Dst, DefaultApprox>,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err> where
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
[src]
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
fn into_as<Dst>(self) -> Dst where
Self: Into<Dst>,
[src]
Self: Into<Dst>,
fn try_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: TryInto<Dst>,
[src]
Self: TryInto<Dst>,
fn value_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ValueInto<Dst>,
[src]
Self: ValueInto<Dst>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<Src> TryFrom<Src> for Src
[src]
type Err = NoError
The error type produced by a failed conversion.
pub fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<Src, Dst> TryInto<Dst> for Src where
Dst: TryFrom<Src>,
[src]
Dst: TryFrom<Src>,
type Err = <Dst as TryFrom<Src>>::Err
The error type produced by a failed conversion.
pub fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<Src> ValueFrom<Src> for Src
[src]
type Err = NoError
The error type produced by a failed conversion.
pub fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
[src]
impl<Src, Dst> ValueInto<Dst> for Src where
Dst: ValueFrom<Src>,
[src]
Dst: ValueFrom<Src>,