Rgb To Grayscale Matlab. The im2gray function converts rgb images to grayscale by eliminating the hue and saturation information while retaining the luminance. In matlab there is a function called rgb2gray is available to convert rgb image to grayscale image.
When you call cat 3 it makes a 3 d image which is interpreted as an rgb images. Newmap rgb2gray map returns a grayscale colormap equivalent to map. The im2gray function converts rgb images to grayscale by eliminating the hue and saturation information while retaining the luminance.
Convert from rgb to grayscale without rgb2gray.
In the case above each of the red channel green channel and blue channel are all the same so the the image will appear gray scale as i said in the comment above that line. The im2gray function converts rgb images to grayscale by eliminating the hue and saturation information while retaining the luminance. Rgb images are 3 d arrays. I im2gray rgb converts the specified truecolor image rgb to a grayscale intensity image i.