# Lecture 11,12 representation and description

Representation and Description

Digital Image Processing
Lecture 11,12 – Representation and
Description
Lecturer: Ha Dai Duong
Faculty of Information Technology

I. Introduction




After an image has been segmented into regions by
methods such as those discussed in previous lectures,
segmented pixels usually is represented àn described in
a form suiable for further computer processing.
A segmented region can be represented by: external
(boundary) pixels or internal pixels



When shape is important, a boundary representation is used
When colour or texture is important, an internal representation is
used

Digital Image Processing

2

1

Representation and Description

I. Introduction




The description of a region is based on its representation,
for example a boundary can be described by its length
The features selected as descriptors are usually required
to be as insensitive as possible to variations in:
Scale;
Translation;
Rotation;





=> That is the features should be scale, translation and
rotation invariant

Digital Image Processing

3

I. Introduction


Contents:




Representation
Boundary Descriptors
Region Descriptors

Digital Image Processing

4

2

Representation and Description

II.1. Chain code



Chain codes are used to represent a boundary by a connected
sequence of straight-line segments of specified length and direction.
Typically, this presentation is based on 4- or 8-connectivity of the
segments, the direction of each segment is coded by using a
numbering scheme such as the ones shown in Fig 11.1

Digital Image Processing

5

II.1. Chain code




Generation of chain code: follow the boundary in
an clockwise direction and assign a direction to
the segment between successive pixels
Difficulties:





Code generally very long
Noise changes the code

Solution: Resample the boundary using a larger
grid spacing
Digital Image Processing

6

3

Representation and Description

II.1. Chain code


Example

Digital Image Processing

7

II.1 . Chain code





Chain code depends on starting point
Normalization: consider the code to be circular
and choose the starting point in such a way that
the sequence represents the smallest integer
Example:

Digital Image Processing

8

4

Representation and Description

II.1. Chain code


Rotation invariance: consider the first difference
in the code: This code is obtained by counting the
number of direction changes (go counter clockwise)


Example:
4-directional code: 1 0 1 0 3 3 2 2
first difference:
33133030




0
1

3

0
1

3

Scale invariance: chance grid size
Note: when objects differ in scale and orientation
(rotation), they will be sampled differently
2

2

9

Digital Image Processing

II.2. Polygonal Approximations


A digital boundary can be approximated by a pologon.
For closed curve, the approximation is exact when the number of
segments in polygon is equal to the number of points in the boundary
so that each pair of adjacent points defines a segment in the polygon.





In practice, the goal of polygonal approximation is to
capture the “essence” of boundary shape with the fewest
possible polygonal segments
Several polygonal approximation techniques of modest
complexity and processing requirements are well suited
for image processing applications.
Digital Image Processing

10

5

Representation and Description

II.2. Polygonal Approximations


Minimum perimeter polygons
Imagine the boundary as a “rubber band” and let it shrink...



The maximum error per grid cell is √2d, where d is the dimension
of a grid cell



Digital Image Processing

11

II.2. Polygonal Approximations
Merging techniques



1.
2.
3.
4.
5.
6.
7.

Consider an arbitrary point on the boundary
Consider the next point and fit a line through these two points:
E = 0 (least squares error is zero)
Now consider the next point as well, and fit a line through all
three these points using a least squares approximation.
Calculate E
Repeat until E > T
Store a and b of y = ax + b, and set E = 0
Find the following line and repeat until all the edge pixels were
considered
Calculate the vertices of the polygon, that is where the lines
intersect

Digital Image Processing

12

6

Representation and Description

II.2. Polygonal Approximations
Merging techniques



 Least Squares Error
 Calculate E as:
where

Digital Image Processing

13

II.2 . Polygonal Approximations
Splitting techniques









Joint the two furthest points on the boundary → line
ab
Obtain a point on the upper segment, that is c and a
point on the lower segment, that is d, such that the
perpendicular distance from these points to ab is as
large as possible
Now obtain a polygon by joining c and d with a and b
Repeat until the perpendicular distance is less than
some predefined fraction of ab

Digital Image Processing

14

7

Representation and Description

II.2. Polygonal Approximations
Splitting techniques - example



Digital Image Processing

15

II.3. Signatures





