[][src]Struct imageproc::geometric_transformations::Projection

pub struct Projection { /* fields omitted */ }

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.

Methods

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]

Calculates a projection from a set of four control point pairs.

Trait Implementations

impl Clone for Projection[src]

impl Copy for Projection[src]

impl<'a, 'b> Mul<&'b Projection> for &'a Projection[src]

type Output = Projection

The resulting type after applying the * operator.

impl Mul<Projection> for Projection[src]

type Output = Projection

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b (f32, f32)> for &'a Projection[src]

type Output = (f32, f32)

The resulting type after applying the * operator.

impl Mul<(f32, f32)> for Projection[src]

type Output = (f32, f32)

The resulting type after applying the * operator.

impl Debug for Projection[src]

Auto Trait Implementations

impl Sync for Projection

impl Send for Projection

impl Unpin for Projection

impl UnwindSafe for Projection

impl RefUnwindSafe for Projection

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> SetParameter for T[src]

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src where
    Dst: ApproxFrom<Src, Scheme>,
    Scheme: ApproxScheme
[src]

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.

impl<T, Dst> ConvAsUtil<Dst> for T[src]

impl<Src, Dst> ValueInto<Dst> for Src where
    Dst: ValueFrom<Src>, 
[src]

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.

impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src where
    Scheme: ApproxScheme
[src]

type Err = NoError

The error type produced by a failed conversion.

impl<Src> ValueFrom<Src> for Src[src]

type Err = NoError

The error type produced by a failed conversion.

impl<T> ConvUtil for T[src]

impl<Src> TryFrom<Src> for Src[src]

type Err = NoError

The error type produced by a failed conversion.

impl<Src, Dst> TryInto<Dst> for Src where
    Dst: TryFrom<Src>, 
[src]

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.