Sidan finns bara på engelska

Lab 5: Transform coding of still images

Task

The goal of the lab learn how transform coding for still images work, similar to JPEG coding. The lab is given as a 4-hour lab.

You should work in groups of 1-2 students.

The lab is written in Matlab. You will need access to the Image Processing Toolbox and the lab specific files (see below).

Lab material

Doing the lab

Start by reading through the lab compendium carefully. The bulk of the compendium is there for you to familiarize yourselves with all the parts of the coder. In order to pass the lab you should answer all the questions in section 7 “Own experiments”.

Coder structure

In the lab you’re using coders that are given by the following block schedule:

The top half is the coder and the bottom half is the decoder. The functions that belong to each block are also listed in the figure.

The input is a colour image in RGB format. The first thing the coder does is to change colour space to YCbCr instead. Next, we optionally subsample the two chroma components, typically no more than a factor 2 in each direction. For your first experiments you should not do any subsampling.

Coding of the colour components is separated, so you will code each component on its own.

Next you perform a block based transform. You can choose between using DCT and DWHT. Here you also need to choose a blocksize. Normally only blocksizes that are integer powers of two are used. You should try at least the block sizes 4x4, 8x8 and 16x16. If you want you can try other sizes too.

After the transform comes the quantizer. Only uniform quantization is used. You can choose to use just one stepsize for all transform components, or separate stepsizes for each component. For the latter case, try out the version presented in the compendium, where you choose a fixed k2 close to 1 and then vary k1 to control the rate.

The quantizer is where you control rate and PSNR of the coder. If you have fine quantization (small stepsizes) you get high quality images (high PSNR) but also high rate (bits/pixel). When you increase the stepsize the rate will decrease but the quailty will also decrease.

After the quantizer comes the source coder. Here you can choose between three methods:

The functions used do not generate actual bit streams, but instead return the number of bits that would be the result.

On the decoder side everything is done in reverse, resulting in a decoded image in RGB format which can be displayed.

A full coder structure is given by making a choice in each step: Choose to use subsampling or not. Choose a transform type. Choose a block size. Choose a quantization method. Choose a source coding method.

The goal of the lab is to determine how these choices affect the performance of the coder, both objectively (by looking at rate-PSNR diagrams) and subjectively (which method gives the best looking images at a given rate).

Objective comparisons

We are interested at seeing how the chosen coder performs at all rates and not just one rate. To do this, we try out our coder with different choices of stepsize(s) in the quantizer. Each stepsize will give a rate (in bits/pixel) and a PSNR (in dB). We can then plot a curve between these points to see the coders performance. Comparing these plots for different coder structures gives us a way to make an objective comparison between the coders. It might look like this for example:

We of course want to have as high PSNR (low distorsion) as possible for a given rate, so in this example the coder corresponding to the red curve is better than the coder corresponding to the blue curve.

Subjective comparisons

We are also interested in subjective comparisons. At a given rate, which coding method gives the best looking image? There will of course be some correlation between objective and subjective quality. High PSNR usually means that the subjective quality is good and vice versa, but mean square error/PSNR is a very simple pixel-based measure and so it can not pick up anything that depends on larger structures in the image.

When doing subjective comparisons between different coding methods, you should try to compare at either the same rate or the same PSNR. For the chosen rate/PSNR, which method looks best?

Questions?

If you have any questions about the lab, contact Harald. Don’t hesitate to ask, it is better if you ask too many questions instead of asking too few questions!