Trait PaddingStrategy

Source
pub trait PaddingStrategy<T>
where T: Copy,
{ // Required methods fn pad( &self, image: ArrayView<'_, T, Ix3>, padding: (usize, usize), ) -> ArrayBase<OwnedRepr<T>, Ix3>; fn get_pixel( &self, image: ArrayView<'_, T, Ix3>, index: (isize, isize), ) -> Option<Array1<T>>; fn get_value( &self, image: ArrayView<'_, T, Ix3>, index: (isize, isize, usize), ) -> Option<T>; // Provided method fn will_pad(&self, _coord: Option<(isize, isize)>) -> bool { ... } }
Expand description

Defines a method for padding the data of an image applied directly to the ndarray type internally. Padding is symmetric

Required Methods§

Source

fn pad( &self, image: ArrayView<'_, T, Ix3>, padding: (usize, usize), ) -> ArrayBase<OwnedRepr<T>, Ix3>

Taking in the image data and the margin to apply to rows and columns returns a padded image

Source

fn get_pixel( &self, image: ArrayView<'_, T, Ix3>, index: (isize, isize), ) -> Option<Array1<T>>

Taking in the image data and row and column return the pixel value if the coordinates are within the image bounds this should probably not be used in the name of performance

Source

fn get_value( &self, image: ArrayView<'_, T, Ix3>, index: (isize, isize, usize), ) -> Option<T>

Gets a value for a channel rows and columns can exceed bounds but the channel index must be present

Provided Methods§

Source

fn will_pad(&self, _coord: Option<(isize, isize)>) -> bool

Returns true if the padder will return a value for (row, col) or if None if it can pad an image at all. NoPadding is a special instance which will always be false

Implementors§

Source§

impl<T> PaddingStrategy<T> for ConstantPadding<T>
where T: Copy,

Source§

impl<T> PaddingStrategy<T> for NoPadding
where T: Copy,

Source§

impl<T> PaddingStrategy<T> for ZeroPadding
where T: Copy + Zero,