1. Download the image mandrill.mat from the class website, and load the matrix into your MATLAB environment by typing the command
>> load mandrill
This matrix is a representation of an image, which may be displayed by typing the commands
>> image(X); colormap(map)
2. Compute the SVD of this image using the command
>> [U,S,V] = svd(X);
This function returns the 3 matrices U, S, and V for a given input matrix.
(a) Plot the distribution of its singular values on your screen:
(b) Denoting by σj , uj , vj the j th singular value, the j th left singular vector and the j th right singular vector, respectively, we define the kth approximation Xk of the image X as
Xk =σ1u1v1t +…+σkukvkt
where vjt is the transpose of the jth right singular vector.
(c) Find the approximations of mandrill for k = 1, 6, 16, 31, and display the corresponding resulting images as shown above.
X5 =σ1u1v1t +…σ4u4v4t +σ5u5v5t
You should be able to display all four images in one page by using the subplot function. ( you might want to use a FOR loop to avoid writing out all the terms individually.) >> subplot(2,2,1)
to display the first image and
to display the second and so forth; and print this page.
(c) Compute the residual images X − Xk for the k’s in (c), and display the residual images in one page as well.
(d) Summarize your observations in the effectiveness of approximating the image with the SVD method. Is there any relation between Xk+1 and the residual X − Xk? If there is, what is it?