why do i get error when i try to use rgb2gray function in gui?
Mostrar comentarios más antiguos
i tried to make a GUI which converts a rgb image to grayscale image.
this is my code:
clc
clear all
ext='*.jpeg';
folder='C:\Users\SAGARIKA\Desktop\butter\butterfly2';
image = uigetfile([folder '\' ext])
old_image = fullfile(folder,image)
copyfile(old_image,['C:\Users\SAGARIKA\Desktop\butter\' image]);
imshow(old_image);
I = rgb2gray(old_image);
i got the following error:
Error using rgb2gray>parse_inputs (line 81)
MAP must be a m x 3 array.
Error in rgb2gray (line 35)
X = parse_inputs(varargin{:});
Error in que (line 9)
I = rgb2gray(old_image);
>>
1 comentario
sagarika tewary
el 18 de Abr. de 2016
Respuesta aceptada
Más respuestas (1)
Jo
el 21 de Oct. de 2016
Editada: Image Analyst
el 21 de Oct. de 2016
I have this code :
I1 = gpuArray(reshape(linspace(0,1,20),[5 4])); %performs the conversion on a GPU.
W = gather (I1);
[I1,map] = imread(fullname);
imshow(I1,map)
myImageAsGray = rgb2gray(map)
%graycomatrix ignores pixel pairs if either of the pixels contains a NaN,
%replaces positive Infs with the value NumLevels,
%replaces negative Infs with the value 1.
%ignores border pixels, if the corresponding neighbor pixel falls outside the image boundaries
graycomatrix(I1, 'offset', [0 1], 'Symmetric', true)
graycomatrix(I1, 'offset', [0 1], 'Symmetric', false)
graycomatrix(I1, 'offset', [0 -1], 'Symmetric', false)
imshow(myImageAsGray)
imagesc(myImageAsGray)
and the same critical issue!
Error using rgb2gray>parse_inputs (line 77)
MAP must be a m x 3 array.
Error in rgb2gray (line 52)
[X, threeD] = parse_inputs(X);
Error in CoC>pushbutton10_Callback (line 634)
myImageAsGray = rgb2gray(map)
I'm able to see the image in grayscale without problem,but with this error message! I tried to add the code that you suggested but the error message is the same.
1 comentario
Image Analyst
el 21 de Oct. de 2016
Please attach your image with the paperclip icon.
Categorías
Más información sobre Images en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!