

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for homework 8 in cse190 - image processing class taught by prof. Serge belongie at university of california, san diego. The homework includes two parts. In the first part, students are required to derive a matrix of squared euclidean distances between feature vectors and prototype vectors and to calculate the inverse of a 2x2 matrix. In the second part, students are asked to implement the k-means clustering algorithm and lucas-kanade optical flow algorithm using matlab.
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


CSE190 – Image Processing – Homework # Instructor: Prof. Serge Belongie. T.A.: Josh Wills. http://www-cse.ucsd.edu/~sjb/classes/wi02/cse Due (in class) 1:25pm Wed. Mar. 13, 2002.
Written exercises
T = E1Tk + (^1) N FT^ − 2 XT^ Y
where E is an N ×1 vector with entries Ei = ‖xi‖^2 , F is a k ×1 vector with entries Fi = ‖mi‖^2 , 1 is a column vector of ones whose length is given by its subscript, X is an n × N matrix of feature vectors, and Y is an n × k matrix of prototype vectors.
a b c d
Show that the inverse is given by
det(A)
d −b −c a
Matlab exercises
(a) Implement the k-means clustering algorithm as described in class. For the stopping criterion, allow the user to supply a threshold on the change in J (the sum of squared error over all clusters) on each iteration, as well as a maximum allowed number of iterations (e.g. 25). Have your program output the value of J on each iteration. Initialize the cluster centers by choosing k feature vectors at random from the data. (b) Load in Figure 6.30(a) (the bowl of strawberries) and use imresize with the ’bilinear’ option and M=0.25 to reduce its resolution by a factor of 4 in x and y. Display the resized image. Construct a matrix of 3-dimensional feature vectors for this image using the RGB values of each pixel. (c) Use k-means to perform clustering on this image using k = 3 and k = 4. In each case, run three trials to see the effects of the random initialization. Display each of the six resulting segmentations as a pseudocolor cluster membership image, like the example shown in class. (Note: if you don’t have access to a color printer, it’s ok to use shades of gray.)
Things to turn in:
(a) Implement the Lucas-Kanade algorithm for measuring optical flow, as described in class. Allow the user to specify the size of the window used in enforcing the smoothness con- straint. Use the quiver function to display the optical flow vectors. In addition, have your program return the two eigenvalues of the windowed image second moment matrix at each pixel. (b) Construct two frames of a simple motion sequence as follows. Make a 16×16 white square centered on a black background of size 32 × 32. Blur it with a Gaussian filter with σ = 1. This image represents I(x, y, t). Produce the second image, representing I(x, y, t + 1), by displacing the first image down one pixel and to the right one pixel. Display each frame, as well as It and the two components of ∇I. (c) Compute and display the optical flow for the above sequence using a window size of 5 × 5. Since you know the “ground truth” displacement (i.e. u = 1, v = 1), comment on the accuracy of your measured optical flow at various points throughout the image. Demonstrate how, by applying a threshold on the eigenvalues, you can suppress the flow vectors at pixels that suffer from the aperture problem. (d) Construct a new sequence consisting of the original first frame and a second frame pro- duced by rotating the first one by 5◦^ (use imrotate with the ’bil’ and ’crop’ options). Now repeat step 2c using this sequence.
Things to turn in: