Python PIL和matplotlob以不同方式显示同一数组

Python PIL和matplotlob以不同方式显示同一数组,python,matplotlib,python-imaging-library,Python,Matplotlib,Python Imaging Library,我有一个数组,它的像素值从0到255。数据类型为uint8。matplotlib生成一些像素失真的图像,在本例中,它位于白色球的右侧。虽然我尝试了不同的数据类型,但在这里我无法解决这个问题。有什么建议吗 frame = np.array(read_image[case,time,:,:],dtype=np.uint8) #Plotting with PIL im = Image.fromarray(frame) #Plotting with matplotlib plt.imshow(fr

我有一个数组,它的像素值从0到255。数据类型为uint8。matplotlib生成一些像素失真的图像,在本例中,它位于白色球的右侧。虽然我尝试了不同的数据类型,但在这里我无法解决这个问题。有什么建议吗

frame = np.array(read_image[case,time,:,:],dtype=np.uint8)

#Plotting with PIL
im = Image.fromarray(frame)


#Plotting with matplotlib
plt.imshow(frame,cmap='gray',vmin=0,vmax=255)
plt.show()
Pill生成:

Matplotlib生成:


也许值得尝试一种不同的插值方案我会的,谢谢。也许值得尝试一种不同的插值方案我会的,谢谢。