# svd_gray

svd_gray, a MATLAB code which reads a file containing a grayscale image and uses the singular value decomposition (SVD) to compute and display a series of low rank approximations to the image.

In MATLAB, images can be thought of as numeric arrays (although you do have to convert them from the uint8 numeric format used for images to the double format used for numeric arrays.)

Therefore, an MxN image A has an SVD decomposition A = U*S*V'.

For any 1 <= R <= min(M,N), a low rank approximation to A is formed by

```        Ar = U(1:m,1:r) * S(1:r,1:r) * V(1:n,1:r)';
```
Properties of the SVD guarantee that Ar is the best possible rank R approximation to the data in A. This means it is often possible to get a good approximation to A using much less data.

### Languages:

svd_gray is available in a MATLAB version.

### Related Data and Programs:

svd_basis, a MATLAB code which applies the singular value decomposition (svd) to a collection of data vectors, extracting dominant modes;

svd_test, a MATLAB code which demonstrates the singular value decomposition (svd) for a simple example.

svd_fingerprint, a MATLAB code which reads a file containing a fingerprint image and uses the singular value decomposition (svd) to compute and display a series of low rank approximations to the image.

svd_snowfall, a MATLAB code which reads a file containing historical snowfall data and analyzes the data with the singular value decomposition (svd).

### Reference:

1. Harry Andrews, Claude Patterson,
Outer Product Expansions and Their Uses in Digital Image Processing,
American Mathematical Monthly,
Volume 82, Number 1, January 1975, pages 1-13.
2. David Kahaner, Cleve Moler, Steven Nash,
Numerical Methods and Software,
Prentice Hall, 1989,
ISBN: 0-13-627258-4,
LC: TA345.K34.

### Source Code:

• svd_gray.m, accepts the name of a gray scale image, computes the SVD, and calls svd_gray_approximate() to compute low rank approximations.
• svd_gray_approximate.m, uses a given SVD factorization to create an R-rank approximation of a gray scale image.