You are here : matlabImage Processingrgb2gray

rgb2gray() - Image Processing

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.


Syntax

I = rgb2gray(RGB)
newmap = rgb2gray(map)


Example

0.2989 * R + 0.5870 * G + 0.1140 * B


Output / Return Value


Limitations


Alternatives / See Also


Reference