Many image processing algorithms are performed on greyscale images. Even colour image algorithms tend to treat each channel (red, green and blue) as a greyscale image.
There are many methods used to calculate the greyscale value. This article discusses three of the most common ones.