What I want to do is take an image file that I read in (scipy.misc.imread(file)) and change every individual RGB value to an average of the three values for that pixel.
For example, I can do this on one individual pixel doing something like this:
import numpy as np
from scipy import misc
import matplotlib.pyplot as plt
from skimage import data
img = misc.imread('./path/to/file.jpg')
print(img[200, 200]) #[145 165 155]
print(img[200, 200]) = int(np.sum(img[200, 200])/3) # sets RGB values at img[200, 200] to the average of the RGB values in this case, 155
print(img[200, 200]) # changed to [155 155 155]
However, I'm new to numpy and ndarrays and I want to know how to apply this to every pixel in the image using slicing. Is this possible? I'm having trouble understanding how to iterate over the entire ndarray and reference the appropriate values to sum and set.
Any help is welcome!

