Question: Run the SVD compression code in Matlab (or any other language). A) Estimate for which value of q the energy norm' retained in the

Run the SVD compression code in Matlab (or any other language). A)

Run the SVD compression code in Matlab (or any other language). A) Estimate for which value of q the energy norm' retained in the compressed image is 99% of the original 2-norm? B) Compute the resulting compression ratio? % SVD compression code for color images clear all; close all; q=200; gray value 901 X0=imread('C:\Users\brio\Desktop\Math 322\Lecture Notes\ Linear Algebra\glassware.jpg'); figure (1) imshow (X0) title ('Original image') X=double (X0)/255; [m, n,p] = size (X); X = reshape (X,m, p*n); [V,S,U] svd (X', 0); % sigma-diag (S); q=max(find (sigma>mu* sigma (1))); %could be used to find q for given threshhold a=diag (S) '/S (1, 1) * 100; a=[100-a (2:length (a) -1), 100]; figure (2) plot (a (1: q), 'ro') title('Scaled singular values') k = 1:q; X = U(:,k) *S (k, k) *V (:, k) '; X = reshape (X, m, n,p); color images figure (3) imshow (X, []); comment out for gray, use only for title (['Compressed image with q = , num2str(q)])

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!