Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
19 views

Lecture 06

This document provides an outline for a lecture on coordinate systems and transformations. It begins with a recap of 2D rotations using matrix representations. It then introduces homogeneous coordinates as a way to represent affine transformations with matrices. Compositions of affine mappings can be expressed by multiplying the corresponding matrices. Rotations can be performed about arbitrary points by applying translations, rotations, and inverse translations sequentially. An example shows a 12 degree rotation about the image center. Finally, the document mentions considering efficiency for compositions of affine mappings.

Uploaded by

zaid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Lecture 06

This document provides an outline for a lecture on coordinate systems and transformations. It begins with a recap of 2D rotations using matrix representations. It then introduces homogeneous coordinates as a way to represent affine transformations with matrices. Compositions of affine mappings can be expressed by multiplying the corresponding matrices. Rotations can be performed about arbitrary points by applying translations, rotations, and inverse translations sequentially. An example shows a 12 degree rotation about the image center. Finally, the document mentions considering efficiency for compositions of affine mappings.

Uploaded by

zaid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

Image Processing,

Retrieval, and Analysis (I)


Prof. Christian Bauckhage
Outline
Lecture 06

Recap

Coordinate Systems and Transformations


Homogeneous Coordinates
Compositions of Affine Mappings
Polar Coordinates

Outlook on Things to Come


Recap

long term goal: image transformations


Recap

rotations in the plane

I 2D rotations are given by:


    
px cos ϕ sin ϕ pu
= pv
py − sin ϕ cos ϕ pv p
ŷ v̂
or a bit shorter: py
px
pxy = Rϕ puv x̂ ϕ

û pu
or shorter yet:

x = Ru
Recap

rotations in the plane


I the back transformation or inverse u = R−1 x
is easy, because R is a rotation matrix
Recap

rotations in the plane


I the back transformation or inverse u = R−1 x
is easy, because R is a rotation matrix, i.e.:

1. R is square
2. det R = cos2 ϕ + sin2 ϕ = 1
3. the column vectors c1 and c2 of R are orthonormal
4. the row vectors r1 and r2 of R are orthonormal
5. R−1 = RT
Recap

rotations in the plane


I the back transformation or inverse u = R−1 x
is easy, because R is a rotation matrix, i.e.:

1. R is square
2. det R = cos2 ϕ + sin2 ϕ = 1
3. the column vectors c1 and c2 of R are orthonormal
4. the row vectors r1 and r2 of R are orthonormal
5. R−1 = RT

⇔ R ∈ SO2 (R)
Recap

rotations in the plane


I the back transformation or inverse u = R−1 x
is easy, because R is a rotation matrix, i.e.:

1. R is square
2. det R = cos2 ϕ + sin2 ϕ = 1
3. the column vectors c1 and c2 of R are orthonormal
4. the row vectors r1 and r2 of R are orthonormal
5. R−1 = RT

⇔ R ∈ SO2 (R)

I because of these properties, it follows that:


 
−1 cos ϕ − sin ϕ
R =
sin ϕ cos ϕ
Recap

scaling, shear, reflection (a.k.a. flipping)


I other affine transformations in the plane, too,
can be realized by means of matrix operations
I of course, several affine transformation may be
composed by applying them in succession
Recap

scaling, shear, reflection (a.k.a. flipping)


I other affine transformations in the plane, too,
can be realized by means of matrix operations
I of course, several affine transformation may be
composed by applying them in succession
I the corresponding result can be accomplished
in a single step, if the corresponding matrices
are combined into a single operation
I to this end, we simply multiply them together
Recap

scaling, shear, reflection (a.k.a. flipping)


I other affine transformations in the plane, too,
can be realized by means of matrix operations
I of course, several affine transformation may be
composed by applying them in succession
I the corresponding result can be accomplished
in a single step, if the corresponding matrices
are combined into a single operation
I to this end, we simply multiply them together

note:
I matrix multiplication is not generally commutative
Recap

example

original: g(u) rotation: g̃(Ru) shearing: g̃(Su)

g̃(SRu) g̃(RSu)
Recap

linear transformations
I affine transformations in a 2D space (i.e. in a
coordinate plane) that can be realized through
of matrix multiplications are linear transformations
Recap

