[英]scikit-image read 8-bit image as 16-bit
I am using both ImageJ and scikit-image to analyze 3D images. 我同时使用ImageJ和scikit-image分析3D图像。 My original image is 16-bit and it is very big.
我的原始图像是16位的,非常大。 I converted 16-bit image to 8-bit image in imageJ so that I can work easily.
我在imageJ中将16位图像转换为8位图像,这样我就可以轻松工作。
Now when I am reading the image with scikit-image module both 16-bit and 8-bit image showing 16-bit only. 现在,当我使用scikit-image模块读取图像时,16位和8位图像都只显示16位。 Can anyone suggest how to read images as 8-bit in scikit-image module?
谁能建议如何在scikit-image模块中将图像读取为8位?
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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.