AOE 5404 Homework 5: Due On Feb. 26, 2025
AOE 5404 Homework 5: Due On Feb. 26, 2025
(1) Load the image into Matlab using the built-in function “imread”, e.g., A = imread('rose.jpg');
The output “A” is a matrix with each entry corresponding to a pixel of the image. What are the dimensions (i.e. numbers
of rows and columns) of the matrix? Visualize the image in Matlab using “imshow(A)”.
(2) Perform SVD on matrix A, using the Matlab built-in function svd. (Hint: The output of imread is an integer matrix.
Before applying SVD, you need to convert it into a real-valued matrix, e.g., by A = double(A).) How many singular
values does the matrix have? Plot the first (i.e. largest) 100 singular values.
(3) Approximate matrix A by a reduced-order (i.e. lower-rank) orthogonal basis, using the first 𝑟𝑟 singular values. Visualize
the images obtained using 𝑟𝑟 = 1, 5, 20, 50, 100. (Hint: If you use “imshow(…)” to visualize a matrix, the matrix needs
to be converted back to an (unsigned) integer matrix. This can be done using function uint8(…).)
(4) What is the storage cost in the case of 𝑟𝑟 = 100 (i.e. how many numbers need to be stored)? How does it compare with
the cost of storing the original image?