Comment passer une variable d'une fonction a une autre?
Erreur:
?? Undefined function or variable 'I'.
Error in ==> testnoise>pushbutton2_Callback at 102
J = imnoise(I,'salt & pepper',0.02);
Error in ==> gui_mainfcn at 75
feval(varargin{:});
Error in ==> testnoise at 43
gui_mainfcn(gui_State, varargin{:});
??? Error while evaluating uicontrol Callback.
C'est une application qui a :
-3 buttons and 3 axes
Boutton1(pushbutton1) -conversion to gray et affichage en axes1
-- Second button(pushbutton2) -application salt&pepper noise pour l'image et affichage en axes2
-- pushbutton3-eliminer noise et afficher image en axes3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
function pushbutton1_Callback(hObject, eventdata, handles)
RGB = imread('test.jpg');
I = rgb2gray(RGB);
axes(handles.axes1);
imshow(I);
end
function pushbutton2_Callback(hObject, eventdata, handles)
J = imnoise(I,'salt & pepper',0.02);
axes(handles.axes2);
imshow(J);
end
function pushbutton3_Callback(hObject, eventdata, handles)
L = medfilt2(J,[3 3]);
axes(handles.axes3);
imshow(L);
end |
Ma question c'est comment de passer une variable d'une fonction a une autre?
Par exemple variable I dans fonction pushbutton1 en pushbutton2. (dans mon cas)
Un petit exemple s'il vous plait.
Merci d'avance!
Partager