I'm working scientifically with images from a microscope, where each of the 3 RGB channels are encoded as uint16 (0-65536). Currently I use OpenCV2 and NumPy to work with the images, and using the flag "cv2.IMREAD_UNCHANGED" everything works fine with the reading, and I can do some work on the image and return it to uint16,
img = cv2.imread('dummy.tif',cv2.IMREAD_UNCHANGED )
#do some work here
img = img.astype(numpy.uint16)
cv2.imwrite('processed.tif',img )
However, so far I can't seem to find any way to save the processed images as 16bit RGB again. Using the cv2.imwrite command just convert the image to uint8, thus turning everything white (that is, everything is truncated to 255, the max for uint8 channels).
Any idea how to proceed?