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. I found the algorithm here https://sourceforge.net/p/octave/image/ci/default/tree/inst/rgb2gray.m
I am calling the function with:
[name,path]=uigetfile('*.*');img=imread([path,name]);[img_x,img_y,nargin]=size(img); if nargin > 1 im=rgb2gray(img);else im=img; % It's already gray.
end
But I got these errors: Error: File: rgb2gray.m
if (iscolormap (rgb)) gray = rgb2gray (rgb)(:, 1) * ones (1, 3);()-indexing must appear last in an index expression.
and
Error in above code (line 5)
im=rgb2gray(img);
Why am I getting those errors?
Best Answer