-2

Can anyone help with the code to go after for loop to convert to grayscale either by average method or weighted method

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()
beaker
  • 15,642
  • 3
  • 29
  • 46

1 Answers1

0

There's already been a post about this - you can either use PIL easily or create it yourself with Numpy and Matplotlib.

Dharman
  • 26,923
  • 21
  • 73
  • 125
Shufi123
  • 221
  • 3
  • 10