matlab课程设计图像处理,MATLAB课程设计--GUI图像处理
% 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';'*.*'},'保存圖像文件','untitled.jpg');
if ~isequal([sfilename,sfilepath],[0,0]) sfilefullname=[sfilepath ,sfilename]; imwrite(handles.img,sfilefullname); else
msgbox('你按了取消鍵','保存失敗'); end
程序關鍵部分:
通[sfilename ,sfilepath]=uiputfile({'*.jpg';'*.bmp';'*.tif';'*.*'},'保存圖像文件','untitled.jpg')選擇圖像文件保存的路徑與格式;然后,通過sfilefullname=[sfilepath ,sfilename];
imwrite(handles.img,sfilefullname); 實現對圖像的保存。
(3)程序的退出。
function exit_Callback(hObject, eventdata, handles) % hObject handle to exit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) clc; close all; close(gcf); clear;
4.3對圖像進行任意的亮度和對比度變化調整,顯示和對比變換前后的圖像。 運行程序后,通過“編輯”菜單中的“常用處理”選中“亮度調節(jié)”
9 / 52
在顯示出相應的功能鍵后,通過載入讀取圖像,比并進行處理,效果如下: 亮度處理前:
亮度處理后:
實現程序段如下:
% --- Executes on button press in radiobutton12.
function radiobutton12_Callback(hObject, eventdata, handles) % hObject handle to radiobutton12 (see GCBO)
10 / 52
% 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={'調整倍數'}; defans={'1'};
p=inputdlg(prompt,'input',1,defans); p1=str2num(p{1});
y=imadjust(handles.img,[ ], [ ],p1); %亮度調節(jié) imshow(y); handles.img=y;
guidata(hObject,handles);
對比度處理前:
對比度處理后(增強3倍):
11 / 52
對比度減弱1.5倍后:
實現程序段如下:
function uipanel10_SelectionChangeFcn(hObject, eventdata, handles) % hObject handle to uipanel10 (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={'輸入參數:'}; defans={'1'};
p=inputdlg(prompt,'input',1,defans); p1=str2num(p{1});
f=immultiply(handles.img,p1); imshow(f);
12 / 52
總結
以上是生活随笔為你收集整理的matlab课程设计图像处理,MATLAB课程设计--GUI图像处理的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 任意阶魔方阵matlab程序,【精品】任
- 下一篇: 信用卡代还手续费多少 小心被黑中介坑了