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]
When I read it using skimage
and output it using matplotlib
. The output image looks like a RGB image.
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()
However, when I read the image using matplotlib
instead, output=plt.imread(os.path.join(image_path,raw_image_name))
. I found that pixel value will become 255 and 0. The output image will become black as shown in the second image. I am confused how does this work? My guess is that there are some dtype change happening during the reading process.