HeadlinesBriefing favicon HeadlinesBriefing.com

Truncated SVD Image Compression Explained

Hacker News •
×

Principal Component Analysis (PCA) reduces data dimensions by transforming data into a new coordinate system via eigen-decomposition of the covariance matrix. Singular Value Decomposition (SVD) factors a real matrix M into three matrices U, Σ, and V where M=U*Σ*V^T. Both U and V are orthonormal, and Σ is rectangular-diagonal with non-negative singular values. SVD relates tightly to PCA: columns of V are principal directions, columns of U*Σ are principal components, and singular values connect to covariance eigenvalues.

Truncated SVD zeros out all Σ coefficients except the top-left n values, discarding corresponding columns in U and V. Reconstructing M'=U'*Σ'*V'^T yields an approximation of the original matrix. Applied to a 1024x1024 grayscale moon image, using only 32 of 1024 components achieves a 16x data reduction (65,568 vs 1,048,576 numbers) while preserving recognizable structure. The mean squared error drops rapidly with initial components, proving they capture most information, while trailing components represent high-frequency details. This mirrors Fourier and Cosine transforms but operates on space vs. variance duality rather than space vs. frequency.