2. 生物医学工程研究所 中南大学
2 2024/2/1
Content:
1. definition and methods classification
2. detection of discontinuities
– Point detection
– Line detection
– Edge detection
3. edge linking and boundary detection
4. thresholding
5. region-based segmentation
6. segmetation by morphological watershed
7. concludes
3. 生物医学工程研究所 中南大学
3 2024/2/1
10.1 definition and methods classification
Definition: Segmentation subdivides an image into its constituent
regions or interest objects. The level to which the subdivision is
carried depends on the problem being solved. When the objects of
interest have been isolated, segmentation should stop.
Classification: discontinuity-based and similarity-based methods,
this two features are two most basic properties of intensity values. In
the first category, the partition of an image is based on abrupt
changes in intensity, such as point, line and edge. The second
category part an image regions that are similar according to a set of
predefined criteria. The thresholding, region growing, and region
spliting and merging are examples.
4. 生物医学工程研究所 中南大学
4 2024/2/1
10.2 detection of discontinuities
The most common way to look for discontinuities is to inspect if the
response R of certain spatial mask to an image is larger than some
pre-defined threshold.
Filtering mask
1 1 2 2 9 9
9
1
i i
i
R w z w z w z
w z
The response of mask
5. 生物医学工程研究所 中南大学
5 2024/2/1
10.2.1 detection of isolated point
R T
We say that a point has been detected when the following condition is
satisfied:
Where T is a nonnegative threshold.
The type of detection process is rather specialized because it is based
on single-pixel discontinuities that have a homogeneous background.
7. 生物医学工程研究所 中南大学
7 2024/2/1
10.2.2 detection of line (one pixel thick)
The detection of line has some relationship with orientation. The
line detection of different direction should use different masks.
Masks of different orientation
Suppose that the four masks are run individually through an image.
If, at a certain point, |Ri| > |Rj|, for any ij, that point is said to be
more likely associated with a line in the direction of mask i.
9. 生物医学工程研究所 中南大学
9 2024/2/1
10.2.3 detection of edge
The detection of edges mainly use the first and second derivatives
introduced in section 3.7 in the context of image enhancement.
Note the difference between edge and boundary, which is explained
in the section 2.5.2 through some length.
Ideal and blurred edge, edge thickness
Blurred edges tend to be thick and sharp edges tend to be thin.
11. 生物医学工程研究所 中南大学
11 2024/2/1
From the above observations, we conclude that the first derivative
can be used to detect the presence of an edge (i.e., to determine if a
point is on a ramp), and the sign of the second derivative can be
used to determine whether an edge pixel lies on the dark or light
side of an edge.
Two additional properties of the second derivative:
(1) It produces two values for every edge in an image (an
undesirable feature)
(2) zero-crossing property which is quite useful for locating the
centers of thick edges.
comments about the properties of first and second derivative
12. 生物医学工程研究所 中南大学
12 2024/2/1
Illustration about behavior of the first and second derivatives
around a noisy edge
These examples are good
illustrations of the sensitivity of
derivatives to noise. The extent
of second derivative is beyond
the first derivative.
13. 生物医学工程研究所 中南大学
13 2024/2/1
First derivative: gradient operators (refer to section 3.7.3)
Reviews:
• Roberts cross-gradient operators
• Prewitt operators
• Sobel operators
Where, Prewitt mask is more simpler to implement than the Sobel
masks; but the later have slightly noise-suppression characteristics.
The two additional Prewitt and Sobel masks for detecting
discontinuities in the diagonal directions.
15. 生物医学工程研究所 中南大学
15 2024/2/1
For reduce the contribution of image detail (such as wall bricks) to
edges, image-averaging is needed before computing gradient.
16. 生物医学工程研究所 中南大学
16 2024/2/1
Second derivative: Laplacian operators (section 3.7.2)
Several reasons that Laplacian generally is not used in its original
form for edge detection:
(1) The Laplacian is unacceptably sensitive to noise;
(2) The magnitude of the Laplacian produces double edges, an
undesirable effect because it complicates segmentation;
(3) unable to detect edge direction
For this reasons, the role of the Laplacian in segmentation includes:
(1)Using it zero-crossing property for edge detection;
(2)Using it help to determine whether a pixel is on the dark or light
side of an edge.
In the role of first category, the Laplacian is combined with
smoothing as a precursor to finding edges via zero-crossing.
17. 生物医学工程研究所 中南大学
17 2024/2/1
Laplacian of a Gaussian (LoG)
2 2
/2
( ) r
h r e
Gaussian function:
Convolving this function with an image blurs the image (can
reduced the effect of noise), with the degree of blurring being
determined by the value of .
Laplacian of a Gaussian (LoG, is also called Mexican hat funciton):
2
2
2 2
2 2
4
( )
r
r
h r e
The purpose of the Laplacian operator is to provide an image with
zero crossing used to establish the location of edges.
20. 生物医学工程研究所 中南大学
20 2024/2/1
The advantages and drawbacks of zero-crossing detection
(1)The edges in the zero-crossing image are thinner than the gradient
Methods;
(2) The capabilities of noise reduction and potential for rugged
performance;
(3) Zero-crossing detection form numerous closed loops and produce
so-called spaghetti (意大利式细面条) effect;
(4) The computation of zero crossing presents a challenge in general.
So, gradient-based edge-finding techniques are used more frequently
than zero-crossing method
21. 生物医学工程研究所 中南大学
21 2024/2/1
10.3 edge linking and boundary detection
Preface:
For many reasons, such as noise, non-uniform illumination and other
reasons, the set of pixels detected by the preceding methods seldom
characterizes an edge completely. Spurious intensity discontinuities
and breaks in the edge is usual. Thus linking procedure following
edge detection to assemble edge pixels into meaningful edges are
needed.
22. 生物医学工程研究所 中南大学
22 2024/2/1
10.3.1 local processing
Similarity-based methods:
Two principal properties used for establishing similarity of edge
pixels are:
(1) The strength of the response of the gradient operator used to
produce the edge pixels;
(2) The direction of gradient vector.
Magnitude similarity and direction similarity:
0 0
0 0
( , ) ( , )
( , ) ( , )
f x y f x y E
x y x y A
Where the edge point (x0, y0) locates in the predefined neighborhood
of point (x, y). When both similarities are satisfied, the two point are
linked and a record must be kept.
24. 生物医学工程研究所 中南大学
24 2024/2/1
10.3.2 global processing via Hough transform
Basic mind: point are linked by determined first if they lie on a curve
of specified shape. For finding all points which lie on a straight lines,
Hough transform can be used.
The principal of Hough transform:
25. 生物医学工程研究所 中南大学
25 2024/2/1
Subdivision of parameter plane
The number of subdivisions in
the ab-plane determines the
accuracy of the co-linearity of
these points.
27. 生物医学工程研究所 中南大学
27 2024/2/1
Edge-linking method based on the Hough transform
Steps:
(1)Compute the gradient of an image and threshold it to obtain a
binary image;
(2)Specify subdivisions in the -plane;
(3)Examine the counts of the accumulator cells for high pixel
concentration;
(4)Examine the relationship (principally for continuity) between pixels
in chosen cell.
29. 生物医学工程研究所 中南大学
29 2024/2/1
10.3.3 global processing via graph-theoretic technique
(self-study)
This approach bases on representing edge segments in the form of a
graph and searching the graph for low-cost paths that correspond to
significant edges. The procedure is more complicated and requires
more processing time, but a more rugged approach.
Basic definitions:
Graph, arc, directed graph, successor of the parent node, expansion of
the node, start or root node, path, cost, edge element, neighbors.
32. 生物医学工程研究所 中南大学
32 2024/2/1
10.4 thresholding technique
Foundation
Global thresholding
Adaptive thresholding
Optimal global and adaptive thresholding
33. 生物医学工程研究所 中南大学
33 2024/2/1
10.4.1 Foundation
In general, segmentation problems requiring multiple thresholds are
best solved using region growing methods, discussed later.
Formalism:
( , ), ( , ), ( , )
1 if ( , )
( , )
0 if ( , )
T T x y p x y f x y
f x y T
g x y
f x y T
Thresholding methods: global, local, dynamic or adaptive.
34. 生物医学工程研究所 中南大学
34 2024/2/1
The role of illumination
Review the content in section 2.3.4 about model an image f(x, y) as
the product of reflectance component r(x, y) and an illumination
component i(x, y).
' '
( , ) ( , ) ( , )
( , ) ln ( , )
ln ( , ) ln ( , )
( , ) ( , )
f x y i x y r x y
z x y f x y
i x y r x y
i x y r x y
From probability theory, if two random variables are independent,
the histogram of their sum is the convolution of respective histogram.
This process would make illuminative component smear the
histogram of reflective component.
36. 生物医学工程研究所 中南大学
36 2024/2/1
10.4.2 basic global thresholding
As indicated earlier, The success of thresholding method depend
entirely on how well this histogram can be partitioned. Such as the
following example of ‘clean’ segmentation.
37. 生物医学工程研究所 中南大学
37 2024/2/1
Automatic generation of global threshold
Steps:
1. Select an initial estimate for T;
2. Segment the image using T. This will produce two groups of pixels:
G1 consisting of all pixels with gray level value > T and G2 with
values T;
3. Compute the average gray level values 1 and 2 for the pixels in
region G1 and G2
4. Compute a new threshold value: T = 0.5(1 + 2 );
5. Repeat the steps 2 through 4 until the difference in T in successive
iterations is smaller than a predefined parameter T0.
Comments:
global thresholding can be expected to be successful in highly
controlled environments, such as industrial inspection, where control of
the illumination usually is feasible.
39. 生物医学工程研究所 中南大学
39 2024/2/1
10.4.3 basic adaptive thresholding
As illustrated earlier, imaging factors such as uneven illumination
can transform a perfectly segmentable histogram into histogram
that can’t be partitioned effectively by a single global threshold. An
approach for handling such a situation is to divide the original
image into subimages and utilize a different threshold to segment
each image. Since the threshold is relate to the location of pixel, this
type of thresholding is adaptive.
Two key isssues:
a. How to subdivision
b. How to estimate local threshold.
42. 生物医学工程研究所 中南大学
42 2024/2/1
10.4.4 Optimal global and adaptive thresholding
Optimal criterion: minimum average segmentation error.
Suppose that an image contains only two principal gray-level region,
and random quantities z denote gray-level values.
So, the overall gray-level variation in the image is:
1 1 2 2
1 2
( ) ( ) ( )
1
p z P p z P p z
and P P
Where P1 and P2 are the probability of occurrence of object and
background pixels.
43. 生物医学工程研究所 中南大学
43 2024/2/1
Objective: select the value of T that minimizes the average error in
making the descisions that a given pixel belongs to an object or
background.
Probability of erroneously classification:
1 2 2 1
( ) ( ) ; ( ) ( )
T
T
E T p z dz E T p z dz
Overall probability of error:
2 1 1 2
( ) ( ) ( )
E T P E T PE T
Differentiate the E(T) with respect to T and equating the result to 0:
2 1 1 2
( ) ( )
P p T P p T
Then optimum threshold can be found by solving the above equation.
If P1=P2, then the optimum threshold is where p1(z) and p2(z)
intersect.
44. 生物医学工程研究所 中南大学
44 2024/2/1
Obtaining the analytical expression for T requires that we know
the equations for the two PDFs. Assume the most usual Gaussian
density as:
2 2 2 2
1 1 2 2
( ) /2 ( ) /2
1 2
1 2
( )
2 2
z u z u
P P
p z e e
Under this conditions, if the two variances are equal, a optimum
threshold using the above procedures is:
2
1 2 1
1 2 2
ln
2
P
T
P
If P1 = P2, the optimal threshold is the average of the means of two
distributions. The same is two if = 0.
45. 生物医学工程研究所 中南大学
45 2024/2/1
Example: outline the boundary of heart left-ventricle in
cardioangiograms
Pre-processing:
(1)Each pixel was mapped with a log function to counter exponential
effects caused by radioactive absorption;
(2) An image obtained before application of the contrast medium was
subtracted from each image captured after the medium was
injected in order to remove the spinal column;
(3)Several angiograms were summed in order to reduce random
noise;
46. 生物医学工程研究所 中南大学
46 2024/2/1
Effects of pre-processing
In order to compute the optimal thresholds , each preprocessed
image was subdivided into 49 regions by placing a 7*7 grid with
50% overlap over each image. Since the original images are of size
256*256 pixels, each of the 49 resulting sub-image contain 64*64
pixels.
47. 生物医学工程研究所 中南大学
47 2024/2/1
Gaussian density estimation for determining optimum thresholds.
Result of boundary estimation:
Cardioangiogram showing
superimposed boudaries.
48. 生物医学工程研究所 中南大学
48 2024/2/1
10.5 region-based segmentation
Basic formulation:
Let R represent the entire image region. Segmentation may be
viewed as a process that partitions R into subregions, R1, R2, …, Rn,
such that:
1
( )
( ) is a connected region
(c) ,for any ;
( ) ( ) TRUE
(e) ( ) FALSE for any adjacent regions
n
i
i
i
i j
i
i j
a R R
b R
R R i j
d P R
P R R
Where P(.) is a logical predicate which deals with the properties
that must be satisfied by the pixel in a segmented region.
49. 生物医学工程研究所 中南大学
49 2024/2/1
10.5.1 region growing
Region growing is a procedure that groups pixel or subregions into
larger regions based on a predefined criteria from a set of “seed”
points.
Several key factors: the selection of “seed” points, similarity criteria,
descriptor (based on intensity levels, such as moments or texture,
and spatial properties), stop rule, adjacency definition.
Notation: Descriptors alone can yield misleading results if
connectivity or adjacency information is not used in the region-
growing process.
51. 生物医学工程研究所 中南大学
51 2024/2/1
10.5.2 region splitting and merging
This approach is to subdivide an image initially into a set of arbitrary,
disjointed regions and then merge and/or split the regions in an
attempt to satisfy the conditions (a)~(e) mentioned in the starting of
this section.
Splitting process:
After finishing the splitting, for any two adjacent regions Ri and Rj, if
P(RiRj)=True, the two regions must be merged.
52. 生物医学工程研究所 中南大学
52 2024/2/1
Steps summarization:
1. At the beginning, divide the initial image into quadrants;
2. Split into four disjoint quadrants any region Ri for which
P(Ri)=FALSE;
3. Merge any adjacent regions Ri and Rj for which P(RiRj)=True;
4. Stop until no further merging or splitting is possible.
Example:
53. 生物医学工程研究所 中南大学
53 2024/2/1
10.6 segmentation by morphological watersheds
Basic concepts:
Three types of points:
(a)Point belonging to a regional minimum;
(b)Catchment basin or watershed: Points at which a drop of water, if
placed at the location of any these points, would fall with
certainty to a single minimum;
(c) divide lines or watershed lines: points at which would be equally
likely to fall to more than one such minimum;
The main objective of this type of segmentation algorithms is to find
the watershed lines.
One of the principal applications of watershed segmentation is in the
extraction of nearly uniform (bloblike) objects from the
background. In practice, this approach is usually applied to the
gradient of an image, rather than the image itself.
56. 生物医学工程研究所 中南大学
56 2024/2/1
10.6.1 dam construction
Dam construction is based on binary image. The simplest method is
to use morphological dilation (see Section 9.2.1).
Two conditions must be satisfied in dilating process:
(1) The dilation has to be constrained to q (denote the connected
component in figure (b) shown in the next page). This means that the
center of the structuring element can be located only at points in q.
(2) The dilation can’t be performed on points that would cause the
sets being dilated to merge (become a single connected component)
60. 生物医学工程研究所 中南大学
60 2024/2/1
10.6.3 the use of markers
Direct application of the watershed segmentation algorithm
generally leads to over-segmentation due to noise and other local
irregularities of the gradient. A practical solution to this problem is
to limit the number of allowable regions by incorporating a
preprocessing stage designed to bring additional knowledge into the
segmentation procedure.
An approach used to control over-segmentation is based on the
concept of markers. A marker is a connected component belonging
to an image, including internal and external markers.
Two principal steps for marker selection:
(1) preprocessing; (2) definition of a set of criteria that markers
must satisfy.
62. 生物医学工程研究所 中南大学
62 2024/2/1
In this case, the internal markers is defined as: (1) a region that is
surrounded by points of higher “altitude”; (2) such that the points
in the region form a connected component; and (3) in which all
points in the connected component have the same gray-level value.
First the image was smoothed, then internal markers were formed
shown as light gray. Next, the watershed algorithm was applied
under the restriction that these internal markers be the only
allowed regional minima. The resulting watershed lines are defined
as the external markers, which effectively partition the image into
regions, with each region containing a single internal marker and
part of background.
64. 生物医学工程研究所 中南大学
64 2024/2/1
Marker selection can range from simple procedures based on gray-
level values and connectivity, to more complex descriptions involving
size, shape, location, relative distances, texture content, and so on.
The point is that using markers brings a prior knowledge to bear on
the segmentation problem. This is a significant advantage of these
methods based on morphological segmentation.