# Fourier Decomposition

Hello everyone have a look at this video of Fourier Decomposition of an image(otherwise you can also refer the image which shows few plots of different extracted waves from an image) . We also know that a Fourier series is given as

$$\frac {a_0} 2 + \sum \limits _{m=1} ^\infty (a_m \cos \frac {2 \pi m t} T + b_m \sin \frac {2 \pi m t} T)$$

1.In the given video at bottom middle there is plot of extracted waves.My doubt is whether these waves means cosine (or sine) functions from the Fourier series formula?

2.What is mean by bases functions(or images)? Whether the plot of Extracted waves are called as bases functions here?

Note:Although above Fourier Formula is for 1D signal and video is of 2D image,please keep in mind Fourier series formula for 2D signal.

• The decomposition of the image is necessarily into sine or cosine functions, it doesnt matter which, because all complex signals can be devided into sines and cosines. by the way there is also a plugin for gimp paint program with wave deconstruction of an image. the source code is probably there for you to interpret. The terminology of the Base Function is not as important as it's practical function... You can make any 3d shape from an infinite number of cubes of different sizes, the same is true with images and sines, there isn't complexity in the theory of the question, only the algebra. – DeltaEnfieldWaid May 2 '15 at 18:01

# My doubt is whether these waves means cosine (or sine) functions from the Fourier series formula?

Here the part of source code from the description of the video on youtube. (I have cut a small part of it and have written some comments for sake of clarity):

% Read initial image.
I = imread('cameraman.tif');
...
% Calculate amplitudes of frequency components.
FT_I = fftn(I);
ABS_FT_I = abs(FT_I);

% Initialize some global variables.
FT_new = zeros(size(FT_I));
FT_cur = zeros(size(FT_new));
newIm  = zeros(size(FT_new));
...
% Demo loop.
n = 1;
nWaves = 1;
while n < % termination condition here.

% Choosing values of demo's parameters.
if n > 20;   nWaves = 10;   end
if n > 200;  nWaves = 100;  end
if n > 2000; nWaves = 1000; end

% Nullify global temporary variable.
FT_cur = 0*FT_cur

% Accumulate 'extracted waves' in frequency domain.
for p = 1:nWaves*2

% Find indices of frequency components with max amplitude.
[a,b] = find(ABS_FT_I == max(ABS_FT_I(:)), 1, 'first');
ABS_FT_I(a,b) = 0;

% Append them to the temporary buffer.
FT_cur(a,b) = FT_I(a,b);
end

% Create 'extracted waves' in spatial domain.
I_cur = ifftn(FT_cur);

% Concatenate all parts of an video frame.
canvas = cat(2, real(I - newIm - I_cur), zeros(size(I)), newIm);
canvasShow = canvas;
canvasShow(:,1:N(2)) = canvasShow(:,1:N(2)) + I_cur;
subplot(2,1,2);

% Plot the real part of the video frame.
% And as result the real part of 'extracted waves'.
imagesc(real(canvasShow), viewRange);
...
end


According to source code, the plot of extracted waves is the real part of the Inverse Fourier Transform of the sum of nWaves spectral components $F(s,t)$ with maximum amplitude: \begin{equation} f(x,y) = \frac{1}{NM}\sum\limits_{s,t\in U}Re\big(F(s,t)e^{2\pi i(sx/N + ty/M)}\big) \end{equation} where $f(x,y)$ is the value of the $(x,y)$ pixel of the extracted waves image in the spatial domain, $F(s,t)$ is the value of the $(s,t)$ component in the frequency domain, $U$ is first nWaves frequency components with $\max|F(s,t)|$. So these waves aren't cosine nor sine. They are non trivial linear combination of sine and cosine waves.

# What are basis functions (images) and Whether the plot of Extracted waves are called as basis functions in mathematics?

It's hard to tell without knowing the procedure, that have been used to create those images. But if the procedure is the same as in the video presentation, then it isn't technically correct to call those images Basis Functions.

• @Oxff thanks sir for your feedback. but according to you what are bases functions here? – devraj Apr 26 '15 at 17:40
• $\zeta _{s,t}(x,y)=e^{2\pi i(sx/N + ty/M)}$ are the basis functions. Can you tell us if you miss some fundamental math about linear algebra (family, base etc...) ? – Antoine Bassoul Apr 26 '15 at 18:37
• @Oxff sir in your source code .what value of "n " should I put as termination condition – devraj May 3 '15 at 11:52
• @devraj I'm not the author of this code. The author of the video have provided link to the source code. Here you can download it and see all details. – Nikolai Popov May 3 '15 at 16:47

1) A Fourier serie is written as $$\frac {a_0} 2 + \sum \limits _{m=1} ^\infty (a_m \cos \frac {2 \pi m t} T + \mathbf{i} \, b_m \sin \frac {2 \pi m t} T)$$ Unless your signal is even, i.e. $f(-t)=f(t)$ the fourier decomposition will have a real (cosine) part and an imaginary (sine) part. The middle bottom plot is more likely to be the power spectral density i.e. the fourrier transform's squared modulus.

2) Indeed, the Fourrier basis is a orthonormal basis, in a mathematical sense. $$\zeta _m(t)=\cos \frac {2 \pi m t} T + i \, \sin \frac {2 \pi m t} T$$ $$\int_{0}^{T}{\zeta _k(t)\zeta _l(t) \, dt}=\delta _{kl} %\quad \forall k,l\in[0,T-1]$$

The two conclusions above still holds in the 2D case simply use as basis functions: $$\zeta _{u,v}(x,y)=e^{-i2\pi(ux+vy)}$$ Define an image $f(x,y)$ and it's Fourier transform : $$F(u,v)=\int \int f(x,y) \zeta _{u,v} \, d x d y$$ $F(u,v)$ isn't real unless $f(x,y)$ is even respect to $x$ and even respect to $y$, and so when building the Fourier transform's representatio, it is more likely that the represented value is the Fourier transform's squared modulus. In the 2D case, Fourier's basis function still form a basis, it is complicated to define a base in a functional space. The two main things to note are : First, the scalar product between basis functions $\zeta _{u_1,v_1}$ and $\zeta _{u_2,v_2}$ is always equal to 0 unless $u_1=u_2$ and $v1=v_2$ then it is equal to 1 (orthonormality). One must then prove that every function $f(x,y)$ is uniquely writtable as a linear combinaison of $\zeta _{u,v}$'s. It is true for periodic function, but I can't provide you the demonstration.

I let you check the definition of a basis for a vector space, if you understand it it will give you a good grasp of what is a basis in general.