 My Math Forum Singular vector decomposition and Low Rank Approximation
 User Name Remember Me? Password

 Applied Math Applied Math Forum

November 11th, 2018, 07:05 AM   #1
Newbie

Joined: Jul 2018
From: Asia

Posts: 9
Thanks: 1

Singular vector decomposition and Low Rank Approximation

In https://blogs.sas.com/content/iml/20...oximation.html , could anyone elaborate on the following sentence ? Why is it 48 ?

Quote:
 For the rank-3 approximation, three columns of the U matrix contain 33 numbers and three columns of VT contain 15 numbers. So the total number of values required to represent the rank-3 approximation is only 48, which is almost half the number of values as for the original image.

Besides, could anyone explain how the following two equations work for low rank approximation ?

Code:
Ak = U[ ,idx] * diag(D[idx]) * V[ ,idx]; /* rank k approximation */

Ak = (Ak - min(Ak)) / range(Ak); /* for plotting, stdize into [0,1] */

I found that the first equation implements the internal code of matlab/octave svd() function

and the second equation is "just scaling the remnant back - to cover the entire scale of (grey) colors" as described by one of my friend

Again, what is the mathematical relationship between singular vector decomposition (svd) and low rank approximation ?

I have copied a matlab/octave function online to be used with any images for the purpose of image compression using svd()

Code:
function C=compressimage(k)

A=imread('einstein.jpg');

B=A(:,:,1);

B=im2double(B);

% imshow(B);

[U,S,V]=svd(B);

[m,n]=size(S);

n=min(m,n);

% plot([1:n,diag(S),'.');

% axis([-10,n+1,0,300]);

% hold on

C=diag(S)';

for i=k+1:n

S(i,i)=0;

end

B=U*S*V';

imshow(B);

C=C';

end November 11th, 2018, 09:44 AM #2 Senior Member   Joined: Sep 2015 From: USA Posts: 2,531 Thanks: 1390 I don't know if this problem is spam bait or not but clicking on the link took me to some shopping website. November 11th, 2018, 04:23 PM #3 Newbie   Joined: Jul 2018 From: Asia Posts: 9 Thanks: 1 @romsek Sorry, that sas blog link has an advertisement website before the actual sas blog link. Instead, please use https://web.archive.org/web/20180502...oximation.html which uses the directly captured webpage from archive.org It should be safe for everyone now. November 11th, 2018, 04:27 PM   #4
Newbie

Joined: Jul 2018
From: Asia

Posts: 9
Thanks: 1

Quote:
 using the technique I mentioned, I was able to reduce the size (of the information you need to store) from 1028*768 to 1028*3 + 768*3. And, furthermore, I understand the 1028*3 part can be re-used for other images if you suspect they come from the same process. (the latter part doesn't really apply to images, I think). [U S V ] = svd(Sigma); where sigma = b' * b. Then, UR = U(:,1:k). Finally, Breduced = B *UR. All you need to store is UR and Breduced. To reconstruct B, Breconstructed = Breduced * UR'; For example, k=19 captures 99.99% of the information and pretty much reconstructs the image. With k=64, 99.999% information and I can't tell them apart. yet, huge size reduction
The above quote is from my friend regarding the image compression application for low rank approximation using svd(). I am still digesting it. Please comment if you understand. November 11th, 2018, 06:17 PM #5 Newbie   Joined: Jul 2018 From: Asia Posts: 9 Thanks: 1 See https://www.diffchecker.com/AEdocp5B The following simpler matlab/octave function also works well in image compression using svd() Could anyone comment about this code below ? Code: function C=compressimage2(k) A=imread('einstein.jpg'); B=A(:,:,1); B=im2double(B); % imshow(B); sigma = B' * B; [U,S,V]=svd(sigma); UR = U(:,1:k); Breduced = B *UR; Breconstructed = Breduced * UR' ; imshow(Breconstructed); end Tags approximation, decomposition, low, rank, singular, svd, vector Thread Tools Show Printable Version Email this Page Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Similar Threads Thread Thread Starter Forum Replies Last Post life24 Linear Algebra 1 June 30th, 2016 08:15 AM zylo Linear Algebra 1 October 12th, 2015 06:22 AM Bhuvaneshnick Algebra 0 December 22nd, 2014 11:53 PM SLUO Applied Math 1 September 8th, 2013 02:08 AM 450081592 Linear Algebra 1 November 16th, 2009 09:05 PM

 Contact - Home - Forums - Cryptocurrency Forum - Top

Copyright © 2019 My Math Forum. All rights reserved.      