0% found this document useful (0 votes)
46 views86 pages

Chapter 4 DSIP

Chapter 10 of 'Digital Image Processing' focuses on image segmentation, which involves dividing an image into regions based on similarity and discontinuity. It discusses various methods for detecting discontinuities such as point, line, and edge detection, along with gradient operators and the Canny edge detector. The chapter also covers the Hough Transform for edge linking and boundary detection, emphasizing the importance of edge detection in this process.

Uploaded by

himanshu.garg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views86 pages

Chapter 4 DSIP

Chapter 10 of 'Digital Image Processing' focuses on image segmentation, which involves dividing an image into regions based on similarity and discontinuity. It discusses various methods for detecting discontinuities such as point, line, and edge detection, along with gradient operators and the Canny edge detector. The chapter also covers the Hough Transform for edge linking and boundary detection, emphasizing the importance of edge detection in this process.

Uploaded by

himanshu.garg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Digital Image Processing, 2nd ed. [Link].

com

Chapter 10
Image Segmentation

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Chapter 10
Image Segmentation

• Image segmentation divides an image into regions that are


connected and have some similarity within the region and
some difference between adjacent regions.
• The goal is usually to find individual objects in an image.
• For the most part there are fundamentally two kinds of
approaches to segmentation: discontinuity and similarity.
– Similarity may be due to pixel intensity, color or texture.
– Differences are sudden changes (discontinuities) in any of these, but
especially sudden changes in intensity along a boundary line, which is
called an edge.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Image Segmentation

Discontinuity Similarity

e.g. e.g.
- Point Detection - Thresholding
- Line Detection - Region Growing
- Edge Detection - Region splitting &
merging

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities

• There are three kinds of discontinuities of intensity: points,


lines and edges.
• The most common way to look for discontinuities is to scan a
small mask over the image. The mask determines which kind
of discontinuity to look for.
9
R  w1 z1  w2 z 2  ...  w9 z9   wi zi
i 1

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Point Detection

R T
where T : a nonnegativ e threshold

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Line Detection

• Only slightly more common than point detection is to find a


one pixel wide line in an image.
• For digital images the only three point straight lines are only
horizontal, vertical, or diagonal (+ or –45).

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Line Detection

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Edge Detection

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Edge Detection

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Edge Detection

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Edge Detection

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Gradient Operators

• First-order derivatives:
– The gradient of an image f(x,y) at location (x,y) is defined
as the vector:
 x
G  f
x

f      f 
 y   y 
G
– The magnitude of this vector: f  mag(f )  G  G  2
x
2
y 
1
2

 Gx 
– The direction of this vector:  ( x, y )  tan  
1

 Gy 

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Gradient Operators

Roberts cross-gradient operators

Prewitt operators

Sobel operators

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Gradient Operators

Prewitt masks for


detecting diagonal edges

Sobel masks for


detecting diagonal edges

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Gradient Operators: Example

f  G x  G y

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Gradient Operators: Example

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Gradient Operators: Example

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Gradient Operators

• Second-order derivatives: (The Laplacian)


– The Laplacian of an 2D function f(x,y) is defined as
2 f 2 f
 f  2  2
2

x y
– Two forms in practice:

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Gradient Operators

• Consider the function: A Gaussian function


r2

h( r )  e 2 2
where r 2  x 2  y 2
and  : the standard deviation
• The Laplacian of h is
r2
 r     2 2
2 2 The Laplacian of a
 h( r )   
2
e Gaussian (LoG)
 
4

• The Laplacian of a Gaussian sometimes is called the Mexican
hat function. It also can be computed by smoothing the image
with the Gaussian smoothing mask, followed by application of
the Laplacian mask.
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Gradient Operators

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Gradient Operators: Example

Sobel gradient

© 2002 R. C. Gonzalez & R. E. Woods


Gaussian smooth function Laplacian mask
Digital Image Processing, 2nd ed. [Link]

Detection of Discontinuities
Gradient Operators: Example

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Edge Linking and Boundary Detection


Local Processing

• Two properties of edge points are useful for edge linking:


– the strength (or magnitude) of the detected edge points
– their directions (determined from gradient directions)
• This is usually done in local neighborhoods.
• Adjacent edge points with similar magnitude and direction are
linked.
• For example, an edge pixel with coordinates (x0,y0) in a
predefined neighborhood of (x,y) is similar to the pixel at (x,y)
if
f ( x, y)  ( x0 , y0 )  E, E : a nonnegativ e threshold
 ( x, y)   ( x0 , y0 )  A, A : a nonegative angle threshold

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Edge Linking and Boundary Detection


