简体   繁体   中英

scikit-image read 8-bit image as 16-bit

I am using both ImageJ and scikit-image to analyze 3D images. My original image is 16-bit and it is very big. I converted 16-bit image to 8-bit image in imageJ so that I can work easily.
Now when I am reading the image with scikit-image module both 16-bit and 8-bit image showing 16-bit only. Can anyone suggest how to read images as 8-bit in scikit-image module?

from skimage import io,color
image = io.imread(files)

You can perform the conversion through integer division ( // ) or bitwise right shift ( >> ) followed by type casting.

image = np.uint8(io.imread('Image8bit.tif') >> 8)

or

image = np.uint8(io.imread('Image8bit.tif') // 2**8)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM