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 suia
Trang 1Digital Image Processing
Lecture 11,12 – Representation and
Description
Lecturer: Ha Dai DuongFaculty 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
Trang 2Digital Image Processing 3
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:
Trang 3Digital Image Processing 5
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
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
Trang 4Digital Image Processing 7
II.1 Chain code
Example
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:
Trang 5Digital Image Processing 9
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: 3 3 1 3 3 0 3 0
Scale invariance: chance grid size
Note: when objects differ in scale and orientation
(rotation), they will be sampled differently
1 0 1 0 3 3 2 2
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
Trang 6Digital Image Processing 11
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
II.2 Polygonal Approximations
Merging techniques
1 Consider an arbitrary point on the boundary
2 Consider the next point and fit a line through these two points:
E = 0 (least squares error is zero)
3 Now consider the next point as well, and fit a line through all
three these points using a least squares approximation
Calculate E
4 Repeat until E > T
5 Store a and b of y = ax + b, and set E = 0
6 Find the following line and repeat until all the edge pixels were
considered
7 Calculate the vertices of the polygon, that is where the lines
intersect
Trang 7Digital Image Processing 13
II.2 Polygonal Approximations
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
Trang 8Digital Image Processing 15
II.2 Polygonal Approximations
Splitting techniques - example
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
Trang 9Digital Image Processing 17
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
Problem: sensitive to noise
(2) Divide each sample by its variance - assuming it is not zero
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)
Trang 10Digital Image Processing 19
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
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
Trang 11Digital Image Processing 21
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
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!
Trang 12Digital Image Processing 23
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
N(p1) ≡ number of non-zero neighbours of p1
T(p1) ≡ number of 0 − 1 transitions in the sequence
Trang 13Digital Image Processing 25
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}
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
a) 2 < N(p1) < 6
b) T(p1) = 1
c) p2 · p4 · p8 = 0
d) p2 · p6 · p8 = 0
Delete all the flagged contour points
Repeat steps 1 and step 2 until no contour point is
deleted during an iteration
Trang 14Digital Image Processing 27
II.5 Skeletons
Reasons for each of these conditions
II.5 Skeletons
Example
Trang 15Digital Image Processing 29
III.1 Simple boundary descriptors
Diameter: Diameter of B is defined as
Where D is a distance measure
Eccentricity: the ratio of the major to the minor axis.
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
Trang 16Digital Image Processing 31
III.2 Shape Numbers
Example
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 Find the basic rectangle - Fig 11.12(b)
2 Subdivision of the basic rectangle with grid 3x6 - Fig 11.12(c)
3 Chain code directions are aligned with the resulting grid, find
the shape number Fig 11.12 (d)
Trang 17Digital Image Processing 33
III.2 Shape Numbers
Example
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)
Trang 18Digital Image Processing 35
III.3 Fourier Discriptors
When we traverse this boundary in an
anti-clockwise 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
III.3 Fourier Discriptors
S (n=0…K-1) are called Fourier descritorsof the boundary
Trang 19Digital Image Processing 37
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
III.3 Fourier Discriptors
Some basic properties of Fourier descriptors
Trang 20Digital Image Processing 39
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)
III.4 Statistical moments
Trang 21Digital Image Processing 41
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
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
Trang 22Digital Image Processing 43
IV.2 Topological Descriptors
C: The number of connected components
H: The number of holes
Euler number is also topological property.
Trang 23Digital Image Processing 45
IV.2 Topological Descriptors
Example
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
Trang 24Digital Image Processing 47
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
of z about mean is
Trang 25Digital Image Processing 49
Trang 26Digital Image Processing 51
IV.3 Texture
Mean: Average gray level of each region, not really texture.
Standard deviation: First texture has significantly less
variability in gray level than the other two textures The same
comment hold for R
Third moment: generally is useful for determining the degree
of symmetry of histogram: negative - left, positive – right
Uniformity: First subimage is smoother (more uniform than the
rest).
Entropy: same idea with standard deviation
V Use Principal Components
Applicable for boundaries and regions
Can also describle sets of images that were registered
diffirently, for example the three images of a color RGB
image…
Treat three images as unit by expressing each group of
corresponding pixels as a vector
when we have n registered images
Trang 27Digital Image Processing 53
V Use Principal Components
For K vector samples from a random population,
the mean vector can be approximated as
The covariance matri Cx can be approximated
as follows:
V Use Principal Components
Trang 28Digital Image Processing 55
V Use Principal Components
Example
V Use Principal Components
Trang 29Digital Image Processing 57
V Use Principal Components
V Use Principal Components
Trang 30Digital Image Processing 59
V Use Principal Components
V Use Principal Components
Trang 31Digital Image Processing 61
V Use Principal Components
V Use Principal Components
Trang 32Digital Image Processing 63
V Use Principal Components
Instead of storing all six
images, we only store two
Trang 33Digital Image Processing 65
VI Relational Descriptors
VI Relational Descriptors