<?xml version="1.0" encoding="UTF-8" standalone="no"?>
	<?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<title>ImgExample</title>
<style type="text/css">body {
	font-size : 12pt;
	font-family : serif;
	color : #000000
}
math {
color : #000000;
font-family : Mathematica1, Mathematica2, Mathematica3, Mathematica4, Mathematica5, serif, CMSY10, Symbol, Times, Lucida Sans Unicode, MT Extra
}
</style>
</head>
<body>
<h2>Image Processing Example</h2><br />
<br />
A color-indexed or RGB digital image is essentially a big matrix (or three), and as such provides an excellent example of some of the properties of the SVD. We can make use of the ordering of the singular values to reduce the data needed to describe the most 'important' aspects of the system. Specifically, we can write the following SVD version of the Spectral Decomposition:<br />
<br />
<div align="center"><math xmlns="http://www.w3.org/1998/Math/MathML"><mstyle displaystyle="true"><mi>M</mi><mo>=</mo><msub><mi>d</mi><mn>1</mn></msub><mover accent="true"><mrow><msub><mi>U</mi><mn>1</mn></msub></mrow><mo stretchy="true">&RightArrow;</mo></mover><mo>&CircleTimes;</mo><mover accent="true"><mrow><msub><mi>V</mi><mn>1</mn></msub></mrow><mo stretchy="true">&RightArrow;</mo></mover><mo>+</mo><msub><mi>d</mi><mn>2</mn></msub><mover accent="true"><mrow><msub><mi>U</mi><mn>2</mn></msub></mrow><mo stretchy="true">&RightArrow;</mo></mover><mo>&CircleTimes;</mo><mover accent="true"><mrow><msub><mi>V</mi><mn>2</mn></msub></mrow><mo stretchy="true">&RightArrow;</mo></mover>
<mo>+</mo><mo>.</mo><mo>.</mo><mo>.</mo><mo>+</mo><msub><mi>d</mi><mi>n</mi></msub><mover accent="true"><mrow><msub><mi>U</mi><mi>n</mi></msub></mrow><mo stretchy="true">&RightArrow;</mo></mover><mo>&CircleTimes;</mo><mover accent="true"><mrow><msub><mi>V</mi><mi>n</mi></msub></mrow><mo stretchy="true">&RightArrow;</mo></mover></mstyle></math></div><br />
<br />
where <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>d</mi><mi>i</mi></msub></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><mover accent="true"><mrow><msub><mi>U</mi><mi>i</mi></msub></mrow><mo stretchy="true">&RightArrow;</mo></mover></math>, and <math xmlns="http://www.w3.org/1998/Math/MathML"><mover accent="true"><mrow><msub><mi>V</mi><mi>i</mi></msub></mrow><mo stretchy="true">&RightArrow;</mo></mover></math> are the i^{th} Singular Value, Left Singular Vector (column of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math>), and Right Singular Vector (row of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>V</mi></math>), respectively.<br />
<br />
Just as with the eigenvalues in a Spectral Decomposition, the first few Singular Values will be the largest, and thus these terms will make the largest 'contributions' to <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>M</mi></math>. In fact, the matrix constructed by adding the first <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>k</mi></math> such terms is the rank-k matrix closest to <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>M</mi></math>, in terms of least-squares distance between elements. This provides a simple compression or feature extraction technique.<br />
<br />
The following image is the blue channel from a 650 \times 600 RGB image. We convert the elements to floats, contruct the SVD, and then recreate the image using the approximation above for various values of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>k</mi></math>. Note that for, say, <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>k</mi><mo>=</mo><mn>10</mn></math>, we are using (at most) <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>k</mi><mo>*</mo><mn>600</mn><mo>*</mo><mn>2</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>1201</mn></math> numbers, rather then the original <math xmlns="http://www.w3.org/1998/Math/MathML"><mn>600</mn><mo>*</mo><mn>650</mn><mo>=</mo><mn>390,000</mn></math>, a significant compression.
</body>
</html>