SVD and its application to image compression

1 분 소요

SVD of a matrix

The SVD (Singular Value Decomposition) of a matrix $A$ is the factorization of $A$ into the product of three matrices $A = UDV^T$, where the columns of $U$ and $V$ are orthonormal and the matrix $D$ is diagonal with nonnegative real entries. This decomposition can also be written as

${\displaystyle A = \sum_{k=1}^{r} \sigma_k u_k v_k^T}$

where $r$ is the rank of $A$, the singular value $\sigma_k$ is the $k$-th element of $D$ arranged in decending order, and $u_k$ and $v_k$ are the $k$-th columns of $U$ and $V$.

Reducing the rank (approximation)

The approximation of $A$ can be obtained as follows:

${\displaystyle \tilde{A} = \sum_{k=1}^{n} \sigma_k u_k v_k^T}$

where $n (\le r)$ is the rank of the compressed matrix $\tilde{A}$.

Image compression via SVD

If $A$ contains pixels of an image, $\tilde{A}$ is a compressed image using a reduced amount of memory. This is what is meant by image compression via SVD. If a color image is given, the SVD can be performed to each of the three channels (e.g. red, green & blue). A set of Python codes for compressing images using SVD is provided here. How to run this program is simple as shown in the following short video.

Note: What has been described above is explained in more detail on the following pages:

  1. SVD and its relation to PCA
  2. Image compression by SVD

You can actually try SVD with your own image file.

댓글남기기