plt.imshow shows color images for grayscale images in IPython

imRGB was a 3D matrix (height x width x 3).
Now imGray is a 2D matrix in which there are no colors, only a “luminosity” value.
So matplotlib applied a colormap by default.

Read this page and try to apply a grayscale colormap or a different colormap, check the results.

plt.imshow(imGray, cmap="gray")

Use this page as reference for colormaps. Some colormap could not work, if it occurs try another colormap.

Leave a Comment