clear;
IM=imread('letra_e2.bmp');
IM=imread('letra_e2.bmp');
subplot(1,3,1);
imshow(IM);
[nf nc]=size(IM)
x=0;
while x<nf*nc
   c=mod(x,nc)+1;
   f=floor(x/nc)+1;
   x=x+1;
   if IM(f,c)==1,
         ff=f;
         cc=c;
         break;
  end;
end;


V=[];

while 1
   V=[V; cc ff]
   IM(ff,cc)=0;
   ff0=ff;
   cc0=cc;
   if IM(ff+1,cc+1)==1,
      ff=ff+1;
      cc=cc+1;
   else
   if IM(ff+0,cc+1)==1,
      ff=ff+0;
      cc=cc+1;
   else
   if IM(ff+1,cc+0)==1,
      ff=ff+1;
      cc=cc+0;         
   else
   if IM(ff+0,cc-1)==1,
      ff=ff+0;
      cc=cc-1;               
   else
   if IM(ff-1,cc+0)==1,
      ff=ff-1;
      cc=cc+0;               
   else
   if IM(ff-1,cc-1)==1,
      ff=ff-1;
      cc=cc-1;               
   else
   if IM(ff+1,cc-1)==1,
      ff=ff+1;
      cc=cc-1;               
   else
   if IM(ff-1,cc+1)==1,
      ff=ff-1;
      cc=cc+1;               
   end;end;end;end;end;end;end;end;


   if (ff==ff0) & (cc==cc0), break;end;
   subplot(1,3,2);imshow(IM);
   pause(0);
   i=i+1
end;

D=V(:,1)+V(:,2)*sqrt(-1);

F=fft(D);

F2=F*0;
len=length(F);
delta=8;
F2(1:delta)=F(1:delta);
F2(len-delta:len)=F(len-delta:len);

D2=ifft(F2);
subplot(1,3,3);plot(D2);









