My Math Forum  

Go Back   My Math Forum > College Math Forum > Applied Math

Applied Math Applied Math Forum


Reply
 
LinkBack Thread Tools Display Modes
November 11th, 2018, 08: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
promach is offline  
 
November 11th, 2018, 10:44 AM   #2
Senior Member
 
romsek's Avatar
 
Joined: Sep 2015
From: USA

Posts: 2,202
Thanks: 1157

I don't know if this problem is spam bait or not but clicking on the link took me to some shopping website.
romsek is offline  
November 11th, 2018, 05: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.
promach is offline  
November 11th, 2018, 05: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.
promach is offline  
November 11th, 2018, 07: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
promach is offline  
Reply

  My Math Forum > College Math Forum > Applied Math

Tags
approximation, decomposition, low, rank, singular, svd, vector



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
SVD - Singular value decomposition life24 Linear Algebra 1 June 30th, 2016 09:15 AM
Column Rank equals Row Rank zylo Linear Algebra 1 October 12th, 2015 07:22 AM
orthogonal or singular Bhuvaneshnick Algebra 0 December 23rd, 2014 12:53 AM
Singular Value Decomposition SLUO Applied Math 1 September 8th, 2013 03:08 AM
Prove A is singular 450081592 Linear Algebra 1 November 16th, 2009 10:05 PM





Copyright © 2018 My Math Forum. All rights reserved.