Mathematical Background- PART 1

(adapted in part from http://iul.cs.byu.edu/450/F96/450.html)

Reviews (see any linear algebra texts you may have or library has for more details):


Coordinate Systems

Most spatial quantities are represented quantitatively by specifying the quantity relative to a coordinate system. The usual coordinate systems in use are:

Two dimensional (2D)
- usually representing positions in a plane, such as an image plane, or describing flat objects. The letters I&J or X&Y are often used to denote the directions in these 2D spaces. More exotic planar spaces might be a locally flat patch on a curved surface (often using U&V), the parameterization of a curved surface (also using U&V), or the surface orientation (using P&Q).

Three dimensional (3D)
- usually representing the positions of points in our normal 3D world (letters X,Y&Z). Other commonly encountered 3D spaces are: a sequence of images over time (I,J&T), the surface defined by the intensity of light in an image (X,Y & I), or the surface defined by the distance of the scene to a sensor (X,Y & Z).

Four dimensional (4D)
- these spaces usually derive from looking at a 3D world over time (X,Y,Z&T).

The coordinate systems are specified using as many axes as there are dimensions. The axes are usually perpendicular, and there is a ``coordinate system origin'' where all the axes intersect and which has the value (0,0) or (0,0,0), etc, depending on the dimensionality of the space.


Vectors

Vectors are commonly used to represent the positions of points in a space, or also the displacement (direction and amount) between two points. In a 2D space, two values are needed to specify the position of a point. For example, a given point

at distance x in the X direction and distance y in the Y direction is represented by:

Figure 1a shows point . For simplicity in text, the vector can also be represented as . The T turns (``transposes'') a vector from a horizontal direction to a vertical direction and vice versa: .

 
Figure 1: a) Point in 2D coordinate system. b) vector between points and  

If a vector is , then the length of that vector is:

The length of the vector is also called the norm of the vector, although more properly it should be called the norm or 2-norm, for reasons that we need not go into here.

Vectors can represent directions. In this case, the vector is usually a unit vector, that is, it has length 1. One can create a unit vector by dividing a vector by its length:

Vectors are added/subtracted by adding/subtracting their components:

Vectors can represent changes/differences in positions. In this case, the length of the vector is the distance between the points. If and are two point positions, then the vector between them (see Figure 1b) is:

and the distance between the points is the length of the vector between them.

The dot product between two vectors and is defined as:

The angle between two vectors is defined using the dot product:



Vector Spaces, Spanning Vectors, and Basis Vectors

Even though your [height, weight, age] vector doesn't live in a physical geometric space, you can think of the space covered by all possible vectors of this form. Such a space is called the vector space in which these vectors live. Usually, we'll denote this in a fashion similar to this:


where is a vector and V is the space in which it lives.

For example, vectors in the two-dimensional Cartesian plane like you've seen in introductory Physics courses have a first component that can be any real number and a second component that can also be any real number. Using the symbol to denote the set of real numbers, we can describe this vector space as


or more compactly,


By definition, a vector space is closed: linear combination of vectors in the space always produces another vector in the space. A set of vectors from which you can construct any other vector in the space is called a spanning set. For example, by combining some amount of the vectors , , and , one can construct any other vector in the 2-D plane.

A minimal spanning set (one that contains as few vectors as possible) is called a basis set. In the previous example, one really only needs any two of the three vectors to span the space.

It is useful for the vectors in a basis set to have no components in the direction of each another (orthogonal). In the previous example, and are an orthogonal basis set while the other pairs aren't.

Finally, since we're spanning the space through linear combinations of vectors, the actual length of the vectors isn't really important--the direction is. To simplify things, we'll usually work with unit-length vectors for our basis sets. Basis sets that are orthogonal and normalized to unit length are called orthonormal.

A compact way of writing that a set of vectors is orthonormal is write


where the function (called the Krönecker delta function) is defined as


Think of this as a mathematician's way of writing ``1 if they're the same and 0 if they're different''. This is simply a compact notation for expressing the familiar definition that orthonormal vectors have length one and are orthogonal to each other.

