版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
廣東藥學(xué)院實(shí)驗(yàn)報(bào)告實(shí)驗(yàn)九一張圖像的各種濾波器的設(shè)計(jì)與實(shí)現(xiàn)班級(jí): 生物醫(yī)學(xué)工程09 姓名: 鄭曾永、凌智偉、區(qū)榮義 學(xué)號(hào):0907512111、0907512115、09075121132011年12月21日TOC\o"1-5"\h\z\o"CurrentDocument"1實(shí)驗(yàn)?zāi)康?3\o"CurrentDocument"實(shí)驗(yàn)內(nèi)容與要求 3\o"CurrentDocument"實(shí)驗(yàn)內(nèi)容與實(shí)驗(yàn)步驟 33.1GUI界面的形成: 33.2各種濾波器實(shí)現(xiàn)代碼: 5三維轉(zhuǎn)二維 5加入椒鹽噪聲 6\o"CurrentDocument"3.2.3.圖像讀入 7圖像信息查詢 7進(jìn)行高斯濾波 8\o"CurrentDocument"進(jìn)彳亍sobel濾波 9\o"CurrentDocument"進(jìn)彳亍prewitt濾波 10進(jìn)行拉普拉斯濾波 11進(jìn)行高斯拉普拉斯濾波 12進(jìn)行均值濾波 13進(jìn)行模糊濾波 14進(jìn)行高通高斯濾波 15進(jìn)行中值濾波 16彩色圖像轉(zhuǎn)灰度圖像 17灰度圖像轉(zhuǎn)為索引圖像 18圖像轉(zhuǎn)為二值圖像 18\o"CurrentDocument"實(shí)驗(yàn)心得: 191實(shí)驗(yàn)?zāi)康?學(xué)會(huì)使用MATLAB的M文本和GUI界面的設(shè)計(jì)學(xué)會(huì)各種濾波器函數(shù)的調(diào)用與設(shè)計(jì)對(duì)各種濾波器的效果進(jìn)行對(duì)比分析實(shí)驗(yàn)內(nèi)容與要求1、 位圖格式圖像基本操作2、 圖像的讀取3、 各種濾波器的實(shí)現(xiàn)4、 濾波器效果的比較。實(shí)驗(yàn)內(nèi)容與實(shí)驗(yàn)步驟3.1GUI界面的形成:實(shí)驗(yàn)代碼:functionvarargout=untitled(varargin)%UNTITLEDM-fileforuntitled.fig%UNTITLED,byitself,createsanewUNTITLEDorraisestheexisting%singleton*.%%H=UNTITLEDreturnsthehandletoanewUNTITLEDorthehandleto% theexistingsingleton*.%% UNTITLED('CALLBACK',hObject,eventData,handles,...)callsthelocal%functionnamedCALLBACKinUNTITLED.Mwiththegiveninputarguments.%%UNTITLED('Property','Value',...)createsanewUNTITLEDorraisesthe%existingsingleton*.Startingfromtheleft,propertyvaluepairsare%appliedtotheGUIbeforeuntitled_OpeningFunctiongetscalled.An%unrecognizedpropertynameorinvalidvaluemakespropertyapplication%stop.Allinputsarepassedtountitled_OpeningFcnviavarargin.%%*SeeGUIOptionsonGUIDE'sToolsmenu.Choose"GUIallowsonlyone%instancetorun(singleton)".%%Seealso:GUIDE,GUIDATA,GUIHANDLES%Edittheabovetexttomodifytheresponsetohelpuntitled%LastModifiedbyGUIDEv2.513-Dec-201120:58:27%Begininitializationcode-DONOTEDITgui_Singleton=1;gui_State=struct('gui_Name',mfilename,...'gui_Singleton',gui_Singleton,...'gui_OpeningFcn',@untitled_OpeningFcn,...'gui_OutputFcn',@untitled_OutputFcn,...'gui_LayoutFcn',[],...'gui_Callback',[]);ifnargin&isstr(varargin{1})gui_State.gui_Callback=str2func(varargin{1});endifnargout[varargout{1:nargout}]=gui_mainfcn(gui_State,varargin{:});elsegui_mainfcn(gui_State,varargin{:});end%Endinitializationcode-DONOTEDIT%---Executesjustbeforeuntitledismadevisible.functionuntitled_OpeningFcn(hObject,eventdata,handles,varargin)%Thisfunctionhasnooutputargs,seeOutputFcn.%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%varargin commandlineargumentstountitled(seeVARARGIN)%Choosedefaultcommandlineoutputforuntitledhandles.output=hObject;%Updatehandlesstructureguidata(hObject,handles);%UIWAITmakesuntitledwaitforuserresponse(seeUIRESUME)%uiwait(handles.figure1);%---Outputsfromthisfunctionarereturnedtothecommandline.functionvarargout=untitled_OutputFcn(hObject,eventdata,handles)
%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Getdefaultcommandlineoutputfromhandlesstructurevarargout{1}=handles.output;界面框圖:功夫。3.2各種濾波器實(shí)現(xiàn)代碼:3.2.1.三維轉(zhuǎn)二維%---Executesonbuttonpressinpushbutton1.functionpushbutton1_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton1(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)g0=imread('lena.tif);g0=g0(:,:,2);%三維轉(zhuǎn)二維figure(1);imshow(g0);title('原圖')效果:
原圖對(duì)比心得:三維圖像轉(zhuǎn)二維圖像,二維效果是彩色圖變成黑白的,但是黑白的圖像不可原圖對(duì)比心得:三維圖像轉(zhuǎn)二維圖像,二維效果是彩色圖變成黑白的,但是黑白的圖像不可3.2.2.加入椒鹽噪聲%---Executesonbuttonpressinpushbutton2.functionpushbutton2_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton2(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)g0=imread('lena.tif);g1=imnoise(g0,'salt&pepper',0.2);g1=im2double(g1);figure(2);imshow(g1);title('加入椒鹽噪聲')效果原圖效果對(duì)比心得:百度知識(shí):椒鹽噪聲是由圖像傳感器,傳輸信道,解碼處理等產(chǎn)生的黑白相間的亮暗點(diǎn)噪聲。椒鹽噪聲往往由圖像切割引起。去除脈沖干擾級(jí)椒
鹽噪聲最常用的算法是中值濾波3.2.3.圖像讀入%---Executesonbuttonpressinpushbutton3.functionpushbutton3_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton3(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)I=imread('lena.jpg'); %圖像讀入figure(11);imshow(I) %圖像顯示原圖效果圖像信息查詢%---Executesonbuttonpressinpushbutton5.functionpushbutton5_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton5(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)inf=imfinfo('lena.jpg')%圖像信息查詢
inf=FilenajneFileModDateFileSizeFormatFormatVersionWidthHeightBitDepthColorTypeFormatSignatureNumberOfSamplesCodingMethodCodingProcessComment,lena.jpginf=FilenajneFileModDateFileSizeFormatFormatVersionWidthHeightBitDepthColorTypeFormatSignatureNumberOfSamplesCodingMethodCodingProcessCommentJ15-Dec-20UU:32:00,3614?■?jpg12911924Huffman'Sequential,{}進(jìn)行高斯濾波%---Executesonbuttonpressinpushbutton?.functionpushbutton7_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton?(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)g0=imread('lena.tif);ifisrgb(gO)g0=rgb2gray(g0)endg1=imnoise(g0,'salt&pepper',0.2);g1=im2double(g1);h1=fspecial('gaussian',4,0.3);g2=filter2(h1,g1,'same');figure(4);imshow(g2);title('進(jìn)行高斯濾波')原圖 效果對(duì)比心得:高斯濾波主要的用途是信號(hào)的平滑處理,通過(guò)對(duì)比可以看到效果圖的兩點(diǎn)像素變得之間的差值邊的小了很多,這也是photoship中的高斯模糊的效果的原因。進(jìn)行sobel濾波%---Executesonbuttonpressinpushbuttons.functionpushbutton8_Callback(hObject,eventdata,handles)%hObjecthandletopushbuttons(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)g0=imread('lena.tif);ifisrgb(gO)g0=rgb2gray(g0)endg1=imnoise(g0,'salt&pepper',0.2);g1=im2double(g1);h2=fspecial('sobel')g3=filter2(h2,g1,'same')figure(5);imshow(g3);title('進(jìn)行sobel濾波')
原圖對(duì)比心得:通過(guò)進(jìn)行sobel濾波后,原圖對(duì)比心得:通過(guò)進(jìn)行sobel濾波后,效果圖像變得混亂了,主要由于sobel濾波是一種邊沿檢測(cè),百度:Sobel算子并沒(méi)有將圖像的主體與背景嚴(yán)格地區(qū)分開(kāi)來(lái),換言之就是Sobel算子沒(méi)有基于圖像灰度進(jìn)行處理,由于Sobel算子沒(méi)有嚴(yán)格地模擬人的視覺(jué)生理特征,所以提取的圖像輪廓有時(shí)并不能令人滿意。進(jìn)行prewitt濾波%---Executesonbuttonpressinpushbutton9.functionpushbutton9_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton9(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)g0=imread('lena.tif);ifisrgb(g0)g0=rgb2gray(g0)endg1=imnoise(g0,'salt&pepper',0.2);g1=im2double(g1);h3=fspecial('prewitt')g4=filter2(h3,g1,'same')figure(6);imshow(g4);title('進(jìn)行prewitt濾波')
原圖效果原圖對(duì)比心得:prewitt濾波和上面的sobel濾波的效果出不多,因?yàn)樗麄兌际沁呇貦z測(cè)的算子。但是仔細(xì)觀察還是有一點(diǎn)的區(qū)別的,sobel濾波的效果的亮度好一點(diǎn)。3.2.8.進(jìn)行拉普拉斯濾波%---Executesonbuttonpressinpushbutton10.functionpushbutton10_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton10(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)g0=imread('lena.tif);ifisrgb(g0)g0=rgb2gray(g0)endg1=imnoise(g0,'salt&pepper',0.2);g1=im2double(g1);h4=fspecial('laplacian',0.5);g5=filter2(h4,g1,'same');figure(7);imshow(g5);title(進(jìn)行拉普拉斯濾波');
原圖對(duì)比心得:拉普拉斯濾波比邊緣檢測(cè)的效果好一點(diǎn)。效果原圖對(duì)比心得:拉普拉斯濾波比邊緣檢測(cè)的效果好一點(diǎn)。效果3.2.9.進(jìn)行高斯拉普拉斯濾波%---Executesonbuttonpressinpushbuttonll.functionpushbutton11_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton11(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)g0=imread('lena.tif);ifisrgb(g0)g0=rgb2gray(g0)endg1=imnoise(g0,'salt&pepper',0.2);g1=im2double(g1);h5=fspecial('log',4,0.3);g6=filter2(h5,g1,'same');figure(7);imshow(g6);title('進(jìn)行高斯拉普拉斯濾波);
原圖效果原圖對(duì)比心得:通過(guò)與高斯濾波和拉普拉斯濾波進(jìn)行對(duì)比,可以看到高斯拉普拉斯濾波是兩種濾波的結(jié)合效果。3.2.10.進(jìn)行均值濾波%---Executesonbuttonpressinpushbutton12.functionpushbutton12_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton12(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)g0=imread('lena.tif);ifisrgb(g0)g0=rgb2gray(g0)endg1=imnoise(g0,'salt&pepper',0.2);g1=im2double(g1);h6=fspecial('average');g7=filter2(h6,g1,'same');figure(8);imshow(g7);title('進(jìn)行均值濾波');原圖對(duì)比心得:均值濾波與高斯濾波的效果好一點(diǎn)。效果3.2.11.進(jìn)行模糊濾波%---Executesonbuttonpressinpushbutton13.functionpushbutton13_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton13(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)g0=imread('lena.tif);ifisrgb(g0)g0=rgb2gray(g0)endg1=imnoise(g0,'salt&pepper',0.2);g1=im2double(g1);h7=fspecial('unsharp',0.3);g8=filter2(h7,g1,'same');figure(8);imshow(g8);title(進(jìn)行模糊濾波');原圖效果對(duì)比心得:模糊濾波總體感覺(jué)上是在原圖的基礎(chǔ)上添加了一些多余的像素,讓圖像看起來(lái)有模糊地感覺(jué)。3.2.12.進(jìn)行高通高斯濾波%---Executesonbuttonpressinpushbutton14.functionpushbutton14_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton14(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)g0=imread('lena.tif);ifisrgb(g0)g0=rgb2gray(g0)endg1=imnoise(g0,'salt&pepper',0.2);g1=im2double(g1);h8=[0-10;-15-1;0-10];g9=filter2(h8,g1,'same');figure(9);imshow(g9);title('進(jìn)行高通高斯濾波');
原圖 效果對(duì)比心得:同理高通高斯濾波和高斯拉普拉斯濾波的原理差不多,都是把兩個(gè)濾波器加在一起,但是它的效果比高斯拉普拉斯濾波的好一些。3.2.13.進(jìn)行中值濾波%---Executesonbuttonpressinpushbutton15.functionpushbutton15_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton15(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)g0=imread('lena.tif);ifisrgb(g0)g0=rgb2gray(g0)endg1=imnoise(g0,'salt&pepper',0.2);g1=im2double(g1);h9=g1;g10=medfilt2(h9);figure(10);imshow(g10);title(進(jìn)行中值濾波');
原圖 效果對(duì)比心得:中值濾波讓圖片看起來(lái)變得有點(diǎn)平滑柔軟的感覺(jué)。百度:中值濾波法是種非線性平滑技術(shù),它將每一像素點(diǎn)的灰度值設(shè)置為該點(diǎn)某鄰域窗口內(nèi)的所有像素點(diǎn)灰度值的中值.3.2.14.彩色圖像轉(zhuǎn)灰度圖像%---Executesonbuttonpressinpushbutton19.functionpushbutton19_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton19(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)I=imread('lena.jpg');X1=rgb2gray(I);figure(12);imshow(X1)效果心得:灰度圖像和黑白圖像有一點(diǎn)區(qū)別:灰度圖像通常顯示為從最暗黑色到最亮的白色的灰度,盡管理論上這個(gè)采樣可以任何顏色的不同深淺,甚至可以是不同亮度上的不同顏色,而黑白圖像則是只有黑色與白色兩種顏色。
3.2.15.灰度圖像轉(zhuǎn)為索引圖像%---Executesonbuttonpressinpushbutton20.functionpushbutton20_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton20(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)I=imread('l
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝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ù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 房屋買(mǎi)賣(mài)合同簡(jiǎn)易版范本格式
- 肥料運(yùn)輸合同2024年
- 房產(chǎn)贈(zèng)與合同公證的步驟
- 2024汽車買(mǎi)賣(mài)合同寫(xiě)
- 建筑企業(yè)分公司協(xié)議-合同范本
- 2024【承包廠食堂合同范本】關(guān)于醫(yī)院食堂承包的合同范本
- 權(quán)威汽車買(mǎi)賣(mài)合同樣式集
- 2024年電商托管代運(yùn)營(yíng)協(xié)議
- 2024音像制品經(jīng)銷合同范本
- 施工機(jī)械安全租賃協(xié)議
- 裝飾裝修工程售后服務(wù)具體措施
- 乙炔發(fā)生器、電石庫(kù)安全檢查表
- 克拉申監(jiān)控理論述評(píng)
- ICH技術(shù)指導(dǎo)原則概述
- (完整版)一年級(jí)家長(zhǎng)會(huì)PPT模板
- 《中華商業(yè)文化》第七章
- 15D503利用建筑物金屬體做防雷及接地裝置安裝圖集
- 消防訓(xùn)練工作研討材料
- 第六章-機(jī)車轉(zhuǎn)向架課件
- 醫(yī)患雙方權(quán)利和義務(wù)課件
- 高三年級(jí)班級(jí)成績(jī)分析報(bào)告
評(píng)論
0/150
提交評(píng)論