SVD for Images : Java Applications - Andrew Trusty (gtg877q)
 
Instructions
The applications were programmed using Java 1.4.2 and may not work with earlier versions. Download and extract the zip archive SVD4Images.zip which includes the executable JAR SVD4Images.jar, the source files for the applications and the images used to run the applications.

The JAR file SVD4Images.jar is a java executable JAR that may be run
from the command line using "java -jar SVD4Images.jar" assuming Java is
setup on the computer. The JAR will then execute an example application
using the SVD compression algorithm, see the Example Application Usage section on the right for using this application. The JAR requires the three images below to be in the same folder as it to run correctly.

earth.jpg
sunset.jpg
einstein.jpg

Also available in the JAR are the EncodeSVD and DecodeSVD applications.

EncodeSVD may be run by typing "java -cp SVD4Images.jar EncodeSVD"
This application allows you to encode image files to an SVD compressed image file format (.svd) or re-encode image files into the standard .png image format. Be aware that encoding large images may not work correctly due to the JAMA SVD calculations.

DecodeSVD may be run by typing "java -cp SVD4Images.jar DecodeSVD"
This application allows you to decode SVD compressed image files (.svd) to the standard .png image format.

Upon running either of the above two applications you will be prompted for the input needed.


Example Application Usage
Click an image from the left three choices to use and then enter your own choice of rank K and press Generate New Images.

The new images should start to appear along with their σ(1) and σ(k) values. The image using the rank you specified should appear in the northwest area.

Selecting the checkbox Choose best K will have the application determine the smallest K that produces the best quality and override the custom user input.
 
Source
A zip archive of the executable JAR with the source and class files and the images it needs is available here SVD4Images.zip, it includes the JAMA Package classes.
Questions

Q. To get a good easily recognizable image, do you need to have σ(k+1) small compares to 255, or just small compared to σ(1), or is there some other criterion of smallness that is even more relevant?
A. Through my experimentation with the process I found that it is more important to have σ(k+1) small compared to σ(1) rather than to 255. For this reason when running my application the Auto choose best K method uses as a stop condition the σ(k+1) that is 1% of σ(1). I found 1% was roughly the best number that kept the sharpness and colors of the original images. Choosing σ(k+1) small compared to 255 on the other hand worked differently for each image as their singular values differed.


Q. How small can you make k, and still keep the portrait recognizable? In other words (roughly), what is the rank of a human face?
A. I found that using a value of k roughly around 9 generated an image that my mind would instantly pick out as a face. At this level the image has view discerning details but the main features of the face could be easily picked up; the eyes, the nose, the mouth, and the shape of the head.