数字图象处理_第1页
数字图象处理_第2页
数字图象处理_第3页
数字图象处理_第4页
数字图象处理_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、a = imread('D:UserscolaDesktop数字图像处理上机实验1Fig0338(a)(blurry_moon).tif');figure(1);subplot(1,2,1);imshow(a);title('原始图像');h=fspecial('laplacian');j=imfilter(a,h);subplot(1,2,2);imshow(a-j,);title('laplacian基础滤波器锐化后的图像');figure(2);subplot(1,2,1);imshow(a);title('原始图像

2、');h=0 -1 0;-1 5 -1;0 -1 0;j=conv2(a,h,'same');subplot(1,2,2);imshow(j,);title('laplacian手工指定锐化后的图像');I=imread('D:UserscolaDesktop数字图像处理上机实验1Fig0316(4)(bottom_left).tif');figure(1);J=histeq(I);subplot(1,2,1),imshow(I),title('原始图像');subplot(1,2,2),imhist(I,64),titl

3、e('原始的直方图');figure(2);subplot(1,2,1),imshow(J),title('直方图均衡化后的图像');subplot(1,2,2),imhist(J,64);title('均衡化后的直方图');figure(3);a=imhist(I)./numel(I);b=cumsum(a);x=linspace(0,1,256);plot(x,b);axis(0 1 0 1);set(gca,'xtick',0:0.2:1);set(gca,'ytick',0:0.2:1);xlabel(&#

4、39;输入亮度值','fontsize',20);ylabel('输出亮度值','fontsize',20);text(0.18,0.5,'变换函数','fontsize',20);clear all;clc; I=imread('D:UserscolaDesktop数字图像处理上机实验1Fig0343(a)(skeleton_orig).tif');I2=im2double(I);figure(1);imshow(I2);title('原始图像');figure(2);h=

5、fspecial('laplacian',0);j=imfilter(I2,h,'replicate');imshow(j,);title('laplacian锐化后的图像');figure(3);I22=I2-j;imshow(I22);title('3:1图和2图相减后图像');figure(4);h1=-1 -2 -1;0 0 0;1 2 1;h11=-1,0,1;-2,0,2;-1,0,1;graxx=filter2(h1,I2,'same'); graxx=abs(graxx);grayy=filter2

6、(h11,I2,'same');grayy=abs(grayy);ja=graxx+grayy;imshow(ja,);title('4:1图sobel梯度处理后图像');figure(5); h2 = fspecial('average',5);j2=imfilter(ja,h2); imshow(j2);title('5:使用5*5均值滤波器平滑后的sobel图像'); figure(6);j3=I22.*j2;imshow(j3);title('6:3图和5图相乘相乘的掩蔽图像');figure(7);j4=

7、I2+j3;imshow(j4);title('7:1图和6图求和得到的锐化图像'); figure(8);gamma=0.5; c=1; j5=c.*j4.gamma; imshow(j5); title('8:图7进行幂率变换后的最终图像'); figure(9);subplot(241);imshow(I2);subplot(242);imshow(j,);subplot(243);imshow(I22);subplot(244);imshow(ja,);subplot(245);imshow(j2);subplot(246);imshow(j3);sub

8、plot(247);imshow(j4);subplot(248);imshow(j5);f=imread('C:UserscolaDesktop数字图像处理第3次上机实习Fig1004(b)(turbine_blade_black_dot).tif');w=-1 -1 -1;-1 8 -1;-1 -1 -1;%模板g=abs(imfilter(double(f),w);%滤波T=max(g(:);%找最大值,设置阈值a=g>=T;%点检测最终结果subplot(131);imshow(f);subplot(132);imshow(g,);subplot(133);ims

9、how(a);f=imread('C:UserscolaDesktop数字图像处理第3次上机实习Fig1005(a)(wirebond_mask).tif');w =2 -1 -1;-1 2 -1;-1 -1 2;%模板g=abs(imfilter(double(f),w);subplot(121)imshow(g);T=max(g(:);%找最大值,设置阈值g2=g>=T;%线检测最终结果subplot(122)imshow(g2)f=imread('C:UserscolaDesktop数字图像处理第3次上机实习Fig1016(a)(building_origi

10、nal).tif');subplot(321),imshow(f);title('检测的原始图像');g1,t=edge(f,'sobel');subplot(322),imshow(g1);title('Sobel检测后图像');g2,t=edge(f,'Roberts');subplot(323),imshow(g2);title('Roberts检测后图像');g3,t=edge(f,'Prewitt');subplot(324),imshow(g2);title('Prewi

11、tt检测后图像');g4,t=edge(f,'log');subplot(325),imshow(g4);title('Log检测后图像');f=imread('C:UserscolaDesktop数字图像处理第3次上机实习Fig1038(a)(noisy_fingerprint).tif');T2=graythresh(f);%得到的是01的小数?g=f<=T2*255;subplot(121), imshow(f);title('原始图像');subplot(122),imshow(g);title('阈

12、值处理后的图像');I=imread('C:UserscolaDesktop数字图像处理第3次上机实习Fig0914(a)(licoln from penny).tif');subplot(121),imshow(I);title('原始图像');I1=im2bw(I);I2=bwperim(I1); %获取区域的周长subplot(1,2,2),imshow(I2);title('边界周长的二值图像');f=imread('C:UserscolaDesktop数字图像处理第3次上机实习Fig0911(a)(noisy_finge

13、rprint).tif');subplot(1,2,1),imshow(f);title('原始图像');se=strel('square',3);%建立结构元fo=imopen(f,se); %开运算foc=imclose(fo,se);%闭运算subplot(122),imshow(foc);f=imread('C:UserscolaDesktop数字图像处理第3次上机实习Fig0940(a)(rice_image_with_intensity_gradient).tif');subplot(1,2,1),imshow(f);titl

14、e('原始图像');se=strel('square',3);%建立结构元fo=imopen(f,se); %开运算f1=imtophat(fo,se);subplot(122),imshow(f-f1,);I=imread('C:UserscolaDesktop数字图像处理第3次上机实习building_canny.tif');subplot(121);imshow(I); %显示示例图片%Img = edge(I,'roberts'); H, T, R = hough(Img); %hough变换%subplot(122);P

15、 = houghpeaks(H, 15, 'threshold', ceil(0.3*max(H(:); %寻找最大点%lines = houghlines(Img, T, R, P,'FillGap',10,'MinLength',20 ); %返回找到的直线%imshow(I), hold on max_len = 0; for k = 1:length(lines) xy = lines(k).point1; lines(k).point2; plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','red'); % plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow'); %plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red'); endf=imread('C:UserscolaDesktop数字图像处理第3次上机实习calc

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论