What does matplotlib `imshow(interpolation='nearest')` do?

前端 未结 1 1770
庸人自扰
庸人自扰 2021-02-13 13:01

I use imshow function with interpolation=\'nearest\' on a grayscale image and get a nice color picture as a result, looks like it does some sort of col

相关标签:
1条回答
  • 2021-02-13 13:54

    interpolation='nearest' simply displays an image without trying to interpolate between pixels if the display resolution is not the same as the image resolution (which is most often the case). It will result an image in which pixels are displayed as a square of multiple pixels.

    There is no relation between interpolation='nearest' and the grayscale image being displayed in color. By default imshow uses the jet colormap to display an image. If you want it to be displayed in greyscale, call the gray() method to select the gray colormap.

    0 讨论(0)
提交回复
热议问题