Convert RGB image to YUV and YCbCr color space image in Opencv Python
问题 Can anyone help me to convert an RGB colour space image to YUV colour space image and to YCbCr colour space image using opencv Python? 回答1: Use cv2.cvtColor(src, code) to convert Color-Space, the code starts with COLOR_ . You can use this to look for the color code. import cv2 ## get all color codes codes = [x for x in dir(cv2) if x.startswith("COLOR_")] ## print first three color codes print(codes[:3]) # ['COLOR_BAYER_BG2BGR', 'COLOR_BAYER_BG2BGRA', 'COLOR_BAYER_BG2BGR_EA'] ## print all