dataeval.utils.preprocessing

Utility functions for preprocessing images and bounding boxes.

Classes

BoundingBox

A bounding box representation that supports multiple coordinate formats.

BoundingBoxFormat

Supported bounding box coordinate formats.

Functions

clip_and_pad(image, box)

Extract a region from an image based on a bounding box.

edge_filter(image[, offset])

Return the image filtered using a 3x3 edge detection kernel.

get_bitdepth(image)

Approximates the bit depth of the image using the min and max pixel values.

normalize_image_shape(image)

Normalize the image shape into (C,H,W) format.

rescale(image[, depth])

Rescales the image using the bit depth provided.

resize(image, resize_dim[, use_pil])

Resizes a grayscale (HxW) 8-bit image using PIL or scipy.ndimage.zoom.

to_canonical_grayscale(image)

Convert an image of arbitrary channels (CHW) to a single-channel uint8 grayscale image (HW).