pub struct ImageBuf { /* private fields */ }Expand description
Structured image buffer with metadata.
Stores pixels in row-major order: data[y * width * channels + x * channels + c].
Implementations§
Source§impl ImageBuf
impl ImageBuf
Sourcepub fn new(
data: Vec<f32>,
width: usize,
height: usize,
channels: usize,
) -> Result<Self, ImageError>
pub fn new( data: Vec<f32>, width: usize, height: usize, channels: usize, ) -> Result<Self, ImageError>
Create a new image buffer.
§Errors
Returns error if data length doesn’t match width * height * channels.
Trait Implementations§
Source§impl ImageOps for ImageBuf
impl ImageOps for ImageBuf
Source§fn apply_conv2d(
&self,
kernel: &[f32],
kw: usize,
kh: usize,
border: BorderMode,
) -> Result<ImageBuf, ImageError>
fn apply_conv2d( &self, kernel: &[f32], kw: usize, kh: usize, border: BorderMode, ) -> Result<ImageBuf, ImageError>
Apply 2D convolution with given kernel and border mode.
Source§fn blur(&self, sigma: f32) -> Result<ImageBuf, ImageError>
fn blur(&self, sigma: f32) -> Result<ImageBuf, ImageError>
Apply Gaussian blur with given sigma.
Source§fn sobel_gradients(&self) -> Result<(ImageBuf, ImageBuf), ImageError>
fn sobel_gradients(&self) -> Result<(ImageBuf, ImageBuf), ImageError>
Compute Sobel gradients (gx, gy).
Source§fn canny_edges(
&self,
sigma: f32,
low: f32,
high: f32,
) -> Result<ImageBuf, ImageError>
fn canny_edges( &self, sigma: f32, low: f32, high: f32, ) -> Result<ImageBuf, ImageError>
Apply Canny edge detection (converts multi-channel to grayscale).
Source§fn apply_dilate(
&self,
se: &[f32],
sw: usize,
sh: usize,
) -> Result<ImageBuf, ImageError>
fn apply_dilate( &self, se: &[f32], sw: usize, sh: usize, ) -> Result<ImageBuf, ImageError>
Morphological dilation with structuring element.
Source§fn apply_erode(
&self,
se: &[f32],
sw: usize,
sh: usize,
) -> Result<ImageBuf, ImageError>
fn apply_erode( &self, se: &[f32], sw: usize, sh: usize, ) -> Result<ImageBuf, ImageError>
Morphological erosion with structuring element.
Source§fn apply_resize(
&self,
new_w: usize,
new_h: usize,
interp: Interpolation,
) -> Result<ImageBuf, ImageError>
fn apply_resize( &self, new_w: usize, new_h: usize, interp: Interpolation, ) -> Result<ImageBuf, ImageError>
Resize image to new dimensions.
Source§fn compute_histogram(&self, bins: usize) -> Result<Vec<u32>, ImageError>
fn compute_histogram(&self, bins: usize) -> Result<Vec<u32>, ImageError>
Compute histogram with given number of bins.
Source§fn label_components(&self) -> Result<(Vec<u32>, u32), ImageError>
fn label_components(&self) -> Result<(Vec<u32>, u32), ImageError>
Label connected components in binary image.
Auto Trait Implementations§
impl Freeze for ImageBuf
impl RefUnwindSafe for ImageBuf
impl Send for ImageBuf
impl Sync for ImageBuf
impl Unpin for ImageBuf
impl UnsafeUnpin for ImageBuf
impl UnwindSafe for ImageBuf
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