The act of reducing the space occupied by a given file is called data compression. The need to compress data arose from the search for optimization in file transfer and storage. Through compression algorithms that are usually classified as lossy and lossless. The compression method that will be used in this project will be through singular value decomposition (SVD), a method that is classified as an algorithm that has data loss, because after decompression of a given file the information obtained It is different from the original, but similar enough to the original image to remain useful.
Given an image of MxN pixels, the first step will be to value each pixel in a matrix B with dimensions M, N and use SVD factorization to obtain U, Σ and V^T. The fundamental point of compression using SVD is Σ, some singular values are more significant and others are extremely small. Keeping few singular values, for example only 30 singular values, we would be sending only the 30 corresponding columns of U and V. The other columns will be multiplied by the smallest singular value being ignored. As we increase the number of singular values, the reconstructed image becomes more faithful to the original image. To calculate the percentage of space that we will use after compression just use the following formula, where k = the number of singular values and (m, n) = the dimensions of the original image:
k(1+m+n)/mn
In linear algebra, SVD is a broader matrix factorization method than diagonalization, not only being limited to square matrices but also enabling rectangular matrix factorization. Decomposing matrix A into 3 matrices U, Σ and V ^ T, where U and V are square orthogonal matrices (not necessarily transposed from one another or having the same dimensions) and Σ a diagonal matrix. Here's how to extract these arrays from matrix A:
The columns of matrix U are composed of the eigenvectors of AA^T
The columns of matrix V are generated by the eigenvectors of A^TA
The main diagonal of the matrix Σ consists of the square root of the non-zero eigenvalues, denominated as singular values, of ATA and AAT. A very common convention is to sort them downwards, the other elements of the matrix will be zeros.
After compression using 100 singular values

