Grayscale function

compute average of RGB channels