[Solved] AMATH301 Homework 9

30 $

File Name: AMATH301_Homework_9.zip
File Size: 178.98 KB

SKU: [Solved] AMATH301 Homework 9 Category: Tag:

Or Upload Your Assignment Here:


The first problem requires the file arnold01.jpg and the second problem requires the file NoisyImage.mat. These files are included with the homework assignment. You should download the files into the same directory as your script file and access them by using the imread and load commands, respectively. However, you should not upload them to Scorelator. Scorelator has its own copy of both files.

In the instructions below, I ask you to plot things. Plotting is not required to get full credit for the assignment, but I highly recommend it so that you can get a sense of what is being done. However, you should remove all plots before submitting to Scorelator.

  1. Read the image jpg into Matlab and convert it to a grayscale image with double precision numbers by using the following commands.

A = imread(‘arnold01.jpg’);

A = double(rgb2gray(A)); Plot the image using the commands:

imagesc(A) colormap gray

  • Perform a singular value decomposition on the matrix A that was generated by the image jpg. Create a 10×1 column vector that contains the ten largest singular values of A. Store this vector in A1.dat. The cumulative energy in the first r modes is the sum of the first r (i.e. r largest) singular values divided by the sum of all of the singular values. Calculate the cumulative energy in the first 10 modes and save it in A2.dat.
  • Find the smallest value of r such that the cumulative energy in the first r modes is greater than 0. Save the value of r in A3.dat. Approximate the matrix A by using the first r modes (i.e. the first r columns of U, the first r singular values, and the first r rows of V T, where U and V come from the SVD). Subtract this approximation from the original matrix A and then calculate the size of the error by using the norm command (use the default matrix norm and NOT the infinity norm). Save the error in A4.dat. Plot the approximation using imagesc and compare with the original image.
  • Now find the smallest value of r such that the cumulative energy in the first r modes is greater than 0. Save the value of r in A5.dat. Just like in part (b), approximate the matrix A by using the first r modes, calculate the error, and save the error in A6.dat. Plot the approximation using imagesc and compare with the original image.

Things to think about: What were the values of r that you found in parts (b) and (c)? How much less information needs to be stored if you just keep the truncated versions of U, Σ, and V ? How good do the approximations look? How much cumulative energy do you think is needed for a “good” approximation?

  1. Use the load command to load the data in mat. Two matrices should appear in your workspace. The matrix A is the true version of some image and the matrix A_noise is a noisy version of the same image. Plot both images using the imshow command and compare them. The goal of this problem is to denoise the noisy image.
    • Calculate the error between the matrix A and the matrix A_noise by subtracting and taking the norm. Save the error in dat. Perform a singular value decomposition on the matrix A_noise. Save the largest singular value in A8.dat.
    • Calculate the cumulative energy in the first 2 modes and save it in dat. Then approximate the matrix A_noise by using the first 2 modes. Calculate the error between the matrix A which represents the true image and this approximation. Save the error in A10.dat. Plot this approximation and compare to both the true image and the noisy image.

Things to think about: Look at all of the singular values of A_noise (or at least the first 20). Do a singular value decomposion on A and look at the singular values.

How do they compare? Does this explain why using the first 2 modes of A_noise was so effective? Do you think the denoising process would be more difficult on a different image?

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] AMATH301 Homework 9
30 $