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 preservedStructs§
- Image
Buf - Structured image buffer with metadata.
Enums§
- Border
Mode - Border handling mode for convolution.
- DType
- Pixel data type.
- Image
Error - Errors from image operations.
- Interpolation
- Interpolation method for resize.
Traits§
- Image
Ops - Image operations trait for
ImageBufmethod 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).