首页 Matlab图像处理实验指导书

Matlab图像处理实验指导书

举报
开通vip

Matlab图像处理实验指导书郑州大学 《Matlab应用图像处理》课程实验指导书 郑 州 大 学 《 Matlab应用图像处理 》课程 实 验 指 导 书 电气工程学院·生物医学工程系 2006年11月 实验一 Matlab图像显示方法 一、实验目的 1. 了解Matlab的基本功能及操作方法 2. 练习图像读写和显示函数的使用方法 3. 掌握Matlab支持的五类图像的显示方法 二、实验内容 1. 图像的读写 a) 图像读 RGB = imread('ngc6543a.jpg'); b) 图像写 先从一个.mat ...

Matlab图像处理实验指导书
郑州大学 《Matlab应用图像处理》课程实验指导书 郑 州 大 学 《 Matlab应用图像处理 》课程 实 验 指 导 书 电气工程学院·生物医学工程系 2006年11月 实验一 Matlab图像显示 方法 快递客服问题件处理详细方法山木方法pdf计算方法pdf华与华方法下载八字理论方法下载 一、实验目的 1. 了解Matlab的基本功能及操作方法 2. 练习图像读写和显示函数的使用方法 3. 掌握Matlab支持的五类图像的显示方法 二、实验内容 1. 图像的读写 a) 图像读 RGB = imread('ngc6543a.jpg'); b) 图像写 先从一个.mat 文件中载入一幅图像,然后利用图像写函数imwrite,创建一个.bmp文件,并将图像存入其中。 load clown whos imwrite(X,map,'clown.bmp') c) 图像文件格式转换 bitmap = imread('clown.bmp','bmp'); imwrite(bitmap,'clown.png','png'); 2. 图像显示 a) 二进制图像的显示 BW1=zeros(20,20); %创建仅包含0/1的双精度图像 BW1(2:2:18,2:2:18)=1; imshow(BW1,'notruesize'); whos BW2=uint8(BW1); figure,imshow(BW2,'notruesize') BW3=BW2~=0; %逻辑 标志 禁止坐卧标志下载饮用水保护区标志下载桥隧标志图下载上坡路安全标志下载地理标志专用标志下载 置为on figure,imshow(BW3,'notruesize') whos BW=imread('circles.tif'); imshow(BW); figure,imshow(~BW); figure,imshow(BW,[1 0 0;0 0 1]); b) 灰度图像的显示 I=imread('testpat1.tif'); J=filter2([1 2;-1 -2],I); imshow(I) figure,imshow(J,[]) c) 索引图像的显示 load clown %装载一幅图像 imwrite(X,map,'clown.bmp'); %保存为bmp文件 imshow(X) imshow(X,map) d) RGB图像的显示 I=imread('flowers.tif'); imshow(I) RGB=imread('ngc6543a.jpg'); figure,imshow(RGB) imshow(I(:,:,3) % 显示第3个颜色分量 e) 多帧图像的显示 mri=uint8(zeros(128,128,1,27)); % 27帧文件mri.tif初始化 for frame=1:27 [mri(:,:,:,frame),map]=imread('mri.tif',frame); % 读入每一帧 end imshow(mri(:,:,:,3),map); % 显示第3帧 figure,imshow(mri(:,:,:,6),map); % 显示第6帧 figure,imshow(mri(:,:,:,10),map); % 显示第10帧 figure,imshow(mri(:,:,:,20),map); % 显示第20帧 f) 显示多幅图像 [X1,map1]=imread('forest.tif'); [X2,map2]=imread('trees.tif'); subplot(1,2,1),imshow(X1,map1) subplot(1,2,2),imshow(X2,map2) subplot(1,2,1),subimage(X1,map1) subplot(1,2,2),subimage(X2,map2) 三、思考 快递公司问题件快递公司问题件货款处理关于圆的周长面积重点题型关于解方程组的题及答案关于南海问题 : 1. 图像显示时,若不带参数’notruesize’,显示效果如何? 2. 如何显示RGB图像的某一个颜色分量? 3. 如何显示多帧图像的所有帧?如何根据多帧图像创建电影片段? 实验二 图像运算 一、实验目的 1. 熟悉图像点运算和代数运算的实现方法 2. 了解图像几何运算的简单应用 3. 了解图像的邻域操作 二、实验内容 1. 图像点运算 读入图像‘rice.tif’,通过图像点运算改变对比度。 rice=imread('rice.tif'); subplot(131),imshow(rice) I=double(rice); %转换为双精度类型 J=I*0.43+60; rice2=uint8(J); %转换为uint8 subplot(132),imshow(rice2) J=I*1.5-60; rice3=uint8(J); %转换为uint8 subplot(133),imshow(rice3) 2. 图像的代数运算 a) 图像加法运算 I=imread('rice.tif'); imshow(I) J=imread('cameraman.tif'); figure,imshow(J) K=imadd(I,J); figure,imshow(K) K2=imadd(I,J,'uint16'); figure,imshow(K2,[]) RGB=imread('flowers.tif'); RGB2=imadd(RGB,50); imshow(RGB) figure,imshow(RGB2) RGB3=imadd(RGB,100); figure,imshow(RGB3) b) 图像减法运算 I=imread('rice.tif'); imshow(I) background = imopen(I,strel('disk',15)); %估计背景图像 figure, imshow(background); I2=imsubtract(I,background); %从原始图像中减去背景图像 figure, imshow(I2) c) 图像乘法运算 I=imread('moon.tif'); J=immultiply(I,1.2); K=immultiply(I,0.5); imshow(I) figure,imshow(J) figure,imshow(K) d) *图像除法运算 3. 图像的几何运算 a) 改变图像的大小 读入图像‘ic.tif’,改变图像大小,分别将原图像放大1.5倍和缩小0.5倍。 I=imread('ic.tif'); J=imresize(I,1.25); K=imresize(I,0.8); imshow(I) figure,imshow(J) figure,imshow(K) Y=imresize(I,[100,150]); figure,imshow(Y) b) 旋转一幅图像 将上述图像顺时针和逆时针旋转任意角度,观察显示效果。 I=imread('ic.tif'); J=imrotate(I,30,'bilinear'); J1=imrotate(I,30,'bilinear','crop'); imshow(I) figure,imshow(J) figure,imshow(J1) J2=imrotate(I,-15,'bilinear'); figure,imshow(J2) c) 图像剪切 通过交互式操作,从一幅图像中剪切一个矩形区域。 I=imread('ic.tif'); imshow(I); I1=imcrop; figure,imshow(I1) I2=imcrop(I,[30 60 120 160]); figure,imshow(I2) 4. *图像的邻域操作 读入图像‘tire.tif’,分别使用函数nlfilter和blkproc对图像进行滑动邻域操作和分离邻域操作。 I=imread('tire.tif'); f=inline('max(x(:))'); %构造复合函数 I2=nlfilter(I,[3 3],f); %滑动邻域操作 imshow(I) figure,imshow(I2) I=imread('tire.tif'); f=inline('uint8(round(mean2(x)*ones(size(x))))'); %构造复合函数 I2=blkproc(I,[8 8],f); %滑动邻域操作 imshow(I) figure,imshow(I2) 实验三 图像变换与滤波器设计 一、实验目的 1. 了解傅立叶变换、离散余弦变换及Radon变换在图像处理中的应用 2. 了解Matlab线性滤波器的设计方法 二、实验内容 1. 傅立叶变换 a) 绘制一个二值图像矩阵,并将其傅立叶函数可视化。 f=zeros(30,30); f(5:24,13:17)=1; imshow(f,'notruesize') F=fft2(f); F2=log(abs(F)); figure,imshow(F2,[-1 5],'notruesize');colormap(jet); F=fft2(f,256,256); %零填充为256×256矩阵 figure,imshow(log(abs(F)),[-1 5],'notruesize');colormap(jet); F2=fftshift(F); %将图像频谱中心由矩阵原点移至矩阵中心 figure,imshow(log(abs(F2)),[-1 5],'notruesize');colormap(jet); b) 利用傅立叶变换分析两幅图像的相关性,定位图像特征。读入图像‘text.tif’,抽取其中的字母‘a’。 bw=imread('text.tif'); a=bw(59:71,81:91); imshow(bw); figure,imshow(a); C=real(ifft2(fft2(bw).*fft2(rot90(a,2),256,256)));%求相关性 figure,imshow(C,[]); thresh=max(C(:)); figure,imshow(C>thresh-10) figure,imshow(C>thresh-15) 2. 离散余弦变换(DCT) a) 使用dct2对图像‘autumn.tif’进行DCT变换。 RGB=imread('autumn.tif'); imshow(RGB) I=rgb2gray(RGB); %转换为灰度图像 figure,imshow(I) J=dct2(I); figure,imshow(log(abs(J)),[]),colormap(jet(64));colorbar; b) 将上述DCT变换结果中绝对值小于10的系数舍弃,使用idct2重构图像并与原图像比较。 RGB=imread('autumn.tif'); I=rgb2gray(RGB); %转换为灰度图像 J=dct2(I); figure,imshow(I) K=idct2(J); figure,imshow(K,[0 255]) J(abs(J)<10)=0; %舍弃系数 K2=idct2(J); figure,imshow(K2,[0 255]) c) 利用DCT变换进行图像压缩。 I=imread('cameraman.tif'); I=im2double(I); T=dctmtx(8); B=blkproc(I,[8,8],'P1*x*P2',T,T'); 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; B2=blkproc(B,[8 8],'P1.*x',mask); I2=blkproc(B2,[8 8],'P1*x*P2',T',T); imshow(I) figure,imshow(I2) 3. Radon变换 使用Radon逆变换重建图像。 P=phantom(256); %创建256灰度级大脑图 imshow(P) theta1=0:10:170;[R1,xp]=radon(P,theta1); %18个投影 theta2=0:5:175; [R2,xp]=radon(P,theta2); %36个投影 theta3=0:2:178; [R3,xp]=radon(P,theta3); %90个投影 figure,imagesc(theta3,xp,R3);colormap(hot);colorbar % 使用逆变换重构图像 I1=iradon(R1,10); %用R1重构图像 I2=iradon(R2,5); %用R2重构图像 I3=iradon(R3,2); %用R3重构图像 figure,imshow(I1) figure,imshow(I2) figure,imshow(I3) 4. *Matlab线形滤波器设计 采用频率变换方式,通过一维最优波纹FIR滤波器创建二维FIR滤波器(p96)。 b=remez(10,[0 0.4 0.6 1],[1 1 0 0]); %阶次,频率向量,对应的理想幅频响应 h=ftrans2(b); [H,w]=freqz(b,1,64,'whole'); colormap(jet(64)) plot(w/pi-1,fftshift(abs(H))); %使x轴取值0处对应曲线中心 figure,freqz2(h,[32 32]) 实验四 形态学操作与空间变换 一、实验目的 1. 了解膨胀和腐蚀的Matlab实现方法 2. 掌握图像膨胀、腐蚀、开启、闭合等形态学操作函数的使用方法 3. 了解二进制图像的形态学应用 4. 了解空间变换函数及图像匹配方法 二、实验内容 1. 图像膨胀 a) 对包含矩形对象的二进制图像进行膨胀操作。 BW=zeros(9,10); BW(4:6,4:7)=1; imshow(BW,'notruesize') se=strel('square',3); %正方形结构元素 BW2=imdilate(BW,se); figure,imshow(BW2,'notruesize') b) 改变上述结构元素类型(如:line, diamond, disk等),重新进行膨胀操作。 c) 对图像‘text.tif’进行上述操作,观察不同结构元素膨胀的效果。 BW3=imread('text.tif'); imshow(BW3) se2=strel('line',11,90); %线型结构元素 BW4=imdilate(BW3,se2); figure,imshow(BW4) 2. 图像腐蚀 a) 对图像‘circbw.tif’进行腐蚀操作。 BW1=imread('circbw.tif'); se=strel('arbitrary',eye(5)); BW2=imerode(BW1,se); imshow(BW1) figure,imshow(BW2) b) 对图像‘text.tif’进行腐蚀操作。 BW=imread('text.tif'); se=strel('line',11,90); BW2=imerode(BW3,se); imshow(BW) figure,imshow(BW2) 3. 膨胀与腐蚀的综合使用 a) 从原始图像‘circbw.tif’中删除电流线,仅保留芯片对象。 方法一:先腐蚀(imerode),再膨胀(imdilate); BW1=imread('circbw.tif'); imshow(BW1) se=strel('rectangle',[40 30]); %选择适当大小的矩形结构元素 BW2=imerode(BW1,se); %先腐蚀,删除较细的直线 figure,imshow(BW2) BW3=imdilate(BW2,se); %再膨胀,恢复矩形的大小 figure,imshow(BW3) 方法二:使用形态开启函数(imopen)。 BW1=imread('circbw.tif'); imshow(BW1) se=strel('rectangle',[40 30]); BW2=imopen(BW1,se); %开启操作 figure,imshow(BW2) b) 改变结构元素的大小,重新进行开启操作,观察处理结果。 se=strel(‘rectangle’,[20 10]); se=strel(‘rectangle’,[50 40]); c) 置结构元素大小为[4 3],同时观察形态开启(imopen)与闭合(imclose)的效果, 总结 初级经济法重点总结下载党员个人总结TXt高中句型全总结.doc高中句型全总结.doc理论力学知识点总结pdf 形态开启与闭合在图像处理中的作用。 I=imread('circbw.tif'); imshow(I) se=strel('rectangle',[4 3]); I1=imopen(I,se); %开启操作 I2=imclose(I,se); %闭合操作 figure,imshow(I1) figure,imshow(I2) 4. *高帽与低帽变换 a) 读入图像‘pearlite.tif’,分别显示其高帽变换与低帽变换结果,并与原图像比较。(设se=strel('disk',5);)。 I=imread('pearlite.tif'); subplot(221),imshow(I) se=strel('disk',5); J=imtophat(I,se); subplot(222),imshow(J) K=imbothat(I,se); subplot(223),imshow(K) L=imsubtract(imadd(J,I),K); subplot(224),imshow(L) b) 要求显示在一个窗口中。 5. 图像极值的处理方法 a) 对于下图所示的图像矩阵A,利用函数imregionalmax寻找其局部极大值 A=[10 10 10 10 10 10 10 10 10 10; 10 13 13 13 10 10 11 10 11 10; 10 13 13 13 10 10 10 11 10 10; 10 13 13 13 10 10 11 10 11 10; 10 10 10 10 10 10 10 10 10 10; 10 11 10 10 10 18 18 18 10 10; 10 10 10 11 10 18 18 18 10 10; 10 10 11 10 10 18 18 18 10 10; 10 11 10 11 10 10 10 10 10 10; 10 10 10 10 10 10 11 10 10 10]; B=imregionalmax(A) b) 利用函数imextendedmax寻找像素值大于其邻域像素值2个单位的局部极大值。 C=imextendedmax(A,2) 6. *创建一幅图像,求其距离矩阵。 bw=zeros(5,5); bw(2,2)=1;bw(4,4)=1; D=bwdist(bw) center1=-10; center2=-center1; dist=sqrt(2*(2*center1)^2); radius=dist/2*1.4; lims=[floor(center1-1.2*radius) ceil(center2+1.2*radius)]; [x,y]=meshgrid(lims(1):lims(2)); bw1=sqrt((x-center1).^2+(y-center2).^2)<=radius; bw2=sqrt((x-center2).^2+(y-center2).^2)<=radius; bw1=sqrt((x-center1).^2+(y-center1).^2)<=radius; bw=bw1|bw2; imshow(bw) D=bwdist(bw); figure,imshow(D,[ ]) D1=bwdist(~bw); figure,imshow(D1,[ ]) 7. *使用伪彩色显示标记矩阵。 BW=[0 0 0 0 0 0 0 0; 0 1 1 0 0 1 1 1; 0 1 1 0 0 0 1 1; 0 1 1 0 0 0 0 0; 0 0 0 1 1 0 0 0; 0 0 0 1 1 0 0 0; 0 0 0 1 1 0 0 0; 0 0 0 0 0 0 0 0] X=bwlabel(BW,4) RGB=label2rgb(X,@jet,'k'); imshow(RGB,'notruesize') 8. 利用选择控制点实现图像匹配。 Matlab图像匹配的步骤: 将标准图像和待匹配图像读入Matlab;指定图像中的控制点对并保存;使用互相关性进一步协调控制点对(可选);制定所需变换类型并根据控制点对推断变换参数;变换未匹配的图像。 %读入待匹配图像和标准图像 unregistered = imread('westconcordaerial.png'); imshow(unregistered) orthophoto = imread('westconcordorthophoto.png'); figure,imshow(orthophoto) %选择图像中对应的控制点 cpselect(unregistered(:,:,1),orthophoto) %保存控制点对 input_points base_points %使用相关性进一步协调控制点对 input_points_corr=cpcorr(input_points,base_points,unregistered(:,:,1),orthophoto); input_points_corr %根据控制点对推断空间变换参数 mytform=cp2tform(input_points,base_points,'projective'); %变换未匹配的图像 registered=imtransform(unregistered,mytform); figure,imshow(registered) 实验五 图像增强与复原 一、实验目的: 1. 了解灰度变换增强和空域滤波增强的Matlab实现方法 2. 掌握直方图灰度变换方法 3. 掌握噪声模拟和图像滤波函数的使用方法 4. 了解图像复原的Matlab实现方法 二、实验内容 1. 灰度变换增强 a) 线段上像素灰度分布 读入灰度图像‘debye1.tif’,采用交互式操作,用improfile绘制一条线段的灰度值。 imshow('debye1.tif') improfile 读入RGB图像‘flowers.tif’,显示所选线段上红、绿、蓝颜色分量的分布 imshow('flowers.tif') improfile b) 直方图变换 i. 直方图显示 读入图像‘rice.tif’,在一个窗口中显示灰度级n=64,128和256的图像直方图。 I=imread('rice.tif'); imshow(I) figure,imhist(I,64) figure,imhist(I,128) ii. 直方图灰度调节 利用函数imadjust调解图像灰度范围,观察变换后的图像及其直方图的变化。 I=imread('rice.tif'); imshow(I) figure,imhist(I) J=imadjust(I,[0.15 0.9],[0 1]); figure,imhist(J) figure,imshow(J) I=imread('cameraman.tif'); imshow(I) figure,imhist(I) J=imadjust(I,[0 0.2],[0.5 1]); figure,imhist(J) figure,imshow(J) iii. 直方图均衡化 分别对图像‘pout.tif’和‘tire.tif’进行直方图均衡化处理,比较处理前后图像及直方图分布的变化。 I=imread('pout.tif'); imshow(I) figure,imhist(I) J=histeq(I); figure,imhist(J) figure,imshow(J) I=imread('tire.tif'); imshow(I) figure,imhist(I) J=histeq(I); figure,imshow(J) figure,imhist(J) 2. 空域滤波增强 A) 噪声模拟 利用函数imnoise给图像‘eight.tif’分别添加高斯(gaussian)噪声和椒盐(salt & pepper)噪声。 I=imread('eight.tif'); imshow(I) I1=imnoise(I,'gaussian',0,0.01); figure,imshow(I1) I2=imnoise(I,'salt & pepper'); figure,imshow(I2) B) 空域滤波 对上述噪声图像进行均值滤波和中值滤波,比较滤波效果。 I=imread('eight.tif'); J=imnoise(I,'salt & pepper',0.02); imshow(J) K1=medfilt2(J,[3 3]); % 3*3中值滤波 figure,imshow(K1) K2=filter2(fspecial('average',5),J)/255; figure,imshow(K2) 总结均值滤波和中值滤波的特点及使用场合。 均值滤波器是一种最常用的线性低通平滑滤波器。可抑制图像中的噪声,但同时也使图像变得模糊 中值滤波器是一种最常用的非线性平滑滤波器。可消除图像中孤立的噪声点,又可产生较少的模糊 *对图像'saturn.tif'采用'laplacian'高通滤波器进行锐化滤波。 I=imread('saturn.tif'); imshow(I) h=fspecial('laplacian'); I2=filter2(h,I); figure,imshow(I2) 3. 图像复原 A) 模糊与噪声 对图像‘flowers.tif’分别采用运动PSF和均值滤波PSF进行模糊。 I=imread('flowers.tif'); I=I(10+[1:256],222+[1:256],:); %剪切图像 imshow(I) len=30; %运动位移 theta=10; %运动角度 PSF=fspecial('motion',len,theta); blurred=imfilter(I,PSP,'circular','conv'); figure,imshow(blurred) I=imread('flowers.tif'); imshow(I) H=fspecial('motion',50,45); %运动PSP motionblur=imfilter(I,H); figure,imshow(motionblur) H=fspecial(‘disk’,10); %均值滤波PSP averageblur=imfilter(I,H); figure,imshow(averageblur) 在上述模糊图像上再添加噪声 J=imnoise(motionblur,'salt & pepper'); figure,imshow(J) B) 维纳滤波复原 使用维纳滤波复原函数deconvwnr复原无噪声模糊图像。 len=30; theta=10; PSF=fspecial('motion',len,theta); blurred=imfilter(I,PSF,'circular','conv'); figure,imshow(blurred) wnr1=deconvwnr(blurred,PSF); %真实PSF figure,imshow(wnr1) %非真实PSF wnr2=deconvwnr(blurred,fspecial('motion',2*len,theta)); figure,imshow(wnr2) %非真实PSF wnr3=deconvwnr(blurred,fspecial('motion',len,2*theta)); figure,imshow(wnr3) *使用维纳滤波复原函数deconvwnr复原模糊噪声图像。 PSF=fspecial('motion',len,theta); blurred=imfilter(I,PSF,'circular','conv'); noise=0.1*randn(size(I)); BlurredNoisy=imadd(blurred,im2uint8(noise)); figure,imshow(BlurredNoisy) wnr4=deconvwnr(BlurredNoisy,PSF); figure,imshow(wnr4) *设置信噪比和相关函数的维纳滤波复原(p179图9.12)。 NSR=sum(noise(:).^2)/sum(im2double(I(:)).^2); %计算信噪比 wnr5=deconvwnr(BlurredNoisy,PSF,NSR); figure,imshow(wnr5) %设置信噪比的复原结果 NP=abs(fftn(noise)).^2; %噪声能量谱密度 NCORR=fftshift(real(ifftn(NP))); %噪声自相关函数 IP=abs(fftn(im2double(I))).^2; %图像能量谱密度 ICORR=fftshift(real(ifftn(IP))); %图像自相关函数 wnr6=deconvwnr(BlurredNoisy,PSF,NCORR,ICORR); figure,imshow(wnr6) %设置自相关函数的复原结果 实验六 图像分析与理解及图像压缩 一、实验目的 1. 了解DCT变换在图像压缩中的应用 2. 掌握边缘检测的Matlab实现方法 3. 了解用四叉数分解函数进行区域分割的方法 4. 了解Matlab区域操作函数的使用方法 5. 了解图像分析和理解的基本方法 二、实验内容 1. 图像分析与理解 A) 边缘检测 使用edge函数对图像‘rice.tif’进行边缘检测。 I=imread('rice.tif'); imshow(I) bw1=edge(I,'roberts'); bw2=edge(I,'sobel'); bw3=edge(I,'prewitt'); bw4=edge(I,'canny'); bw5=edge(I,'log'); figure,imshow(bw1) figure,imshow(bw2) figure,imshow(bw3) figure,imshow(bw4) figure,imshow(bw5) 要求同时比较'roberts','sobel','prewitt','canny','log'算子的检测效果。 edge函数提供的最有效的边缘检测方法是canny方法。优点: 使用两种不同的阈值分别检测强、弱边缘,并且仅当弱边缘与强边缘相连时,才将弱边缘包含在输出图像中。 该方法不易受噪声干扰,能够在噪声和边缘间取得较好的平衡,检测到真正的弱边缘。 B) 区域操作 使用区域选择函数roicolor, 区域滤波函数roifilt2和区域填充函数roifilld对图像‘pout.tif’或‘eight.tif’进行区域操作。 I=imread('pout.tif'); imshow(I) BW=roipoly; figure,imshow(BW) h=fspecial('unsharp'); I2=roifilt2(h,I,BW); figure,imshow(I2) I3=roifill; figure,imshow(I3); I=imread('eight.tif'); imshow(I) c=[222 272 300 270 221 194]; r=[21 21 75 121 121 75]; BW=roipoly(I,c,r); figure,imshow(BW) H=fspecial('unsharp'); J1=roifilt2(H,I,BW); figure,imshow(J1) J2=roifill(I,c,r); figure,imshow(J2) C) *区域分割 使用函数qtdecomp对图像‘alumgrns.tif’进行四叉树分解。 I=imread('alumgrns.tif'); I=I(1+[1:256],1+[1:256]); imshow(I) S=qtdecomp(I,0.2); figure,imshow(S) S=qtdecomp(I,0.1); figure,imshow(S) D) 图像分析与理解 *用分水岭分割函数watershed对图像‘afmsurf.tif’进行分割,测试互相接触的对象。 afm=imread('afmsurf.tif'); subplot(231),imshow(afm),title('Original Image'); se=strel('disk',15); Itop=imtophat(afm,se); % 高帽变换 subplot(232),imshow(Itop,[ ]),title('Tophat Image'); Ibot=imbothat(afm,se); % 低帽变换 subplot(233),imshow(Ibot,[ ]),title('Bottomhat Image'); Ienhance=imsubtract(imadd(Itop,afm),Ibot); subplot(234),imshow(Ienhance),title('Original+Tophat-Bottomhat'); Iec=imcomplement(Ienhance); Iemin=imextendedmin(Iec,22); % 搜索谷值 Iimpose=imimposemin(Iec,Iemin); % 置谷值为0 subplot(235),imshow(Iimpose),title('Complement of Enhanced Image'); wat=watershed(Iimpose); % 分水岭分割 subplot(236),imshow(wat),title('Watershed Segmented Image'); rgb=label2rgb(wat); subplot(236),imshow(rgb),title('Color Segmented Image'); 2. 图像压缩 A) DCT变换在图像压缩中的应用 执行Matlab自带的演示程序dctdemo,比较DCT变换矩阵舍弃系数对重构图像的影响 dctdemo B) *小波变换在图像压缩中的应用 4
本文档为【Matlab图像处理实验指导书】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_037277
暂无简介~
格式:doc
大小:160KB
软件:Word
页数:23
分类:
上传时间:2010-01-27
浏览量:24