Trait IsIntensityMutImage

Source
pub trait IsIntensityMutImage<Scalar, Pixel>: Sized
where Scalar: IsIntensityScalar + 'static, Pixel: IntensityPixel<Scalar> + 'static,
{ type Pixel<OtherScalar: IsIntensityScalar>: IntensityPixel<OtherScalar>; type CastedMutImage<OtherScalar: IsIntensityScalar>; // Required methods fn to_grayscale(img: Self) -> GenMutImage<2, 0, Scalar, Scalar, 1, 1>; fn to_grayscale_alpha( img: Self, ) -> GenMutImage<3, 1, Scalar, Matrix<Scalar, Const<2>, Const<1>, ArrayStorage<Scalar, 2, 1>>, 2, 1>; fn to_rgb( img: Self, ) -> GenMutImage<3, 1, Scalar, Matrix<Scalar, Const<3>, Const<1>, ArrayStorage<Scalar, 3, 1>>, 3, 1>; fn to_rgba( img: Self, ) -> GenMutImage<3, 1, Scalar, Matrix<Scalar, Const<4>, Const<1>, ArrayStorage<Scalar, 4, 1>>, 4, 1>; fn convert_to<OtherScalar>(img: Self) -> Self::CastedMutImage<OtherScalar> where OtherScalar: IsIntensityScalar; }
Expand description

Trait for “intensity” images (grayscale, grayscale+alpha, RGB, RGBA).

Hence it s a trait for grayscale (1-channel), grayscale+alpha (2-channel), RGB (3-channel), and RGBA images (4-channel).

This trait provides methods for converting between different image type. As of now, three scalar type are supported: u8, u16, and f32:

  • u8 images are in the range [0, 255], i.e. 100% intensity corresponds to 255.

  • u16 images are in the range [0, 65535], i.e. 100% intensity corresponds to 65535.

  • f32 images shall be in the range [0.0, 1.0] and 100% intensity corresponds to 1.0. If the f32 is outside this range, conversion results may be surprising.

These are image type which typically used for computer vision and graphics applications.

Required Associated Types§

Source

type Pixel<OtherScalar: IsIntensityScalar>: IntensityPixel<OtherScalar>

Pixel type

Source

type CastedMutImage<OtherScalar: IsIntensityScalar>

Casted mutable image type

Required Methods§

Source

fn to_grayscale(img: Self) -> GenMutImage<2, 0, Scalar, Scalar, 1, 1>

Converts the image to a grayscale image.

Source

fn to_grayscale_alpha( img: Self, ) -> GenMutImage<3, 1, Scalar, Matrix<Scalar, Const<2>, Const<1>, ArrayStorage<Scalar, 2, 1>>, 2, 1>

Converts the image to a grayscale_alpha image.

Source

fn to_rgb( img: Self, ) -> GenMutImage<3, 1, Scalar, Matrix<Scalar, Const<3>, Const<1>, ArrayStorage<Scalar, 3, 1>>, 3, 1>

Converts the image to a RGB image.

Source

fn to_rgba( img: Self, ) -> GenMutImage<3, 1, Scalar, Matrix<Scalar, Const<4>, Const<1>, ArrayStorage<Scalar, 4, 1>>, 4, 1>

Converts the image to a RGBA image.

Source

fn convert_to<OtherScalar>(img: Self) -> Self::CastedMutImage<OtherScalar>
where OtherScalar: IsIntensityScalar,

Converts the image to a u8 image.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Scalar> IsIntensityMutImage<Scalar, Matrix<Scalar, Const<2>, Const<1>, ArrayStorage<Scalar, 2, 1>>> for GenMutImage<3, 1, Scalar, Matrix<Scalar, Const<2>, Const<1>, ArrayStorage<Scalar, 2, 1>>, 2, 1>
where Scalar: IsIntensityScalar + 'static,

Source§

type Pixel<S: IsIntensityScalar> = Matrix<S, Const<2>, Const<1>, ArrayStorage<S, 2, 1>>

Source§

type CastedMutImage<OtherScalar: IsIntensityScalar> = GenMutImage<3, 1, OtherScalar, Matrix<OtherScalar, Const<2>, Const<1>, ArrayStorage<OtherScalar, 2, 1>>, 2, 1>

Source§

impl<Scalar> IsIntensityMutImage<Scalar, Matrix<Scalar, Const<3>, Const<1>, ArrayStorage<Scalar, 3, 1>>> for GenMutImage<3, 1, Scalar, Matrix<Scalar, Const<3>, Const<1>, ArrayStorage<Scalar, 3, 1>>, 3, 1>
where Scalar: IsIntensityScalar + 'static,

Source§

type Pixel<S: IsIntensityScalar> = Matrix<S, Const<3>, Const<1>, ArrayStorage<S, 3, 1>>

Source§

type CastedMutImage<OtherScalar: IsIntensityScalar> = GenMutImage<3, 1, OtherScalar, Matrix<OtherScalar, Const<3>, Const<1>, ArrayStorage<OtherScalar, 3, 1>>, 3, 1>

Source§

impl<Scalar> IsIntensityMutImage<Scalar, Matrix<Scalar, Const<4>, Const<1>, ArrayStorage<Scalar, 4, 1>>> for GenMutImage<3, 1, Scalar, Matrix<Scalar, Const<4>, Const<1>, ArrayStorage<Scalar, 4, 1>>, 4, 1>
where Scalar: IsIntensityScalar + 'static,

Source§

type Pixel<S: IsIntensityScalar> = Matrix<S, Const<4>, Const<1>, ArrayStorage<S, 4, 1>>

Source§

type CastedMutImage<OtherScalar: IsIntensityScalar> = GenMutImage<3, 1, OtherScalar, Matrix<OtherScalar, Const<4>, Const<1>, ArrayStorage<OtherScalar, 4, 1>>, 4, 1>

Source§

impl<Scalar> IsIntensityMutImage<Scalar, Scalar> for GenMutImage<2, 0, Scalar, Scalar, 1, 1>
where Scalar: IsIntensityScalar + 'static,

Source§

type Pixel<S: IsIntensityScalar> = S

Source§

type CastedMutImage<OtherScalar: IsIntensityScalar> = GenMutImage<2, 0, OtherScalar, OtherScalar, 1, 1>