版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、MATLAB圖像增強(qiáng)程序舉例1.灰度變換增強(qiáng)程序:% GRAY TRANSFORMclc;I=imread('pout.tif');imshow(I);J=imadjust(I,0.3 0.7,0 1,1); %transforms the walues in the %intensity image I to values in J by linealy mapping values% between 0.3 and 0.7 to values between 0 and 1.figure;imshow(J);J=imadjust(I,0.3 0.7,0
2、 1,0.5); % if GAMMA is less than 1,the% mapping si weighted toward higher (brighter) output values.figure;imshow(J);J=imadjust(I,0.3 0.7,0 1,1.5); % if GAMMA is greater than% 1,the mapping si weighted toward lower (darker) output values.figure;imshow(J)J=imadjust(I,0.3 0.7,0 1,
3、1); % If TOP<BOTTOM,the output% image is reversed,as in a photographic negative.figure;imshow(J);5.bmp (587.92 KB)2008-7-18 08:252.直方圖灰度變換%直方圖灰度變換X,map=imread('forest.tif');I=ind2gray(X,map);%把索引圖像轉(zhuǎn)換為灰度圖像imshow(I);title('原圖像');improfile%用鼠標(biāo)選擇一條對(duì)角線,顯示線段的灰度值figure;subplot
4、(121)plot(0:0.01:1,sqrt(0:0.01:1)axis squaretitle('平方根灰度變換函數(shù)')subplot(122)maxnum=double(max(max(I);%取得二維數(shù)組最大值J=sqrt(double(I)/maxnum);%把數(shù)據(jù)類(lèi)型轉(zhuǎn)換成double,然后進(jìn)行平方根變換%sqrt函數(shù)不支持uint8類(lèi)型J=uint8(J*maxnum);%把數(shù)據(jù)類(lèi)型轉(zhuǎn)換成uint8類(lèi)型imshow(J)title('平方根變換后的圖像')3.直方圖均衡化程序舉例% HISTGRAM EAQUALIZATIONclc;% Clear
5、 command windowI=imread('tire.tif');% reads the image in tire.tif into Iimshow(I);% displays the intensity image I with 256 gray levelsfigure;%creates a new figure windowimhist(I);% displays a histogram for the intensity image IJ=histeq(I,64);% transforms the intensity image I,returning J an
6、 intensityfigure;%image with 64 discrete levelsimshow(J);figure;imhist(J);J=histeq(I,32);%transforms the intensity image ,returning in % J an intensityfigure;%image with 32 discrete levelsimshow(J);figure;imhist(J);4.直方圖規(guī)定化程序舉例% HISTGRAM REGULIZATIONclc; %Clear command windowI=imread('tire.tif
7、39;);%reads the image in tire.tif into IJ=histeq(I,32);%transforms the intensity image I,returning in%J an intensity image with 32 discrete levelscounts,x=imhist(J);%displays a histogram for the intensity image IQ=imread('pout.tif');%reads the image in tire.tif into Ifigure;imshow(Q);figure;
8、imhist(Q);M=histeq(Q,counts);%transforms the intensity image Q so that the%histogram of the output image M approximately matches countsfigure;imshow(M);figure;imhist(M);空域?yàn)V波增強(qiáng)部分程序1.線性平滑濾波I=imread('eight.tif');J=imnoise(I,'salt & pepper',0.02);subplot(221),imshow(I)title('原圖像&
9、#39;)subplot(222),imshow(J)title('添加椒鹽噪聲圖像')K1=filter2(fspecial('average',3),J)/255;%應(yīng)用3*3鄰域窗口法 subplot(223),imshow(K1)title('3x3窗的鄰域平均濾波圖像')K2=filter2(fspecial('average',7),J)/255;%應(yīng)用7*7鄰域窗口法 subplot(224),imshow(K2)title('7x7窗的鄰域平均濾波圖像')5.bmp (689.12 KB)2008-
10、7-18 09:502.中值濾波器MATLAB中的二維中值濾波函數(shù)medfit2來(lái)進(jìn)行圖像中椒鹽躁聲的去除%IMAGE NOISE REDUCTION WITH MEDIAN FILTERclc;hood=3;%濾波窗口I,map=imread('eight.tif');imshow(I,map);noisy=imnoise(I,'salt & pepper',0.05);figure;imshow(noisy,map);filtered1=medfilt2(noisy,hood hood);figure;imshow(filtered1,map);ho
11、od=5;filtered2=medfilt2(noisy,hood hood);figure;imshow(filtered2,map);hood=7;filtered3=medfilt2(noisy,hood hood);figure;imshow(filtered3,map);3. 4鄰域8鄰域平均濾波算法% IMAGE NOISE REDUCTION WITH MEAN ALGORITHMclc;I,map=imread('eight.tif');noisy=imnoise(I,'salt & pepper',0.05);m
12、yfilt1=0 1 0;1 1 1;0 1 0;%4鄰域平均濾波模版myfilt1=myfilt1/9;%對(duì)模版歸一化filtered1=filter2(myfilt1,noisy);imshow(filtered1,map);myfilt2=1 1 1;1 1 1;1 1 1;myfilt2=myfilt2/9;filtered2=filter2(myfilt2,noisy);figure;imshow(filtered2,map);頻域增強(qiáng)程序舉例1.低通濾波器% LOWPASS FILTERclc;I,map=imread('eight.tif');noisy=imno
13、ise(I,'gaussian',0.05);imshow(noisy,map);myfilt1=1 1 1;1 1 1;1 1 1;myfilt1=myfilt1/9;filtered1=filter2(myfilt1,noisy);figure;imshow(filtered1,map);myfilt2=1 1 1;1 2 1;1 1 1;myfilt2=myfilt2/10;filtered2=filter2(myfilt2,noisy);figure;imshow(filtered2,map);myfilt3=1 2 1;2 4 2; 1 2 1;myfilt3=fil
14、ter2(myfilt3,noisy);figure;imshow(filtered3,map);2.布特沃斯低通濾波器圖像實(shí)例I=imread('saturn.png');J=imnoise(I,'salt & pepper',0.02);subpolt(121),imshow(J)subplot(121),imshow(J)title('含噪聲的原圖像')%- 08-7-18 上午10:37 -%I=imread('saturn.png');J=imnoise(I,'salt & pepper',0.02);subpolt(121),imshow(J)subplot(121),imshow(J)title('含噪聲的原圖像')clc;I=imread('saturn.png');J=imnoise(I,'salt & pepper',0.02);subplot(121),imshow(J)title('含噪聲的原圖像')J=double(J);f=fft2(J);g=fftshift(f)
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025-2030全球桌面排版系統(tǒng)行業(yè)調(diào)研及趨勢(shì)分析報(bào)告
- 2025-2030全球醫(yī)療設(shè)備安全解決方案行業(yè)調(diào)研及趨勢(shì)分析報(bào)告
- 2025年全球及中國(guó)一次性甲狀腺穿刺器行業(yè)頭部企業(yè)市場(chǎng)占有率及排名調(diào)研報(bào)告
- 2025-2030全球亞歷山大變石激光器行業(yè)調(diào)研及趨勢(shì)分析報(bào)告
- 2025廣州市農(nóng)村集體經(jīng)濟(jì)承包合同管理規(guī)定
- 勞務(wù)派遣合同協(xié)議模板范本
- 2025地區(qū)展柜、物料定作布展合同
- 個(gè)人連帶擔(dān)保合同
- 房屋場(chǎng)地租賃合同
- 砌筑勞務(wù)分包合同范本
- 《中國(guó)古代寓言》導(dǎo)讀(課件)2023-2024學(xué)年統(tǒng)編版語(yǔ)文三年級(jí)下冊(cè)
- 五年級(jí)上冊(cè)計(jì)算題大全1000題帶答案
- 工程建設(shè)行業(yè)標(biāo)準(zhǔn)內(nèi)置保溫現(xiàn)澆混凝土復(fù)合剪力墻技術(shù)規(guī)程
- 液壓動(dòng)力元件-柱塞泵課件講解
- 人教版五年級(jí)上冊(cè)數(shù)學(xué)脫式計(jì)算100題及答案
- 屋面細(xì)石混凝土保護(hù)層施工方案及方法
- 2024年1月山西省高三年級(jí)適應(yīng)性調(diào)研測(cè)試(一模)理科綜合試卷(含答案)
- 110kv各類(lèi)型變壓器的計(jì)算單
- 5A+Chapter+1+Changes+at+home+課件(新思維小學(xué)英語(yǔ))
- 安徽省2023年中考數(shù)學(xué)試卷(附答案)
- 護(hù)工(陪護(hù))培訓(xùn)教材(完整版)資料
評(píng)論
0/150
提交評(píng)論