Skip to content

Instantly share code, notes, and snippets.

Created December 24, 2021 12:14
What would you like to do?
16bit grayscale to separate 8 bit color channels
import numpy as np, cv2
src = cv2.imread("moon-elevation-8k-16bit.tif",cv2.IMREAD_UNCHANGED)
h,w = src.shape
dst = np.zeros((h,w,3), np.uint8)
dst[:,:,1] = (src & 0xff00) >> 8
dst[:,:,2] = src & 0x00ff
Copy link

Screenshot 2021-12-24 at 13 24 56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment