# 2-D Fourier series components from image

Suppose I draw a black/white image where the color black represents 1.0 and the color white represents 0. Is there a way to extract numerical estimates for the coefficients of a (real) 2-D Fourier series which approximates this image?

Here is a simple example:

What about for more complex images such as:

or

• To clarify, do you want to take the DFT of these images? Or get a symbolic function to work with? – CA Trevillian Sep 7 at 0:45

As you want a real FFT, the picture must by symmetric or anti-symmetric. Here is a simple symmetric example:

dat = Table[If[x^2 + y^2 < 4, 0, 1], {x, -n, n}, {y, -n, n}];
MatrixPlot[dat]
fdat = FourierDCT[dat] // Chop;
MatrixPlot[fdat]


Here a more complicated one:

n = 5;
dat = Table[If[OddQ[x + y], 0, 1], {x, -n, n}, {y, -n, n}];
MatrixPlot[dat]
fdat = FourierDCT[dat] // Chop;
MatrixPlot[fdat]


And here a circle:

n = 100;
dat = Table[If[x^2 + y^2 < .5 10^4, 0, 1], {x, -n, n}, {y, -n, n}];
MatrixPlot[dat]
fdat = FourierDCT[dat] // Chop;
MatrixPlot[fdat]