

%Reading the image



im=imread('ortofoto3.tif');;

%size(im)        1000      1000


r=45; 
red1=[81:r:919];
red2=[81:r:919];

rad=40;

num=1;
mfd=[];

for ii=1:max(size(red1))
    ii
    for jj=1:max(size(red2))
  
      a=[red1(ii) red2(jj)];
     val1=a(1)-2*rad;
     val2=a(1)+2*rad;
     val3=a(2)-2*rad;
     val4=a(2)+2*rad;
     
     peq=im(val1:val2,val3:val4);
   vg=[0];
   %vg=[];
   at=sum(sum(peq));
   
   for k=2:50 
    
   
   vg=[vg 1 - sum(sum(imopen(peq,strel('square',k))))/at];
   

   end

   mfd(num,:)=vg;
   num=num+1;
    end
end
   
   plot(1:50,mfd') 

   
	%dlmwrite('mfdgrsqcurvas50_orto2.txt',mfd,' ');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