linear transformations
I affine transformations in a 2D space (i.e. in a
coordinate plane) that can be realized through
of matrix multiplications are linear transformations
I a transformation T is linear, if, for vectors u and v
and a scalar α, it is characterized by

T(u + v) = T(u) + T(v)


T(αu) = αT(u)
Recap

linear transformations
I affine transformations in a 2D space (i.e. in a
coordinate plane) that can be realized through
of matrix multiplications are linear transformations
I a transformation T is linear, if, for vectors u and v
and a scalar α, it is characterized by

T(u + v) = T(u) + T(v)


T(αu) = αT(u)

note:
I a translation in a 2D space can not be realized by
means of matrix multiplication
Recap

general affine transformation


I a general affine transformation is therefore given as
      
px a b pu e
= +
py c d pv f

or equivalently:

x = Mu + t
Recap

general affine transformation


I a general affine transformation is therefore given as
      
px a b pu e
= +
py c d pv f

or equivalently:

x = Mu + t

note:

I every linear transformation is affine,


but not every affine transformation is linear
Coordinate Systems and Transformations

homogeneous coordinates
I borrow an idea from projective geometry, namely
embed the n-dim space in an n + 1-dim space
Coordinate Systems and Transformations

homogeneous coordinates
I borrow an idea from projective geometry, namely
embed the n-dim space in an n + 1-dim space
I for a 2D plane we have
 
  wx
x
→ wy
y
w
Coordinate Systems and Transformations

homogeneous coordinates
I borrow an idea from projective geometry, namely
embed the n-dim space in an n + 1-dim space
I for a 2D plane we have
 
  wx
x
→ wy
y
w

I w is usually chosen to be w = 1, thus


 
  x
x
→ y
y
1
Coordinate Systems and Transformations

metaphor
I visualization / geometric interpretation of the transition to
homogeneous coordinates

y

x
Coordinate Systems and Transformations

homogeneous coordinates
I in homogeneous coordinates, affine transformations
in the plane can be expressed by means of a matrix
multiplication, for instance
        
x a x+a 1 0 a x
 y  +  b =  y + b  =  0 1 b  y 
1 0 1 0 0 1 1
Coordinate Systems and Transformations

homogeneous coordinates
I in homogeneous coordinates, affine transformations
in the plane can be expressed by means of a matrix
multiplication, for instance
        
x a x+a 1 0 a x
 y  +  b =  y + b  =  0 1 b  y 
1 0 1 0 0 1 1

I in homogeneous coordinates, x = Mu + t simplifies to


    
x M t u
=
1 00 1 1
Coordinate Systems and Transformations

compositions of affine mappings


I using homogeneous coordinates, the 2D rotation becomes
    
px cos ϕ sin ϕ 0 pu
py  =  − sin ϕ cos ϕ 0 pv 
1 0 0 1 1
Coordinate Systems and Transformations

compositions of affine mappings


I using homogeneous coordinates, the 2D rotation becomes
    
px cos ϕ sin ϕ 0 pu
py  =  − sin ϕ cos ϕ 0 pv 
1 0 0 1 1

note:

I this rotation matrix rotates images about the origin


Coordinate Systems and Transformations

Question:
I how do we rotate about an arbitrary point p?
Coordinate Systems and Transformations

Question:
I how do we rotate about an arbitrary point p?

Answer:
I by mans of the following algorithm
1. change into a coordinate system, where p is the origin, i.e.
carry out the translation O → O 0 = p
2. carry out the desired rotation in this new system
3. carry out the back transformation O 0 → O
Coordinate Systems and Transformations

Question:
I how do we rotate about an arbitrary point p?

Answer:
I by mans of the following algorithm
1. change into a coordinate system, where p is the origin, i.e.
carry out the translation O → O 0 = p
2. carry out the desired rotation in this new system
3. carry out the back transformation O 0 → O

I for rotating about a point with coordinates (a, b), we obtain


      
px 1 0 a cos ϕ sin ϕ 0 1 0 −a pu
 py  =  0 1 b  − sin ϕ cos ϕ 0 0 1 −b pv 
1 0 0 1 0 0 1 0 0 1 1
Coordinate Systems and Transformations

example
I rotation of 12◦ about the origin or the center of an image
Coordinate Systems and Transformations

