In Matlab, how do I convert an image which is in the red green and blue (RGB) format to a gray scale image without using the toolbox.
Asked
Active
Viewed 205 times
0
-
1Take an average of the channels? `mean(I,3)` – Dan Dec 13 '13 at 09:55
1 Answers
7
With "the" toolbox: rgb2gray.
Without "the" toolbox: look here, or here or here or this paper or here or here or ...
That's just the first couple of Google hits for "convert RGB to grayscale" and "convert RGB to grayscale MATLAB".
Summary:
gray = 0.2989*img(:,:,1) + 0.5870*img(:,:,2) + 0.1140*img(:,:,3);
where img
is your RGB image.

Community
- 1
- 1

Rody Oldenhuis
- 37,726
- 7
- 50
- 96