简体   繁体   中英

Skimage read always images as float but in my case it is not?

As far as I know, skiamge library reads images in float but for my image, it shows me in uint8 , could someone please guide me why? the code is:

import matplotlib.pyplot as plt

from skimage import io, color
from skimage.transform import rescale, resize, downscale_local_mean

img = io.imread("Medical_Imaging/circuit.tif", as_grey=True)

You can see my image here .

skimage will only return images as float if they are already float, or if it needs to convert to float to do some calculations. For example, if the image data in the file is RGB, as_gray=True will need a weighted addition of all the channels (see the rgb2gray function ), so the image will be converted to float.

In your case, the image is already a grayscale uint8 image, so skimage does no conversion.

If you do want to make sure that your image is float, pass it through skimage.util.img_as_float .

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