




已閱讀5頁,還剩19頁未讀, 繼續(xù)免費閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
Matlab GUI要求利用MATLAB GUI設(shè)計實現(xiàn)圖像處理的圖形用戶界面,利用MATLAB圖像處理工具箱實現(xiàn)以下的圖像處理功能: 1.實現(xiàn)圖像的讀取和保存。 2.讓用戶能夠?qū)D像進行任意亮度和對比度變化調(diào)整,顯示變換前后的圖像。 3.讓用戶能夠用鼠標選取圖像感興趣區(qū)域,顯示和保存該選擇區(qū)域。 4.編寫程序通過最近鄰插值和雙線性插值等算法將用戶所選取的圖像區(qū)域進行放大和縮小。整數(shù)倍的操作,并保存,比較幾種插值的效果。 5.實現(xiàn)圖像直方圖統(tǒng)計均衡,要求顯示直方圖統(tǒng)計,比較直方圖均衡后的效果。 6.對圖像加入各種噪聲,通過幾種濾波算法實現(xiàn)去噪并比較去噪效果??傮wGUI效果圖(菜單部分功能為要求功能,界面部分及菜單部分功能為擴展功能):第一小題:(讀?。┐a: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()實現(xiàn)打開文件對話框,并且獲取選中對象的路徑及文件名,將其打開。(保存)代碼: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()打開保存文件對話框,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()打開輸入信息對話框,輸入?yún)?shù),在調(diào)用imadjust()函數(shù)改變其亮度(對比度調(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()輸出信息對話框提示用戶相關(guān)操作,imadjust(),結(jié)合stretchlim(H)調(diào)整最佳對比度。第三小題:代碼: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獲取當前處理圖像,打開文件保存對話框,讀取路徑,寫入磁盤。第四小題:(最鄰近插值)代碼: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);(處理前)截圖:(處理后)分析:通過這兩種插值方法,對于最鄰近插值只是簡單在行列間直接插入臨近若干行列,使得圖像失真,對于雙線性插值算法,通過X與Y方向上通過成比例插值,這樣使得像素值比較連續(xù),圖像質(zhì)量比較高,顯得平滑,但由于高頻分量值受損,圖像會顯得比較模糊。第五小題代碼(統(tǒng)計):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)計)分析:通過調(diào)用imhist()函數(shù)將不同像素值的點進行統(tǒng)計,畫出對應(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)整灰度值,進行圖像均衡。第六小題:代碼(椒鹽噪聲):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等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 結(jié)構(gòu)化思維商務(wù)英語考試試題及答案
- 注冊土木工程師考試內(nèi)容清單試題及答案
- 社會管理創(chuàng)新試題及答案
- 游戲化營銷在品牌傳播中的影響力分析:2025年深度報告
- 標準推理測試題及答案
- 威海考教師編試題及答案
- 無機化學實驗題目及答案
- 護理基礎(chǔ)考核試題及答案
- 萍鄉(xiāng)衛(wèi)生職業(yè)學院《經(jīng)貿(mào)日語》2023-2024學年第一學期期末試卷
- 江蘇省鹽城市大豐2025屆初三年級下學期十月份月考化學試題含解析
- HIV實驗室SOP文件-新版
- 孤獨癥兒童評估填寫范例(一表兩圖)
- 賀蘭山東麓干紅葡萄酒多酚組分與其抗氧化、抗癌活性的關(guān)聯(lián)性研究
- 第15課+十月革命的勝利與蘇聯(lián)的社會主義實踐【高效備課精研 + 知識精講提升】 高一歷史 課件(中外歷史綱要下)
- (4.3.1)-3.3我國儲糧生態(tài)區(qū)的分布
- 遼寧盤錦浩業(yè)化工“1.15”泄漏爆炸著火事故警示教育
- 2023年衡陽市水務(wù)投資集團有限公司招聘筆試題庫及答案解析
- 110~750kV架空輸電線路設(shè)計規(guī)范方案
- 北師大版五年級數(shù)學下冊公開課《包裝的學問》課件
- 北師大版英語八年級下冊 Unit 4 Lesson 11 Online Time 課件(30張PPT)
- 淺析商業(yè)綜合體的消防疏散
評論
0/150
提交評論