CS-498 Probability and Statistics for Computer Scientists

D.A. Forsyth --- 3310 Soda Hall

daf@uiuc.edu, daf@illinois.edu

MWF 1214 Siebel, 11h00-11h50

 

 

Homework 6: Due 2 Dec 2013

You should do this homework individually

 

  1. You will build a (very crude) image compression procedure using principal components. Collect 10 images from the web. Good places are images.google.com or flickr.com. Your images should show complex textured backgrounds and interesting scenes. Start with images that are at least 640x480 pixels. Use matlab's imresize (or some other code) to resize these images to 320x240. Matlab has methods to read in images (imread); display images (imshow). It stores color images as an nxmx3 array of integers. You should turn the color images into grey level images whose pixels take real values. I do so by averaging the three color channels, and using real to cast from integer to real.
  2. Each image will be stored as a matrix. The columns of the matrix are the columns of the image. For each separate image, regard the image as a set of column vectors, and compute the covariance matrix of the columns. Now compute the principal components of this dataset, by computing the eigenvectors and eigenvalues of the covariance matrix (eig will help here in matlab).
  3. For each image, compute the number of principal components required to represent the image with no more than 1% error. Prepare a document showing each image, and the expansion of the image on that set of principal components.
  4. Now regard all of the images as a single dataset, and compute its principal components. Choose two images from your dataset, and find the smallest number of these principal components required to represent each with no more than 1% error. Expand the other eight images on to those principal components. How large is the error? Prepare a document showing each image, and the expansion of the image on the set of shared principal components.