compositions of affine mappings


I some thoughts on efficiency
Coordinate Systems and Transformations

compositions of affine mappings


I some thoughts on efficiency
I for example, consider again
      
px 1 0 a cos ϕ sin ϕ 0 1 0 −a pu
 py  =  0 1 b  − sin ϕ cos ϕ 0 0 1 −b pv 
1 0 0 1 0 0 1 0 0 1 1

I how to proceed?
Coordinate Systems and Transformations

compositions of affine mappings


I naı̈ve matrix multiplication is of complexity O(n3 )
(Strassen’s algorithm works in O(nlog2 7 ) ≈ O(n2.807 ))
I naı̈ve matrix vector multiplication requires O(n2 )
Coordinate Systems and Transformations

compositions of affine mappings


I naı̈ve matrix multiplication is of complexity O(n3 )
(Strassen’s algorithm works in O(nlog2 7 ) ≈ O(n2.807 ))
I naı̈ve matrix vector multiplication requires O(n2 )
I the previous example can thus be computed using
either

2 × 33 + 1 × 32 = 63

or

3 × 32 = 27

operations . . .
Coordinate Systems and Transformations

nevertheless . . .
Coordinate Systems and Transformations

nevertheless . . .
I given that an image contains M × N pixels,
it is preferable to compute the composition
before applying it to every pixel
Coordinate Systems and Transformations

polar coordinates
I points in the plane do not necessarily have to be
addressed by means of coordinates w.r.t. an axial
coordinate system
Coordinate Systems and Transformations

polar coordinates
I points in the plane do not necessarily have to be
addressed by means of coordinates w.r.t. an axial
coordinate system
I they may also be referenced by means of a the length
of a line segment and an angle
y y

py
p p

px x x
Coordinate Systems and Transformations

polar coordinates
I (r, ϕ) are called planar polar coordinates
Coordinate Systems and Transformations

polar coordinates
I (r, ϕ) are called planar polar coordinates

I if the polar coordinates of a point p are known, we can


easily compute its Cartesian coordinates (px , py ) as
px = r cos ϕ
py = r sin ϕ
Coordinate Systems and Transformations

polar coordinates
I (r, ϕ) are called planar polar coordinates

I if the polar coordinates of a point p are known, we can


easily compute its Cartesian coordinates (px , py ) as
px = r cos ϕ
py = r sin ϕ

I if the Cartesian coordinates (px , py ) are known, the polar


coordinates can be obtained from
q
r = p2x + p2y
py
ϕ = arctan
px
Coordinate Systems and Transformations

polar coordinates
I the point for which r = 0 is called the pole
Coordinate Systems and Transformations

polar coordinates
I the point for which r = 0 is called the pole
I the axis for which ϕ = 0◦ is called the polar axis
Coordinate Systems and Transformations

polar coordinates
I the point for which r = 0 is called the pole
I the axis for which ϕ = 0◦ is called the polar axis
I the angle ϕ is measured counterclockwise with respect to
the polar axis (i.e. the x-axis) and is usually referred to as
the azimuth
Coordinate Systems and Transformations

note:

I for points where px = 0, arctan is not defined


Coordinate Systems and Transformations

note:

I for points where px = 0, arctan is not defined


I for most modern compilers or interpreters, however,
this does not pose a serious problem . . .
Coordinate Systems and Transformations

note:

I for points where px = 0, arctan is not defined


I for most modern compilers or interpreters, however,
this does not pose a serious problem . . .
I for instance, upon entering man atan2 at the Linux
console, we see an explanation of the behavior and
implementation details of the arctan function:
Coordinate Systems and Transformations

The atan2() and atan2f() functions compute the principal value of the arc
tangent of y/x, in the interval [-pi,pi] radians. The sign of atan2() and
atan2f() is determined by the sign of y. The value of atan2(y,x) is com-
puted as follows where f is the number of fraction bits associated with the
data type.
_____________________________________________________
Value of Input Arguments Angle Returned
_____________________________________________________
x = 0 or y/x > 2**(f+1) pi/2 * (sign y)
x > 0 and y/x <= 2**(f+1) atan(y/x)
x < 0 and y/x <= 2**(f+1) pi * (sign y) + atan(y/x)
_____________________________________________________
Coordinate Systems and Transformations

