I = rgb2gray(RGB) converts the truecolor image RGB to the grayscale intensity image I.
The rgb2gray function converts RGB images to grayscale by eliminating the hue and saturation information while retaining the luminance.
If you have Parallel Computing Toolboxâ„¢ installed, rgb2gray can perform this conversion on a GPU.
newmap = rgb2gray(map) returns a grayscale colormap equivalent to map.
I = rgb2gray(RGB) newmap = rgb2gray(map)
0.2989 * R + 0.5870 * G + 0.1140 * B