Lab3- INT 302: Image Processing
Start Date: April 22th, 2025; Due Date: May 13th, 2025
Percentage of Final mark: 70%
Late Submission Policy: 5% of the total marks available for the assessment shall be deducted from the assessment mark for each working day after the submission date, up to a maximum of five working days.
Introduction:
This assignment contains one in-class quiz and two lab tasks. The content covers image histogram, morphological operation and image transform, image compression and decompression, and one real application (i.e, eigenfaces). The in-class quiz will take under formal invigilation. This lab assessment includes the programming code and the report. The programming code should be run successfully, and the results should be correct. Moreover, the code quality will also be considered, such as efficiency, comments, robustness. The report should answer all questions in the tasks, and explain them clearly. It is recommended to add some conclusions about the whole lab.
Objectives:
Through the working in this lab, the students can achieve the learning outcomes A, B, C, D and E:
l Understand the basic principles of digital image processing
l Understand the techniques used in digital image processing.
l Have an appreciation of the areas of applications for various image processing techniques, e.g., image enhancement, image transform, image compression and morphological operations.
l Apply relevant image processing techniques to a given problem.
l Have basic skills to develop image processing software.
Downloads:
Download the files of lab-Material.zip from the Learning Mall (actually these are three parts for one large rar file.), unzip the file into a folder Lab-Material. Now load into your Matlab workspace the file data_for_eigenfaces.mat; you will see then in your workspace the following variables:
1- eigenfaces_blk which contains 100 eigenfaces, and each one is 450*300.
2- employees_DB is an array containing the employees’ ID and eigenface weighting parameters.
Lab Tasks (70 marks):
Task 1 Eigenface
Background:Suppose you have been asked by a company to develop a software for face recognition. This software will be used by the company to check the identity of their employees, and prevent unauthorized persons from getting in. This software needs to interface with a database containing the employee records (employees_DB). Each record contains the following information: ID and Parameters describing the face (the weights of the Eigenface representation).
1. Orthonormal basis. (8 marks)
The variable eigenfaces_blk contains 100 eigenfaces, where you can regard each as a vector representation by row or column concatenation.
(1) Describe the definition of orthogonality. (3’)
(2) Based on your definition, verify that these eigenfaces are orthogonal. (2’)
(3) What is the orthonormal basis? Are these eigenfaces orthonormal? If they are not orthonormal, normalize them to be orthonormal as eigenfaces_blk_norm. (3’)
2. Forward transform: generating the Eigenfaces weights of a face. (14 marks)
When an image of a face is presented to the system for classification / recognition, its own weights are found by projecting the image onto the collection of eigenfaces. This provides a set of weights describing this particular face. It means that you transform the faces in the original spatial domain to the values in the eigenfaces domain, which is called forward transform.
(1) Describe how to get the weights on the orthogonal basis in general and explain why it can be calculated in this way. (5’)
(2) Write a Matlab function which generates the weights of a face. The function should have the following declaration: (4’)
function [weights_of_face] = get_face_weights(im, eigenfaces_blk);
(3) Use the function get_face_weights to find the weighting parameters for the image find_id.jpg. Plot these weighting parameters. Compared to the pixel values in original spatial domain, what do these weights represent? (5’)
3. Inverse transform.: Face generation from its “weights”. (18 marks)
(1) Describe how to synthesis the original image from the weights on the orthogonal basis in general. (3’)
(2) Write a Matlab function which generates a face from its weights. The function should have the following declaration: (3’)
function [im] = generate_face_from_weights(weights_of_face, eigenfaces_blk)
(3) Use the obtained weights_of_face in the task of forward transform. on the image find_id.jpg to synthesize the image of the face using the function generate_face_from_weights. (2’)
(4) Comparing eigen-face with 2D-DCT. Write the code to use 2D DCT transform on find_id.jpg and only take the first 100 weights (i.e., first 10*10 blocks, and zero for other weights) to recover the image. Comments on using different numbers and fill the PSNR in the following table, and show the corresponding generated faces. Comparing the recovered image of the 100 weights with the synthesized image in (3). (10’=3+5+2)
Number
|
10*10
|
20*20
|
30*30
|
40*40
|
50*50
|
PSNR
|
|
|
|
|
|
4. Application of Image transform: recognizing an employee from his/her image.
(10 marks)
To recognize someone from his (/her) face’s photo the weights of this face need to be compared against all weights in the database to find the closest match. The Euclidean Distance between two vectors is a simple approach for finding two nearest neighbors; this metric could be used in this task to find the closest face in the database.
(1) Based on this tip, describe how to recognize an employee by using eighenfaces technology here, then write a Matlab function which finds the employee’s ID starting from his/her photo. The function should have the following declaration: (5’)
function [ID] = get_employees_ID_from_DB (im, employees_DB, eigenfaces_blk);
(2) Find the employee’s ID of the image find_id.jpg, and write it down in your report. (2’)
(3) Show your ideas to improve the robustness of this recognition algorithm for the following case: if the input face is with some noise (e.g., AWGN and Salt & Pepper). (3’)
Task 2 Image Compression and Decompression (20 marks)
1. Write a function to do the two-dimensional DCT of all the 8 X 8 non-overlapping blocks of the image im, and merge the left-top pixel of all blocks after the DCT transformation to get a smaller image ims. Using the image “SummerPalace.bmp” as input image, please show the image ims here, and give the comments on comparing it to the original input image. (8’)
2. To convert the floating point numbers of the 2D-DCT into integer numbers, write a function to quantize each 8 x 8 block using the following formula:round where bij is the i-th row and j-th column of the 8 x 8 2D-DCT transformed block, whereas, qij is the element of the quantization matrix Qmat (N=8, equation(1)). And S is a scalar value given by equation (2). (3’)
3. Write a function to decompress image imo, which should invert the above two steps. (4’)
4. Using the image “SummerPalace.bmp” as input image im in the above functions, fill the following table with different QP values in the equation (2) for the PSNR between the original input image im and the decompressed image imo. Please give the comments on this table. (5’)
QP
|
1
|
6
|
14
|
20
|
26
|
40
|
55
|
90
|
PSNR
[dB]
|
|
|
|
|
|
|
|
|
Please note that you can directly use the Matlab functions of DCT2 and IDCT2 in the above functions.
Lab Report
Write a short report which should contain a concise description of your results and observations. Include listings of the Matlab scripts that you have written. Describe each of the images that you were asked to display.
Report format: Single column; Fond size: #12, no more than 20 pages. Answer each question completely:
– Do not attach the code at the end of the report, just put the useful code under each question
– The results maybe contain some figures, please add the index and title of each figure.
Submission before 2025-5-13.
– Electronic version to LM with a ZIP of all files
• zip file name: INT302-Lab3-Name-studentID.zip
• One file with same file name of ZIP File: Report ( with studentID, name, Lab title on the homepage)
• One folder: codes and other materials. (I can run it directly)
Marking scheme
80%-100% Essentially complete and correct work.
60%-79% Shows understanding, but contains a small number of errors or gaps.
40%-59% Clear evidence of a serious attempt at the work, showing some understanding, but with important gaps.
20%-39% Scrappy work, bare evidence of understanding or significant work omitted.
<20% No understanding or little real attempt made.