




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、均衡化: 图像一直方图集中在低灰度区,图像偏暗;图像二直方图集中在高灰度区,图像偏亮;图像三直方图集中在中部,图像效反差小。a=imread(fig1_1_1.bmp);b=imread(fig1_1_2.bmp);c=imread(fig1_1_3.bmp);a1=histeq(a);b1=histeq(b);c1=histeq(c);subplot(3,3,1),imshow(a),title(原始图像1);subplot(3,3,2),imshow(b),title(原始图像2);subplot(3,3,3),imshow(c),title(原始图像3);subplot(3,3,4),i
2、mhist(a),title(图1直方图);subplot(3,3,5),imhist(b),title(图2直方图);subplot(3,3,6),imhist(c),title(图3直方图);subplot(3,3,7),imshow(a1),title(均衡化后图像1);subplot(3,3,8),imshow(b1),title(均衡化后图像2);subplot(3,3,9),imshow(c1),title(均衡化后图像3);平滑滤波:a=imread(fig1_2.bmp );a1=imnoise(a,salt & pepper,0.02);l1=filter2(fspecial
3、(average,3),a1)/255; l2=filter2(fspecial(average,5),a1)/255; l3=filter2(fspecial(average,7),a1)/255; l4=filter2(fspecial(average,9),a1)/255; figure (1)subplot(2,3,1),imshow(a),title(原始图像);subplot(2,3,2),imshow(l1);title(3*3 模板平滑滤波);subplot(2,3,3),imshow(l2);title(5*5 模板平滑滤波);subplot(2,3,4),imshow(l3
4、);title(7*7 模板平滑滤波);subplot(2,3,5),imshow(l4);title(9*9 模板平滑滤波);l11=filter2(fspecial(average,3),a)/255; l22=filter2(fspecial(average,5),a)/255; l33=filter2(fspecial(average,7),a)/255; l44=filter2(fspecial(average,9),a)/255; figure (2)subplot(2,3,1),imshow(a),title(原始图像);subplot(2,3,2),imshow(a1),tit
5、le( 添加椒盐噪声的图像);subplot(2,3,3),imshow(l11);title(3*3 模板平滑滤波);subplot(2,3,4),imshow(l22);title(5*5 模板平滑滤波);subplot(2,3,5),imshow(l33);title(7*7 模板平滑滤波);subplot(2,3,6),imshow(l44);title(9*9 模板平滑滤波);平滑滤波是低频增强的空间域滤波技术。它的目的有两类:一类是模糊;另一类是消除噪音。空间域的平滑滤波一般采用简单平均法进行,就是求邻近像元点的平均亮度值。在噪声均匀分布在边缘时,使用平滑滤波会有较大的误差,如果噪
6、声不是均匀分布,可有效去除噪声。邻域的大小与平滑的效果直接相关,邻域越大平滑的效果越好,但邻域过大,平滑会使边缘信息损失的越大,从而使输出的图像变得模糊,因此需合理选择邻域的大小。锐化滤波:i=imread(fig1_2.bmp); f= 8 ;g=-1 -1 -1; -1 8 -1; -1 -1 -1; m=-1 -1 -1 -1 -1; -1 -1 8 -1 -1;-1 -1 -1 -1 -1;n=-1 -1 -1 -1 -1 -1 -1; -1 -1 -1 8 -1 -1 -1;-1 -1 -1 -1 -1 -1 -1;p=-1 -1 -1 -1 -1 -1 -1 -1 -1;-1 -1
7、 -1 -1 8 -1 -1 -1 -1;-1 -1 -1 -1 -1 -1 -1 -1 -1;h=double(i);e=conv2(h,f,same);j=conv2(h,g,same);x=conv2(h,m,same);y=conv2(h,n,same);z=conv2(h,n,same);subplot(2,3,1);imshow(h);title(原始图像);subplot(2,3,2);imshow(e);title(滤波后图像1);subplot(2,3,3);imshow(j);title(滤波后图像2);subplot(2,3,4);imshow(x);title(滤波后图
8、像3);subplot(2,3,5);imshow(y);title(滤波后图像4); subplot(2,3,6);imshow(z);title(滤波后图像5);图像锐化处理的目的是为了使图像的边缘、轮廓线以及图像的细节变的清晰。一般情况下,在计算机图像处理中可用微分运算和高通滤波器来实现图像的锐化。空间域图像的锐化常用的是拉普拉斯运算,它不仅是偏导数的线性组合,而且是各向同性的,这样可以使图像中间任何方向伸展的边缘和轮廓线变得清晰低通滤波:I=imread(fig1_2.bmp); m n p=size(I);I=double(I);subplot(2,2,1);image(I);col
9、ormap(gray),title(原始图);Noise=wgn(m,n,25);New = Noise + I;subplot(2,2,2);image(New),title(噪声图);g=fft2(New); g=fftshift(g);M,N=size(g);nn=2; d0=20; m=fix(M/2); n=fix(N/2);for i=1:M for j=1:N d=sqrt(i-m)2+(j-n)2); h=1/(1+0.414*(d/d0)(2*nn); result(i,j)=h*g(i,j); endendresult=ifftshift(result);J2=ifft2(
10、result); J3=uint8(real(J2);subplot(2,2,3);image(J3),title(截止频率20 ); nn=2; d0=100; m=fix(M/2); n=fix(N/2);for i=1:M for j=1:N d=sqrt(i-m)2+(j-n)2); h=1/(1+0.414*(d/d0)(2*nn); result(i,j)=h*g(i,j); endendresult=ifftshift(result);J2=ifft2(result);J3=uint8(real(J2);subplot(2,2,4);image(J3),title(截止频率100
11、 )去掉信号中不必要的高频成分,降低采样频率,避免频率混淆,去掉高频干扰高通滤波:I=imread(fig1_2.bmp);m n p=size(I);I=double(I);subplot(2,2,1),image(I),colormap(gray);,title(原始图);Noise=wgn(m,n,25);New = Noise + I;subplot(2,2,2);image(New),title(噪声图);g=fft2(New); g=fftshift(g);M,N=size(g);d0=15; m=fix(M/2); n=fix(N/2);for i=1:M for j=1:N d
12、=sqrt(i-m)2+(j-n)2); if(d=d0) h=0; else h=1; end result(i,j)=h*g(i,j); endendresult=ifftshift(result);J1=ifft2(result);J2=uint8(real(J1);subplot(2,2,3),imshow(J2),title(IHPF滤波(d0=15) ;M,N=size(g);d0=100; m=fix(M/2); n=fix(N/2);for i=1:M for j=1:N d=sqrt(i-m)2+(j-n)2); if(dg)=2*pi-H(bg);H=H/(2*pi);nu
13、m=min(min(r,g),b);fen=r+g+b;fen(fen=0)=eps;S=1-3.*num./fen;H(S=0)=0;I=(r+g+b)/3;hsi=cat(3,H,S,I);subplot(3,3,7),imshow(H),title(H);subplot(3,3,8),imshow(S),title(S);subplot(3,3,9),imshow(I),title(I);I1=rgb2gray(rgb);subplot(3,3,2),imshow(I1);title(灰度图像);k1=filter2(fspecial(average,3),I1)/255; subplo
14、t(3,3,3),imshow(k1);title(平滑滤波图像);图像的校正:A=imread(fig3_1.bmp); se=strel(ball,12,0);BW=imdilate(A,se);BW2 = bwmorph(BW, thin,Inf);H,T,R = hough(BW2);P = houghpeaks(H,5); lines = houghlines(BW2,T,R,P);for k = 1:length(lines) xy = lines(k).point1; lines(k).point2;endm=(xy(2,2)- xy(1,2)/(xy(2,1)-xy(1,1);
15、M=atan(m);M=M*180/3.14;C=imrotate(A,M); subplot(1,2,1);imshow(A);title(原图像);subplot(1,2,2);imshow(C);title(校正后的图像);图像融合:X1=imread(fig4_1_a.jpg);X2=imread(fig4_1_b.jpg);X3=imread(fig4_1_c.jpg);X4=imread(fig4_1_d.jpg);X5=imread(fig4_1_e.jpg);X6=imread(fig4_1_f.jpg);subplot(3,2,1);imshow(X1);title(序列图像
16、1);subplot(3,2,2);imshow(X2);title(序列图像2);subplot(3,2,3);imshow(X3);title(序列图像3);subplot(3,2,4);imshow(X4);title(序列图像4);subplot(3,2,5);imshow(X5);title(序列图像5);subplot(3,2,6);imshow(X6);title(序列图像);X1=double(X1);X2=double(X2);X3=double(X3);X4=double(X4);X5=double(X5);X6=double(X6);c1,I1=wavedec2(X1,3
17、,sym4);c2,I2=wavedec2(X2,3,sym4);c3,I3=wavedec2(X3,3,sym4);c4,I4=wavedec2(X4,3,sym4);c5,I5=wavedec2(X5,3,sym4);c6,I6=wavedec2(X6,3,sym4);%对分解系数进行融合c=c1+c2+c3+c4+c5+c6;I=I1+I2+I3+I4+I5+I6; c=0.001*(c1+c2+c3+c4+c5+c6);%应用融合系数进行图像重构并显示XX=waverec2(c,I1,sym4);figure;XX=double(XX);imshow(XX);title(融合图像);图像压缩:clearI=imread(fig5_1.tif); %该图片在安装matlab的目录中找,原图为灰度图象 I=im2double(I);%图像存储类型转换 T=dctmtx(8);%离散余弦变换矩阵 B=blkproc(I,8 8,P1*x*P2,T,T); %对原图像进行DCT变换 mask=1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025买卖合同需要注意的事项
- 高级审计师试题及答案的总结与体会试题及答案
- 高级审计师考试应试技巧备战攻略及试题及答案
- 高级会计实务发展趋势试题及答案
- 2025授权开发合同协议范本
- 附中六年级上册试卷及答案
- 佛山高三生物试卷及答案
- 高级会计知识脉络试题及答案总结
- 2025租房委托合同样本
- 2025全年业绩提升合同
- 2025年广东省高三语文5月模拟联测试卷附答案解析
- 2024年河北省魏县事业单位公开招聘医疗卫生岗笔试题带答案
- 道路施工现场安全管理措施
- 歌曲《wake》中英文歌词对照
- 深圳经济特区行业协会章程示范文本
- 工作面安全生产条件验收表
- 门诊病历书写规范PPT
- 2022版《语文课程标准》
- DB13(J)∕T 8057-2019 市政排水管渠工程施工质量验收标准
- 最新中山市中小学校情况一览表
- 管廊、管架基础施工方案
评论
0/150
提交评论