Single Value Decomposition

Objective:

Is to decompress the image  using SVD (SINGLE VALUE DECOMPOSITION) and study the observation.

Assumption:

Single value decomposition: decompose the bigger matrix into smaller.

Image of size M x N (M cross N) can be consider as bigger matrix and using SVD we can decompose that into further smaller matrix hence decomposing of image is obtained.

Tools used:

Initially I stared with octave (the high-level language primarily intended for numerical computations) and i proceed well but when tried to convert image to double conversion by im2double function I got an error saying unidentified line . This is because octave has a bug in im2double for uint16 images, I found this piece of information from one of community site forum

So now it a time to play with Mat lab instead of octave .

Observation and legends:

I took two type of image for compression. Sizes of the images are 400×400.

1. An image that covers less details of the snap.

apple_500x40012

2. An image that covers more details of the snap.

500x400

I apply svd so as to obtain U,S,V matrix and changed the K values to both of images to study the observation.

when K = 400

80 %

k400 k400
when K = 300

60 %

k300 K300
when K = 250

50%

k250 K250
when k = 150
30%
k150 K150
quality of image changes
when k = 50
10%
k50 K50
when K =25
5 %
k25
quality of image changes
when k = 12.5

2.5 %

k12 5

Mat lab code :

close all

[A,map]=imread(‘h:cccc.jpg’);

Im2D=im2double(A,’indexed’);

imshow(Im2D,map)

[u,s,v]=svd(Im2D);

C=zeros(size(Im2D));

k=10;     // k values will be changed

for

j=1:k

C=C+s(j,j)*u(:,j)*v(:,j).’;

end

C=floor(C);

imshow(C,map)

k=find(C<1);

C(k)=1;

set(gcf,’Unit’,’inches’,’Paperposition’,[0,0,2,1])

print -djpeg ‘lenak.jpg’

Result

Although both images are of same size with same K values, It has been observed that image that coves less details of snap can be decompressed to larger extend than the image that cover more details of the snap.


4 Comments

  1. Diding Nuriska wrote
    at 8:22 PM - 19th February 2011 Permalink

    I want to ask you, I have problem here,,,

    what matrices that we call subspace from SVD factorization?
    is it U,,V or T?
    Thank you

  2. shakthydoss wrote
    at 3:52 AM - 20th February 2011 Permalink

    Yes , you are right
    to be more appropriate it is U V S.
    Where U corresponds to rows , V corresponds to columns and S corresponds to diagonals.

  3. Diding Nuriska wrote
    at 7:55 AM - 20th February 2011 Permalink

    yes, that’s U S V,,,

    do you know what matrices that call subspace?
    is it u s or v???

    thank you…

  4. shakthydoss wrote
    at 12:02 PM - 22nd February 2011 Permalink

    Lets say A be matrix of size m X n , then n columns is a linear subspace of n-dimensional Euclidean space. So it can be V.
    I also believe that there are four fundamental subspace, and row space is one among.If that is going to be case there is a possibly for U S also.

    thank you

Post a Comment

Your email is never published nor shared. Required fields are marked *