How to show numpy NxM array with dtype=float as plain gray scale image?

后端 未结 2 1685
孤街浪徒
孤街浪徒 2021-01-27 14:06

When creating an numpy array with dtype=float, the the presentation method using matplotlib.pyplot.imshow appears to be dependent on the v

2条回答
  •  礼貌的吻别
    2021-01-27 14:10

    Found out that imshow does normalize by default, so to avoid this, the vmin and vmax must be given to imshow, which is then:

    plt.imshow(img, cmap='gray', vmin=0, vmax=1)
    

提交回复
热议问题