【文章內容簡介】
像進行保存時,可以通過按鈕實現(xiàn)功能,將“處理后圖像”即坐標軸axes2中的圖像文件保存到文件夾“MATLAB”中。在菜單編輯器中“保存”的Callback函數(shù)中加入如下程序代碼: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)%global BW[filename,pathname]=... uiputfile({39。*.tif39。39。*.jpg39。39。*.png39。39。*.bmp39。},39。save pictrue39。)。if isequal(filename,0)||isequal(pathname,0) returnelse str=[pathname filename] axes()。 im=getimage()。 imwrite(im,str)。End程序退出。當用戶點擊“退出”按鈕,則執(zhí)行整個GUI界面的退出功能。在菜單編輯器中“退出”的Callback子函數(shù)中添加如下代碼: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)close(gcf) %關閉當前Figure窗口句柄 圖像的邊緣檢測。對于該功能的實現(xiàn),本程序在一個Button group——“邊緣檢測”中設置了5個radio Button,分別在每個按鈕的回調函數(shù)Callback中添加代碼,每次用戶點擊該組按鈕時只有一個按鈕起作用,分別對同一圖像進行邊緣檢測處理。所添加的程序如下:function uipanel4_SelectionChangeF(hObject, eventdata, handles)% hObject handle to the selected obj