João Victor Borges
SVD image compression
Context and problem

Final project for Scientific Computing and Data Analysis (UFRJ, 2026.1). The goal was to make the theorems visible: why truncating the SVD at the k largest singular values gives the best possible approximation of the image.

My role

Interface, API, numerical implementation and the theory page with the formulas.

Stack
PythonFastAPINumPySciPyPillowReact 18TypeScriptChart.jsKaTeX
Technical decisions
01

Backend processing

NumPy and SciPy (truncated SVD via ARPACK) decompose each RGB channel and return the reconstructed image for each k.

02

Region-based compression

The user selects an area with the mouse and chooses between a global SVD with a mask or per-tile SVD on 128×128 blocks.

03

Theory × measurement

The analysis screen compares the error predicted by the Frobenius norm with the pixel-by-pixel measurement, and shows the instability of computing σ via √λ(AᵀA).

Screen gallery
compressor
analysis
theory
Result

Three screens (Compressor, Analysis and Theory) and seven endpoints. In the charts, SVD always sits below the alternatives, confirming the theorem's optimality.