Skip to main content

Module image

Module image 

Source
Expand description

Utility functions for image processing.

This module provides functions for loading, converting, and manipulating images in the OCR pipeline. It includes functions for converting between different image formats, loading single or batch images from files, creating images from raw data, and resize-and-pad operations.

Structs§

OCRResizePadConfig
Configuration for OCR-style resize-and-pad operations with width constraints.
ResizePadConfig
Configuration for resize-and-pad operations.

Enums§

PaddingStrategy
Padding strategy for resize-and-pad operations.

Functions§

calculate_center_crop_coords
Calculates centered crop coordinates for a target size.
check_image_size
Checks if the given image size is valid (non-zero dimensions).
create_rgb_image
Creates an RgbImage from raw pixel data.
dynamic_to_gray
Converts a DynamicImage to a GrayImage.
dynamic_to_rgb
Converts a DynamicImage to an RgbImage.
load_image
Loads an image from a file path and converts it to RgbImage.
load_image_from_memory
Loads an image from the given bytes and converts it to RgbImage.
load_images
Loads a batch of images from file paths.
load_images_batch_with_policy
Load multiple images from file paths using centralized parallel policy.
load_images_batch_with_threshold
Loads a batch of images from file paths with a custom parallel threshold.
mask_region
Masks a rectangular region in an RGB image with a solid color.
mask_regions
Masks multiple bounding box regions in an RGB image.
ocr_resize_and_pad
Resize an image for OCR processing with width constraints and padding.
pad_image
Pads an image to the specified dimensions with a fill color.
resize_and_pad
Resize an image to fit within target dimensions while maintaining aspect ratio, then pad to exact target dimensions.
resize_gray_image
Resizes a grayscale image to the target dimensions using Lanczos3 filtering.
resize_image
Resizes an RGB image to the target dimensions using Lanczos3 filtering.
resize_images_batch
Resizes a batch of images to the specified dimensions.
resize_images_batch_to_dynamic
Resizes a batch of images and converts them to DynamicImage format.
rgb_to_grayscale
Converts an RGB image to grayscale.
slice_gray_image
Extracts a rectangular region from a grayscale image.
slice_image
Extracts a rectangular region from an RGB image.
validate_crop_bounds
Validates that crop coordinates stay within image bounds.