Dear All,

I have a tif images, its type is float32, shape is (128*128) (a grayscale image). All the pixel values are of range [0.0, 1.0]

 I am trying to read it using skimage and show it on screen using matplotlib

from skimage import io
import matplotlib.pyplot as plt
output=io.imread(os.path.join(image_path,raw_image_name))
print(output.dtype)
print(output.shape)
print(output.max())
print(output.min())
plt.imshow(output)
plt.show()

The output image looks like color image instead of gray image as shown originally. I attached the screenshot as the capture-1.jpg.

However, when I read the image using matplotlib instead,i.e.,  output=plt.imread(os.path.join(image_path,raw_image_name)). I found that pixel value will become 255 and 0. The dtype is still float32. But when I print output, the pixel values are either 0. or 255.

The output image will become black as shown in the second image (capture-2.jpg). I am confused how does this work? My guess is that there are some dtype changes happening during the reading image and showing image, 


Thanks,

Yuanyuan