基于MATLAB的图像分割技术.doc

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
基于MATLAB的图像分割技术

利用阀值法对图像进行分割: f=imread(peppers.png); f=rgb2gray(f); f=im2double(f); t=0.5*(min(f(:))+max(f(:))); done=false; while ~done g=f=t; tn=0.5*(mean(f(g))+mean(f(~g))); done=abs(t-tn)0.1; t=tn; end; display(Threshold(t)-Iterative); Threshold(t)-Iterative t t = 0.4691 r=im2bw(f,t); subplot(2,2,1);imshow(f); subplot(2,2,2);imshow(r); xlabel(迭代法全局阀值分割); th=graythresh(f); th th = 0.3961 s=im2bw(f,th); subplot(2,2,3);imshow(s); xlabel(全局阀值Otsu分割); se=strel(disk,10); ft=imtophat(f,se); thr=graythresh(ft); thr thr = 0.1098 lt=im2bw(ft,thr); subplot(2,2,4);imshow(lt); xlabel(局部阀值分割); 用迭代法对图像进行分割: i=imread(eight.tif); zmax=max(max(i)); zmin=min(min(i)); tk=(zmax+zmin)/2; bcal=1; isize=size(i); while (bcal) ifg=0; ibg=0; fg=0; bg=0; for j=1:isize(1) for k=1:isize(2) tmp=i(j,k); if(tmp=tk) ifg=ifg+1; fg=fg+double(tmp); else ibg=ibg+1; bg=bg+double(tmp); end; end; end; zo=fg/ifg; zb=bg/ibg; tktmp=uint8((zo+zb)/2); if(tktmp==tk) bcal=0; else tk=tktmp; end; end; disp(strcat(迭代后阀值,num2str(tk))); 迭代后阀值165 newi=im2bw(i,double(tk)/255); subplot(1,2,1);imshow(i); subplot(1,2,2);imshow(newi); xlabel(迭代法); 用Otsu法进行阀值选择: i=imread(coins.png); subplot(1,2,1);imshow(i); bw=im2bw(i,graythresh(getimage)); subplot(1,2,2);imshow(bw); 使用分水岭算法对图像进行分割: c1=-10; c2=-c1; dist=sqrt(2*(2*c1)^2); rad=dist/2*1.4; li=[floor(c1-1.2*rad) ceil(c2+1.2*rad)]; [x,y]=meshgrid(li(1):li(2)); bw1=sqrt((x-c1).^2+(y-c1).^2)=rad; bw2=sqrt((x-c2).^2+(y-c2).^2)=rad; bw=bw1|bw2; subplot(1,3,1);imshow(bw); d=bwdist(~bw); subplot(1,3,2);imshow(d,[]); d=-d; d(~bw)=-Inf; l=watershed(d); rgb=label2rgb(l,jet,[.5 .5 .5]); subplot(1,3,3);imshow(rgb); 使用分水岭算法: c1=-10; c2=-c1; dist=sqrt(3*(2*c1)^2)

文档评论(0)

dajuhyy + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档