You are on page 1of 12

Lab of COMP 319

Final Project: Image Compression with MATLAB

Lab tutor : Yao Zhang, Shenghua ZHONG Email: zsh696@gmail.com csshzhong@comp.polyu.edu.hk Lab 4: Nov 30, 2011
1

Outline of Lab 4

Some important reminders of final project Some important steps and information of final project How to debug the user defined function

Important reminders of final project


1. Deadline: Mon Dec. 15 at 23:59pm . Penalty for late submission Tue. Dec. 16 Wed. Dec. 17 Thu. Dec. 18 After Dec. 18 00:00 - 23:59 00:00 - 23:59 00:00 - 23:59 23:59 25% deduction 50% deduction 75% deduction Zero point

Please try your best to finish the project and submit it on time !

Important reminders of final project


2. There are only two functions should be and can be modified and submitted: Compress.m and Decompress.m. There is no need to submit a final project report. your personal compress.m and decompress.m functions will be scored by using the uniform main.m function, so submission of other functions or files is useless and unallowed.

Important reminders of final project


3. You can observe the MSE value and the compression ratio to check the performance of your functions. The MSE value and compression ratio will be given above your recovered image, you can check them according to the grading sample listed on the courses webpage. The compression ratio should larger than 1, otherwise the score of your final project will be zero!

Important reminders of final project


4. The components in the matrixes orig_image, comp_image and reco_image should be the integers. The size of the reco_image should be same with the size of orig_image.

Don't make any modification of the provided functions expect Compress.m and Decompress.m.
Don't read the image file when you modify Compress.m and Decompress.m, otherwise, you will get zero point in the final project.
6

How to Debug User-Defined Function


User-defined functions are stored as M-files. Each must start with a function definition line that contains

the word function, one or several variables that defines the function output, a function name, and one or several variables used for the input argument. Save the function as M-file using the same name in your function

Some examples:
function output = my_function(x)
function [output1, output2] = my_function(x1,x2,x3)

Hints: The function name and the names of the input and output variables are arbitrary and selected by the programmer, but the word function can not be changed.
7

Review of Lab 2 about User-Defined Function


comments function output = poly(x) % This function calculates the value of a third-order % polynomial output = 3*x.^3+5*x.^2-2*x+1

Save above commands into an M-file and then type the below commands in command window to observe the results: >> a=4; >> poly(a) >> b=1:5; >> poly(b)

How to Debug User-Defined Function


Compress.m, Decompress.m, and xxx.m except main.m are both user-defined function.

They like a black box (user only know the input and output parameters)

Debug is important to check whether the programms are correct.


9

The First Step to Debug User-Defined Function


Set breakpoint at the line of the Entry to the user-defined function in the main.m

10

The Second Step to Debug User-Defined Function


Run main.m to the Entry

11

The Third Step to Debug User-Defined Function


Click Step in button and go into the user-defined function

12

You might also like