欢迎来到天天文库
浏览记录
ID:59217963
大小:13.50 KB
页数:2页
时间:2020-09-09
《图像分割参考程序.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、灰度阈值法x=imread(‘*.bmp’);N=256;[row,col]=size(x);th=0;p=zeros(N);fori=1:row*colp(fix(x(i)+1))=p(fix(x(i)+1))+1;endp1=zeros(N);p1(1)=p(1);fori=2:Np1(i)=p(i)-p(i-1);endp2=zeros(N);p2(1)=p1(1);fori=2:Np2(i)=p1(i)-p1(i-1);endfori=1:Nifp2(i)>=0th=p2(i);endendfori=1:row*col;ifx(
2、i)>thx(i)=256;elsex(i)=0;endendRobert算子f=imread(‘*.bmp’);f1=double(f);[row,col]=size(f);f2=zeros([row,col]);forx=2:(row-1);fory=2:(col-1);f2(x,y)=sqrt((abs(f1(x,y)-f1(x+1,y+1)))^2+(abs(f1(x+1,y)-f1(x,y+1)))^2);endendLaplacian算子f=imread(‘*.bmp’);f1=double(f);[row,col]=siz
3、e(f);f2=zeros([row,col]);forx=2:(row-1)fory=2:(col-1)f2(x,y)=f1(x-1,y)+f1(x+1,y)+f1(x,y-1)+f1(x,y+1)-4*f1(x,y);endend
此文档下载收益归作者所有