File:Fafo2test3.png

Filtering of the real array $A$ shown in.

The Fourier-2 transform $B$ of the function $A$ is determines with


 * $\displaystyle B(p,q)=\frac{1}{2\pi} \int \int \mathrm d x \mathrm d y  \exp(-ipx-iqy) A(x,y)$

The modulus of array $B$ is shown in figure.

The filtered function $\tilde A$ is determined with


 * $\displaystyle \tilde A(x,y)=\frac{1}{2\pi} \int \int \mathrm d p \mathrm d q  \exp(ipx+iqy)

\vartheta(20-p^2-q^2) B(p,q)$ whete $\vartheta$ is the unit step function.

C++ generator
// Files ado.cin and fafo.cin should be in the working directory for the compillation of the code below:

using namespace std;
 * 1) include
 * 2) include
 * 3) include 
 * 4) include
 * 1) define z_type complex
 * 2) define DB double


 * 1) include "fafo.cin"
 * 2) include "ado.cin"
 * 3) define DO(x,y) for(x=0;x= N dx=sqrt(2.*M_PI/M); dy=sqrt(2.*M_PI/N); DO(m,M){ x=dx*(m-M/2.); DO(n,N){ y=dy*(n-N/2.); if(.3*x*x+.2*y*y >2.1) A[n*M+m]=0.; else A[n*M+m]=1.; if(fabs(x)<.8 && fabs(y+1.7)<.3 )  A[n*M+m]-=1.; if( (fabs(x-1.)<.3 || fabs(x+1.)<.3 ) && fabs(y-.8)<.2 )  A[n*M+m]-=1.; }}

// Fourier: DO(m,M){ DO(n,N) b[n]=A[n*M+m]; fafo(b,N,1); DO(n,N) A[n*M+m]=b[n]; } DO(n,N){ DO(m,M) b[m]=A[n*M+m]; fafo(b,M,1); DO(m,M) A[n*M+m]=b[m]; }

DO(m,M){ x=dx*(m-M/2.); DO(n,N){ y=dy*(n-N/2.); s=x*x+y*y; //     A[n*M+m]*=exp(-.04*s); if(s>20.) A[n*M+m]=0; }}

DO(m,M){ DO(n,N) b[n]=A[n*M+m]; fafo(b,N,-1); DO(n,N) A[n*M+m]=b[n]; } DO(n,N){ DO(m,M) b[m]=A[n*M+m]; fafo(b,M,-1); DO(m,M) A[n*M+m]=b[m]; } fprintf(o,"gsave\n"); fprintf(o,"%2d %2d scale\n",M,N); fprintf(o,"%2d %2d 4 [%2d 0 0 %2d 0 %2d]\n<", M,N,M,-N,N);

s=0; DO(m,M) DO(n,N){ t=abs(A[n*M+m]); if(t>s) s=t; } s=15./s;

for(n=N-1;n>=0;n--) { fprintf(o,"\n"); DO(m,M){ fprintf(o,"%1x",int(s*abs(A[n*M+m])+.6) ); }} fprintf(o,"\n>\n"); fprintf(o,"image\n"); free(A); fprintf(o,"grestore\n"); M(M/2.+.5,-1); L(M/2+.5,N+1); M(-1,N/2.+.5); L(M+1,N/2.+.5); fprintf(o,"1 0 0 RGB .1 W S\n"); fprintf(o,"showpage\n%c%cTrailer\n",'%','%'); fclose(o); system("epstopdf fafo2test3.eps"); system( "convert fafo2test3.eps fafo2test3.gif"); system(  "open fafo2test3.gif"); }
 * 1) define M(x,y) fprintf(o,"%6.3f %6.3f M\n",0.+x,0.+y);
 * 2) define L(x,y) fprintf(o,"%6.3f %6.3f L\n",0.+x,0.+y);

EPS version generated
%!PS-Adobe-2.0 EPSF-2.0

%%BoundingBox: 0 0 642 642

/M {moveto} bind def /L {lineto} bind def /S {stroke} bind def /s {show newpath} bind def /C {closepath} bind def /F {fill} bind def /o {.1 0 360 arc C S} bind def /times-Roman findfont 20 scalefont setfont /W {setlinewidth} bind def /RGB {setrgbcolor} bind def 1 1 translate 10 10 scale gsave 64 64 scale 64 64 4 [64 0 0 -64 0 64] < 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000010000000000000000000000000000000 0000000000000000000000000001100000001100000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000011101110000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000011111110000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000011121110000000000000000000000000000 0000000000000000000000000001111101111100000000000000000000000000 0000000000000000000000000011013444310110000000000000000000000000 00000000000000000000000000013579a9753100000000000000000000000000 000000000000000000010010001479bcdcb97410001001000000000000000000 0000000000001000000101111047bdddddddb740111101000000100000000000 000000000000000010100101127beedcbcdeeb72110100101000000000000000 00000000000000001010111205aefecbbbcefea5021110101000000000000000 00000000000001000010101138cdcbbcccbbcdc8311010100001000000000000 0000000000000000000010115adb879ded978bda511010000000000000000000 0000000000000000010111128cd9659dfd9569dc821111010000000000000000 0000000000000000010101139dd9669ded9669dd931101010000000000000000 0000000000000000010101139ddb99accca99bdd931101010000000000000000 0000000000000000000101149ddcbbcbbbcbbcdd941101000000000000000000 0000000000000000000101149ddccddcccddccdd941101000000000000000000 0000000000000000000101038cdccdeedeedccdc830101000000000000000000 0000000000000000000101037bdcccccccccccdb730101000000000000000000 0000000000000000000001115addca98889acdda511100000000000000000000 00000000000000000000101138cec9632369cec8311010000000000000000000 00000000000000000010101205adda62126adda5021010100000000000000000 000000000000000000101101127cdca767acdc72110110100000000000000000 0000000000000000000101111148cdddddddc841111101000000000000000000 00000000000000100001011010147adefeda7410101101000010000000000000 00000000000000000000100001112579a9752111000010000000000000000000 0000000000000000000000000011102333201110000000000000000000000000 0000000000000000000000000001111111111100000000000000000000000000 0000000000000000000000000111001111100111000000000000000000000000 0000000000000000000000000001111101111100000000000000000000000000 0000000000000000000000000000001111100000000000000000000000000000 0000000000000000000000000001110000011100000000000000000000000000 0000000000000000000000000000001000100000000000000000000000000000 0000000000000000000000000001100000001100000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000110000000000011000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000100000000000001000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 > image grestore 32.500 -1.000 M 32.500 65.000 L -1.000 32.500 M 65.000 32.500 L 1 0 0 RGB .1 W S showpage %%Trailer

Keywords
Fourier transform, EPS