When enlarging or shrinking with the cv2.resize function, 16-bit grayscale images are increased to 24 bits. Is there a way to resize them without changing the depth?
img=cv2.imread("16bitgray.tiff")
img512 = cv2.resize(img, (512,512), interpolation=cv2.INTER_NEAREST)
If you read a 16-bit greyscale TIFF with:
img=cv2.imread("16bitgray.tiff")
you'll get an RGB888 TIFF because that is the default. You need:
img=cv2.imread("16bitgray.tiff", cv2.IMREAD_UNCHANGED)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.