将图像转换为灰度python

2024-09-30 08:27:59 发布

您现在位置:Python中文网/ 问答频道 /正文

有人能帮我把代码转换成平均法或加权法的灰度值吗

import matplotlib.pyplot
import numpy


myImage = matplotlib.pyplot.imread('flower.png')

height=myImage.shape[0]
width=myImage.shape[1]

for x in range(0, height-1):
    for y in range(0,width-1):

      INSET CODE HERE


imgplot = matplotlib.pyplot.imshow(myImage)
matplotlib.pyplot.show()

Tags: 代码inimportnumpyformatplotlibrangewidth

热门问题