Digital Communications – EEEE3007
COURSEWORK – this is worth 25% of the total module marks
The report on this work should be submitted on or before 19h March 2020
JPEG – Computing Exercise
This exercise is intended to give you an appreciation and a deeper understanding of how and why JPEG image compression is able to store high quality images in a fraction of the space required for uncompressed storage.
You may use any software you wish to complete the exercise, although you are recommended to use MATLAB as it contains all the tools you should require. MATLAB is available in the 3rd floor computing lab (if you have not used MATLAB before, it is VERY easy to pick up; try typing ‘getting started with MATLAB’ into Google and you will find a number of tutorials to get you going. I will be around in the 3rd floor lab 4 to 5 on Tuesdays (as in your timetable) to answer questions.
You will be supplied (via Moodle) with a file ‘Lena.mat’ containing a grey-scale image known as ‘Lena’ ; this image is one used very commonly in papers and articles on image processing, it is a good sample image as it contains areas of both low and high contrast. This image is quantized into 256 grey levels i.e. with values ranging from 0 (black) to 255 (white). To get this image into a MATLAB program (or workspace),copy the Lena.mat file into the directory you are using for MATLAB and use the line of code ‘load Lena’. This will deliver a matrix containing the grey levels.
You are required to carry out the following operations and to produce a report – the report should be about 8 pages in length and should be written to be like a short magazine article or book chapter explaining how JPEG works and how effective it is at compressing images. You do not need to show every result you produce, choose the ones that best fit with the way you have decided to write about and explain the topic of JPEG.
The report will be marked on the following categories (with an equal share of marks for each category):
• Effectiveness of your code to produce the required results
• The quality of the results you have obtained and their presentation in figures and text
• The analysis you have conducted to assess the quality of the reconstructed images and the amount of data reduction achieved
• The comments and the conclusions you have drawn
The following are a suggested set of tasks to complete to produce some results that may be useful in writing your report.
Part A
1. Select an 8 pixel by 8 pixel region of the image (from an interesting area of the image)
• Produce an image of this small region and also print a matrix of the pixel values.
• Perform a 2-D DCT operation on this small image (N.B. in MATLAB use the function DCT2)
• Print a matrix of the DCT coefficient values you have obtained.
• Comment on the distribution of the coefficient values and their positions in the matrix compared with the original 8 by 8 pixel values.
• Perform an inverse 2-D DCT operation (IDCT2 in MATLAB) on the matrix of DCT coefficients and compare the result with the original pixel values.
• Think about the comparison and what this indicates about the role of the DCT within JPEG – your reflections might form part of your report.
Part B
• Select the same 8 pixel by 8 pixel region of the image and perform a DCT operation.
• Quantize the DCT coefficients using the ‘M’ matrix of quantization intervals supplied in WebCT as the file M1.mat This can be achieved by (i) dividing the matrix of DCT coefficients by the quantization-interval matrix (ii) rounding the result to the nearest integer value. These values can be called ‘scaled and quantized DCT coefficients’.
• From the matrices values obtained in 9, attempt to restore the pixel values by (iii) multiplying the result of (ii) by the appropriate quantization-interval matrix to ‘undo’ the division performed in (i) and then (iv) by performing an inverse DCT operation to get back to pixel values
• Compare the ‘restored’ pixel values with the original values and reflect on the quality of the restoration process and the potential amount of data reduction. The results of your reflections might form part of your report.
Part C
• Repeat part B (sections 8 to 11) but this time perform the operations not just on one 8 pixel by 8 pixel region but on every 8 by 8 region in the whole ‘Lena’ image. N.B. this sounds complicated but is very easily done in MATLAB using the BLKPROC (block processing) function.
• Compare the restored image with the original ‘Lena’ image and comment on the visual image quality
• Consider/devise how to assess the quality of the restored images in some quantitative way and see how well this agrees with the visual quality. Devise some method to estimate quantitatively the amount of data reduction achieved. The results you obtain might form part of your report..
• Repeat 14 with the M matrix scaled to alter the amount of data compression and think about how to present the results of this (a graph of ‘image quality’ against ‘compression’ is one way). Reflect on what these results mean. The results of your reflection might form part of your report.