I use OpenCV 2 to process some images in the YCbCr color space. At the moment, I can detect some noise due to the conversion of RGB → YCbCr and then YCbCr → RGB, but as the documentation says :
If you use cvtColor with 8-bit images, the conversion will be lost. For many applications, this will not be noticeable, but it is recommended to use 32-bit images in applications that require a full range of colors, or convert the image before the operation, and then convert it back.
So, I would like to convert my image to 16 or 32 bits, but I did not find how to do this with NumPy. Some ideas?
img = cv2.imread(imgNameIn)
cv2.cvtColor(img, cv2.COLOR_BGR2YCR_CB, img)
cv2.cvtColor(img, cv2.COLOR_YCR_CB2BGR, img)
cv2.imwrite(imgNameOut, img, [cv2.cv.CV_IMWRITE_PNG_COMPRESSION, 0])
source
share