I just started learning image processing and I was trying to read a RGB image then convert it to grayscale. I was hoping for something like this:
However, what I get was:
I tried using both scipy and PIL but they yield the same results. Am I lacking of understanding about grayscale image here?
from scipy import misc car = misc.imread('image.jpg', mode="L") plt.imshow(car)
from PIL import Image pil_im = Image.open('image.jpg') pil_imgray = pil_im.convert('LA') img = np.array(list(pil_imgray.getdata(band=0)), float) img.shape = (pil_imgray.size, pil_imgray.size) plt.imshow(img)