我正在try 使用matplotlib.pyplot.imshow()显示灰度图像.我的问题是灰度图像显示为色彩映射表.我需要灰度,因为我想在图像上画彩色.
我读入图像并使用PIL's Image.open().convert("L")转换为灰度
image = Image.open(file).convert("L")
然后我把图像转换成矩阵,这样我就可以用
matrix = scipy.misc.fromimage(image, 0)
然而,当我
figure()
matplotlib.pyplot.imshow(matrix)
show()
它使用彩色贴图显示图像(即,它不是灰度).
我在这里做错了什么?