Skip to content Skip to navigation

OpenStax_CNX

You are here: Home » Content » Vector Graphics: Two-Dimensional Image Transformations

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Endorsed by Endorsed (What does "Endorsed by" mean?)

This content has been endorsed by the organizations listed. Click each link for a list of all content endorsed by the organization.
  • IEEE-SPS

    This module is included inLens: IEEE Signal Processing Society Lens
    By: IEEE Signal Processing SocietyAs a part of collection: "A First Course in Electrical and Computer Engineering"

    Click the "IEEE-SPS" link to see all content they endorse.

  • College Open Textbooks display tagshide tags

    This module is included inLens: Community College Open Textbook Collaborative
    By: CC Open Textbook CollaborativeAs a part of collection: "A First Course in Electrical and Computer Engineering"

    Comments:

    "Reviewer's Comments: 'I recommend this book as a "required primary textbook." This text attempts to lower the barriers for students that take courses such as Principles of Electrical Engineering, […]"

    Click the "College Open Textbooks" link to see all content they endorse.

    Click the tag icon tag icon to display tags associated with this content.

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • Bookshare

    This module is included inLens: Bookshare's Lens
    By: Bookshare - A Benetech InitiativeAs a part of collection: "A First Course in Electrical and Computer Engineering"

    Comments:

    "Accessible versions of this collection are available at Bookshare. DAISY and BRF provided."

    Click the "Bookshare" link to see all content affiliated with them.

  • NSF Partnership display tagshide tags

    This module is included inLens: NSF Partnership in Signal Processing
    By: Sidney BurrusAs a part of collection: "A First Course in Electrical and Computer Engineering"

    Click the "NSF Partnership" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

  • Featured Content display tagshide tags

    This module is included inLens: Connexions Featured Content
    By: ConnexionsAs a part of collection: "A First Course in Electrical and Computer Engineering"

    Comments:

    "A First Course in Electrical and Computer Engineering provides readers with a comprehensive, introductory look at the world of electrical engineering. It was originally written by Louis Scharf […]"

    Click the "Featured Content" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Also in these lenses

  • UniqU content

    This module is included inLens: UniqU's lens
    By: UniqU, LLCAs a part of collection: "A First Course in Electrical and Computer Engineering"

    Click the "UniqU content" link to see all content selected in this lens.

  • Lens for Engineering

    This module is included inLens: Lens for Engineering
    By: Sidney Burrus

    Click the "Lens for Engineering" link to see all content selected in this lens.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

Vector Graphics: Two-Dimensional Image Transformations

Module by: Louis Scharf. E-mail the author

Note:

This module is part of the collection, A First Course in Electrical and Computer Engineering. The LaTeX source files for this collection were created using an optical character recognition technology, and because of this process there may be more errors than usual. Please contact us if you discover any errors.

We now turn our attention to operating on the point matrix G G to produce the desired transformations. We will consider (i) rotation; (ii) scaling; (iii) and translation (moving) of objects. Rotation and scaling are done by matrix multiplication with a square transformation matrix A. If we call the transformed point matrix GnewGnew, we have

[Gnew]=[A][G].[Gnew]=[A][G].
(1)

We call A A a matrix operator because it “operates” on G G 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 and scaling. 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

A=R(θ)=cosθ-sinθsinθcosθ.A=R(θ)=cosθ-sinθsinθcosθ.
(2)

When applied to the point matrix G, this matrix operator rotates each point by the angle θ, regardless of the number of points.

Example 1

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 (3,1)(3,1):

G=31 .G=31.
(3)

The necessary transformation matrix is R(θ)R(θ) with θ=π6θ=π6 Then the rotated point is given by

G n e w = R ( π 6 ) G = c o s ( π 6 ) - s i n ( π 6 ) s i n ( π 6 ) c o s ( π 6 ) 3 1 2 . 10 2 . 37 · G n e w = R ( π 6 ) G = c o s ( π 6 ) - s i n ( π 6 ) s i n ( π 6 ) c o s ( π 6 ) 3 1 2 . 10 2 . 37 ·
(4)

Scaling. An object can be enlarged or reduced in each dimension inde- pendently. The matrix operator that scales an image by a factor of s x s x along the x-axis and s y s y along the y-axis is

A=S(sx,sy)=sx00sy.A=S(sx,sy)=sx00sy.
(5)

Most often we take sx=sysx=sy to scale an image by the same amount in both dimensions.

Exercise 1

Write out the following matrices. Simplify and give numerical answers to two decimal places:

  1. R(π2)R(π2);
  2. S(3,2)S(3,2);
  3. R(-π4)R(-π4);
  4. S(-1,1)S(-1,1).

Exercise 2: Reflections

What does S(-1,1)S(-1,1) do? S(1,-1)?S(-1,-1)S(1,-1)?S(-1,-1)? S(1,1)S(1,1)?

Exercise 3

Given G=0-1.544052.3-1G=0-1.544052.3-1 and θ=π3θ=π3 find Gnew=Gnew=R(θ)GR(θ)G. Give numerical answers to two decimal places.

Exercise 4

Apply each of the transformations in Exercise 1 and 2 to the image

G = 1 1 2 2 1 2 2 1 ; H = 1 2 3 4 2 3 4 1 . G = 1 1 2 2 1 2 2 1 ; H = 1 2 3 4 2 3 4 1 .
(6)

Sketch the original image and each transformation of it.

Translation. An object can be moved by adding a constant vector b to every point in the object. For example, b=20-5b=20-5 will move an object 20 units to the right and 5 units down. We can write this in terms of the point matrix as

G n e w = G + b 1 T G n e w = G + b 1 T
(7)

where 1 (read “the one-vector”) is a vector of n l's:

1=111.1=111.
(8)

In MATLAB, 1 may be obtained by ones(n,1). The outer product of b b with 1 in Equation 7 simply serves to make n n copies of b b so that one copy can be added to each point in G G.

Content actions

Download module as:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks