You are on page 1of 13

CSC 553: Computer


Lec 06: Image Segmentation: Based on

Edges and Gray Shades
 Powerful segmentation techniques that use
the edges in an image, grow regions using
the gray shades in an image, and use both
the edges and gray shades.
 These techniques work well over a range of
images because edges and gray shades are
important clues to objects in a scene.
Figure 10.1 shows the result of
using edges to segment an
The left side shows the output
of an edge detector.
The right side is the result of
grouping the pixels \inside" the
edges as objects | a triangle
and rectangle.
This idea is simple. Detect the
edges and group the pixels as
Figure 10.2 illustrates growing
objects using the gray shades
in an image. Pixels are grouped
with a neighboring pixel if their
gray shades are close enough.
Two pixels are replaced with
their average and examination
shifts to the neighbors of this
two-pixel object. If the gray
shades of the neighbors are
close enough, they become part
of the object and their values
adjust the average gray shade
of the object. The left side
shows the input, and the
right side shows the result of
growing objects in this manner.
The 1s are the background
object produced by grouping
the 1s, 2s, and 3s. The triangle
of 2s is a grouping of the 7s and
8s, and the rectangle of 3s is
the 8s and 9s.
Figure 10.3 combines the two
techniques. The left side
shows a gray shade
image with the output of an
edge detector (*s)
superimposed. The right side
shows the result of growing
regions using the gray
shades while ignoring the
detected edges (*s). The
result is the three objects
produced in Figure 10.2
separated by the edges.
These three simple
techniques work well in ideal
situations. Most images,
however, are not ideal. Real
images and image
processing routines introduce
 There are three potential problems using
these segmentation techniques:
 (1) the input image can have too many edges
and objects,
 (2) the edge detectors may not be good
enough, and
 (3) unwanted items ruin region growing.
Figure 10.5 shows a house,
and Figure 10.6 shows its

Segmentation should detect

the roof, windows, and

The bricks, leaves, and

shutter slats are real, but
small, so unwanted.
High quality edge detection
is essential to use these

Figure 10.8 demonstrates

how a small edge detector
error leads to a big
segmentation error.
On the left side of the
figure, I poked a small hole
in the left edge of the
rectangle. The right side
shows the terrible
segmentation result.
Figure 10.8 shows the result of edge
detection on Figure 10.4. Thresholding the
strong (bright) and weak (faint) edges
produces a clean 1-0 image. This requires
a consistent and automatic method to nd
the threshold point. Detected edges can be too
thin and too thick.

A surplus of stray, thin edges misleads

segmentation, and heavy, extra-thick edges ruin
objects. Figure 10.9 shows how the triple thick
edges on the left side produce the distorted
objects on the right side.
 Preprocessing
 Improved Edge Detection
 Improved Region Growing
 Preprocessing involves smoothing the input
image to remove noise, marks, and unwanted
detail. The median filter from Chapter 7, one
form of smoothing, sorts the pixels in an nxn
area (3x3, 5x5, etc.), and replaces the center
pixel with the median value. High- and low-
pixel filters, variations of the median filter, sort
the pixels in an nxn area and replace the
center pixel with either the highest or lowest
pixel value.
 Figure 10.11 illustrates the median, high-
pixel, and low-pixel filters. The left side shows
the input | the image section. The right side
shows the output for each filter processing a
3x3 area. The median filter removes the
spikes of the larger numbers. The high-pixel
filter output has many high values because
the input has a large number in most of its
3x3 areas. The low-pixel filter output is all 1s
because there is a 1 in every 3x3 area of the
Improved Edge Detection
 Accurate edge detectors with automatic thresholding of
edges and the ability to thin edges are needed for
effective segmentation.
 Good edge detection requires a technique for
thresholding the edge detector output consistently and
automatically. One technique sets the threshold point at
a given percentage of pixels in the histogram.
 This calculates the histogram for the edge detector
output and sums the histogram values beginning with
zero. When this sum exceeds a given percent of the
total, this is the threshold value.
 This method produces consistent results without any
manual intervention. A good percentage to use is 50
percent for most edge detectors and images.