Local Processing: Example

In this example,
we can find the
license plate
candidate after
edge linking
process.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Effects of Noise

• Consider a single row or column of the image


– Plotting intensity as a function of position gives a signal

Where is the edge??


© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]

Solution: Smooth First

Where is the edge? Look for peaks in


© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]

Derivative Theorem of Convolution

…saves us one operation.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Laplacian of Gaussian (LoG)


2  2 
h  f    2 h   f
x 2
 x  Laplacian of Gaussian

Laplacian of Gaussian
operator

Where is the edge? Zero-crossings of bottom graph !


© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]

Canny Edge Operator

• Smooth image I with 2D Gaussian: GI

• Find local edge normal directions for each pixel


G  I 
n
G  I 

• Compute edge magnitudes G  I 

• Locate edges by finding zero-crossings along the edge normal directions


(non-maximum suppression)
 2 G  I 
0
n 2

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing,
Non-maximum 2nd ed.
Suppression [Link]

• Check if pixel is local maximum along gradient direction


– requires checking interpolated pixels p and r

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

The Canny Edge Detector

original image (Lena)

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

The canny edge detector

magnitude of the gradient


© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]

The Canny Edge Detector

After non-maximum suppression

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Edge Linking and Boundary Detection


Global Processing via the Hough Transform

Canny Edge Detection Algorithm


• An edge detection algorithm detects edges in an image by determining where the
brightness/intensity of an image changes drastically.
• For the Hough Transform algorithm, it is crucial to perform edge detection first to
produce an edge image which will then be used as input into the algorithm.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Edge Linking and Boundary Detection


Global Processing via the Hough Transform

• Hough transform: a way of finding edge points in an image


that lie along a straight line.
• Example: xy-plane v.s. ab-plane (parameter space)
yi  axi  b

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Problem: Given set of points, use Hough transform to join


these points. A(1,4), B(2,3) ,C(3,1) ,D(4,1) ,E(5,0)

Solution:
Lets think about equation of line that is y=ax+b.
Now, if we rewrite the same line equation by keeping b in LHS, then we
get b=-ax+y. So if we write the same equation for point A(1,4), then
consider x=1 and y=4 so that we will get b=-a+4. The following table
shows all the equations for a given point

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Point equations Now a=0 New point (a,b) Now a=1 New point (a,b)

A(1,4) b= -a+4 b= -(0)+4 =4 (0,4) b= -(1)+4 =3 (1,3)

B(2,3) b= -2a+3 b= -2(0)+3=3 (0,3) b= -2(1)+3=1 (1,1)

C(3,1) b= -3a+1 b= -3(0)+1=1 (0,1) b= -3(1)+1=-2 (1,-2)

D(4,1) b= -4a+1 b= -4(0)+1=1 (0,1) b= -4(1)+1=3 (1,-3)

E(5,0) b= -5a+0 b= -5(0)+0=0 (0,0) b= -5(1)+0=-5 (1,-5)

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Let us plot the new point on the


graph as given below
Point New New
point point
(a,b) (a,b)
A(1,4) (0,4) (1,3)

B(2,3) (0,3) (1,1)

C(3,1) (0,1) (1,-2)

D(4,1) (0,1) (1,-3)

E(5,0) (0,0) (1,-5)

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

We can see that almost all line crosses each other at a point (-1,5). So
here now a=-1 and b =5.
Now let’s put these values in the y=ax+b equation so we get y=-1x+5
so y=-x+5 is the line equation that will link all the edges.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Edge Linking and Boundary Detection


Global Processing via the Hough Transform

• There is one flaw with representing lines in the form of y = ax


+ b and the Hough Space with the slope and intercept.
• In this form, the algorithm won’t be able to detect vertical lines
because the slope a is undefined/infinity for vertical lines
(Leavers, 1992).
• Programmatically, this means that a computer would need an
infinite amount of memory to represent all possible values of a.
• To avoid this issue, a straight line is instead represented by a
line called the normal line that passes through the origin and
perpendicular to that straight line. The form of the normal line
is ρ = x cos(θ) + y sin(θ) where ρ is the length of the normal
line and θ is the angle between the normal line and the x axis.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Edge Linking and Boundary Detection


Global Processing via the Hough Transform

• The Hough transform consists of


