oa::image
image module in the OA Vision public surface.
MdRust public API
Public Types
Public Functions
pub fn adaptive_threshold_gaussian( input: &Image, kernel_size: u32, c: f32, max_value: f32, sigma: f32, border: BorderMode, ) -> Result<Image>pub fn adaptive_threshold_mean( input: &Image, kernel_size: u32, c: f32, max_value: f32, border: BorderMode, ) -> Result<Image>pub fn bilateral_filter( input: &Image, kernel_size: u32, sigma_color: f32, sigma_space: f32, border: BorderMode, ) -> Result<Image>pub fn channel_reorder( input: &Image, order: [u32; 4], output_format: ImageFormat, ) -> Result<Image>pub fn convolve_2d( input: &Image, kernel: &Matrix, border: BorderMode, border_value: f32, ) -> Result<Image>pub fn decode_file( engine: &Engine, path: impl AsRef<Path>, format: ImageFormat, ) -> Result<Image>pub fn dilate( input: &Image, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Image>pub fn erase( input: &Image, x: u32, y: u32, width: u32, height: u32, value: f32, ) -> Result<Image>pub fn erode( input: &Image, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Image>pub fn morphology_black_hat( input: &Image, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Image>pub fn morphology_close( input: &Image, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Image>pub fn morphology_gradient( input: &Image, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Image>pub fn morphology_open( input: &Image, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Image>pub fn morphology_top_hat( input: &Image, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Image>pub fn pad( input: &Image, left: u32, right: u32, top: u32, bottom: u32, border: BorderMode, border_value: f32, ) -> Result<Image>pub fn remap( input: &Image, map: &Matrix, interpolation: InterpolationMode, border: BorderMode, border_value: f32, ) -> Result<Image>pub fn resize( input: &Image, target_width: u32, target_height: u32, interpolation: InterpolationMode, ) -> Result<Image>pub fn resize_normalize( input: &Image, width: u32, height: u32, parameters: NormalizationParams, ) -> Result<Image>pub fn salt_pepper_noise( input: &Image, probability: f32, salt_value: f32, pepper_value: f32, seed: u64, ) -> Result<Image>pub fn save_rgba_file( rgba: &[u8], width: u32, height: u32, path: impl AsRef<Path>, quality: u32, ) -> Result<()>pub fn segmentation_overlay( input: &Image, mask: &Matrix, palette: &Matrix, alpha: f32, ) -> Result<Image>pub fn separable_convolve_2d( input: &Image, kernel_x: &Matrix, kernel_y: &Matrix, border: BorderMode, border_value: f32, ) -> Result<Image>Function Documentation
Threshold against a local Gaussian-weighted mean minus c.
Threshold against the local arithmetic mean minus c.
Blend two equal semantic images using a * (1-alpha) + b * alpha.
Average an odd rectangular neighborhood up to 31×31.
Apply a bilateral neighborhood filter.
Apply value * contrast + brightness.
Return whether this build can decode codec.
Return whether this build can encode codec.
Extract a centered region with the requested exact extent.
Reorder one to four channels and explicitly assign the resulting format. order[c] selects the source channel for output channel c. The output format must have the same channel count as the input so pixel data and semantic metadata cannot diverge.
Clamp every pixel to the inclusive interval.
Apply one shared FP32 [3, 4] affine color transform to RGB channels.
Composite two equal images with a clamped Gray or per-channel mask.
Convert between three-channel RGB and BGR semantics, including identity.
Apply same-shape 2D cross-correlation with an odd FP32 kernel up to 31×31.
Extract a region, clipping its right and bottom edges to the source extent.
Decode a JPEG, PNG, WebP, BMP, or TGA file and upload normalized planar FP32 pixels. The result is one NCHW image shaped [1, channels, height, width]. This is a synchronous host codec boundary followed by device upload. Errors Returns an error for an empty path, filesystem failure, unsupported or malformed media, unsupported requested format, checked-size overflow, or device allocation/upload failure.
Decode JPEG, PNG, WebP, BMP, or TGA bytes and upload normalized planar FP32 pixels. The requested output format may be Gray, Rgb, or Rgba. The result is one NCHW image shaped [1, channels, height, width]. Errors Returns an error for empty, unsupported, or malformed media, unsupported requested format, checked-size overflow, or device allocation/upload failure.
Dilate with an odd rectangular structuring element up to 31×31.
Read normalized planar FP32 pixels and encode one still-image bitstream. quality is used by the lossy JPEG and WebP encoders and must be in [1, 100] for those codecs. This is an explicit blocking host-observation boundary. Errors Returns an error for Auto, unsupported image metadata, invalid quality, readback failure, checked-size overflow, or codec failure.
Fill the intersection of a rectangle and the image with one finite value.
Erode with an odd rectangular structuring element up to 31×31.
Flip an image horizontally, vertically, or along both axes.
Apply max(value, 0)^gamma * gain.
Apply a normalized Gaussian blur with replicate borders.
Add explicit-seed Philox Gaussian noise to every pixel.
Convert an RGB or RGBA image to Rec.709 grayscale.
Produce true_value for values inside the inclusive interval and zero outside it.
Invert every value around max_value.
Apply the four-neighbor discrete Laplacian.
Select the median of an odd square neighborhood up to 15×15.
Return the morphological closing minus the source.
Dilate and then erode with the same rectangular element.
Return dilation minus erosion.
Erode and then dilate with the same rectangular element.
Return the source minus its morphological opening.
Apply (pixel - mean[channel]) / std[channel] to up to three channels.
Add asymmetric padding with an explicit border policy.
Quantize [low, high] to levels evenly spaced values using round-half-up.
Resample an image from an FP32 absolute-coordinate map shaped [1|batch, 2, output_height, output_width].
Resize an FP32 channel-first image while preserving its layout and format. NCHW and CHW storage are supported. Nearest sampling follows the donor OA floor-coordinate rule. Bilinear sampling uses half-pixel centers with align_corners = false. The call records work asynchronously and returns an Image immediately. Reading its backing matrix is an explicit submission and observation point. Errors Returns an error for a zero target extent, an empty source extent, a dtype or layout outside the admitted checkpoint, checked-size overflow, or a runtime recording failure.
Bilinearly resize and normalize in one semantic and executable operation.
Rotate clockwise by a multiple of 90 degrees.
Replace a seeded fraction of pixels with salt or pepper values.
Encode an Image using the codec inferred from the output extension and save it. Supported extensions are .jpg, .jpeg, .png, .webp, .bmp, and .tga. This is an explicit blocking device-readback and filesystem boundary. Errors Returns an error for an empty or unsupported path, invalid image or quality, readback or encoding failure, or a host filesystem failure.
Encode and save one exact packed RGBA8 host image. This is the host sink used by render sessions after their own explicit completion and readback protocol has produced packed bytes. Errors Returns an error for an empty or unsupported path, zero or overflowing dimensions, a mismatched byte count, invalid quality, codec failure, or a host filesystem failure.
Compute one first-order Scharr derivative.
Blend a class palette over an RGB/RGBA image using an I32 label map.
Apply horizontal and vertical odd FP32 vector kernels up to length 31.
Apply a nonnegative four-neighbor sharpening amount.
Compute one first-order Sobel derivative.
Invert values at or above threshold around max_value.
Replace values above threshold with max_value and all others with zero.
Replace values at or below threshold with max_value and all others with zero.
Replace values at or below threshold with zero.
Replace values above threshold with zero.
Truncate values above threshold.
Apply an unsharp mask using a Gaussian detail estimate.
Apply an inverse FP32 2x3 affine transform to an image.
Apply an inverse FP32 3x3 perspective transform to an image.