Je veux realiser l'ajoutement et l'elimination du bruit d'une photo charge en axes1. Dans axes2 apparait elimination du bruit dans axes3 l'ajout du bruit(a l'appui des bouttons pushbutton2 respectivement pushbutton3).

J'ai regarde l'exemple du matlab la fonction pour le filtre median et j'ai fait une interface grafique comme celle dans cette photo:

http://img8.imageshack.us/img8/7153/medianfiltre.png




J'ajout ici le code (pushbutton2_Callback et pushbutton3_Callback) ne fonctionne pas. Pourquoi?



Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
img = imread('poza1.jpg'); %lire cette image quand on press le button %load image
imshow(img); %afficher l'image dans axes1
 
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 
%l'elimination du bruit de l'image photo1.jpg quand on presse le bouton2
removenoise = filter2(fspecial('average',3),removenoise)/255;
figure, imshow(removenoise)
set(handles.axes2,'string'); %stoquage de l'image sans  bruit en axes2
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%l'ajout  du bruit de l'image photo1.jpg quand on press le button3
addnoise = imnoise(img,'salt & pepper',0.02);
figure, imshow(addnoise)
set(handles.axes3,'string'); %stoquage de l'image avec du bruit en axes3