When you save a photo as a jpeg image, your software follows the
following steps:
In a typical photo there are many smooth blocks and then the Fourier
coefficients corresponding to large frequencies are small and map into
zero after quantization. In this way the lossless compression is very effective because the file contains a lot of zeros.
Consider the following test image: Technical comment:
The corresponding file is a special jpeg without lossless
compression. It contains the same information as the original image
(created with GIMP). The same happens with the rest of the images, they
represent faithfully the indicated procedures. The black frames around
the image do no belong to the images.
Now, we simply delete the Fourier coefficients a_{nm} with n>1 or m>1, only a_{00}, a_{10}, a_{01}, a_{11}, remain. This makes 4/64=1/16 of the information. We observe some flaws in the
sharp edges. A kind of shadow. Recall that Fourier analysis is only
successful when approximating smooth functions (recall the Gibbs
phenomenon).
If we delete the Fourier coefficients a_{nm} with n>4 or m>4, the result is: In practice, this and the original image are indistinguishable, although we only keep 25/64, less than 40% of the information.
Now, consider only the Fourier coefficients a_{0m} and see the effect: All the edges are distorted
except the vertical line. This line has width 6px (<8) and height
248px (a multiple of 8). In each block this line is vertically a smooth
function, a constant one and horizontally it is a step funtion. By our
choice of Fourier coefficients, we have to our disposal the harmonics
needed to analize any constant function vertically (n=0) and arbitrary
horizontally (0<=m<8).
If we change the role of n and m, considering only the Fourier coefficients a_{n0}, the vertical line is also affected. Note that the height is preserved (because it is divisible by 8 and starts exactly at the beginning of a block). The last two images contain
more information than the second one 8/64>4/64, exactly double. But
we are including in then some information, like a_{07} or a_{70} that
is visually less relevant, and we are missing for instance a_{11} and
a_{01} or a_{10} that embody important information.
For instance, preserving all the Fourier coefficients but a_{11}, one gets: and if also a_{01} is omitted the image is severely affected:
|
Matlab
programs generating the images |
|
% Filter Fourier
coefficients
|
%Function in another file |