8
ASSIGNMENT 2: Calculate the Singular Value Decomposition of Images

Svd Report

Embed Size (px)

DESCRIPTION

Singular Value Decomposition Project in MATLAB

Citation preview

Page 1: Svd Report

ASSIGNMENT 2:

Calculate the Singular Value Decomposition

of Images

Page 2: Svd Report

INTRODUCTION:

As continued from project 1 in this project we will calculate the singular value decomposition of the images and use it for image compression. The images used in image processing requires large storage space. The solution for this problem is data compression without losing the exact data.

Here we are using the singular value decomposition for image compression without losing exact data. In this we are taking the 512 x 512 image matrix and compute its left or right singular vectors of the image matrix. Instead of using entire matrix we take subset of the matrix and compute SVD of smaller matrix and claim that it’s the good approximation of the image.

Now we are using the JAVA as our tool to compute the singular value decomposition of the images that we got from project 1and compress it using JAVA. IDE used for JAVA is eclipse software. We are computing the SVD of matrices, image compression, rate of convergence, floating point calculation, plotting graphs of approximation of image and Norm wise error calculation using JAVA.

Some of the concepts of representation of color models and the floating point implementation in JAVA have been looked into along-with the computation exercise.

Page 3: Svd Report

Concept on SVD :

Singular value decomposition has many theoretical and practical applications. It can performed on any real matrices. Let we have A m x n matrix with rank r , where r <= n<=m then A can be factorized as,

A= U S VT

Where U is m x m matrix, V is n x n and S is diagonal matrix in such a way that its singular value decreases diagonally.

The rank of matrix A is equal to the number of nonzero singular values, which allows us to compress matrix by eliminating the smaller singular values of the matrix. When image is converted to SVD it is not compressed but by using the some of the singular values we are able to obtain the compressed image which is near to original image.

Page 4: Svd Report

Project discussion

Question 1 )

Firstly we use images A, B and C which have got from project-1. We calculate the SVD of image matrix A, B and C using the algorithm of power method in JAVA.

From this we get three matrices U, V and S, where U is the left column vector and V is right column vector and S is the singular value.

Computation of power method : The computation involves taking the V0 vector approximately and

multiplying it with the image matrix Awe get vector U1 and singular values.

Similarly multiplying U1 with matrix AT we get V1.

Further multiplying the matrix A with V1 gives U2 vector and singular values

This way by using the method we get vectors V and U. Programming of the singular value calculations with V and U vectors

respectively by using JAVA is shown in the APPENDIX. Moreover we are getting different iterations taking different singular values

which gives us different images shown in APPENDIX. Now we continue the iterations till this equation,

According to equation the singular value of matrix i.e. For ( m > j),we need to assume Smm=0.

But from matrix A,B and C we are unable to get any value less than 10-5. So we are using the singular value of matrix 512 * 512 for programming.

Now programming of JAVA Code is explained in the APPENDIX.

Page 5: Svd Report

Question 2 :-

Calculating the singular values in above question is being considered as X which belongs to the image matrix A, B and C. And we have obtained the matrix which by taking approximate singular values which are the subset from the matrix A,B and C. This can be given by equation :

Where integer the number of non zero singular values of X.

So we assumed different values of p starting from 10, 20, 30 upto 510 of the matrix A, B and C to estimate different approximation of the images. The error wise norms of the image is being calculated accordingly.

Now the operations of the program is as follows:

The image is read using the JAVA at the given path using IMAGE defined object.

Now reading the images from JAVA analogous to exact image is acquired after using 140 singular values.

This image can be considered as Xp. To get the magnitude of the Xp need to calculate the norm the different singular values.

Dividing the singular values of Xp by 2-norm gives the magnitude. On calculating the magnitude printing different images of X Pby using the

JAVA at the given path using IMAGE defined object. Calculating the magnitude of (X-Xp) using JAVA . After calculating this plotting the graph of magnitude of ∥X−X P∥1 versus

“p” by using java. This graph is shown in the APPENDIX .

Page 6: Svd Report

Discussion from the plot:

First singular value calculated of “ankurgray.jpg” :- 74288.035 First singular value calculated of “snehalgray.jpg”:- 80210.2 First singular value calculated of “sagargray.jpg”:- 69567.889 The plot of error norm versus singular value is gradually decreasing. This

is due to the singular value is decreasing. ∥X−X P∥1 versus “p” depends upon the singular values.