EN161 Image Understanding
Laboratory Sessions

  
General Information
  • The laboratory sessions will build on the material covered in the class, and aim to solidify your understanding of concepts through hands-on experimentation. You will see and believe for yourself that image processing is fun and one can produce useful results. The sessions will involve solving the assigned problems using MATLAB. You will hand in a report on the assignment worked out during the session and afterwards. The reports will include the results- e.g., images, observations, and answers to specific questions- obtained, and the MATLAB programs written for that purpose. 
 
List of Assignments:

 

MATLAB Background
 

You already had a basic tutorial on MATLAB. In this lab, in addition to your basic MATLAB knowledge, you will be using some functions from MATLAB's image processing toolbox for accessing, displaying, and saving images. Assume that you want to access a gray level image named eight.tif (it comes with MATLAB image processing toolbox), type

  1. I = imread('eight.tif');
This will create an mxn matrix with entries representing the gray level values for the pixels of the image. To see the values of m and n, type
  1. size(I);
Now, to display the image type
  1. imshow(I);
Now, take a moment to think about the image coordinate system, the convention may seem a bit confusing at first. The horizontal axis (x-axis) corresponds the columns of I (we have n of them), and the vertical axis (y-axis) corresponds to the rows of I (we have m of them).

Finally to save an image matrix I after you change its entries, e.g., under the name new.tif, type 

  1. imwrite(I, 'new.jpg','jpg');
The third argument indicates the specific image format, in this example it is jpg. Check out the help for imread and imwrite to see what other image formats are supported by MATLAB, and what other optional arguments the commands have.

In MATLAB, I is of type UINT8 (an integer between 0-255), to manipulate the image content other than through straightforward value settings, you need to convert the image to double precision to do this type

  1. Id = double(I);
To convert a double precision matrix back to image precision, i.e., UINT8, for viewing or saving the image type
  1. I = uint8(Id);