matlab GUI程序設(shè)計(jì)與分析.doc_第1頁(yè)
matlab GUI程序設(shè)計(jì)與分析.doc_第2頁(yè)
matlab GUI程序設(shè)計(jì)與分析.doc_第3頁(yè)
matlab GUI程序設(shè)計(jì)與分析.doc_第4頁(yè)
matlab GUI程序設(shè)計(jì)與分析.doc_第5頁(yè)
已閱讀5頁(yè),還剩19頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

Matlab GUI要求利用MATLAB GUI設(shè)計(jì)實(shí)現(xiàn)圖像處理的圖形用戶界面,利用MATLAB圖像處理工具箱實(shí)現(xiàn)以下的圖像處理功能: 1.實(shí)現(xiàn)圖像的讀取和保存。 2.讓用戶能夠?qū)D像進(jìn)行任意亮度和對(duì)比度變化調(diào)整,顯示變換前后的圖像。 3.讓用戶能夠用鼠標(biāo)選取圖像感興趣區(qū)域,顯示和保存該選擇區(qū)域。 4.編寫程序通過最近鄰插值和雙線性插值等算法將用戶所選取的圖像區(qū)域進(jìn)行放大和縮小。整數(shù)倍的操作,并保存,比較幾種插值的效果。 5.實(shí)現(xiàn)圖像直方圖統(tǒng)計(jì)均衡,要求顯示直方圖統(tǒng)計(jì),比較直方圖均衡后的效果。 6.對(duì)圖像加入各種噪聲,通過幾種濾波算法實(shí)現(xiàn)去噪并比較去噪效果。總體GUI效果圖(菜單部分功能為要求功能,界面部分及菜單部分功能為擴(kuò)展功能):第一小題:(讀取)代碼:function open_Callback(hObject, eventdata, handles)% hObject handle to open (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;*.*,Open file,100,100);file=pathname,filename;global G %save path to restoreG=file;x=imread(file);axes(handles.axes1); %show image as reference in axes1imshow(x);axes(handles.axes2); %show image as edit in axes2imshow(x);handles.img=x;guidata(hObject,handles);截圖:分析:通過uigetfile()實(shí)現(xiàn)打開文件對(duì)話框,并且獲取選中對(duì)象的路徑及文件名,將其打開。(保存)代碼: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)savename,savepath=uiputfile(*.jpg;*.*,Save file,untitled.jpg,100,100);file=savepath ,savename;global HH=getimage;imwrite(H,file);handles.img=H;guidata(hObject,handles);imwrite(H,file,Quality,100);截圖:分析:通過uiputfile()打開保存文件對(duì)話框,imwrite()寫入磁盤。第二小題:(亮度調(diào)整)代碼:function rgb_Callback(hObject, eventdata, handles)% hObject handle to rgb (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global Haxes(handles.axes2);H=getimage;defans=1;p=inputdlg(input number(more than 1 is to strengthen dark,else light),input parameter,1,defans,off);p1=str2double(p1);I=imadjust(handles.img,0,1,0,1,p1);imshow(I);handles.img=I;guidata(hObject,handles);截圖:(處理前)(處理后)分析:通過inputdlg()打開輸入信息對(duì)話框,輸入?yún)?shù),在調(diào)用imadjust()函數(shù)改變其亮度(對(duì)比度調(diào)整)代碼:function strengthen_gray_Callback(hObject, eventdata, handles)% hObject handle to strengthen_gray (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)persistent aif isempty(a) a=1endif a=1 helpdlg(The effect gets better for gray,Tip);a=0;endglobal Haxes(handles.axes2);H=getimage; f=imadjust(handles.img,stretchlim(H),);imshow(f);handles.img=f;guidata(hObject,handles);截圖:(處理前)(處理后)分析:通過helpdlg()輸出信息對(duì)話框提示用戶相關(guān)操作,imadjust(),結(jié)合stretchlim(H)調(diào)整最佳對(duì)比度。第三小題:代碼:function crop_Callback(hObject, eventdata, handles)% hObject handle to crop (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global Haxes(handles.axes2);H=getimage;x=imcrop;imshow(x);handles.img=x;guidata(hObject,handles);截圖:(處理前)(處理后)(保存)分析:通過imcrop函數(shù)剪取圖像部分區(qū)域,getimage獲取當(dāng)前處理圖像,打開文件保存對(duì)話框,讀取路徑,寫入磁盤。第四小題:(最鄰近插值)代碼:function nearest_Callback(hObject, eventdata,handles)% hObject handle to nearest (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global H%axes(handles.axes2);H=getimage;prompt=Input Number:;defans=2;p=inputdlg(prompt,input,1,defans);p1=str2num(p1);f=imresize(H,p1);figure,imshow(f);handles.img=f;guidata(hObject,handles);截圖:(處理前)(處理后)(雙線性插值)代碼:function bilinear_Callback(hObject, eventdata, handles)% hObject handle to bilinear (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global H%axes(handles.axes2);H=getimage;prompt=Input Number:;defans=0.5;p=inputdlg(prompt,input,1,defans);p1=str2num(p1);f=imresize(handles.img,p1,bilinear);figureimshow(f);handles.img=f;guidata(hObject,handles);(處理前)截圖:(處理后)分析:通過這兩種插值方法,對(duì)于最鄰近插值只是簡(jiǎn)單在行列間直接插入臨近若干行列,使得圖像失真,對(duì)于雙線性插值算法,通過X與Y方向上通過成比例插值,這樣使得像素值比較連續(xù),圖像質(zhì)量比較高,顯得平滑,但由于高頻分量值受損,圖像會(huì)顯得比較模糊。第五小題代碼(統(tǒng)計(jì)):function statistics_Callback(hObject, eventdata, handles)% hObject handle to statistics (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)persistent aif isempty(a) a=1endif a=1 warndlg(Please transform it to gray,Warning,modal);a=0;endaxes(handles.axes2);x=imhist(handles.img);%xlabel(value)%ylabel(number)%legend(statistics,0)x1=x(1:10:256);y1=1:10:256;bar(y1,x1,grouped);axis(0,255,0,10000);set(handles.axes2,xtick,0:51:255); %to adapt to the changeset(handles.axes2,ytick,0:1000:10000);截圖:(處理前)(統(tǒng)計(jì))分析:通過調(diào)用imhist()函數(shù)將不同像素值的點(diǎn)進(jìn)行統(tǒng)計(jì),畫出對(duì)應(yīng)直方圖,在用bar()函數(shù)將直方圖調(diào)整為條狀圖。(代碼均衡)代碼:function self_adapt_Callback(hObject, eventdata, handles)% hObject handle to self_adapt (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)persistent aif isempty(a) a=1endif a=1 warndlg(Please transform it to gray,Warning,modal);a=0;endglobal Haxes(handles.axes2);H=getimage;J=adapthisteq(H);f=imshow(J);handles.img=f;guidata(hObject,handles);截圖:(處理后)分析:通過dapthisteq()函數(shù)自適應(yīng)調(diào)整灰度值,進(jìn)行圖像均衡。第六小題:代碼(椒鹽噪聲):function pepper_Callback(hObject, eventdata, handles)% hObject handle to pepper (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global Haxes(handles.axes2);H=getimage; defans=0.05;p=inputdlg(Input density of noise:,Input parameter,1,defans);d=str2num(p1);f=imnoise(handles.img,salt & pepper,d);imshow(f);handles.img=f;guidata(hObject,handles);截圖:(處理前)(處理后)(中值濾波)代碼:function median_Callback(hObject, eventdata, handles)% hObject handle to median (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)persistent aif isempty(a) a=1endif a=1 warndlg(Please transform it to gray,Warning,modal);a=0;endglobal Haxes(handles.axes2);H=getimage;A=medfilt2(handles.img);imshow(A);handles.img=A;guidata(hObject,handles);截圖:(高斯噪聲)代碼:function gaussian_Callback(hObject, eventdata, handles)% hObject handle to gaussian (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUID

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論