finding all pairs of values of 
and  which satisfy the equations
that pass through (x,y).
• These are accumulated in what is
basically a 2-dimensional
histogram.
• When plotted these pairs of  and
 will look like a sine wave. The
process is repeated for all
x cos   y sin   
appropriate (x,y) locations.

[Link]
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]

For the given image use Hough Transform to form the edge.

Solution:

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

As can be seen, the line


passes through 4 points,
point(3,3) is kept
outside as it does not lie
on the line

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Thresholding

• Assumption: the range of intensity levels covered by objects of


interest is different from the background.
1 if f ( x, y )  T
g ( x, y )  
0 if f ( x, y )  T

Single threshold Multiple threshold

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Thresholding
The Role of Illumination

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Thresholding
The Role of Illumination

r ( x, y ) (a) (c) i ( x, y )

(d) (e)

f ( x, y)  i( x, y )r ( x, y)
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]

Thresholding
Basic Global Thresholding

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Thresholding
Basic Global Thresholding

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Thresholding
Basic Adaptive Thresholding

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Thresholding
Basic Adaptive Thresholding

How to solve this problem?

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Thresholding
Basic Adaptive Thresholding

Answer: subdivision

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Thresholding
Optimal Global and Adaptive Thresholding

• This method treats pixel values as probability density functions.


• The goal of this method is to minimize the probability of
misclassifying pixels as either object or background.
• There are two kinds of error:
– mislabeling an object pixel as background, and
– mislabeling a background pixel as object.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Thresholding
Use of Boundary Characteristics

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Thresholding
Thresholds Based on Several Variables

Color image

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Region-Based Segmentation

• Edges and thresholds sometimes do not give good


results for segmentation.
• Region-based segmentation is based on the
connectivity of similar pixels in a region.
– Each region must be uniform.
– Connectivity of the pixels within the region is very
important.
• There are two main approaches to region-based
segmentation: region growing and region splitting.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Region-Based Segmentation
Basic Formulation

• Let R represent the entire image region.


• Segmentation is a process that partitions R into subregions,
R1,R2,…,Rn, such that
n
(a)  Ri  R
i 1
(b) Ri is a connected region, i  1,2,..., n
(c) Ri  R j   for all i and j, i  j
(d) P( Ri )  TRUE for i  1,2,..., n
(e) P( Ri  R j )  FALSE for any adjacent regions Ri and R j
where P(Rk): a logical predicate defined over the points in set Rk
For example: P(Rk)=TRUE if all pixels in Rk have the same gray
level.
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]

Region Growing
1. Region growing is a procedure that groups pixels or
subregions into larger regions.
2. The simplest of these approaches is pixel aggregation, which
starts with a set of “seed” points and from these grows
regions by appending to each seed points those neighboring
pixels that have similar properties (such as gray level,
texture, color, shape).
3. Region growing based techniques are better than the edge-
based techniques in noisy images where edges are difficult to
detect.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Region Growing

Threshold=10 10 10 10 10 10 10 10
10 10 10 69 70 10 10
59 10 60 64 59 56 60
10 59 10 60 70 10 62
10 60 59 65 67 10 65
10 10 10 10 10 10 10
10 10 10 10 10 10 10

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 10 10 69 70 10 10 10 10 10 69 70 10 10 10 10 10 69 70 10 10
59 10 60 64 59 56 60 59 10 60 64 59 56 60 59 10 60 64 59 56 60
10 59 10 60 70 10 62 10 59 10 60 70 10 62 10 59 10 60 70 10 62
10 60 59 65 67 10 65 10 60 59 65 67 10 65 10 60 59 65 67 10 65
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10

10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 10 10 69 70 10 10 10 10 10 69 70 10 10 10 10 10 69 70 10 10
59 10 60 64 59 56 60 59 10 60 64 59 56 60 59 10 60 64 59 56 60
10 59 10 60 70 10 62 10 59 10 60 70 10 62 10 59 10 60 70 10 62
10 60 59 65 67 10 65 10 60 59 65 67 10 65 10 60 59 65 67 10 65
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Region-Based Segmentation
Region Growing

• Fig. 10.41 shows the histogram of Fig. 10.40 (a). It is difficult to


segment the defects by thresholding methods. (Applying region
growing methods are better in this case.)

Figure 10.40(a) Figure 10.41

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Region-Based Segmentation
Region Growing

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Region-Based Segmentation
Region Splitting and Merging

• Region splitting is the opposite of region growing.


