converting tiff file to grey scale using im2gray error at position 1

I try to convert my tiff files to grey scale images. I read that I should use im2grey. But I get an error that there is an invaling argument at position 1 and that the value must be numeric. What does this mean?

Antworten (1)

You have to read the data in first; you cannot pass in a file name
img = imread('flamingos.jpg');
grimg = im2gray(img);
imshow(grimg)

3 Kommentare

I thought that the problem was that i could not read the image first since the left side was x by x and the right side x by x by 3 which meant that i should convert it first to a gray image. this is the initial problem do you know how i could solve this.
Example:
for K = 1 : 5
filename = sprintf('img%05d.tiff', K);
outputs(:,:,K) = im2gray(imread(filename));
end
That worked thank you!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Convert Image Type finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 26 Apr. 2021

Kommentiert:

am 26 Apr. 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by