阅读背景:

如何使用matplotlib / numpy将数组保存为灰度图像?

来源:互联网 

I am trying to save a numpy array of dimensions 128x128 pixels into a grayscale image. I simply thought that the pyplot.imsave function would do the job but it's not, it somehow converts my array into an RGB image. I tried to force the colormap to Gray during conversion but eventhough the saved image appears in grayscale, it still has a 128x128x4 dimension. Here is a code sample I wrote to show the behaviour :I am trying to save a numpy array of dimensions




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: