数字图象处理实验题剖析精选.pptVIP

  • 5
  • 0
  • 约2.53千字
  • 约 22页
  • 2020-12-23 发布于福建
  • 举报
数字图象处理 张晓与 地图学与地理信息系统 A1编程实现图象同时对比度 d= zeros(32,32);%背景灰度值为0,图像尺寸为32x32 d(13:20,13:20)=2;%中心方块为8x8,灰度值为2 figure %建立图形窗口 subplot (221) ashow(d,[0,5]);%显示图像d d= zeros(32,32)+1;%景灰度值为1,图像尺寸为32x32 d(13:20,13:20)=2 subplot (222) imshow(d, [0, 5) d= zeros(32,32)+3;%背景灰度值为3,图像尺寸为32x32 d(13:20,13:20)=2; subplot (223) imshow(d,[0, 5) d= zeros(32,32)+5;%背景灰度值为5,图像尺寸为32x32 d(13:20,13:20)=2 subplot (224) imshow(d, [0, 5) A1结果 - FigurE 1 dt监s” Insert Iool:la: op Lindow Help A2编程实现马赫带效应 c⊥ear d=zeros(6, 40) %背景灰度值为0,图像尺寸为6x40 6,1:2)=0;d(1:6,3:4)=1;d(1:6,5:6)=2 d(1:6,7:8)=3;d(1:6,9:10)=4;d(1:6,1:12)=5 d(1:6,13:14)=6;d(1:6,15:16)=7;d(1:6,17:18)=8; d(1:6,19:20)=9;d(1:6,21:22)=10;d(1:6,23:24)=11 d(1:6,25:26)=12;d(1:6,27:28)=13;d(1:6,29:30)=14; d(1:6,31:32)=15;d(1:6,33:34)=16;d(1:6,35:36)=17 d(1:6,37:38)=18;d(1:6,39:40)=19 figure %显示图形窗口 imshow(d,[0,20],’ notruesize’);%显示图形d a Figure 1 口口舀小闽只曾回口国■回 B1编程实现图象读入,计算并显示图象的 复利叶功率谱;进一步实现 巴特沃斯高通滤波 巴特沃斯低通滤波 A= tread(‘ shilong.jpg’);%图像读入 B=gb2gray(A);%RGB图像转换灰度图像 subplot(231), dshow(B); title(灰度图像’) C-fftshift(fft2(double (B))) %显示图像傅立叶频谱 subplot(232), dshow(1og(abs(C)),[]); title(傅立叶频谱’) %显示图像傅立叶功率谱 subplot(233), ashow(log((abs(C)^2),[]); title(傅立叶功率 谱”) N1,N2]=size(C);%‰ Butterworth高通滤波器 do nl=fix(N1/2) n2=fix(N2/2) for i=l: NI for j=1: N2 d=sgrt((i-n1)2+(j-n2)2) if d==0 h=0 h=1/(1+(d0/d)(2*n)); end D(i, j)=h*c(i, j) nd E=ifft(ifftshift( D)) F=uint8 (real(E)) subplot(234), ashow(F); title( Butterworth高通滤波结果 G=impose (B,salt pepper,0.02);%添加椒盐噪声 subplot(235), ashow(G); title(添加椒盐噪声 ftshift(fft2(double(G))) N1,N2]=size(H);‰ Butterworth低通滤波器 d0=50 nl=fix(N1/2) n2=fix(N2/2) for 1=1: NI d=sqrt(i-n1)2+(j-n2)2); h=1/(1+0.414*(d/d0)”(2*n) I(i, j)=h*H(i, j) d end J=ifft (ifftshift(I)) K=uint8 (real() subplot(236), ashow(K); title( Butterworth低通滤波结果) B1结果 回区 iile Edit Yiew Insert Lools Desktop Window Help @口舀t回回■國 灰度图像 傅立叶频塔 υlr巾高通滤波结果添加椒盐噪声E

文档评论(0)

1亿VIP精品文档

相关文档