16

我在灰度图像上使用imshow函数interpolation='nearest'并得到一张漂亮的彩色图片,看起来它为我做了某种颜色分割,到底发生了什么?

我也想得到这样的图像处理,在 numpy 数组上有一些功能interpolate('nearest')吗?

编辑:如果我错了,请纠正我,它看起来像简单的像素聚类(集群是相应颜色图的颜色),并且“最近”这个词表示它采用最接近的颜色图颜色(可能在 RGB 空间中)到决定像素属于哪个簇。

4

1 回答 1

24

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.

于 2012-09-18T09:15:48.083 回答