% --- Executes on button press in Roberts.
functionRoberts_Callback(hObject, eventdata, handles) R = handles.I;
BW = edge(R,'roberts',0.1); %??í????ó?T2?′?ìY?è axes(handles.axes3);
imshow(BW,[]);title('roberts??×ó'); % hObject handle to Roberts (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in Laplacian.
functionLaplacian_Callback(hObject, eventdata, handles) L = handles.I;
H = [0 -1 0;-1 4 -1;0 -1 0]; J = imfilter(L,H); handles.J = J; axes(handles.axes4);
imshow(J,[]);title('à-??à-?1??×ó'); % hObject handle to Laplacian (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in imhist.
functionimhist_Callback(hObject, eventdata, handles) I = handles.I; axes(handles.axes2);
imhist(I);title('?-ê?í????±·?í?'); % hObject handle to imhist (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in linear.
functionlinear_Callback(hObject, eventdata, handles) I = handles.I;
J = imadjust(I,[0.3 0.7],[]); %ê1ó?imadjustoˉêy??DD?ò?èμ???D?±??? axes(handles.axes3);imshow(J);title('??D?±???');
axes(handles.axes4);imhist(J);title('??D?±????±·?í?'); %??ê?±???oóμ?í????±·?í?
% hObject handle to linear (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in histeq.
functionhisteq_Callback(hObject, eventdata, handles) I = handles.I;
J = histeq(I); %íê3é?±·?í??ùoa?ˉ axes(handles.axes5);
imshow(J);title('?ùoa?ˉoóí???'); axes(handles.axes6);
imhist(J);title('?ùoa?ˉμ??±·?í?'); % hObject handle to histeq (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in Clean.
functionClean_Callback(hObject, eventdata, handles) I = ones(256,256);
axes(handles.axes1);imshow(I); axes(handles.axes2);imshow(I); axes(handles.axes3);imshow(I); axes(handles.axes4);imshow(I); axes(handles.axes5);imshow(I); axes(handles.axes6);imshow(I);
% hObject handle to Clean (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
function edit7_Callback(hObject, eventdata, handles) % hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit7 as text % str2double(get(hObject,'String')) returns contents of edit7 as a double
% --- Executes during object creation, after setting all properties. function edit7_CreateFcn(hObject, eventdata, handles) % hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.
ifispc&&isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
七、 实验结果
八、 思考题
(1) 结合教材第6章介绍的图像增强编程方法,说明采用GUIDE环境开发在此方面具有
的特点。
图形用于界面(Graphical User Interfaces,GUI)是提供人机交互的工具和方法。GUI是包含图形对象(如窗口、图标、菜单和文本)的用户界面。以某种方式选择或激活这些对象时,通常会引起动作或者发生变化。一个设计优秀的GUI能够非常直观的让用户知道如何操作MATLAB界面,并且了解设计者的开发意图。MATLAB的GUI为开发者提供了一个不脱离MATLAB的开发环境,有助于MATLAB程序的GUI集成。这样可以使开发者不必理会一大堆烦杂的代码,简化程序,但是同样可以实现向决策者提供图文并茂的界面,甚至达到多媒体的效果。可以说MATLAB提供了一个简便的开发环境,可以让开发者快速上手,提高了开发者的工作效率。
所谓的GUIDE就是图形用户界面开发环境(Graphical User Interface Development Environment),它向用户提供了一系列的创建用户图形界面的工具。这些工具大大
简化了GUI设计和生成的过程。GUIDE可以完成的任务有如下两点:1)输出GUI。2)GUI编程。GUIDE实际上是一套MATLAB工具集,它主要由七部分组成:版面设计器、属性编辑器、菜单编辑器、调整工具、对象浏览器、Tab顺序编辑器、M文件编辑器。

