Realm

oa::Image

Dense pixels with explicit axis-order and channel-order semantics. Image composes a Matrix instead of erasing its numeric dtype and storage behavior. Construction validates all metadata once; the matrix is thereafter exposed immutably so the image contract cannot be invalidated.

StRust public API

Declaration

pub struct Image { /* private fields */ }
Public Rust declaration.

Public Methods

pub const fn as_matrix(&self) -> &Matrix
pub fn into_matrix(self) -> Matrix
pub fn width(&self) -> usize
pub fn height(&self) -> usize
pub const fn channels(&self) -> usize
pub fn batch_size(&self) -> usize
pub const fn layout(&self) -> ImageLayout
pub const fn format(&self) -> ImageFormat
pub const fn dtype(&self) -> DType
pub fn resize( &self, target_width: u32, target_height: u32, interpolation: InterpolationMode, ) -> Result<Self>
pub fn crop(&self, x: u32, y: u32, width: u32, height: u32) -> Result<Self>
pub fn flip(&self, horizontal: bool, vertical: bool) -> Result<Self>
pub fn rotate(&self, degrees: u32) -> Result<Self>
pub fn pad( &self, left: u32, right: u32, top: u32, bottom: u32, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn center_crop(&self, width: u32, height: u32) -> Result<Self>
pub fn remap( &self, map: &Matrix, interpolation: InterpolationMode, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn warp_affine( &self, transform: &Matrix, width: u32, height: u32, interpolation: InterpolationMode, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn warp_perspective( &self, transform: &Matrix, width: u32, height: u32, interpolation: InterpolationMode, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn threshold_binary(&self, threshold: f32, max_value: f32) -> Result<Self>
pub fn threshold_binary_inv( &self, threshold: f32, max_value: f32, ) -> Result<Self>
pub fn threshold_truncate(&self, threshold: f32) -> Result<Self>
pub fn threshold_to_zero(&self, threshold: f32) -> Result<Self>
pub fn threshold_to_zero_inv(&self, threshold: f32) -> Result<Self>
pub fn in_range(&self, low: f32, high: f32, true_value: f32) -> Result<Self>
pub fn clamp(&self, low: f32, high: f32) -> Result<Self>
pub fn invert(&self, max_value: f32) -> Result<Self>
pub fn brightness_contrast( &self, brightness: f32, contrast: f32, ) -> Result<Self>
pub fn gamma_contrast(&self, gamma: f32, gain: f32) -> Result<Self>
pub fn solarize(&self, threshold: f32, max_value: f32) -> Result<Self>
pub fn posterize(&self, levels: u32, low: f32, high: f32) -> Result<Self>
pub fn grayscale(&self) -> Result<Self>
pub fn alpha_blend(&self, right: &Image, alpha: f32) -> Result<Self>
pub fn composite(&self, right: &Image, mask: &Image) -> Result<Self>
pub fn erase( &self, x: u32, y: u32, width: u32, height: u32, value: f32, ) -> Result<Self>
pub fn color_twist(&self, transform: &Matrix) -> Result<Self>
pub fn channel_reorder( &self, order: [u32; 4], output_format: ImageFormat, ) -> Result<Self>
pub fn gaussian_noise(&self, mean: f32, stddev: f32, seed: u64) -> Result<Self>
pub fn salt_pepper_noise( &self, probability: f32, salt_value: f32, pepper_value: f32, seed: u64, ) -> Result<Self>
pub fn convolve_2d( &self, kernel: &Matrix, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn separable_convolve_2d( &self, kernel_x: &Matrix, kernel_y: &Matrix, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn average_blur( &self, width: u32, height: u32, border: BorderMode, ) -> Result<Self>
pub fn sobel(&self, dx: u32, dy: u32, border: BorderMode) -> Result<Self>
pub fn scharr(&self, dx: u32, dy: u32, border: BorderMode) -> Result<Self>
pub fn laplacian(&self, border: BorderMode) -> Result<Self>
pub fn erode( &self, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn dilate( &self, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn morphology_open( &self, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn morphology_close( &self, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn morphology_gradient( &self, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn gaussian_blur(&self, sigma: f32, kernel_size: u32) -> Result<Self>
pub fn sharpen(&self, amount: f32, border: BorderMode) -> Result<Self>
pub fn median_blur(&self, kernel_size: u32, border: BorderMode) -> Result<Self>
pub fn bilateral_filter( &self, kernel_size: u32, sigma_color: f32, sigma_space: f32, border: BorderMode, ) -> Result<Self>
pub fn unsharp_mask( &self, sigma: f32, amount: f32, kernel_size: u32, ) -> Result<Self>
pub fn morphology_top_hat( &self, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn morphology_black_hat( &self, width: u32, height: u32, border: BorderMode, border_value: f32, ) -> Result<Self>
pub fn adaptive_threshold_mean( &self, kernel_size: u32, c: f32, max_value: f32, border: BorderMode, ) -> Result<Self>
pub fn adaptive_threshold_gaussian( &self, kernel_size: u32, c: f32, max_value: f32, sigma: f32, border: BorderMode, ) -> Result<Self>
pub fn normalize(&self, parameters: NormalizationConfig) -> Result<Self>
pub fn convert_color(&self, destination_format: ImageFormat) -> Result<Self>
pub fn resize_normalize( &self, width: u32, height: u32, parameters: NormalizationConfig, ) -> Result<Self>
pub fn segmentation_overlay( &self, mask: &Matrix, palette: &Matrix, alpha: f32, ) -> Result<Self>
fn clone(&self) -> Image

Associated Functions

pub fn new( data: Matrix, layout: ImageLayout, format: ImageFormat, ) -> Result<Self>

Public Method Documentation

pub const fn as_matrix( &self ) -> &Matrix
No public source comment is attached to this declaration.
pub fn into_matrix( self ) -> Matrix
No public source comment is attached to this declaration.
pub fn width( &self ) -> usize
No public source comment is attached to this declaration.
pub fn height( &self ) -> usize
No public source comment is attached to this declaration.
pub const fn channels( &self ) -> usize
No public source comment is attached to this declaration.
pub fn batch_size( &self ) -> usize
No public source comment is attached to this declaration.
pub const fn layout( &self ) -> ImageLayout
No public source comment is attached to this declaration.
pub const fn format( &self ) -> ImageFormat
No public source comment is attached to this declaration.
pub const fn dtype( &self ) -> DType
No public source comment is attached to this declaration.
pub fn resize( &self, target_width: u32, target_height: u32, interpolation: InterpolationMode ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn crop( &self, x: u32, y: u32, width: u32, height: u32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn flip( &self, horizontal: bool, vertical: bool ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn rotate( &self, degrees: u32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn pad( &self, left: u32, right: u32, top: u32, bottom: u32, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn center_crop( &self, width: u32, height: u32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn remap( &self, map: &Matrix, interpolation: InterpolationMode, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn warp_affine( &self, transform: &Matrix, width: u32, height: u32, interpolation: InterpolationMode, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn warp_perspective( &self, transform: &Matrix, width: u32, height: u32, interpolation: InterpolationMode, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn threshold_binary( &self, threshold: f32, max_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn threshold_binary_inv( &self, threshold: f32, max_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn threshold_truncate( &self, threshold: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn threshold_to_zero( &self, threshold: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn threshold_to_zero_inv( &self, threshold: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn in_range( &self, low: f32, high: f32, true_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn clamp( &self, low: f32, high: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn invert( &self, max_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn brightness_contrast( &self, brightness: f32, contrast: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn gamma_contrast( &self, gamma: f32, gain: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn solarize( &self, threshold: f32, max_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn posterize( &self, levels: u32, low: f32, high: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn grayscale( &self ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn alpha_blend( &self, right: &Image, alpha: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn composite( &self, right: &Image, mask: &Image ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn erase( &self, x: u32, y: u32, width: u32, height: u32, value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn color_twist( &self, transform: &Matrix ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn channel_reorder( &self, order: [u32; 4], output_format: ImageFormat ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn gaussian_noise( &self, mean: f32, stddev: f32, seed: u64 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn salt_pepper_noise( &self, probability: f32, salt_value: f32, pepper_value: f32, seed: u64 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn convolve_2d( &self, kernel: &Matrix, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn separable_convolve_2d( &self, kernel_x: &Matrix, kernel_y: &Matrix, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn average_blur( &self, width: u32, height: u32, border: BorderMode ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn sobel( &self, dx: u32, dy: u32, border: BorderMode ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn scharr( &self, dx: u32, dy: u32, border: BorderMode ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn laplacian( &self, border: BorderMode ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn erode( &self, width: u32, height: u32, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn dilate( &self, width: u32, height: u32, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn morphology_open( &self, width: u32, height: u32, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn morphology_close( &self, width: u32, height: u32, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn morphology_gradient( &self, width: u32, height: u32, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn gaussian_blur( &self, sigma: f32, kernel_size: u32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn sharpen( &self, amount: f32, border: BorderMode ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn median_blur( &self, kernel_size: u32, border: BorderMode ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn bilateral_filter( &self, kernel_size: u32, sigma_color: f32, sigma_space: f32, border: BorderMode ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn unsharp_mask( &self, sigma: f32, amount: f32, kernel_size: u32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn morphology_top_hat( &self, width: u32, height: u32, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn morphology_black_hat( &self, width: u32, height: u32, border: BorderMode, border_value: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn adaptive_threshold_mean( &self, kernel_size: u32, c: f32, max_value: f32, border: BorderMode ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn adaptive_threshold_gaussian( &self, kernel_size: u32, c: f32, max_value: f32, sigma: f32, border: BorderMode ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn normalize( &self, parameters: NormalizationConfig ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn convert_color( &self, destination_format: ImageFormat ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn resize_normalize( &self, width: u32, height: u32, parameters: NormalizationConfig ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn segmentation_overlay( &self, mask: &Matrix, palette: &Matrix, alpha: f32 ) -> Result<Self>
No public source comment is attached to this declaration.
fn clone( &self ) -> Image
No public source comment is attached to this declaration.
pub fn new( data: Matrix, layout: ImageLayout, format: ImageFormat ) -> Result<Self>
No public source comment is attached to this declaration.