A signature is a 1-D representation of boundary. It might be
generated by various ways
Simplest approach: plot r(θ)
r: distance from centroid of boundary to boundary point
θ: angle with the positive x-axis

Digital Image Processing

16

8

Representation and Description

II.3. Signatures
Translation invariant, but not rotation or scale invariant
Normalization for rotation:







(1) Choose the starting point as the furthest point from the
centroid OR
(2) Choose the starting point as the point on the major axis that
is the furthest from the centroid

Normalization for scale:





Note: ↑ scale => ↑ amplitude of signature
(1) Scale signature between 0 and 1



(2) Divide each sample by its variance - assuming it is not zero



Problem: sensitive to noise

Digital Image Processing

17

II.3. Signatures
Alternative approach: plot Φ(θ)












Φ: angle between the line tangent to the boundary and a
reference line
θ: angle with the positive x-axis
Φ(θ) carry information about basic shape characteristics
Alternative approach: use the so-called slope density function
as a signature, that is a histogram of the tangent-angle values
Respond strongly to sections of the boundary with constant
tangent angles (straight or nearly straight segments)
Deep valleys in sections producing rapidly varying angles
(corners or other sharp inflections)
Digital Image Processing

18

9

Representation and Description

II.4. Boundary segments







Boundary segments are usually easier to
describe than the boundary as a whole
We need a robust decomposition: convex hull
A convex set (region) is a set (region) in which
any two elements (points) A and B in the set
(region) can be joined by a line AB, so that each
point on AB is part of the set (region)
The convex hull H of an arbitrary set (region) S
is the smallest convex set (region) containing S
Digital Image Processing

19

II.4. Boundary segments


Convex deficiency: D = H − S



The region boundary is partitioned by following the
contour of S and marking the points at which a
transition is made into or out of a component of the
convex deficiency
Digital Image Processing

20

10

Representation and Description

II.5. Skeletons
An important approach to representing the
structural shape of a plane region is to reduce it
to a graph.
This reduction may be ascomplished by
obtaining the skeleton of the region via a
thinning algorithm
The skeleton of a region may be defined via the
medial axis transformation proposed by Blum in
1967







Digital Image Processing

21

II.5. Skeletons




Brute force method: Medial axis transformation (MAT - 1967)
Consider a region R with boundary B...
For each point p in R find its closest neighbour in B





If p has more than one closest neighbour, then p is part of the medial axis
Example

Problem: we have to calculate the distance between every internal point
and every point on the edge of the boundary!

Digital Image Processing

22

11

Representation and Description

II.5. Skeletons
Thinning algorithm:




Edge points are deleted in an iterative way so that
1. end points are not removed,
2. connectivity is not broken, and
3. no excessive erosion is caused to the region





This algorithm thins a binary region, where an
edge point = 1 and a background point = 0
Contour point: Edge point (= 1) with at least one
neighbour with a value of 0
Digital Image Processing

23

II.5. Skeletons


Step 1: A contour point is flagged for deletion if
a) 2 < N(p1) < 6
b) T(p1) = 1
c) p2 · p4 · p6 = 0
d) p4 · p6 · p8 = 0

Where:
 N(p1) ≡ number of non-zero neighbours of p1
 T(p1) ≡ number of 0 − 1 transitions in the sequence
{p2, p3, p4, p5, p6, p7, p8, p9, p2}
Digital Image Processing

24

12

Representation and Description

II.5. Skeletons


Example
- N(p1) ≡ number of non-zero neighbours of p1
- T(p1) ≡ number of 0 − 1 transitions in the sequence

{p2, p3, p4, p5, p6, p7, p8, p9, p2}

Digital Image Processing

25

II.5. Skeletons
Now delete all the flagged contour points and consider
the remaining contour points...
Step 2: A contour point is flagged for deletion if





2 < N(p1) < 6
b) T(p1) = 1
c) p2 · p4 · p8 = 0
d) p2 · p6 · p8 = 0
a)




Delete all the flagged contour points
Repeat steps 1 and step 2 until no contour point is
deleted during an iteration
Digital Image Processing

26

13

Representation and Description

II.5. Skeletons


Reasons for each of these conditions...

Digital Image Processing

27

II.5. Skeletons


Example

Digital Image Processing

28

14

Representation and Description

