mmcv.image.bgr2ycbcr¶
- mmcv.image.bgr2ycbcr(img: numpy.ndarray, y_only: bool = False) → numpy.ndarray[source]¶
Convert a BGR image to YCbCr image.
The bgr version of rgb2ycbcr. It implements the ITU-R BT.601 conversion for standard-definition television. See more details in https://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.601_conversion.
It differs from a similar function in cv2.cvtColor: BGR <-> YCrCb. In OpenCV, it implements a JPEG conversion. See more details in https://en.wikipedia.org/wiki/YCbCr#JPEG_conversion.
- Parameters
img (ndarray) – The input image. It accepts: 1. np.uint8 type with range [0, 255]; 2. np.float32 type with range [0, 1].
y_only (bool) – Whether to only return Y channel. Default: False.
- Returns
The converted YCbCr image. The output image has the same type and range as input image.
- Return type
ndarray