brails.utils.segmentation_utils module
This module provides utilities for visualizing segmentation results.
- brails.utils.segmentation_utils.create_overlaid_image(base_image: str | Path, mask_image: ndarray, output_dir: str | Path) None
Overlay a segmentation mask on a base image and save the result.
- Args:
- base_image (str or Path):
Path to the original image.
- mask_image (np.ndarray):
A 2D array of class labels representing the segmentation mask.
- output_dir (str or Path):
Directory where the overlaid image will be saved.
- Returns:
None
- brails.utils.segmentation_utils.decode_segmap(image: ndarray, nc: int = 5) ndarray
Convert a class-labeled mask image to an RGB image using a color map.
- Args:
- image (np.ndarray):
2D array of class indices.
- nc (int):
Number of classes. Default is 5.
- Returns:
- np.ndarray:
RGB image (H, W, 3) representation of the mask.