Load your image in [red green blue] matrix format.
In this question you will investigate colour downsampling and the effect of quantising the DCT.
a) Create functions to transform the picture from [R G B] to [Y Cb Cr] and vice versa. Verify
that these functions work as expected.
b) Display the Y, Cb and Cr colour planes. Verify that your eye is more sensitive to brightness
than colour (your results should be similar to those in the lecture notes)
c) Implement chrominance downsampling, including 2h1v, 2h2v and 4h4v. Comment on the
picture quality.
We will now consider the Discrete Cosine Transformation. For this section, we will only consider
Luminance, so discard the Chrominance planes and only consider Y.
d) Clip the Y plane to a multiple of (8x8) pixel blocks.
e) Taking each 8x8 block in turn, perform a 2D DCT transformation.
f) Using the quantisation matrix Q (given in notes), quantise your DCT.
g) Now perform the inverse DCT on your quantised matrix (remember to multiply by Q!) and
reconstruct your image. Display the picture and comment on the image quality (as you see
it)
h) Repeat f and g, using Qx4.
Note: For d-h, your code will be more efficient if you perform the transformation, quantisation and
inverse transformation all at once on an 8x8 block. There is no need to store the entire image in the
DCT domain.
Note: This question intends to focus on image compression algorithms, not a detailed knowledge of
Matlab. These hints are intended to guide you through the use of Matlab to complete the
assignment.
I recommend you work on an image no more than 640x480 pixels.