How to to find the singular value (sigma) in image compression in SVD without using built in command?
3 views (last 30 days)
Show older comments
I have already find the matrix 80X80, but i want in matrix 99X80. In file that i have attach, i used sigma=sqrt(Q).
%reading and converting the image
A=imread('C:\Users\SONY\Documents\project mat723\echaphoto1.jpg');
A=rgb2gray(A);
B=double(A); %transform to real values
S=B(:,:,1); %convert B to matrix form
C=transpose(B);
D=C*B;%(A^t)*A
K=im2double(D);
y=poly(D); %characteristic polynomial
P=roots(y); %eigenvalues,(lambda)
[V,e]=eig(D);
V1=V(:,:,1); %eigenvector for matrix D
[m,n]=size(B);
Q=zeros(m,n);
R=zeros(n,n);
for j=1:80
v=B(:,j);
for i=1:j-1
R(i,j)=Q(:,i)'*B(:,j);
v=v-R(i,j)*Q(:,i);
end
R(j,j)=norm(v);
Q(:,j)=v/R(j,j); %normalize v to be the next unit vector
end
sigma=sqrt(e);
%W=orth(Q)
[W,M]=qr(Q);
s=svds(sigma);
VT=transpose(Q);
Y=rand(m,n);
I=eye(n);
Z=complex(Y,B);
2 Comments
Answers (0)
See Also
Categories
Find more on Eigenvalues in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!