版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、例8-2clear all;I=imread(circuit.tif);figure;subplot(221);imshow(I);subplot(222);imhist(I);I1=histeq(I);subplot(223);imshow(I1);subplot(224);imhist(I1);例8-4I=imread(circuit.tif);M,N=size(I);for i=1:8:257 counts(i)=i;endQ=imread(circuit.tif);N=histeq(Q,counts);figure;subplot(221);imshow(N);subplot(222)
2、;imhist(N);axis(0 256 0 5000);例8-5clear;a=imread(coins.png); %读取图像anoised=imnoise(a,gaussian,0.1,0.005); %对图像进行高斯加噪%制定卷积核h=ones(3,3)/5;h(1,1)=0;h(1,3)=0;h(3,1)=0;h(1,3)=0;%平滑运算a2=imfilter(anoised,h);subplot(131);imshow(a); %显示原始图像subplot(132);imshow(anoised); %加有高斯噪声的图像subplot(133);imshow(a2); %经过平滑
3、后的图像例8-6clear all;I=imread(eight.tif);J=imnoise(I,salt & pepper,0.02);subplot(231);imshow(I);subplot(232);imshow(J);K1=filter2(fspecial(average,3),J); %进行33模板平滑滤波K2=filter2(fspecial(average,5),J); %进行55模板平滑滤波K3=filter2(fspecial(average,7),J); %进行77模板平滑滤波K4=filter2(fspecial(average,9),J); %进行99模板平滑滤波
4、subplot(233);imshow(uint8(K1);subplot(234);imshow(uint8(K2);subplot(235);imshow(uint8(K3);subplot(236);imshow(uint8(K4);例8-7a=imread(coins.png); %读取图像b=imnoise(a,salt & pepper,0.02); %对图像增加椒盐噪声k=medfilt2(b); %中值滤波去噪subplot(131);imshow(a); xlabel(原始图像);subplot(132);imshow(b);xlabel(含有椒盐噪声图像);subplot(
5、133);imshow(k);xlabel(中值滤波去噪图像);例8-9I=imread(lena.bmp);J=im2double(I);subplot(2,2,1),imshow(J,)h1=0 -1 0, -1 5 -1,0 -1 0;h2=-1 -1 -1, -1 9 -1,-1 -1 -1;h3=1 -2 0, -2 5 -2,1 -2 1;A=conv2(J,h1,same);subplot(2,2,2), imshow(A,)B=conv2(J,h2,same);subplot(2,2,3),imshow(B,)C=conv2(J,h3,same);subplot(2,2,4),
6、imshow(C,)例8-10clear all;I,map=imread(lena.bmp);figure(1),imshow(I,map);I=double(I);IX,IY=gradient(I);GM=sqrt(IX.*IX+IY.*IY);meth1=GM;figure(2),imshow(meth 1,map);meth 2=I;J=find(GM10);meth 2(J)=GM(J);figure(3),imshow(meth 2,map);meth 3=I; J=find(GM10);meth 3(J)=255;figure(4),imshow(meth 3,map);meth
7、 4=I;J=find(GM10);meth 5(J)=255;Q=find(GM10);OUTS(Q)=0;figure(6),imshow(meth 5,map);例8-11I=imread(cat.jpg);h1=0,-1,0;-1,5,-1;0,-1,0;h2=-1,-1,-1;-1,9,-1;-1,-1,-1;BW1=imfilter(I,h1);BW2=imfilter(I,h2);figure;subplot(131);imshow(I);subplot(132);imshow(BW1);subplot(133);imshow(BW2);例8-12clear;I=imread(l
8、ena.bmp);I1=double(I);h1=fspecial(sobel);I2=filter2(h1,I);figure;subplot(121);imshow(I);I3=I1-I2;subplot(122);imshow(I3,);例8-13clear all;%实现巴特沃斯低通滤波器I=imread(saturn.png);J=imnoise(I,salt & pepper,0.02); %给原图像加入椒盐噪声figure;subplot(121);imshow(J);J=double(J);%采用傅里叶变换f=fft2(J);%数据矩阵平衡g=fftshift(f);m,n=s
9、ize(f);N=3;d0=20;n1=floor(m/2);n2=floor(n/2);for i=1:m for j=1:n d=sqrt(i-n1)2+(j-n2)2); h=1/(1+(d/d0)(2*N); g(i,j)=h*g(i,j); endendg=ifftshift(g);g=uint8(real(ifft2(g);subplot(122);imshow(g);例8-14clear all;% 频域高通滤波法对图像进行增强I,map=imread(lena.bmp);noisy=imnoise(I,gaussian,0.01); %原图中加入高斯噪声M N=size(I);
10、F=fft2(noisy);fftshift(F);Dcut=100;D0=250;D1=150;for u=1:M for v=1:N D(u,v)=sqrt(u2+v2);%巴特沃斯高通滤波器传递函数BUTTERH(u,v)=1/(1+(sqrt(2)-1)*(Dcut/D(u,v)2;EXPOTH(u,v)=exp(log(1/sqrt(2)*(Dcut/D(u,v)2); %指数高通滤波器传递函数 if D(u,v)D1 %梯形高通滤波器传递函数 THFH(u,v)=0; elseif D(u,v)=1 & yr(i)=m) if f(yr(i),xr(i)=1 if xmin=0 xmin=i; end xmax=i; end end end if tetadetect(n1)=0 x=xmin-1:xmax-1; y=y(x+1); else y=xmin-1:xmax-1; x=x(y+1); end y=m-1-y; plot(x,y,linewidth,1); hold on;endaxis(0,m-1,0,n-1);title(Hough变换检测出的直线);例9-5f=imread(woman.bmp);subplot(121);imshow(f);title(原始图像);f=double(f);T=(min(f(
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年银行业专业人员中级职业资格考试(专业实务个人理财)试题及答案(青海果洛)
- 2026年行政执法人员行政执法资格证试题库及答案(真题版)
- 小学数学《图形的旋转》课件
- 人工基础应用 第十一章 课后习题参考答案
- 无人机企业电池循环寿命方案
- 企业文化体系构建与落地方案
- 相交线题目及答案应用题
- 企业出差管理与差旅标准制度
- 软件开发企业项目研发成本管控方案
- 2026年全国执业兽医资格考试(兽医全科类)《预防科目》真题回忆版
- A4版2023-6山东新高考数学答题卡 (新课标I卷)w可编辑改成A4版方便打印
- 平台印刷机-机械原理课程设计报告
- 实验设计与统计分析
- 医防融合的实践路径与手段分析
- 吉林大学物理化学实验 习题与试卷
- 2023年模具业界掀起低碳环保时代风报告模板
- 地下室聚氨酯防水技术交底
- 大学英语四级真题阅读练习10套(附参考答案)
- 贵阳市普通中学2022-2023学年度高一下学期期末语文试题(扫描版含答案)
- 机器人概论期末试卷(B)
- (11.5)-4.3.1高原珍宝红景天中药养颜秘籍
评论
0/150
提交评论