CIS 601 Spring 2007
Homework 6: A simple image compression in the Frequency Domain
Part 1: (7 points)
Please program a simple image compression algorithm as follows:
- Transform a grayvalue image into the frequency domain using fft2
- Set all Fourier coefficients, which are not dominant enough, to 0. This means (F being the fft): FC=F.*(abs(F)>T)
with a certain threshold T
- Use the inverse transform of FC to go back to the spatial domain and see what happened.
You didn't actually program a compression algorithm, but it would be easy to use any compression algorithm on FC
(e.g. runlength or Huffman). Do NOT program the actual compression, it wouldn't bring new insights.
Instead think about the following:
The interesting thing is to find the min. T such that the reconstructed image is more or less ok.
Can you find a way to automatically determine T? Hint: you could compare the original and reconstructed image and
try different T values until those two images are sufficiently similar. 'Sufficiently similar' introduces a new threshold Ts
(in the spatial domain), but that one is easier to handle; additionally it is more versatile, since the
same threshold Ts is usable for different images.
Part2: (3 points)
Since our perception reacts to higher frequencies much earlier than to low frequencies, the algorithm above is
not optimal. A better approach might be, to first emphasize the amplitudes of the higher frequencies, before a
constant threshold is used. Please find a way to implement this idea.
Note: the optimal solution of part one would take into account, that all the information of the fft2 is in the upper
left matrix only. To deal with this is somewhat unhandy, so please make your (and my) life simple and just
forget that fact, always work on the whole matrix.
Good luck !