image_utils
anomaly_match.image_processing.image_utils
¶
Shared image conversion utilities.
ensure_uint8_hwc(image)
¶
Convert an image array to uint8 HWC format.
Handles CHW-to-HWC transposition and float-to-uint8 conversion using skimage for consistency across the codebase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
ndarray
|
Input image array (CHW or HWC, any numeric dtype). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
uint8 HWC numpy array. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If image is empty or has fewer than 2 dimensions. |