the (r, ϕ)-plane


I an interesting effect results from treating the polar
coordinates (r, ϕ) of a set of points as Cartesian
coordinates
Coordinate Systems and Transformations

the (r, ϕ)-plane


I an interesting effect results from treating the polar
coordinates (r, ϕ) of a set of points as Cartesian
coordinates
I that is, we define two orthogonal axes and plots the
r-coordinates along the one axis and the ϕ-coordinates
along the other axis
Coordinate Systems and Transformations

the (r, ϕ)-plane


I an interesting effect results from treating the polar
coordinates (r, ϕ) of a set of points as Cartesian
coordinates
I that is, we define two orthogonal axes and plots the
r-coordinates along the one axis and the ϕ-coordinates
along the other axis
I this realizes a coordinate transformation from the
(x, y)-plane into the (r, ϕ)-plane
Coordinate Systems and Transformations

the (r, ϕ)-plane


I an interesting effect results from treating the polar
coordinates (r, ϕ) of a set of points as Cartesian
coordinates
I that is, we define two orthogonal axes and plots the
r-coordinates along the one axis and the ϕ-coordinates
along the other axis
I this realizes a coordinate transformation from the
(x, y)-plane into the (r, ϕ)-plane
I this means, that functions (images) cannot only be
transformed within one type of space but may also be
expressed in different mathematical spaces; this also
happens when we apply Fourier transforms, Cosine
transforms, Wavelet transforms, etc.
Coordinate Systems and Transformations

example
I image represented in the (r, ϕ) plane

y ϕ

496 π/2

0 x 0 r
0 730 0 882.6
Coordinate Systems and Transformations

example
I image represented in the (r, ϕ) plane

y ϕ

496 π/2

0 x 0 r
0 730 0 882.6

I the pole coincides with the origin (0, 0) of the Euclidean plane
I the polar axis coincides with the x-axis of the Euclidean plane
Coordinate Systems and Transformations

example (cont.)

y ϕ

496 π/2

0 x 0 r
0 730 0 882.6
Coordinate Systems and Transformations

example (cont.)

y ϕ

496 π/2

0 x 0 r
0 730 0 882.6
Coordinate Systems and Transformations

example
I a different transformation (x, y) → (r, ϕ)
ϕ
y

248

0 r
−248 x 431.3
0 365 0
−365

I here, the pole coincides with the center of the image


Outlook on Things to Come

Question:
I what have we done so far?
Outlook on Things to Come

Question:
I what have we done so far?

Answer:
I we looked at
I image acquisition
I image representations
Outlook on Things to Come

Question:
I what have we done so far?

Answer:
I we looked at
I image acquisition
I image representations

I we also looked at
I vector spaces
I coordinate systems
I coordinate transformations
Outlook on Things to Come

Answer (cont.):
I we learned that
I intensity images are matrices G ∈ Rm×n
I intensity images are vectors g ∈ Rm·n
Outlook on Things to Come

Answer (cont.):
I we learned that
I intensity images are matrices G ∈ Rm×n
I intensity images are vectors g ∈ Rm·n
I intensity images are functions g : R2 R
Outlook on Things to Come

Answer (cont.):
I we learned that
I intensity images are matrices G ∈ Rm×n
I intensity images are vectors g ∈ Rm·n
I intensity images are functions g : R2 R

I we also learned that


I certain real and complex valued functions are vectors
Outlook on Things to Come

Answer (cont.):
I we learned that
I intensity images are matrices G ∈ Rm×n
I intensity images are vectors g ∈ Rm·n
I intensity images are functions g : R2 R

I we also learned that


I certain real and complex valued functions are vectors

I we also learned that


I coordinate vectors u can be transformed to produce, say

g̃(x) = g̃ T(u) = g(u)
Outlook on Things to Come

next, we
I get to know yet another point of view for looking at g(x)
Outlook on Things to Come

next, we
I get to know yet another point of view for looking at g(x)
I understand this point of view and make use of the
interesting possibilities it has to offer
Outlook on Things to Come

next, we
I get to know yet another point of view for looking at g(x)
I understand this point of view and make use of the
interesting possibilities it has to offer

g(x, y) log |G(µ, ν)|

You might also like