hi guys how should i fix i=this code error its supposed to be changing an image to gray scale mind u this is in app designer

 Respuesta aceptada

Have you tried using im2gray instead of rgb2gray?

5 comentarios

i did and it worked with no error but it doesnt show in the wanted axis i dont know why here y file can u plz check it out for me
a=getappdata(0,'a');
a_gray=im2gray(a);
setappdata(0,'filename',a_gray);
I=imshow( a_gray,'parent',app.UIAxes2,...
'XData',[1 app.UIAxes2.Position(3)],...
'YData',[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];
heres is what shoes in the interface (modified image)after i hit the grayshade button it changes to blank
You don't need these lines.
a=getappdata(0,'a');
setappdata(0,'filename',a_gray);
You can call the defined property variable Image
a_gray=im2gray(app.Image);
I=imshow( a_gray,'parent',app.UIAxes2,...
'XData',[1 app.UIAxes2.Position(3)],...
'YData',[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];
so i did as you said and it worked thank u very much but the last thing is the gaussian and periodic noise this is my code for them and they didnt work how can i fix them plz?
this is the gaussina noise code
a=(app.Image);
noise=imnoise(a,'gaussian');
I=imshow(noise,'parent',app.UIAxes2,...
'XData',[1 app.UIAxes2.Position(3)],...
'YData',[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];
and this the periodic noise code
a=(app.Image);
s=size(a);
[x,y]=meshgrid(1:s(1),1:s(2));
p=sin(x/3+y/5)+1;
noise=(im2double(a)+p/2)/2;
I=imshow(noise,'parent',app.UIAxes2,...
'XData',[1 app.UIAxes2.Position(3)],...
'YData',[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];
sorry i also have this low pass filter also doesnt work how can i fix it
a=(app.Image);
f1=fspecial('average',[5,5]);
I=imshow(f1,'parent',app.UIAxes2,...
'XData',[1 app.UIAxes2.Position(3)],...
'YData',[1 app.UIAxes2.Position(4)]);
app.UIAxes2.XLim=[0 I.XData(2)];
app.UIAxes2.YLim=[0 I.YData(2)];

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 2 de Dic. de 2022

Comentada:

el 2 de Dic. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by