How to understand SVD in image compressing?

In linear algebra, the singular value decomposition (SVD) is a factorization of a real or complex matrix.  If you want to ask the physical meaning of the singular value, then we must consider the actual application of SVD.

Before we start, let’s review the SVD in two single slides, these slides only contain the most important parts that we care about, for further research, readers are suggested to find a math book!

slide1slide2

First of all, let’s welcome the First Lady of image processing Lenna. Probably she is the most famous image (sorry, I mean woman 😛 ) in geeks’ world. As we all know, an image is actually a matrix. The size of the matrix is the pixel number. For example, this Lenna image is a 512×512 matrix. Let‘s denote this matrix as A.

lenna
Lenna.png (512×512)

Just like what we have learned from the slides, let’s see what the A1, A2, A200 and A512 look like and compare the results. For convenience, Itransfer the RGB image into Grayscale image for calculation.

demo_svd_a1
A1
demo_svd_a10
A2
demo_svd_a200
A200
demo_svd_a512
A512

It is not hard to see that on the right side, with higher value, the reconstructed image becomes much clearer. It feels like we gradually turn on the resolution of the screen.

Meanwhile, at the bottom of each image, I estimate the storage of each image, it reveals another function of SVD, compressing the image. As we see, A200 is almost the same with A, but cost less saving space.

In Data Mining and Machine Learning, SVD is also used to perform dimensionality reduction.  You could find more useful information in the following links.

The Code could be found on GitHub (:P Viewer discretion is advised :P).

[links]:

Author: Caihao (Chris) Cui

Data Scientist and Machine Learning Expert: Translating modern machine learning and computer vision techniques into engineering and bringing ideas to life to design a better future.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s