MATLAB實(shí)現(xiàn)頻域平滑濾波以及圖像去噪代碼_第1頁
MATLAB實(shí)現(xiàn)頻域平滑濾波以及圖像去噪代碼_第2頁
MATLAB實(shí)現(xiàn)頻域平滑濾波以及圖像去噪代碼_第3頁
MATLAB實(shí)現(xiàn)頻域平滑濾波以及圖像去噪代碼_第4頁
免費(fèi)預(yù)覽已結(jié)束,剩余1頁可下載查看

下載本文檔

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

文檔簡(jiǎn)介

1、MATLAB實(shí)現(xiàn)頻域平滑濾波以及圖像去噪代碼用MATLA實(shí)現(xiàn)頻域平滑濾波以及圖像去噪代碼懸賞分:50 - 解決時(shí)間 :2008-11-8 14:21 是數(shù)字圖象處理的實(shí)驗(yàn),麻煩高人給個(gè)寫好的代碼,希望能在重要語句后面附 上一定的說明,只要能在 MATLAEt運(yùn)行成功,必然給分。具體的實(shí)驗(yàn)指導(dǎo)書上的 要求如下 : 頻域平滑濾波實(shí)驗(yàn)步驟1. 打開 Matlab 編程環(huán)境 ;2. 利用imread 函數(shù)讀入圖像數(shù)據(jù);3. 利用 imshow 顯示所讀入的圖像數(shù)據(jù) ;4. 將圖像數(shù)據(jù)由 uint8 格式轉(zhuǎn)換為 double 格式,并將各點(diǎn)數(shù)據(jù)乘以 (-1)x+y 以便 FFT 變換后的結(jié)果中低頻數(shù)據(jù)處

2、于圖像中央 ;5. 用 fft2 函數(shù)對(duì)圖像數(shù)據(jù)進(jìn)行二維 FFT 變換,得到頻率域圖像數(shù)據(jù) ; 6.計(jì)算頻率域圖像的幅值并進(jìn)行對(duì)數(shù)變換,利用imshow 顯示頻率域圖 像;7. 在頻率圖像上去除濾波半徑以外的數(shù)據(jù) (置 0);8. 計(jì)算頻率域圖像的幅值并進(jìn)行對(duì)數(shù)變換,利用imshow 顯示處理過的頻域圖像數(shù)據(jù) ;9. 用 ifft2 函數(shù)對(duì)圖像數(shù)據(jù)進(jìn)行二維 FFT 逆變換,并用 real 函數(shù)取 其實(shí) 部,得到處理過的空間域圖像數(shù)據(jù) ;10. 將圖像數(shù)據(jù)各點(diǎn)數(shù)據(jù)乘以 (-1)x+y;11. 利用 imshow 顯示處理結(jié)果圖像數(shù)據(jù) ;12. 利用 imwrite 函數(shù)保存圖像處理結(jié)果數(shù)據(jù)。圖像

3、去噪實(shí)驗(yàn)步驟 :1. 打開 Matlab 編程環(huán)境 ;2. 利用 imread 函數(shù)讀入包含噪聲的原始圖像數(shù)據(jù) ;3. 利用 imshow 顯示所讀入的圖像數(shù)據(jù) ;4. 以 3X3 大小為處理掩模,編寫代碼實(shí)現(xiàn)中值濾波算法,并對(duì)原始噪聲 圖像 進(jìn)行濾波處理 ;5. 利用 imshow 顯示處理結(jié)果圖像數(shù)據(jù) ;6. 利用 imwrite 函數(shù)保存圖像處理結(jié)果數(shù)據(jù)。即使不是按這些步驟來的也沒關(guān)系,只要是那個(gè)功能,能實(shí)現(xiàn)就0K謝謝大家%spatial frequency (SF) filtering by low pass filter% the SF filter is unselective t

4、o orientation (doughnut-shaped in the SF% domain).FileName,PathName,FilterIndex = uigetfile ; filename = fullfile(PathName, FileName) ;X map = imread(filename, fmt); % read image L = double(X); % transform to double % need to add (-1)x+y to L% calculate the number of points for FFT (power of 2)fftsi

5、ze = 2 .A ceil(log2(size(L); % 2d fftY = fft2(X, fftsize(1), fftsize (2); Y = fftshift(Y);% obtain frequency (cycles/pixel) f0 = floor(m n / 2) + 1;fy = (m: -1: 1) - f0(1) + 1) / m; fx = (1: n) - f0(2) / n;mfx mfy = meshgrid(fx, fy);% calculate radiusSF = sqrt(mfx .A 2 + mfy .A 2);% SF-bandpass and

6、orientation-unselective filterfilt = SF k0;A_filtered = filt .* A; % SF filtering L_filtered = real(ifft2(ifftshift(A_filtered); % IFFTL_filtered = L_filtered(1: size(L, 1), 1: size(L, 2);%need to add (-1)x + y to L_filtered% showfigure(1);clf reset;colormap gray;% plot imagesubplot(2, 2, 1);imagesc

7、(L);colorbar;axis square;set(gca, TickDir, out);title(original image);xlabel(x);ylabel(y);imwrite(L, fullfile(FilePath, original image.bmp), bmp) ;% plot amplitudeA = abs(A);A = log10(A);% spectral amplitudesubplot(2, 2, 2);imagesc(fx, fy, A);axis xy;axis square;set(gca, TickDir, out); title(amplitu

8、de spectrum); xlabel(fx (cyc/pix); ylabel(fy (cyc/pix);imwrite(A, fullfile(FilePath, amplitude spectrum.bmp), bmp) ; % filter in the SF domainsubplot(2, 2, 3); imagesc(fx, fy, filt); axis xy;axis square;set(gca, TickDir, out); title(filter in the SF domain); xlabel(fx (cyc/pix); ylabel(fy (cyc/pix);

9、imwrite(filt, fullfile(FilePath, filter in SF.bmp), bmp) ; % filtered imagesubplot(2, 2, 4); imagesc(L_filtered);colorbar; axis square; set(gca, TickDir, out);title(filtered image);xlabel(x);ylabel(y);imwrite(filtered, fullfile(FilePath, filtered image.bmp), bmp);%median filter% FileName,PathName,FilterIndex = uigetfile ; filename = fullfile(PathName, FileName) ;LNoise map = imread(filename, fmt); % read image L = medfilt2(LNoise, 3 3); % remove the noise with 3*3 blockf

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(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)論