求分数盒子维数算法的matlab或C/C++源程序?

求分数盒子维数算法的matlab或C/C++源程序


喵喵时光机
浏览 406回答 1
1回答

翻翻过去那场雪

描述颗粒形貌边界的分形维数matlab程序:  im=imread('e:\4.bmp');imshow(im);gr=im;level = graythresh(gr);figure,imshow(gr);bw=im2bw(gr,0.5);%bw= bwperim(bw);%bw=~bw;figure,imshow(bw);  bw=edge(bw,'canny');  figure,imshow(bw);  si=size(bw);  minblock=1;  maxblock=16;  flag=0;  n=linspace(0,0,maxblock-minblock+1);  for k=minblock:maxblock   for y=1:k:si(2)-k   for x=1:k:si(1)-k   flag=0;   for y1=y:y+k-1   for x1=x:x+k-1   if bw(x1,y1)==1   flag=1;   end;   end;   end;   if flag==1   n(k-minblock+1)=n(k-minblock+1)+1;   end;   end;   end;  end;  aa=[minblock:maxblock];  xx1=-log(aa);  yy1=log(n);  a=polyfit(yy1,xx1,1);  x=polyval(a,yy1);  figure,plot(xx1,yy1,'k+',x,yy1,'r');  D=1/a(1);
打开App,查看更多内容
随时随地看视频慕课网APP