Image Processing Reference
In-Depth Information
10.1 Affine Transformations
The class of
affine transformations
covers four different transformations, which are
illustrated in Fig.
10.1
. These are: translation, rotation, scaling and shearing.
10.1.1 Translation
Let us now look at the transformations in Fig.
10.1
and define their concrete map-
ping equations. Translation is simply a matter of shifting the image horizontally
and vertically with a given off-set (measured in pixels) denoted
x
and
y
.For
translation the mapping is thus defined as
x
y
x
y
x
y
x
=
x
+
x
y
=
⇒
=
+
(10.3)
y
+
y
So if
x
=
100 and
y
=
100 then each pixel is shifted 100 pixels in both the
x- and y-direction.
10.1.2 Scaling
When scaling an image, it is made smaller or bigger in the x- and/or y-direction. Say
we have an image of size 300
×
200 and we wish to transform it into a 600
×
100
image. The x-direction is then scaled by: 600
/
300
=
2. We denote this the x-scale
factor and write it as
S
x
=
1
/
2. Together this means
that the pixel in the image
f(x,y)
at position
(x, y)
=
(
100
,
100
)
is mapped to a new
position in the image
g(x
,y
)
, namely
(x
,y
)
2. Similarly
S
y
=
100
/
200
=
=
·
·
=
(
100
2
,
100
1
/
2
)
(
200
,
50
)
.In
general, scaling is expressed as
x
y
S
x
x
y
x
=
·
x
S
x
0
⇒
=
·
(10.4)
0
S
y
y
=
y
·
S
y
10.1.3 Rotation
When rotating an image, as illustrated in Fig.
10.1
(d), we need to define the amount
of rotation in terms of an angle. We denote this angle
θ
meaning that each pixel in
f(x,y)
is rotated
θ
degrees. The transformation is defined as
x
y
cos
θ
x
y
x
=
x
·
cos
θ
−
y
·
sin
θ
−
sin
θ
⇒
=
·
(10.5)
sin
θ
cos
θ
y
=
·
+
·
x
sin
θ
y
cos
θ