title: How to calculate the average grayscale profile of an image?
body: <p>I would like to calculate the average grayscale profile of an image. 
  In my next code I have the evolution of the grayscale of all the pixels of the image, but how to make the average? To obtain a single curve, the average of all the others. Thank you</p>
  
  <pre><code>import imageio 
  import numpy as np
  from matplotlib.pyplot import *
  from matplotlib import pyplot as plt
  img = imread("lion.jpg")
  #
  red = img[:,:,0]
  green = img[:,:,1]
  blue = img[:,:,2]
  #print(np.mean(img)
  line = red[:,:]
  #here How to calculate the average grayscale profile?
  figure(figsize=(8,4))
  plot(line)
  plt.show()      
  </code></pre>