<< Chapter < Page | Chapter >> Page > |
We now turn our attention to operating on the point matrix to produce the desired transformations. We will consider
We call a matrix operator because it “operates” on through matrix multiplication. In contrast, translation must be done by matrix addition.
In a later section you will see that it is advantageous to perform all operations by matrix operators and that we can modify our image representation to allow translation to be done with a matrix operator like rotation andscaling. We will call the modified representation homogeneous coordinates .
Rotation. We saw in the chapter on linear algebra that the matrix that rotates points by an angle is
When applied to the point matrix G , this matrix operator rotates each point by the angle θ , regardless of the number of points.
We can use the rotation matrix to do the single point rotation of the example from "Vector Graphics: Introduction" . We have a point matrix consisting of only the point :
The necessary transformation matrix is with Then the rotated point is given by
Scaling. An object can be enlarged or reduced in each dimension inde- pendently. The matrix operator that scales an image by a factor of along the x-axis and along the y-axis is
Most often we take to scale an image by the same amount in both dimensions.
Translation. An object can be moved by adding a constant vector b to every point in the object. For example, will move an object 20 units to the right and 5 units down. We can write this in terms of the point matrix as
where 1 (read “the one-vector”) is a vector of n l's:
In MATLAB, 1 may be obtained by. The outer product of
with
1 in
Equation 7 simply serves to make
copies of
so that one copy can
be added to each point in
.
ones(n,1)
Notification Switch
Would you like to follow the 'A first course in electrical and computer engineering' conversation and receive update notifications?