Skip to main content

Crate trueno_image

Crate trueno_image 

Source
Expand description

GPU image processing primitives.

§Contract: image-conv2d-v1.yaml

Provides convolution, Gaussian blur, Sobel edge detection, and Canny edge detection with provable properties.

§Example

use trueno_image::{conv2d, BorderMode};

// Identity convolution (delta kernel)
let image = vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0_f32];
let delta = [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0_f32];
let out = conv2d(&image, 3, 3, &delta, 3, 3, BorderMode::Zero).unwrap();
assert!((out[4] - 5.0).abs() < 1e-6); // Center pixel preserved

Structs§

ImageBuf
Structured image buffer with metadata.

Enums§

BorderMode
Border handling mode for convolution.
DType
Pixel data type.
ImageError
Errors from image operations.
Interpolation
Interpolation method for resize.

Traits§

ImageOps
Image operations trait for ImageBuf method dispatch.

Functions§

canny
Canny edge detection.
canny_rgb
Multi-channel Canny edge detection (NPP 3-channel parity).
closing
Morphological closing: dilate then erode.
connected_components
Connected component labeling using union-find (4-connectivity).
conv2d
2D convolution with same-padding.
cumulative_histogram
Compute cumulative histogram (CDF).
dilate
Dilate: output pixel = max of neighborhood defined by structuring element.
equalize
Histogram equalization: remap image to uniform histogram.
erode
Erode: output pixel = min of neighborhood defined by structuring element.
gaussian_blur
Gaussian blur using separable convolution.
gradient_magnitude
Gradient magnitude from Sobel output.
histogram
Compute histogram of a grayscale image with values in [0, 1].
hsv_to_rgb
Convert HSV to RGB color space.
opening
Morphological opening: erode then dilate.
resize
Resize a grayscale image.
rgb_to_gray
Convert RGB image to grayscale using ITU-R BT.601 weights.
rgb_to_hsv
Convert RGB to HSV color space.
separable_conv2d
Separable 2D convolution: apply horizontal then vertical 1D kernels.
sobel
Sobel edge detection: returns (gradient_x, gradient_y).