pub struct TilingConfig {
pub tile_w: usize,
pub tile_h: usize,
pub overlap_ratio: f32,
pub pad: [u8; 4],
pub fit: Fit,
}Expand description
Static tiling configuration for one model. Independent of frame size.
Fields§
§tile_w: usizeTile width = model input width.
tile_h: usizeTile height = model input height.
overlap_ratio: f32Minimum overlap ratio between adjacent tiles, 0.0 <= r < 1.0
(default 0.2). The realized overlap is redistributed evenly and is
always >= this.
pad: [u8; 4]Letterbox pad colour (RGBA), used only when fit == Fit::Letterbox.
fit: FitHow a tile crop is fit into the model input. Defaults to
Fit::Stretch, which is identity for the full square tiles the grid
produces (crop == model input).
Implementations§
Source§impl TilingConfig
impl TilingConfig
Sourcepub fn new(tile_w: usize, tile_h: usize) -> Self
pub fn new(tile_w: usize, tile_h: usize) -> Self
Tile size = model input; deploy defaults (overlap 0.2, stretch fit,
[114,114,114,255] pad).
Sourcepub fn with_overlap(self, overlap_ratio: f32) -> Self
pub fn with_overlap(self, overlap_ratio: f32) -> Self
Set the minimum overlap ratio (builder).
Sourcepub fn with_fit(self, fit: Fit) -> Self
pub fn with_fit(self, fit: Fit) -> Self
Set the fit mode (builder). When switching to Fit::Letterbox, also
copies that variant’s pad into Self::pad so the two stay in sync.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate the config: overlap_ratio in [0.0, 1.0) and non-zero tile
size. Called by every tiling method, and exposed so callers (e.g. the
language bindings) can reject bad input before generating a grid.
§Errors
Returns Error::CropInvalid if the overlap is out of range or a tile
dimension is zero.
Trait Implementations§
Source§impl Clone for TilingConfig
impl Clone for TilingConfig
Source§fn clone(&self) -> TilingConfig
fn clone(&self) -> TilingConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TilingConfig
Source§impl Debug for TilingConfig
impl Debug for TilingConfig
Source§impl PartialEq for TilingConfig
impl PartialEq for TilingConfig
impl StructuralPartialEq for TilingConfig
Auto Trait Implementations§
impl Freeze for TilingConfig
impl RefUnwindSafe for TilingConfig
impl Send for TilingConfig
impl Sync for TilingConfig
impl Unpin for TilingConfig
impl UnsafeUnpin for TilingConfig
impl UnwindSafe for TilingConfig
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
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>
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>
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