Convert Color
- tomni.convert_color.convert_color(img: numpy.ndarray, new_color: Union[str, int]) numpy.ndarray [source]
Convert the color format of an image to the desired color space (GRAY, BGR, or BGRA).
- Parameters
img (np.ndarray) – The image to be converted. Supported color spaces: GRAY (1), BGR (3), and BGRA (4).
new_color (Union[str, int]) – The desired color space for the converted image.
- Raises
ValueError – If new_color is not supported.
ValueError – If the input image has an unsupported number of dimensions.
ValueError – If the input image has an unsupported number of color channels.
- Returns
The converted image.
- Return type
np.ndarray
Note
Supported values:
‘GRAY’/’GREY’
‘BGR’/’COLOR’/’COLOUR’
‘BGRA’/’TRANSPARENT’