8. Geometric Operations¶
Reading Assignment
Please read section 12.7 of [RVC]; then read chapter 7 of [PIVP]; finally read section 14.2.4 of [RVC].
This chapter covers moving, removing, and duplication of pixels within an image.
8.1. Rotating a Pixel¶
Rotation is a very important topic to both machine vision and robotics. Pixels in an image might be rotated to align objects with a model.
Here, we only consider rotating points about the origin. Rotation about other points is an extension of rotating about the origin.
Point is rotated by an angle about the origin to point .
To facilitate the discussion, the point is defined in terms of unit vectors and . The new location, is then defined by unit vectors and formed by rotating and by the angle .
Expressed in matrix notation:
Thus, we have a 2-by-2 rotation matrix.
The rotation matrix has the following special properties.
- The sum of each column is one.
- The columns are orthogonal. The dot product of the columns is zero. It is called an orthonormal matrix.
- The columns define unit vectors for the rotated coordinate frame.
- .
- The determinant, , thus it is never singular.
8.2. Transformation Matrix¶
Geometric translation is often added to the rotation matrix to make a matrix that is called the transformation matrix in homogeneous coordinates. The translation coordinates ( and ) are added in a third column. To make the resulting matrix square, an additional row is also added.
This transformation matrix may then used in the image warping algorithm to find a new location for each pixel. This is referred to as a forward mapping.
The location of each pixel from the source image is found in the target image. This location will likely be between actual pixel locations in the target image. An interpolation algorithm could be used to find the values for each pixel in the target image, but the nearest mapped pixel is usually used with a forward mapping.
A more aesthetically pleasing result is achieved from a backward mapping image warping algorithm. In this approach, each pixel location from the target image is used to find the corresponding image location in the source image. This location will likely be between pixels in the source image, so an interpolation algorithm is used with the neighboring source pixels to determine the target pixel intensity.
Note
The inverse of the homogeneous transformation matrix is not as simple to compute as it is for the rotation matrix. Whereas the inverse of a rotation matrix is found by simply taking the transpose of the matrix, the inverse of a homogeneous transformation matrix is a linear algebra matrix inverse.