I wanted to view SVD in action (using Octave) by running it on an image and then breaking it down into a set of rank 1 matrices. I'm getting stuck before that though, because I'm unable to reproduce the image from its singular vectors and values.

To start, I ran the following code to view the original image:

my_image = imread('~/Desktop/panama.jpg')

enter image description here

I grabbed the singular vectors and values with

[u, s, v] = svd(my_image).

Since $A = usv^T$, and in this example A = my_image, in theory it seems like viewing the right hand side of the $A = usv^T$ equation should look exactly the same. Instead, when I run

imshow(u * s * v')

I get

enter image description here

and then must divide the pixel values by 100-something in order to reproduce the same "exposure" as the original image.

My observation is that the SVD equation doesn't seem to account for this scaling factor. In fact, isn't that what the singular values are for in a way? Could this just be a rounding error? I feel like even then, there shouldn't be such a big difference in the two images.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.