Image Processing Reference

In-Depth Information

Note that the rotation is done counterclockwise since the y-axis is pointing down-

wards. If we wish to do a clockwise rotation we can either use

−

θ
or change the

transformation to

x

y

cos
θ

x

y

x
=
x
·

cos
θ
+
y
·

sin
θ

sin
θ

⇒

=

·

(10.6)

−

sin
θ

cos
θ

y
=−
x
·

sin
θ
+
y
·

cos
θ

10.1.4 Shearing

To shear an image means to shift pixels either horizontally,
B
x
, or vertically,
B
y
.

The difference from translation is that the shifting is not done by the same amount,

but depends on where in the image a pixel is. In Fig.
10.1
(e)
B
x
=−

0
.
5 and
B
y
=

0.

The transformation is defined as

x

y

1

x

y

x
=

+

·

x

y

B
x

B
x

⇒

=

·

(10.7)

B
y

1

y
=

x

·

B
y
+

y

10.1.5 Combining the Transformations

The four transformations can be combined in all kinds of different ways by multiply-

ing the matrices in different orders, yielding a number of different transformations.

One is shown in Fig.
10.1
(f). Instead of defining the scale factors, the shearing fac-

tors and the rotation angle, it is common to merge these three transformation into

one matrix. The combination of the four transformations is therefore defined as

x

y

a
1

x

y

a
3

b
3

x
=

a
1
·

x

+

a
2
·

y

+

a
3

a
2

⇒

=

·

+

(10.8)

b
1

b
2

y
=

b
1
·

x

+

b
2
·

y

+

b
3

and this is the affine transformation. Below the relationships between Eq.
10.8
and

the four above mentioned transformations are listed.

a
1

a
2

a
3

b
1

b
2

b
3

Translation

1

0

x

0

1

y

Scaling

S
x

0

0

0

S
y

0

Rotation

cos
θ

−

sin
θ

0

sin
θ

cos
θ

0

Shearing

1

B
x

0

B
y

1

0

Often
homogeneous coordinates
are used when implementing the transformation

since they make further calculations faster. In homogeneous coordinates, the affine

transformation becomes

⎡

⎤

⎡

⎤

⎡

⎤

x

y

1

a
1
a
2
a
3

b
1
b
2
b
3

001

x

y

1

⎣

⎦
=

⎣

⎦
·

⎣

⎦

(10.9)

where
a
3
=

x
and
b
3
=

y
.