III.1. Simple boundary descriptors
Length: The number of pixels along a boundary
Diameter: Diameter of B is defined as




Where D is a distance measure

Major Axis
Minor Axis
Basic rectangle
Eccentricity: the ratio of the major to the minor axis.






Digital Image Processing

29

III.2. Shape Numbers
Shape number: Difference of chain code that
represents smallest integer
Order n of shape number: number of digits in its
representation
Suppose that we use a 4-directional chain code,
then...










Closed boundary => n even
n limits the number of possible shapes

Digital Image Processing

30

15

Representation and Description

III.2. Shape Numbers
Example



Digital Image Processing

31

III.2. Shape Numbers
Note: the shape number is rotation invariant, but the
coded boundary depends on the orientation of the grid!
One way to normalize the grid orientation is by aliging
the chain code grid with the sides of the basic ractangle
defined in the previous section
Example: Suppose that n=18 is specified for the
boundary shown in Fig 11.12(a)







1.
2.
3.

Find the basic rectangle - Fig 11.12(b)
Subdivision of the basic rectangle with grid 3x6 - Fig 11.12(c)
Chain code directions are aligned with the resulting grid, find
the shape number Fig 11.12 (d)

Digital Image Processing

32

16

Representation and Description

III.2. Shape Numbers


Example

Digital Image Processing

33

III.3. Fourier Discriptors


Suppose that a boundary is represented by K coordinate pairs in the
xy-plane, (x0, y0), (x1, y1), (x2, y2), . . . , (xK−1, yK−1)

Digital Image Processing

34

17

Representation and Description

III.3. Fourier Discriptors




When we traverse this boundary in an anticlockwise direction the boundary can be
represented as the sequence of coordinates sk
= [xk, yk ] for k = 0, 1, 2, . . . , K − 1
Each coordinate pair can be treated as a
complex number so that sk = xk + i*yk => 2-D
problem → 1-D problem

Digital Image Processing

35

III.3. Fourier Discriptors



Sn (n=0…K-1) are called Fourier descritors of the boundary
Digital Image Processing

36

18

Representation and Description

III.3. Fourier Discriptors


Note that the same number of points exist in the approximate
boundary ˜sk. Also note that the smaller P becomes, the more detail
in the boundary is lost...

Digital Image Processing

37

III.3. Fourier Discriptors


Some basic properties of Fourier descriptors

Digital Image Processing

38

19

Representation and Description

III.4. Statistical moments



Statistical moments can be used to describe the
shape of a boundary segment
A boundary segment can be represented by a 1-D
discrete function g(r) ...

Digital Image Processing

39

III.4. Statistical moments

Digital Image Processing

40

20

Representation and Description

IV.1. Simple Regional Descriptors
Area: Number of pixels in region
Perimeter: Length of boundary
Compactness: Perimeter2/Area
Mean and median gray levels
Min and max gray level values
Number of pixels with values above or below
mean








Digital Image Processing

41

IV.2. Topological Descriptors
Topological properties are useful for global
descriptions of regions in image plane.
Topology is the study of properties of a fingure
that are unaffected by any deformation.
That properties may be:









Number of holes
Number of connected conponents

Digital Image Processing

42

21

Representation and Description

IV.2. Topological Descriptors
Example



Digital Image Processing

43

IV.2. Topological Descriptors
Euler number:




E denotes Euler number, it is denined as:
E=C–H
Where
C: The number of connected components
H: The number of holes



Euler number is also topological property.

Digital Image Processing

44

22

Representation and Description

IV.2. Topological Descriptors
Example



Digital Image Processing

45

IV.3. Texture
An important approach to region description is
to quantify its texture content.
Although no formal definition of texture exist,
intuitively this description provides measures of
properties such as









Smoothness
Coarseness and
Regularity

Digital Image Processing

46

23

Representation and Description

IV.3. Texture

Digital Image Processing

47

IV.3. Texture
Statistical approaches






Using the statistical moments of gray-level histogram of an
image or region
Let z be a random variable denoting gray levels and let p(zi),
i=0,1,.., L-1, be the corresponding histogram, the nth moment

Digital Image Processing

48

24

Representation and Description

IV.3. Texture


Statistical approaches

Digital Image Processing

49

IV.3. Texture


Statistical
approaches

Digital Image Processing

50

25 ### Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay

×