I have some rgb images and I want to change them to gray. I used skimage.color.rgb2gay function. my color images have values between 0 and 255 but after changing them to gray the value are between 0 and 1 and it seems they normalize. could you please tell me what is the problem? the input image's type is uint8
and I expect the gray image has unit8
type not float64
! this is the code I used.
import numpy as np
import matplotlib.pyplot as plt
from skimage import data
from skimage.color import rgb2gray
original = data.astronaut()
grayscale1 = rgb2gray(original)
fig, axes = plt.subplots(1, 2, figsize=(8, 4))
ax = axes.ravel()
ax[0].imshow(original)
ax[0].set_title("Original")
ax[1].imshow(grayscale1, cmap=plt.cm.gray)
ax[1].set_title("Grayscale")
fig.tight_layout()
plt.show()