imcvtcolor
imcvtcolor(img: np.ndarray, cvt_mode: Union[int, str]) -> np.ndarray
-
Description: Converts the input image to a different color space.
-
Parameters
- img (
np.ndarray
): The input image to be converted. - cvt_mode (
Union[int, str]
): The color conversion mode. It can be an integer constant representing the conversion code or a string representing an OpenCV color conversion name. For example,BGR2GRAY
is used to convert a BGR image to grayscale. For available options, refer to the OpenCV COLOR documentation.
- img (
-
Returns
- np.ndarray: The image in the desired color space.
-
Example
import capybara as cb
img = cb.imread('lena.png')
ycrcb_img = cb.imcvtcolor(img, 'BGR2YCrCb')import capybara as cb
img = cb.imread('lena.png')
gray_img = cb.imcvtcolor(img, 'BGR2GRAY')