Module image_preprocessing

Module image_preprocessing 

Source
Expand description

Image Preprocessing for Computer Vision Applications

This module provides comprehensive image preprocessing utilities for computer vision and machine learning tasks, including normalization, data augmentation, color space transformations, and feature extraction.

§Features

  • Image normalization and standardization
  • Data augmentation techniques (rotation, scaling, flipping, cropping)
  • Color space transformations (RGB, HSV, LAB, grayscale)
  • Image resizing and cropping
  • Edge detection and feature extraction
  • Batch image processing with parallel support

§Examples

use sklears_preprocessing::image_preprocessing::{
    ImageNormalizer, ImageAugmenter, ColorSpaceTransformer
};
use scirs2_core::ndarray::Array3;

fn example() -> Result<(), Box<dyn std::error::Error>> {
    // Normalize image pixel values to [0, 1] range
    let normalizer = ImageNormalizer::new()
        .with_range((0.0, 1.0))
        .with_channel_wise(true);

    let image = Array3::<f64>::zeros((224, 224, 3)); // RGB image
    let normalized = normalizer.transform(&image)?;

    // Apply data augmentation
    let augmenter = ImageAugmenter::new()
        .with_rotation_range((-15.0, 15.0))
        .with_zoom_range((0.9, 1.1))
        .with_horizontal_flip(true);

    let augmented = augmenter.transform(&normalized)?;

    // Convert color space
    let color_transformer = ColorSpaceTransformer::new()
        .from_rgb()
        .to_hsv();

    let hsv_image = color_transformer.transform(&augmented)?;

    Ok(())
}

Structs§

ColorSpaceTransformer
Color space transformer
EdgeDetector
Edge detector for feature extraction
ImageAugmenter
Image augmenter for data augmentation
ImageAugmenterConfig
Configuration for image augmentation
ImageFeatureExtractor
Basic feature extractor for images
ImageNormalizer
Image normalizer for preprocessing image data
ImageNormalizerConfig
Configuration for image normalization
ImageNormalizerFitted
Fitted state for image normalizer
ImageResizer
Image resizer for changing image dimensions

Enums§

ColorSpace
Color space types for image transformations
EdgeDetectionMethod
Edge detection methods
ImageNormalizationStrategy
Image normalization strategies
InterpolationMethod
Image resizing interpolation methods