1.PIL
from Import = Image.open ("filename"
Support single channel and multi-channel Uint8 TIFF image reading, read single channel Uint16 TIFF image to Uint8 processing, direct read Uint16 TIFF multi-Channel image error, error message:
2.OpenCV
Import Cv2cv2.imread ("filename", Flags)
There are four options for Cv2,imread's flags on the number of channels and bit depths:
imread_unchanged = 1# does not convert, such as saving for 16 bits of the picture, read out is still 16 bits. Imread_grayscale = 0# is converted to grayscale, such as a picture saved for 16 bits, read out as 8 bits, and type CV_8UC1. Imread_color = 1# converted to RGB three-channel image, image depth to 8-bit imread_anydepth = 2# Keep image depth unchanged, convert to grayscale. Imread_anycolor = 4# If the number of image channels is less than or equal to 3, the number of original channels remains unchanged, and if the number of channels is greater than 3, only the first three channels are taken. Image depth converted to 8-bit
For multi-channel TIFF images, to ensure proper reading of image data, it is obvious to choose imread_unchanged as the Flags setting value for Imread.
* Not to Be continued
Python reads TIFF multi-channel images