views:

1882

answers:

2

I am trying to implement an algorithm in computer vision and I want to try it on a set of pictures. The pictures are all in color, but I don't want to deal with that. I want to convert them to grayscale which is enough for testing the algorithm.

How can I convert a color image to grayscale?

I'm reading it with:

x = imread('bla.jpg');

Is there any argument I can add to imread to read it as grayscale? Is there any way I change x to grayscale after reading it?

+6  A: 

Use rgb2gray to strip hue and saturation (ie, convert to grayscale). Documentation

Donnie
@Donnie: I updated the link to the newest documentation.
gnovice
+2  A: 
x = imread('bla.jpg');
k = rgb2gray(x);
figure(1),imshow(k);
s.lakshmi