Notice that a single vector space has an infinite number of possible sets of basis vectors. The two-dimensional plane can be spanned by and , or it can be spanned by and .

We also aren't strictly limited to Cartesian representation of the space. For example, the 2-D plane can be spanned by the Cartesian vectors and or by the polar basis vectors and .

Conversions from representing a vector space in terms of one set of basis vectors to representing the same space in terms of a different set of basis vectors will be fundamental to later lectures.


Vector Transformations

A fundamental relationship from linear algebra is given by the following equations.

Let ... be a set of orthonormal basis vectors for a vector space, then (as we have seen) any vector v in that space can be represented by
 


where
 


and is the jth element of vector and [j] is the jth element of vector .

In other words, any vector is a weighted sum of the basis vectors , and the weight of each vector is the dot product between the vector v and the basis vector .

In this way, any vector can be transformed from a set of components to a set of components in a coordinate system whose basis vectors are . This is known as a change of coordinates or a coordinate transformation.


Matrices

Matrices are commonly used to represent transformations, which are discussed later. They are generally a two-dimensional representation with a given number of rows and columns. So, using standard nomenclature, an matrix has N rows and M columns, each entry of which is a number. An example matrix is:

One often summarizes the notation of a matrix by saying is , referring to the entry of the matrix ( i.e. the entry at the row and column).

For vision purposes, most arrays are square, meaning that they have the same number of rows and columns.

Matrix-Matrix Multiplication

Multiplying, or finding the product of two matrices is a common operation. Let be a matrix and be a matrix. Then, the matrix that is their product is a matrix. If is and is , then the entries of are given by:

Matrix Properties

A special matrix is the identity matrix , which is a square matrix containing all zeros except along the top-left to bottom-right diagonal (called the main diagonal), which has the value one at each diagonal position. Here is the identity matrix:

The identity matrix is a special case of a diagonal matrix, which contains zeros at all locations except along the main diagonal. Here is a diagonal matrix:

For each matrix , there is a special matrix called the inverse of , and is often denoted . This matrix has the property:

In the case of matrices, if the matrix is:

then the inverse of is:

The product of matrices is not commutative, which means that, in general,

(although sometimes they are equal for particular matrices). However, matrix products are associative, which means:


Vector- Matrix Multiplication

To transform a vector into a new coordinate system, one must thus compute its projection onto each of the coordinate basis vectors. If there are N dimensions to the space, this requires N dot products each of the form in Eq. 3.7. A compact way of writing this is to write a single matrix A whose rows are the coordinate basis vectors and take the dot product of each row of the matrix with the vector to be transformed:


This operation is multiplication of a vector by a matrix:


where is the transformed vector (the weights ).

Suppose that we had a set of vectors that we needed to transform into the same space. We could put these vectors into a single matrix V whose columns are the vectors to be transformed and take the dot product of each column of V with each row of A to give a set of vectors. What we get is a new matrix whose columns are the transformed vectors:


To more precisely put it, matrix multiplication is a compact way of transforming a vector into a new coordinate system and is nothing by a collection of dot products. The columns of the first matrix are vectors to be transformed (expressed in the old coordinate system) and the rows of the second matrix are the new coordinate basis vectors (also expressed in the old coordinate system).

One can also do the same thing by transposing each matrix and reversing their order. (Remember from linear algebra: .) You will find that their are two distinct camps that span graphics, image processing, and computer vision: the ``row vector'' people and the ``column vector'' people. It's all a matter of taste really.

Composition of Matrices/Transformations

Suppose that you wanted to transform a set of vectors into one coordinate system and then from there into another expressed in terms of the new one. One can just multiply the matrix of initial vectors by the first transformation matrix and then multiply the result by the second:


(Notice that to add a transformation, we add a matrix on the left side of the existing matrices.) However, matrix multiplication is associative, so


This means that the result of the two transformations is the same as one single transformation whose matrix is the product of the other two.

This is called matrix composition: the collapsing of a set of transformations into a single (usually more complex) one. Notice that for a large set of initial vectors it usually more efficient than applying each transformation successively.