📌  相关文章
📜  program phyton pour realiser un program qui transforme une image en niveau de gris - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:36.178000             🧑  作者: Mango

代码示例1
from matplotlib import pyplot as plt
import matplotlib.image as mpimg

img = mpimg.imread('test.jpg')

R, G, B = img[:,:,0], img[:,:,1], img[:,:,2]
imgGray = 0.2989 * R + 0.5870 * G + 0.1140 * B
plt.imshow(imgGray, cmap='gray')
plt.show()