-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
  • 16,331
  • 3
  • 32
  • 49

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
  • 30,962
  • 25
  • 85
  • 135
Shufi123
  • 233
  • 3
  • 11