imcvtcolor
imcvtcolor(img: np.ndarray, cvt_mode: Union[int, str]) -> np.ndarray
-
Description: Perform color space conversion on the input image.
-
Parameters:
- img (
np.ndarray
): Input image to be converted. - cvt_mode (
Union[int, str]
): Color conversion mode. It can be an integer constant representing the conversion code, or a string representing the OpenCV color conversion name. For example,BGR2GRAY
is used to convert a BGR image to grayscale. For available parameters, please refer directly to OpenCV COLOR.
- img (
-
Returns:
- np.ndarray: Image with the desired color space.
-
Example:
import docsaidkit as D
img = D.imread('lena.png')
ycrcb_img = D.imcvtcolor(img, 'BGR2YCrCb')import docsaidkit as D
img = D.imread('lena.png')
ycrcb_img = D.imcvtcolor(img, 'BGR2YCrCb')