pub struct PixelImage<'a> { /* private fields */ }Expand description
A borrowed pixel view with an explicit source format and row stride.
Implementations§
Source§impl<'a> PixelImage<'a>
impl<'a> PixelImage<'a>
Sourcepub fn new(
data: &'a [u8],
size: (usize, usize),
format: PixelFormat,
) -> Result<Self>
pub fn new( data: &'a [u8], size: (usize, usize), format: PixelFormat, ) -> Result<Self>
Borrows packed pixels and checks that the buffer matches the declared size.
Sourcepub fn with_stride(
data: &'a [u8],
size: (usize, usize),
stride: usize,
format: PixelFormat,
) -> Result<Self>
pub fn with_stride( data: &'a [u8], size: (usize, usize), stride: usize, format: PixelFormat, ) -> Result<Self>
Accepts initialized logical rows, including optional padding between rows.
Sourcepub fn roi(self, origin: (usize, usize), size: (usize, usize)) -> Result<Self>
pub fn roi(self, origin: (usize, usize), size: (usize, usize)) -> Result<Self>
Narrows the view to a checked sub-rectangle.
Sourcepub fn to_mat(self, destination: PixelFormat) -> Result<Mat>
pub fn to_mat(self, destination: PixelFormat) -> Result<Mat>
Converts the view into an owned tensor without resizing.
Sourcepub fn resize_to_mat(
self,
destination: PixelFormat,
target: (usize, usize),
) -> Result<Mat>
pub fn resize_to_mat( self, destination: PixelFormat, target: (usize, usize), ) -> Result<Mat>
Converts the view and resizes it to the requested target size.
Trait Implementations§
Source§impl<'a> Clone for PixelImage<'a>
impl<'a> Clone for PixelImage<'a>
impl<'a> Copy for PixelImage<'a>
Auto Trait Implementations§
impl<'a> Freeze for PixelImage<'a>
impl<'a> RefUnwindSafe for PixelImage<'a>
impl<'a> Send for PixelImage<'a>
impl<'a> Sync for PixelImage<'a>
impl<'a> Unpin for PixelImage<'a>
impl<'a> UnsafeUnpin for PixelImage<'a>
impl<'a> UnwindSafe for PixelImage<'a>
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