coordinate systems and coordinate transformations ... our long term goal is to understand image transformations .... carry out the back transformation O â O ...
Image Processing Prof. Christian Bauckhage
outline lecture 06 recap coordinate systems and coordinate transformations homogeneous coordinates polar coordinates complex exponentials summary outlook on things to come
recap our long term goal is to understand image transformations
recap
planar rotations about the origin px cos ϕ sin ϕ pu = py − sin ϕ cos ϕ pv
pv yˆ
p
v ˆ
py
or a bit shorter
px x ˆ
pxy = Rϕ puv or shorter yet x = Ru
O
u ˆ pu
ϕ
recap
the back transformation or inverse u = R−1 x is easy, because R is a rotation matrix
recap
the back transformation or inverse u = R−1 x is easy, because R is a rotation matrix, that is it is a real valued and square matrix its columns are pairwise orthonormal its rows are pairwise orthonormal its inverse equals its transpose cos ϕ − sin ϕ −1 | R =R = sin ϕ cos ϕ its determinant is det R = cos2 ϕ + sin2 ϕ = 1
recap
the back transformation or inverse u = R−1 x is easy, because R is a rotation matrix, that is it is a real valued and square matrix its columns are pairwise orthonormal its rows are pairwise orthonormal its inverse equals its transpose cos ϕ − sin ϕ −1 | R =R = sin ϕ cos ϕ its determinant is det R = cos2 ϕ + sin2 ϕ = 1 ⇔ R ∈ SO(2, R)
recap
other affine transformations, too, can be realized in terms of matrix-vector operations several affine transformation may be composed simply by applying them in succession the corresponding result can be accomplished in a single step, if the corresponding matrices are combined into a single matrix
recap
matrix products do not generally commute
original g(u)
rotation ˜ g(Ru)
shearing ˜ g(Su)
˜ g(SRu)
˜ g(RSu)
recap
affine transformations that can be realized through of matrix multiplications are linear transformations 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 au = aT u
recap
affine transformations that can be realized through of matrix multiplications are linear transformations 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 au = aT u
translations can not immediately be realized by means of matrix multiplication
recap
general affine transformations are thus px a b pu e = + py c d pv f or equivalently x = Mu+t
recap
general affine transformations are thus px a b pu e = + py c d pv f or equivalently x = Mu+t
every linear transformation is affine, but not every affine transformation is linear
coordinate systems and coordinate transformations
homogeneous coordinates
borrow an idea from projective geometry, namely embed the m-dim space in an (m + 1)-dim space
homogeneous coordinates
borrow an idea from projective geometry, namely embed the m-dim space in an (m + 1)-dim space for points in the 2D plane, we consider wx x → wy y w
homogeneous coordinates
borrow an idea from projective geometry, namely embed the m-dim space in an (m + 1)-dim space for points in the 2D plane, we consider wx x → wy y w w is usually chosen to be w = 1, so that x x → y y 1
metaphor
geometric interpretation of the transition to homogeneous coordinates
→
y x
benefits
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
benefits
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 in homogeneous coordinates, x = Mu + t simplifies to M t x u = 1 1 00 1
2D rotation about the origin
using homogeneous coordinates, planar rotations become px cos ϕ sin ϕ 0 pu py = − sin ϕ cos ϕ 0 pv 1 0 0 1 1
question how do we rotate about an arbitrary point p ∈ R2 ?
question how do we rotate about an arbitrary point p ∈ R2 ? answer by mans of the following algorithm change into a coordinate system, where p is the origin, i.e. carry out the translation O → O 0 = p carry out the rotation in this new system carry out the back transformation O 0 → O
question how do we rotate about an arbitrary point p ∈ R2 ? answer by mans of the following algorithm change into a coordinate system, where p is the origin, i.e. carry out the translation O → O 0 = p carry out the rotation in this new system carry out the back transformation O 0 → O
for rotating about a point with coordinates (a, b), we obtain px 1 py = 0 1 0
0 1 0
a cos ϕ sin ϕ 0 1 0 b − sin ϕ cos ϕ 0 0 1 1 0 0 1 0 0
−a pu −b pv 1 1
example
rotation of 12◦ about the origin or the center of an image
thoughts on computational efficiency
consider once again px 1 py = 0 1 0
0 1 0
how to proceed?
a cos ϕ sin ϕ 0 1 0 b − sin ϕ cos ϕ 0 0 1 1 0 0 1 0 0
−a pu −b pv 1 1
thoughts on computational efficiency
na¨ıve matrix multiplication is of complexity O n3
Strassen’s algorithm works in O nlog2 7 ≈ O n2.807
thoughts on computational efficiency
na¨ıve matrix multiplication is of complexity O n3
Strassen’s algorithm works in O nlog2 7 ≈ O n2.807
na¨ıve matrix vector multiplication requires O n2
thoughts on computational efficiency
na¨ıve matrix multiplication is of complexity O n3
Strassen’s algorithm works in O nlog2 7 ≈ O n2.807
na¨ıve matrix vector multiplication requires O n2 the previous expression can thus be computed using either 2 × 33 + 1 × 32 = 63 or 3 × 32 = 27 operations . . .
polar coordinates
points in the plane do not necessarily have to be addressed w.r.t. an axial coordinate system
y
p
x
polar coordinates
points in the plane do not necessarily have to be addressed w.r.t. an axial coordinate system they may also be referenced by means of the length of a line segment and an angle
y
p
p r ϕ x
polar coordinates
r, ϕ are the planar polar coordinates of a 2D point p
polar coordinates
r, ϕ are the planar polar coordinates of a 2D point p if the polar coordinates of p are known,we can easily compute its Cartesian coordinates x, y as x = r cos ϕ y = r sin ϕ
polar coordinates
r, ϕ are the planar polar coordinates of a 2D point p if the polar coordinates of p are known,we can easily compute its Cartesian coordinates x, y as x = r cos ϕ y = r sin ϕ if the Cartesian coordinates x, y are known, the polar coordinates can be obtained from p r = x 2 + y2 ϕ = arctan
y x
polar coordinates
the point for which r = 0 is called the pole
polar coordinates
the point for which r = 0 is called the pole the axis for which ϕ = 0◦ is called the polar axis
polar coordinates
the point for which r = 0 is called the pole the axis for which ϕ = 0◦ is called the polar axis the angle ϕ is measured counterclockwise with respect to the polar axis (i.e. the x-axis) and is usually referred to as the azimuth
note
for points where x = 0, the argument of arctan(y/x) is not defined
note
for points where x = 0, the argument of arctan(y/x) is not defined yet, for modern compilers or interpreters, this should not pose a serious problem . . .
note
for points where x = 0, the argument of arctan(y/x) is not defined yet, for modern compilers or interpreters, this should not pose a serious problem . . . for instance, upon entering man atan2 at the Linux console, we see an explanation of the behavior and implementation details of the arctan function
note
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 computed 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