pub struct ImageF32 { /* private fields */ }Expand description
HWC f32 image wrapper: (width, height, channels, Vec<f32>).
Simple f32 image wrapper (HWC layout, row-major). Zero overhead.
Implementations§
Source§impl ImageF32
impl ImageF32
Sourcepub fn new(
data: Vec<f32>,
height: usize,
width: usize,
channels: usize,
) -> Option<Self>
pub fn new( data: Vec<f32>, height: usize, width: usize, channels: usize, ) -> Option<Self>
Creates a new image from raw f32 data. Returns None if length doesn’t match.
Sourcepub fn zeros(height: usize, width: usize, channels: usize) -> Self
pub fn zeros(height: usize, width: usize, channels: usize) -> Self
Creates a zero-filled f32 image.
pub fn data(&self) -> &[f32]
pub fn data_mut(&mut self) -> &mut [f32]
pub fn height(&self) -> usize
pub fn width(&self) -> usize
pub fn channels(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn from_tensor(tensor: &Tensor) -> Option<Self>
pub fn from_tensor(tensor: &Tensor) -> Option<Self>
Convert from Tensor [H,W,C].
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ImageF32
impl RefUnwindSafe for ImageF32
impl Send for ImageF32
impl Sync for ImageF32
impl Unpin for ImageF32
impl UnsafeUnpin for ImageF32
impl UnwindSafe for ImageF32
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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