% -------------------------------------------------------------------- function openfile_Callback(hObject, eventdata, handles) % hObject handle to openfile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [filename,pathname]=uigetfile({'*.jpg';'*.bmp';'*.tif';'*.*'},'??¨¨?¨ª???'); if isequal(filename,0)|isequal(pathname,0) errordlg('??¨®D???D???t','3?¡ä¨ª'); return; else
file=[pathname,filename]; global S %¨¦¨¨??¨°???¨¨???a?¨¢?S¡ê?a¡ê¡ä?3?¨º?¨ª???????¡ê?¨°?a???o¨®¦Ì??1?-2¨´?? S=file;
x=imread(file);
set(handles.axes1,'HandleVisibility','ON'); axes(handles.axes1); imshow(x);
set(handles.axes1,'HandleVisibility','OFF'); axes(handles.axes2); imshow(x); handles.img=x;
guidata(hObject,handles); end
% -------------------------------------------------------------------- function about_Callback(hObject, eventdata, handles) % hObject handle to about (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) msgbox('?a¨º?¨°???GUI¦Ì?¨ª???¡ä|¨¤¨ª3¨¬D¨°','1?¨®¨²');
% -------------------------------------------------------------------- function help_Callback(hObject, eventdata, handles) % hObject handle to help (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% -------------------------------------------------------------------- function save_Callback(hObject, eventdata, handles) % hObject handle to save (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
[sfilename ,sfilepath]=uiputfile({'*.jpg';'*.bmp';'*.tif';'*.*'},'a¡ê¡ä?¨ª??????t','untitled.jpg');
37 / 52
if ~isequal([sfilename,sfilepath],[0,0]) sfilefullname=[sfilepath ,sfilename]; imwrite(handles.img,sfilefullname); else
msgbox('???¡ä¨¢?¨¨????¡Â¡ê?','a¡ê¡ä?¨º¡ì?¨¹'); end
% --- Executes on button press in radiobutton12.
function radiobutton12_Callback(hObject, eventdata, handles) % hObject handle to radiobutton12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton12 global T
axes(handles.axes2); T=getimage; prompt={'¦Ì???a?¨ºy'}; defans={'1'};
p=inputdlg(prompt,'input',1,defans); p1=str2num(p{1});
y=imadjust(handles.img,[ ], [ ],p1); %??¨¢¨¢¨ª??? imshow(y); handles.img=y;
guidata(hObject,handles);
% -------------------------------------------------------------------- function uipanel4_SelectionChangeFcn(hObject, eventdata, handles) % hObject handle to uipanel4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global T
str=get(hObject,'string'); axes(handles.axes2); switch str
case '??????¨¦?' T=getimage; prompt={'¨º?¨¨???????¨¦?2?¨ºy1:'}; defans={'0.02'};
p=inputdlg(prompt,'input',1,defans);
38 / 52
p1=str2num(p{1});
f=imnoise(handles.img,'salt & pepper',p1); imshow(f); handles.img=f;
guidata(hObject,handles); case '???1??¨¦?' T=getimage; prompt={'¨º?¨¨????1??¨¦?2?¨ºy1:','¨º?¨¨????1??¨¦?2?¨ºy2'}; defans={'0','0.02'};
p=inputdlg(prompt,'input',1,defans); p1=str2num(p{1}); p2=str2num(p{2});
f=imnoise(handles.img,'gaussian',p1,p2); imshow(f); handles.img=f;
guidata(hObject,handles); case '3?D???¨¦?' T=getimage; prompt={'¨º?¨¨?3?D???¨¦?2?¨ºy1:'}; defans={'0.02'};
p=inputdlg(prompt,'input',1,defans); p1=str2num(p{1});
f=imnoise(handles.img,'speckle',p1); imshow(f); handles.img=f;
guidata(hObject,handles); end
% --- Executes on button press in radiobutton16.
function radiobutton16_Callback(hObject, eventdata, handles) % hObject handle to radiobutton16 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton16 global T
axes(handles.axes2); T=getimage;
x=rgb2gray(handles.img); %RGB¨ª????a???a?¨°?¨¨¨ª??? imshow(x); handles.img=x;
guidata(hObject,handles);
39 / 52
% --- Executes on button press in pushbutton1.
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) global T
axes(handles.axes2); T=getimage;
x=imcrop(handles.img); %??¨ª? imshow(x); handles.img=x;
guidata(hObject,handles);
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles) %¨ª???Dy?a % 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) global T
axes(handles.axes2); T=getimage; prompt={'Dy?a???¨¨:'}; defans={'0'};
p=inputdlg(prompt,'input',1,defans); p1=str2num(p{1});
f=imrotate(handles.img,p1,'bilinear','crop'); imshow(f); handles.img=f;
guidata(hObject,handles);
% Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
40 / 52