– First there is a large region (possible the entire image).
– Then a predicate (measurement) is used to determine if the
region is uniform.
– If not, then the method requires that the region be split into
two regions.
– Then each of these two regions is independently tested by
the predicate (measurement).
– This procedure continues until all resulting regions are
uniform.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Region-Based Segmentation
Region Splitting

• The main problem with region splitting is determining where to


split a region.
• One method to divide a region is to use a quadtree structure.
• Quadtree: a tree in which nodes have exactly four descendants.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Threshold<=3

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Region merging algorithms

• The region merging method is exactly opposite to the region splitting method.
• In this method, the pixel level and consider each of them as a homogenous region.
• At any level of merging, check if the four adjacent homogenous regions arranged in
a 2 x 2 fashion together satisfy the homogeneity property.
• If yes, they are merged to form a bigger region, otherwise the regions are left as
they are.
• max - min ≤ 3

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Region-Based Segmentation
Region Splitting and Merging

• START: consider entire image as one region


• 1. If region satisfies homogeneity criteria, leave it unmodified.
• 2. If not, split it into four quadrants and recursively apply 1
and 2 to each newly generated region. STOP when all regions
in the quadtree satisfy the homogeneity criterion
• 3. If any two adjacent regions Ri , Rj can be merged into a
homogeneous region, merge them. STOP when no merging is
possible any more.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Results – Region grow

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Results – Region Split

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Results-Region Split and Merge

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Boundary Descriptors-Chain Code

Boundary is a good representation of an object shape.


Chain codes: represent an object boundary by a connected
sequence of straight line segments of specified length
and direction.

4-directional 8-directional
© 2002 R. C. Gonzalez & R. E. Woods
chain code chain code
Digital Image Processing, 2nd ed. [Link]

To avoid noise degradation and long chains a resampling of the


image grid is commonly used to describe the boundary at a
coarser level.
Object Boundary
boundary vertices
(resampling)

4-directional 8-directional
chain code chain code

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

First Difference
Problem of a chain code: a chain code sequence depends on a starting point.
Solution: treat a chain code as a circular sequence and redefine the starting point so that the
resulting sequence of numbers forms an integer of minimum magnitude.

The first difference of a chain code: counting the number of direction change (in
counterclockwise) between 2 adjacent elements of the code.

Example: Chain code : The first Example:


1 difference - a chain code: 10103322
01 1 - The first difference = 3133030
2 0 02 2 - Treating a chain code as a
03 3 circular sequence, we get
3 23 1 the first difference = 33133030
20 2
21 3 The first difference is rotational
invariant.
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Shape Number

1
Shape number of the boundary definition:
the first difference of smallest magnitude
2 0
The order n of the shape number:
the number of digits in the sequence
3

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed.
Shape Number (cont.) [Link]

Shape numbers of order


4, 6 and 8

(Images from Rafael C. Gonzalez and Richard E.


© 2002 R. C. Gonzalez & R. E. Woods Wood, Digital Image Processing, 2nd Edition.
Digital Image Processing, 2nd ed. [Link]

Signature

A simple functional representation that can be used to describe and


reconstruct the boundary with appropriate accuracy
1D functional representation of a boundary.
A simple way s to plot the distance from the centroid as a function of
the angle.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Image Moments

• Image moments are a set of statistical parameters to


measure the distribution of where the pixels are and
their intensities. Mathematically, the image moment
Mij of order (i,j) for a greyscale image with pixel
intensities I(x,y) is calculated as

Here, x, y refers to the row and column index and I(x,y) refers
to the intensity at that location (x,y).
© 2002 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 2nd ed. [Link]

Area:
For a binary image, the zeroth order moment corresponds to the
area. Using the above formulae, the zeroth order moment (M00)
is given by

For a binary image, this corresponds to counting all the non-zero


pixels and that is equivalent to the area. For greyscale image, this
corresponds to the sum of pixel intensity values.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Centroid:
Centroid simply is the arithmetic mean position of all the points.
In terms of image moments, centroid is given by the relation

This is simple to understand. For instance, for a binary image


M10 corresponds to the sum of all non-zero pixels (x-coordinate)
and M00 is the total number of non-zero pixels and that is what
the centroid is.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

Let’s take a simple example to understand how to calculate image


moments for a given image.

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

• Central moments are defined as

© 2002 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 2nd ed. [Link]

© 2002 R. C. Gonzalez & R. E. Woods

You might also like