BTL DSRR
BTL DSRR
BTL DSRR
REPORT SUBJECT
LINEAR ALGEBRA
SVD
STUDENT PERFORMANCE
NO. ID NAME
1 2352945 Võ Tá Phúc
2 2353376 Ngô Hải Long
3 2352716 Trần Xuân Lộc
Table of contents
1
Acknowledgement……………………………………………2
I. Introduction………………………………………………… 2
II. Background…………………………………………………3
2.1 Singular Value Decomposition (SVD) ………………4
2.2. Applying SVD in image compression ………………5
III. Matlab code and result……………………………………7
IV. Conclusion…………………………………………………10
References……………………………………………………10
ACKNOWLEDGEMENT
I. Introduction
In an era dominated by technology, the daily generation of vast
datasets has become a norm, with information conveyed in various
formats, prominently through images. The ubiquity of smartphones and
smart gadgets has amplified the importance of images as a means of
communication. As data scientists grapple with the management of
massive digital data, the cost and bandwidth implications of
uncompressed data storage and transmission have led to a surge in
interest within the scientific community regarding data compression
strategies.
2
The representation of an image as a matrix of size m×n, where m and
n denote the pixel height and width, respectively, forms the basis of the
discussion. Each pixel's brightness or darkness is represented by a matrix
element, with grayscale images ranging from 0 (black) to 1 (white). In
the realm of colored imagery, the RGB model assigns values to pixels in
three separate matrices. The storage implications of colored images are
elucidated, considering the increased space requirements due to the
presence of multiple layers.
II. Background
3
SVD stands for Singular Value Decomposition, and it is a mathematical
technique used in linear algebra. It is a factorization method that
decomposes a matrix into three other matrices, which can be useful in
various applications such as data compression, dimensionality reduction,
and solving linear equations.
where:
In essence, SVD divides the supplied matrix into many matrices. The
above matrix, which has m rows and n columns, is factored by the SVD
into three matrices, which are denoted by the notation M =U ∑ V T ,
where U and V T are orthogonal matrices of orders m×m and n×n,
respectively, and ∑ is a diagonal matrix of order m×n. The singular values
of M are nonnegative real numbers that make up the diagonal matrix ∑.
According to [1] and [2], the m columns of U and the n columns of V T
are the left and right singular vectors of M, respectively.
4
+ Find A AT and AT A from the given matrix M.
+ To create U, use A AT . This is done by figuring out the eigenvalues and
eigen vectors of A AT .
+ The eigenvalues and eigen vectors of AT A can also be calculated in
order to generate V.
+ Each eigen vector is divided by its magnitude to produce columns of U
and V.
+ By calculating the square root of the eigenvalues, singular values are
calculated. The diagonal
matrix has them ordered in descending order.
5
As we have seen, it is not necessary to compute the summation to the
very last of the values in the matrices. Smaller values are dropped before
the summation. After truncating the matrix, we get the following
summation.
A k= μ 1u 1 v 1T + μ 2 u 2 v 2T + ...+ μ k u k v k T
6
Figure 2. Image compression using SVD
7
III. Matlab code and result
Input: Image matrix I
Output : Compressed image I’
MATLAB CODE
% Image processing
close all
clc
figure('Name','ORIGINAL component of the imported image');
subplot(4,2,1);
imshow(X);
imwrite(X, 'original.jpg');
title('Original image')
R = X(:,:,1);
G = X(:,:,2);
B = X(:,:,3);
Rimg = cat(3, R, zeros(size(R)), zeros(size(R)));
Gimg = cat(3, zeros(size(G)), G, zeros(size(G)));
Bimg = cat(3, zeros(size(B)), zeros(size(B)), B);
Red = double(R);
Green = double(G);
Blue = double(B);
r=[200,100,50,30,20,10,5,1];
for i=1:length(r)
8
% Compute values for the red image
[U,S,V]=svd(Red);
C = S;
C(r(i)+1:end,:)=0;
C(:,r(i)+1:end)=0;
Dr=U*C*V';
% Compute values for the green image
[U2, S2, V2]=svd(Green);
C = S2;
C(r(i)+1:end,:)=0;
C(:,r(i)+1:end)=0;
Dg=U2*C*V2';
% Compute values for the blue image
[U3, S3, V3]=svd(Blue);
C = S3;
C(r(i)+1:end,:)=0;
C(:,r(i)+1:end)=0;
Db=U3*C*V3';
% Rebuild a colored image with the corresponding data and show it
subplot(4,2,i+1);
buffer = sprintf(' %d singular values', r(i));
Cimg = cat(3, Dr, Dg, Db);
imshow(uint8(Cimg));
imwrite(uint8(Cimg), sprintf('%dcolor.jpg', r(i)));
title(buffer);
end
end
9
RESULT
IV. Conclusion
Singular Value Decomposition (SVD) is a powerful mathematical
technique that has revolutionized several fields by extracting meaningful
information form complex data sets. SVD offers numerous advantages,
such as dimentionality reduction, noise tolerance and data compression.
Its ability to reveal hidden patterns, reduce dimensionality, and provide
10
a compact representation makes it indispensable in numerous
applications.
References:
[1]. H RGB Kotera to spectral lmage conversion using spectral pallete and
compression by svd 461–464.
[2]. S. Jabbar 2015 Using Approximate K-SVD Algorithm.
[3]. M.Dixit and P.K.Kulkarni 2012 Variable Scaling Factor based Invisible Image
Watermarking using Hybrid DWT-SVD Compression-Decompression Technique 2–5.
[4]. Rufai, A.M. Anbarjafari, G.Demirel, Huffman Coding and Singular Value
Decomposition.
11