from PIL import Image
import matplotlib.pyplot as plt
img = Image.open(path_img).convert('RGB') #对于单通道的图像,Image默认读取为L模式,一定要把mode为L转为RGB
plt.imshow(new_img)
plt.show()
用Image对灰度图像进行读取,并防止失真
最新推荐文章于 2024-04-29 10:58:39 发布
from PIL import Image
import matplotlib.pyplot as plt
img = Image.open(path_img).convert('RGB') #对于单通道的图像,Image默认读取为L模式,一定要把mode为L转为RGB
plt.imshow(new_img)
plt.show()