cv3.color_spaces.cvt_color
- cv3.color_spaces.cvt_color(img, code)[source]
Convert image between different color spaces.
- Parameters:
img (numpy.ndarray) – Input image.
code (int) – Color space conversion code (e.g., cv2.COLOR_RGB2BGR).
- Returns:
Image in the target color space.
- Return type:
numpy.ndarray
- Raises:
ValueError – If trying to convert a non-grayscale image to RGB/RGBA.