pub struct ConvertOptions { /* private fields */ }Expand description
Options for convert. The default
converts the whole source, stretched, with no rotation or flip, and maps
pixels as Normalization::unsigned for float destinations.
let opts = ConvertOptions::new()
.letterbox([0, 0, 0, 255])
.placement(LetterboxPlacement::TopLeft)
.pad_output([0.0; 4])
.normalization(Normalization::imagenet())
.rotation(Rotation::None);Implementations§
Source§impl ConvertOptions
impl ConvertOptions
Sourcepub fn source(self, source: Option<Region>) -> Self
pub fn source(self, source: Option<Region>) -> Self
Sample only source of the input; None samples all of it.
Sourcepub fn letterbox(self, pad: [u8; 4]) -> Self
pub fn letterbox(self, pad: [u8; 4]) -> Self
Letterbox: keep the source aspect ratio and pad the rest with the
RGBA pixel pad, which is mapped like the image.
Sourcepub fn placement(self, placement: LetterboxPlacement) -> Self
pub fn placement(self, placement: LetterboxPlacement) -> Self
Where a letterboxed image sits. Ignored without a letterbox fit.
Sourcepub fn pad_output(self, pad: [f32; 4]) -> Self
pub fn pad_output(self, pad: [f32; 4]) -> Self
Pad with these values as written to the destination (after normalization; quantized for integer destinations), instead of mapping the pixel pad. Ignored without a letterbox fit.
Sourcepub fn normalization(self, normalization: impl Into<Normalization>) -> Self
pub fn normalization(self, normalization: impl Into<Normalization>) -> Self
How pixel values map to the destination.
Sourcepub fn get_rotation(&self) -> Rotation
pub fn get_rotation(&self) -> Rotation
The output rotation.
Sourcepub fn get_placement(&self) -> LetterboxPlacement
pub fn get_placement(&self) -> LetterboxPlacement
The letterbox placement.
Sourcepub fn get_pad_output(&self) -> Option<[f32; 4]>
pub fn get_pad_output(&self) -> Option<[f32; 4]>
The output-domain pad, when set.
Sourcepub fn get_normalization(&self) -> Normalization
pub fn get_normalization(&self) -> Normalization
The pixel value mapping.
Trait Implementations§
Source§impl Clone for ConvertOptions
impl Clone for ConvertOptions
impl Copy for ConvertOptions
Source§impl Debug for ConvertOptions
impl Debug for ConvertOptions
Source§impl Default for ConvertOptions
impl Default for ConvertOptions
Source§impl PartialEq for ConvertOptions
impl PartialEq for ConvertOptions
impl StructuralPartialEq for ConvertOptions
Auto Trait Implementations§
impl Freeze for ConvertOptions
impl RefUnwindSafe for ConvertOptions
impl Send for ConvertOptions
impl Sync for ConvertOptions
impl Unpin for ConvertOptions
impl UnsafeUnpin for ConvertOptions
impl UnwindSafe for ConvertOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 more