資源描述:
《數(shù)字圖像處理上機(jī)作業(yè)(word版)》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、數(shù)字圖像處理上機(jī)作業(yè)教師:劉清華學(xué)院:電子工程學(xué)院班級(jí):021141專業(yè):探測(cè)制導(dǎo)與控制技術(shù)姓名:蘇二鵬學(xué)號(hào):02114030(1)(2)f1與f2的幅度譜相同,因?yàn)閒1與f2振幅的絕對(duì)值是相同的。(3)f3的幅度譜與f2的幅度譜按順時(shí)針旋轉(zhuǎn)90度后相同(4)f4的幅度譜與f1的幅度譜按順時(shí)針旋轉(zhuǎn)90度后相同(5)f5的幅度譜是f1與f4的幅度譜相加,f6的幅度譜是f2與f3的幅度譜相加程序:f1=zeros(256,256);f1(65:192,113:144)=100;figuresubplot(121)imshow(f1)title('原圖f1')F=fft2(f1
2、);subplot(122)imshow(abs(F))title('f1幅度譜圖')form=(1:256);forn=(1:256);f2(m,n)=power(-1,m+n)*f1(m,n);endendfiguresubplot(121)imshow(f2)title('f2圖')F1=fft2(f2);subplot(122)imshow(abs(F1))title('f2幅度譜圖')f3=imrotate(f2,-90);figuresubplot(121)imshow(f3)title('f3圖')F2=fft2(f3);subplot(122)imshow
3、(abs(F2))title('f3幅度譜圖')f4=imrotate(f1,-90);figuresubplot(121)imshow(f4)title('f4圖')F5=fft2(f4);subplot(122)imshow(abs(F5))title('f4幅度譜圖')f5=f1+f4;figuresubplot(121)imshow(f5)title('f5圖')F3=fft2(f5)subplot(122)imshow(abs(F3))title('f5幅度譜圖')f6=f2+f3;figuresubplot(121)imshow(f6)title('f6圖')
4、F4=fft2(f6)subplot(122)imshow(abs(F4))title('f6幅度譜圖')256*256圖像如下:從中值濾波和均值濾波后的圖像可以看出,中值濾波把黑色方快完全完全隔離開(kāi),而白色方塊則通過(guò)邊角的兩個(gè)多出來(lái)的像素點(diǎn)相連,而均值濾波則把圖像變模糊了,邊緣模糊的比較厲害。中值濾波后圖像的直方圖沒(méi)有變化,而均值濾波后的直方圖變化了。程序:A=zeros(256,256);fori=(1:64:256);forj=(1:64:256);A(j:j+32,i:i+32)=1;endendform=(32:64:256);forn=(32:64:256);
5、A(n:n+32,m:m+32)=1;endendfigureimshow(A)title('原圖像')figureK=medfilt2(A,[3,3])subplot(121)imshow(K)title('3*3中值濾波')M=filter2(fspecial('average',3),A)subplot(122)imshow(M)title('3*3均值值濾波')figuresubplot(131)imhist(A)axis([0202])title('原圖直方圖')subplot(132)imhist(K)axis([0202])title('中值濾波后的直方圖'
6、)subplot(133)imhist(M)axis([0202])title('均值濾波后的直方圖')整體而言中值濾波的結(jié)果比均值濾波的結(jié)果要好,均值濾波模糊了輪廓邊緣,但是中值濾波對(duì)椒鹽噪聲的濾波破壞了輪廓邊緣。中值濾波對(duì)高斯噪聲的水平濾波不是很好。程序:I=zeros(256,256);fori=(32:24:224);I(23:233,i:i+7)=1;endfigureimshow(I)title('原圖像')A=imnoise(I,'gaussian',0,0.025);figuresubplot(121)imshow(A)title('高斯白噪聲')B=im
7、noise(I,'salt&pepper',0.025);subplot(122)imshow(B)title('椒鹽噪聲')h=[111;111;111];%%領(lǐng)域平均法消除噪聲模板為1/9[111;111;111]h=9./h;Ja=conv2(A,h);figuresubplot(121)imshow(Ja,[])title('對(duì)高斯白噪聲的均值濾波')Jb=conv2(B,h);subplot(122)imshow(Jb,[])title('對(duì)椒鹽噪聲的均值濾波')Ka=medfilt2(A,[3,3])figures