Skip to main content

ImageOps

Trait ImageOps 

Source
pub trait ImageOps {
    // Required methods
    fn apply_conv2d(
        &self,
        kernel: &[f32],
        kw: usize,
        kh: usize,
        border: BorderMode,
    ) -> Result<ImageBuf, ImageError>;
    fn blur(&self, sigma: f32) -> Result<ImageBuf, ImageError>;
    fn sobel_gradients(&self) -> Result<(ImageBuf, ImageBuf), ImageError>;
    fn canny_edges(
        &self,
        sigma: f32,
        low: f32,
        high: f32,
    ) -> Result<ImageBuf, ImageError>;
    fn apply_dilate(
        &self,
        se: &[f32],
        sw: usize,
        sh: usize,
    ) -> Result<ImageBuf, ImageError>;
    fn apply_erode(
        &self,
        se: &[f32],
        sw: usize,
        sh: usize,
    ) -> Result<ImageBuf, ImageError>;
    fn apply_resize(
        &self,
        new_w: usize,
        new_h: usize,
        interp: Interpolation,
    ) -> Result<ImageBuf, ImageError>;
    fn to_gray(&self) -> Result<ImageBuf, ImageError>;
    fn to_hsv(&self) -> Result<ImageBuf, ImageError>;
    fn compute_histogram(&self, bins: usize) -> Result<Vec<u32>, ImageError>;
    fn label_components(&self) -> Result<(Vec<u32>, u32), ImageError>;
}
Expand description

Image operations trait for ImageBuf method dispatch.

Provides a unified interface for applying image processing operations to structured ImageBuf instances with automatic dimension handling.

Required Methods§

Source

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>

Apply Gaussian blur with given sigma.

Source

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>

Apply Canny edge detection (converts multi-channel to grayscale).

Source

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>

Morphological erosion with structuring element.

Source

fn apply_resize( &self, new_w: usize, new_h: usize, interp: Interpolation, ) -> Result<ImageBuf, ImageError>

Resize image to new dimensions.

Source

fn to_gray(&self) -> Result<ImageBuf, ImageError>

Convert to grayscale.

Source

fn to_hsv(&self) -> Result<ImageBuf, ImageError>

Convert RGB to HSV color space.

Source

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>

Label connected components in binary image.

Implementors§