|
This is a simple MATLAB script which uses Singular Value Decomposition (SVD) to compress images. SVD can be used to provide the best lower-rank approximation to a matrix M, and thus be used for image compression. The idea is to use only the first k singular values/vectors of M so they form a lower-ranked matrix which is a good approximation to the original matrix M. This is usually fine because the lower singular values/vectors are small and can be sacrificed to reduce amount of data needed for representation. For a m x n matrix, we can actually store only (m+n+1 n)*k numbers which can be much smaller than the original mn numbers. As can be seen below, the SVD compression brings about little visible loss in quality when suitable values of k are chosen..
It is possible to choose k such that the “compressed image” ends up with a larger file size, which defeats the purpose of this technique. This implies that k must be chosen with k with care. |
Copyright © 2003-2024 Skeel Lee. All works are original ones by Skeel, unless otherwise stated.
|