pub trait IsIntensityMutImage<Scalar, Pixel>: Sizedwhere
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§
Sourcetype Pixel<OtherScalar: IsIntensityScalar>: IntensityPixel<OtherScalar>
type Pixel<OtherScalar: IsIntensityScalar>: IntensityPixel<OtherScalar>
Pixel type
Sourcetype CastedMutImage<OtherScalar: IsIntensityScalar>
type CastedMutImage<OtherScalar: IsIntensityScalar>
Casted mutable image type
Required Methods§
Sourcefn to_grayscale(img: Self) -> GenMutImage<2, 0, Scalar, Scalar, 1, 1>
fn to_grayscale(img: Self) -> GenMutImage<2, 0, Scalar, Scalar, 1, 1>
Converts the image to a grayscale image.
Sourcefn to_grayscale_alpha(
img: Self,
) -> GenMutImage<3, 1, Scalar, Matrix<Scalar, Const<2>, Const<1>, ArrayStorage<Scalar, 2, 1>>, 2, 1>
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.
Sourcefn to_rgb(
img: Self,
) -> GenMutImage<3, 1, Scalar, Matrix<Scalar, Const<3>, Const<1>, ArrayStorage<Scalar, 3, 1>>, 3, 1>
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.
Sourcefn to_rgba(
img: Self,
) -> GenMutImage<3, 1, Scalar, Matrix<Scalar, Const<4>, Const<1>, ArrayStorage<Scalar, 4, 1>>, 4, 1>
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.
Sourcefn convert_to<OtherScalar>(img: Self) -> Self::CastedMutImage<OtherScalar>where
OtherScalar: IsIntensityScalar,
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.