chapter_10

advertisement
Chapter 10
Image Segmentation
國立雲林科技大學 電子工程系
張傳育(Chuan-Yu Chang ) 博士
Office: ES 709
TEL: 05-5342601 ext. 4337
E-mail: chuanyu@yuntech.edu.tw
Introduction

Image Segmentation




Subdivides an image into its constituent regions or
objects.
Segmentation should stop when the objects of interest
in an application have been isolated.
Segmentation accuracy determines the eventual
success or failure of computerized analysis procedures.
Image segmentation algorithm generally are based on
one of two basic properties of intensity values:

Discontinuity


Partitioning an image based on abrupt changes in intensity.
Similarity

Partitioning an image into regions that are similar according
to a set of predefined criteria.
2
Detection of discontinuities

There are three basic types of gray-level discontinuities


Points, lines, and edges.
The most common way to look for discontinuities is to run a
mask through the image in the manner described in Section
3.5. (sum of product)
R  w1 z1  w2 z2  ...  w9 z9
9
(10.1-1)
  wi zi
i 1
3
Detection of discontinuities

Point detection



An isolated point will be quit different from its surroundings.
Measures the weighted differences between the center point and
its neighbors.
A point has been detected at the location on which the mask is
centered if
R T
where T is a nonnegative threshold.
Mask 計 算
後的結果
飛機渦輪
葉片的X光
影像
有小破洞
取(c)圖最大灰
階 的 90% 作 為
threshold 後 的
4
結果
Detection of discontinuities

Line detection





Let R1, R2, R3, and R4 denote the response of the mask in
following.
Suppose that the four masks are run individually through an
image.
If, at a certain point in the image, |Ri|>|Rj|, for all j=/=i, that point is
said to be more likely associated with a line in the direction of
mask i.
If we are interested in detecting all the lines in an image in the
direction defined by a given mask, we simply run the mask
through the image and threshold the absolute value of the result.
The coefficients in each mask sum to zero.
5
Detection of discontinuities


We are interested in finding all the lines that are one pixel
thick and are oriented at -45.
Use the last mask shown in Fig. 10.3.
偵測到的45度
line
強度最強的
line
6
Detection of discontinuities

Edge detection


An edge is a set of connected pixels that lie on
the boundary between two regions.
The “thickness” of the edge is determined by
the length of the ramp.

Blurred edges tend to be thick and sharp edges tend
to be thin.
7
Detection of discontinuities

The first derivative is positive at the points of transition
into and out of the ramp as we move from left to right
along the profile.



It is constant for points in the ramp,
It is zero in areas of constant gray level.
The second derivative is positive at the transition
associated with the dark side of the edge, negative at
the transition associated wit the light side of the edge,
and zero along the ramp and in areas of constant gray
level.
The magnitude of the first derivative can be used to detect the presence
of an edge.
The sign of the second derivative can be used to determine whether
8
an edge pixel lies on the dark or light side of an edge.
Edge detection (cont.)

Two additional properties of the second
derivative around an edge:


It produces two values for every edge in an image.
An imaginary straight line joining the extreme
positive and negative values of the second
derivative would cross zero near the midpoint of
the edge.

The zero-crossing property of the second derivative is
quit useful for locating the centers of thick edges.
9
Detection of discontinuities

The entire transition from black to white is a single edge.
s=0
Image and gray-level profiles
of a ramp edge
s=0.1
First derivative image and the
gray-level profile
s=1
Second derivative
image and the graylevel profile
s=10
10
Edge detection (cont.)



The second derivative is even more sensitive to noise.
Image smoothing should be a serious consideration prior to the
use of derivatives in applications .
Summaries of edge detection
 To be classified as a meaningful edge point, the transition in gray
level associated with that point has to be significant stronger than
the background at that point.



Use a threshold to determine whether a value is “significant” or not.
We define a point in an image as being an edge point if its two
dimensional first-order derivative is greater than a specified
threshold.
A set of such points that are connected according to a predefined
criterion of connectedness is by definition an edge.
Edge segmentation is used if the edge is short in relation to the
dimensions of the image.
 A key problem in segmentation is to assemble edge
segmentations into longer edges.
If we elect to use the second-derivative to define the edge points
in an image as the zero crossing of its second derivative.


11
Detection of discontinuities

Gradient operator

The gradient of an image f(x,y) at location (x,y) is defined as
the vector
 f 
G x   
f      fx 
G y   
 y 

the gradient vector points is the direction of maximum rate of
change of f at coordinates (x,y).
The magnitude of the vector denoted ∇f, where

f  mag(f )  G  G

2
x

1
2 2
y
The direction of the gradient vector denoted by
 Gy
 Gx
 ( x, y )  tan 1 



The angle is measured with respect to the x-axis.
12
Detection of discontinuities

Roberts cross-gradient operator




Prewitt operator



Gx=(z9-z5)
Gy=(z8-z6)
Masks of size 2x2 are awkward to
implement because they do not have
a clear center.
Gx=(z7+z8+z9)-(z1+z2+z3)
Gy=(z3+z6+z9)-(z1+z4+z7)
Sobel operator



Uses a weight of 2 in the center
coefficient.
Gx=(z7+2z8+z9)-(z1+2z2+z3)
Gy=(z3+2z6+z9)-(z1+2z4+z7)
13
Detection of discontinuities


Computation of the gradient requires Gx and Gy be combined in Eq.
(10.1-4), however, this implementations is not always desirable
because of the computational burden required by squares and
square roots.
An approach used frequently is to approximate the gradient by
absolute values:
f  G x  G y

The two additional Prewitt and Sobel masks for detecting
discontinuities in the diagonal directions are shown in Fig. 10.9
用來偵測對角邊界的
Prewitt及Sobel
mask。
14
Detection of discontinuities


Fig. 10.10 shows the response of the two components of
the gradient, |Gx| and |Gy|.
The gradient image formed the sum of these two
components.
15
Detection of discontinuities

Figure 10.11 shows the same sequence of images
as in Fig. 10.10, but with the original image being
smoothed first using a 5x5 averaging filter.

The response of each mask no shows almost no
contribution due to the bricks, with the result being
dominated mostly by the principal edges.
16
Detection of discontinuities




The horizontal and vertical Sobel masks respond about equally
well to edges oriented in the minus and plus 45° direction.
If we emphasize edges along the diagonal directions, the one of
the mask pairs in Fig. 10.9 should be used.
The absolute responses of the diagonal Sobel masks are shown
in Fig. 10.12.
The stronger diagonal response of these masks is evident in
these figures.
17
Detection of discontinuities

The Laplacian of a 2-D function f(x,y) is a second-order
derivative defined as
2 f 2 f
 f  2  2
x
y
2

For a 3x3 region, one of the two forms encountered most
frequently in practice is (水平與垂直邊)
2 f  4z5  z2  z4  z6  z8 

A digital approximation including the diagonal neighbors is
given by (含水平、垂直、及對角邊)
2 f  8z5  z1  z2  z3  z4  z6  z7  z8  z9 
18
Detection of discontinuities

The Laplacian generally is not used in its original
form for edge detection for several reasons:




As a second-order derivative, the Laplacian typically is
unacceptably sensitive noise.
The magnitude of the Laplacian produces double edges.
The Laplacian is unable to detect edge direction.
The role of the Laplacian in segmentation consists of


Using its zero-crossing property for edge location.
Using it for complementary purpose of establishing whether
a pixel is on the dark or light side of an image.
19
Detection of discontinuities

Laplacian of a Gaussian (LoG)

The Laplacian is combined with smoothing as a precursor to
finding edges via zero-crossing, consider the function
h(r )  e



r2
2s 2
where r2=x2+y2 and s is the standard deviation.
Convolving this function with an image blurs the image, with
the degree of blurring being determined by the value of s.
The Laplacian of h is
r2
 r 2  s 2   2s 2
2
 h( r )   
e
2
s



The function is commonly referred to as the “Laplacian of a
Gaussian” (LoG), sometimes is called the ”Mexican hat”
function
20
Detection of discontinuities

The purpose of the Gaussian function in the LoG formulation is to
smooth the image, and the purpose of the Laplacian operator is
to provide an image with zero crossings used to establish the
location of edges.
21
Detection of discontinuities



Fig. 10.15(c) is a spatial Gaussian
function (with a standard deviation
of five pixels) used to obtain a
27x27 spatial smoothing mask.
The mask was obtained by
sampling this Gaussian function at
equal interval.
∇2h can be computed by
application of (c) followed by (d).
The LoG result shown in Fig.
10.15(e) is the image from which
zero crossings are computed to
find edges.



One straightforward approach for
approximating zero-crossings is to
threshold the LoG image by setting
all its positive values to white, and
all negative values to black.
Zero-crossing occur between
positive and negative values of the
Laplacian.
Estimated zero-crossing, obtained
by scanning the threshold image
and noting the transitions between22
black and white.
Detection of discontinuities

Comparing Figs/ 10.15(b) and (g)


The edges in the zero-crossing image are thinner
than the gradient edges.
The edges determined by zero-crossings form
numbers closed loops.


“spaghetti effect” is one of the most serious drawbacks
of this method.
The major drawback is the computation of zero
crossing.
23
Edge Linking and Boundary Detection




Ideally, edge detection should yield pixels lying only
on edges.
In practice, this set of pixels seldom characterizes
an edge completely because of noise, breaks in the
edge from nonuniform illumination, and other effects
that introduce spurious intensity discontinuities.
Thus, edge detection algorithms are followed by
linking procedures to assemble edge pixels into
meaningful edges.
Local Processing


To analyze the characteristics of pixels in a small
neighborhood about every point (x,y) in an image that has
been labeled an edge point.
All points that are similar according to a set of predefined
criteria are linked.
24
Edge Linking and Boundary Detection

The two principal properties used for
establishing similarity of edge pixels:

The strength of the response of the gradient
operator used to produce the edge pixel.
Eq.(10.1-4)

The direction of the gradient vector. Eq. (10.1-5)
25
Edge Linking and Boundary Detection

An edge pixel with coordinates (x0,y0) in a predefined
neighborhood of (x,y), is similar in magnitude to the pixel at (x,y) if
f ( x, y)  f ( x0 , y0 )  E

where E is a nonegativethreshold
An edge pixel at (x0,y0) is the predefined neighborhood of (x,y)has
an angle similar to the pixel at (x,y) if
 ( x, y)   ( x0 , y0 )  A
where A is a nonegativeangle threshold



A point in the predefined neighborhood of (x,y) is linked to the
pixel at (x,y) if both magnitude and direction criteria are satisfied。
This process is repeated at every location in the image.
A record must be kept of linked points as the center of the
neighborhood is moved from pixel to pixel.
26
Edge Linking and Boundary Detection



Example 10-6: the objective is to find rectangles whose sizes
makes them suitable candidates for license plates.
The formation of these rectangles can be accomplished by
detecting strong horizontal and vertical edges.
Linking all points, that had a gradient value greater than 25 and
whose gradient directions did not differ by more than 15°.
使用垂直的
Sobel operator
使用水平的
Sobel operator
分別對圖(b)及(c)
進行edge linking
的動作,將梯度
大於25,且角度
小於15度的點連
起來。
27
Edge Linking and Boundary Detection

Global Processing via the Hough Transform







Points are linked by determining first if they lie on a curve of specified
shape
Given n points in an image, suppose that, we want to find subsets of
these points that lie on straight lines.
Consider a point (xi,yi) and the general equation of a straight line in slopeintercept form, yi=axi+b.
Infinitely many lines pass through (xi,yi), but they all satisfy the equation
yi=axi+b for varying values of a and b.
However, writing this equation as b=-xia+yi and considering the ab-plane
yields the equation of a single line for a fixed pair (xi,yi) .
A second point (xj,yj) also has a line in parameter space associated with it,
and this line intersects the lines associated with (xi,yi) at (a’, b’).
All points contained on this line have lines in parameter space that
intersect at (a’, b’)
28
Edge Linking and Boundary Detection

Hough Transform







Subdividing the parameter space into so-called accumulator cell
Initially, these cells are set to 0.
For every point (xk, yk) in the image plane, we let the parameter a
equal each of the allowed subdivisions values on the a-axis and
solve for the corresponding b using the equation b=-xka+yk.
The resulting b’s are then rounded off to the nearest allowed
value in the b-axis.
If a choice of ap results in solution bq,we let A(p,q)=A(p,q)+1 .
At the end of this procedure, a value of Q in A(i,j) corresponds to
Q points in the xy-plane lying on the line y=aix+bj.
The number of subdivisions in the ab-plane determines the
accuracy of the colinearity of these points.
29
Edge Linking and Boundary Detection

A problem with using the equation y=ax+b to
represent a line is that the slope approaches infinity
as the line approaches the vertical.

To use normal representation of a line
x cos  y sin   
30
Edge Linking and Boundary Detection
X, Y平面上有
五個點(1, 2, 3,
4, 5)
X, Y平面
上五個點
(1, 2, 3, 4,
5) ,在
平面的曲
線
從交點A知
道, 點1, 3,
5)共線。
交點B表示
點2,3,4共線
31
Edge Linking and Boundary Detection

Edge-linking based on Hough transform




Compute the gradient of an image and threshold
it to obtain a binary image.
Specify subdivisions in the -plane.
Examine the counts of the accumulator cells for
high pixel concentration.
Examine the relationship between pixels in a
chosen cell (依其對應的找出直線)。
32
Edge Linking and Boundary Detection




Fig. (a) is an aerial infrared image containing two hangars and a
runway.
Fig. (b) is a thresholded gradient image obtained using the Sobel
operator.
Fig. (c) shows the Hough transform of the gradient image.
Fig. (d) shows the set of pixels linked according to the criteria


They belonged to one of the three accumulator cells with the highest
count.
No gaps were longer than five pixels.
33
Edge Linking and Boundary Detection

Global Processing via Graph-Theoretic Techniques



A global approach for edge detection and linking based on representing
edge segments in the form of a graph and searching the graph for low-cost
paths that correspond to significant edges.
This representation provides a rugged approach that performs well in the
presence of noise.。
Graph G=(N,U)








N: set of node
U: unordered pairs of distinct elements of N
Each pair (ni,nj) of U is called arc,ni, is said to be a parent, nj is said to be a
successor。
The process of identifying the successor of a node is called expansion。
In each graph we define levels, such that level 0 consists of a single node,
called the start or root, and the nodes in the last level are called goal nodes.
Cost (ni,nj) can be associated with every arc (ni,nj) .
A sequence of nodes n1, n2,…,nk, with each node ni being a successor of node ni1, is called a path from n1 to nk.
The cost of the entire path is
k
c   cni 1 , ni 
p
q
i 2
34
Edge Linking and Boundary Detection
Each edge element defined by pixels p and q,
has an associated cost, defined as
c( p, q)  H   f ( p)  f (q)
灰階值
座標
成本
where H is the highest gray-level value
in the image, and f(x) is the gray-level
value of x.
35
Edge Linking and Boundary Detection






By convention, the point p is on the right-hand side of the direction
of travel along edge elements.
To simplify, we assume that edges start in the top row and
terminate in the last row.
p and q are 4-neighbors.
An arc exists between two nodes if the two corresponding edge
elements taken in succession can be part of an edge.
The minimum cost path is shown dashed.
Let r(n) be an estimate of the cost of a minimum-cost path from s
to n plus an estimate of the cost of that path from n to a goal node;
r n   g n   hn 

(10.2-7)
Here, g(n) can be chosen as the lowest-cost path from s to n found
so far, and h(n) is obtained by using any variable heuristic
information.
36
Edge Linking and Boundary Detection
37
Edge Linking and Boundary Detection

Graph search algorithm






Step1: Mark the start node OPEN and set g(s)=0.
Step 2: If no node is OPEN exit with failure; otherwise, continue.
Step 3: Mark CLOSE the OPEN node n whose estimate r(n) computed from
Eq.(10.2-7) is smallest.
Step 4: If n is a goal node, exit with the solution path obtained by tracing back
through the pointets; otherwise, continue.
Step 5: Expand node n, generating all of its successors (If there are no
successors go to step 2)
Step 6: If a successor ni is not marked, set
r ni   g n   cn, ni 

Step 7: if a successor ni is marked CLOSED or OPEN, update its value by
letting
g ' ni   min g ni , g n  cn, ni 
Mark OPEN those CLOSED successors whose g’ value were thus lowered
and redirect to n the pointers from all nodes whose g’ values were lowered.
38
Go to Step 2.
Edge Linking and Boundary Detection


Example 10-9: noisy chromosome silhouette and an
edge found using a heuristic graph search.
The edge is shown in white, superimposed on the
original image.
39
Thresholding

Thresholding
 To select a threshold T, that separates the objects form
the background.


Then any point (x,y) for which f(x,y)>T is called an object point;
otherwise, the point is called a background point.
Multilevel thresholding


Classifies a point (x,y) as belonging to one object class if T1
<f(x,y) ≤T2, and to the other object class if f(x,y) >T2
And to the background if f(x,y) ≤T2
40
Thresholding


In general, segmentation problems requiring multiple thresholds are
best solved using region growing methods.
The thresholding may be viewed as an operation that involves tests
against a function T of the form
T  T x, y, px, y , f x, y 




where f(x,y) is the gray-level of point (x,y) and p(x,y) denotes some
local property of this point.
A threshold image g(x,y) is defined as
1 if f ( x, y )  T
g  x, y   
0 if f ( x, y )  T
Thus, pixels labeled 1 correspond to objects, whereas pixels labeled
0 correspond to the background.
When T depends only on f(x,y) the threshold is called global. If T
depends on both f(x,y) and p(x,y), the threshold is called local.
If T depends on the spatial coordinates x and y, the threshold is called
dynamic or adaptive.
41
The role of illumination

An image f(x,y) is formed as the product of a
reflectance component r(x,y) and an illumination
component i(x,y).
f x, y   ix, y r x, y 



(10.3-4)
In ideal illumination, the reflective nature of objects
and background could be easily separable.
However, the image resulting from poor illumination
could be quit difficult to segment.
Taking the natural logarithm of Eq.(10.3-3)
z x, y   ln f x, y 
 ln ix, y   ln r x, y 
 i' x, y   r ' x, y 
(10.3-5)
42
The role of illumination

From probability theory,

If i’(x,y) and r’(x,y) are independent random
variables, the histogram of z(x,y) is given by the
convolution of the histograms of i’(x,y) and r’(x,y).
43
The role of illumination
電腦產生的反射函數
f ( x, y)  i( x, y)r ( x, y)
影像f(x,y)可看作是反射
量r(x,y)和照度i(x,y)的乘
積。
電腦產生的照度函數
Fig. (a)*Fig(c)
物體和背景的反射特性,
使她們容易被分割,但
差的照明,會使產生的
影像難以分割。
44
Thresholding

Basic global thresholding






Select an initial estimate for T
Segment the image using T
 G1 : consisting of all pixels with gray level values > T
 G2 : consisting of all pixels with gray level values <= T
Compute the average gray level values m1 and m2 for pixels
in regions G1 and G2.
Compute a new threshold value
 T=0.5*(m1 + m2)
Repeat step 2 through 4 until the difference in T in
successive iterations is smaller than a predefined
parameter T0.
The parameter T0 is used to stop the algorithm after
changes become small.
45
Basic Global Thresholding


To partition the image histogram by using a single global
threshold T.
Segmentation is then accomplished by scanning the image
pixel by pixel and labeling each pixel as object or
background, depending on whether the gray level of that
pixel is great or less than the value T.
46
Basic Global Thresholding

Fig. (a) is the original image, (b) is the image histogram.
 The clear valley of the histogram.
 Application of the iterative algorithm resulted in a value of 125.4
after three iterations starting with the average gray level and T0=0.
 The result obtained using T=125 to segment the original image is
shown in Fig. (c).
47
Thresholding

Basic adaptive thresholding



Imaging factors such as uneven illumination can transform a
perfectly segmentable histogram into a histogram that cannot be
partitioned effectively by a single global threshold.
To divide the original image into subimages and then utilize a
different threshold to segment each subimage.
The key issues are


How to subdivide the image?
How to estimate the threshold for each resulting subimages?
Global threshold手
動將T設在山谷
處。
將原始影像根據亮度的變
化分成16區塊。
48
Thresholding
灰階值得分佈極不
均勻,全域門限法
注定失敗
圖10.30(c)的(1,2)及
(2,2)子影像
分成更多的子影像
49
Thresholding

Optimal Global and Adaptive Thresholding
p ( z )  P1 p1 ( z )  P2 p2 ( z )
P1  P2  1
影像中任何像素點不是物體就是背景。
T
E1 (T )   p2 ( z )dz


E2 (T )   p1 ( z )dz
將背景誤認為物體的機率。
將物體誤認為背景的機率。
T
E (T )  P2 E1 (T )  P1 E2 (T )
總誤差
background
object
50
Thresholding
P1 p1 (T )  P2 p2 (T )
P1
pz  
e
2 s 1
為求得最小誤差的門限值T,須求E(T)對T的偏微分。

z  m1 2

2s 12
P2

e
2 s 2
AT 2  BT  C  0
A  s 12  s 22

B  2 m1s 22  m 2s 12

z  m 2 2

2s 22
以gaussian密度函數來近似p(z)
(10.3-10)式的通解

C  s 12 m 22  s 22 m12  2s 12s 22 lns 2 P1 / s 1 P2 
T
m1  m 2
2
 P2 
s2

ln 
m1  m 2  P1 
如果variance相等時。
51
Chapter 10
Image Segmentation
原始的心臟影像,打有顯
影劑,目的在於描繪出左
心室的輪廓。
前處理:
(1)每個像素點經log function轉換
(2)將打藥前與打藥後的影像相減,以消
除脊椎部份。
(3)將多張心臟影像平均以消除雜訊。
52
Chapter 10
Image Segmentation
Block A和Block B的影像
histogram
53
Chapter 10
Image Segmentation
54
Thresholding

Use of boundary characteristics for histogram
improvement and local thresholding


如果histogram的peak是高、宰、對稱,而且被深的山谷給分
隔,則選到好的threshold的機會較大。
改善histogram形狀的方法是只考慮接近物體與背景邊界的像
素點。
0 f  T

sx, y    f  T and  2 f  0
 f  T and  2 f  0

非邊界點標為0
邊界點的深色邊標為+
邊界點的亮色邊標為-
包含有物體的水平/垂直掃描線具有如下的結構:
(…)(-,+)(o or +)(+, -)(…)
55
Thresholding
以Eq.(10.3-16)編碼的手寫字
56
Chapter 10
Image Segmentation
具風景背景的支票
Example 10.14
梯度大於5的梯度
histogram,具有相同高
度,及由顯著山谷所分
開的特性
取梯度histogram的山谷中間值,
當成threshold後的結果。
57
Thresholding

Thresholds based on several variables

Multispectral thresholding


相當於3D空間中找尋分類點。
例如:在RGB影像中分別根據RGB來分類。
以接近臉的灰
階來分割
將color影像
以單色顯示。
分割紅色的成分
58
Region-Based Segmentation

Basic Formulation
n
(a )
R
i
i 1
R
所有的像素點必須屬於任一區域
(b) Ri is a connectedregion,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 i  j
區域內的點必須相連
區域和區域間沒有相連
區域內的像素點有相同的性質。
區域 Ri和Rj有不同的特性
59
Region-Based Segmentation

Region Growing



Group pixels or subregions into regions based on predefined
criteria.
Start with a set of “seed” points and from these grow regions
by appending to each seed those neighboring pixels that have
properties similar to the seed.
Region growing的困難:



Seed point的選擇
Similarity criteria的選擇
Stooping rule的訂立
60
Region-Based Segmentation
選擇灰階值為
255的點當seed
point
Example 10-16 焊接點的檢測
有缺陷的焊接點
的灰階值有傾向
255的趨勢
將和種子點灰階
值差異小於65的
點”長”出來。
61
Region-Based Segmentation
圖10.40 的histogram
(無法清楚分離物體與背景)
62
Region-Based Segmentation

Region Splitting and Merging


一開始將影像分割成任意子影像,然後再合併或分割
成滿足條件的segmentation。
將整張影像R連續的分割成更小的1/4影像,直到任
何區域Ri, P(Ri)=TRUE


從整張圖R開始,如果P(R)=FALSE (表示區域 R內的pixel
有不同的灰階值) ,則將R分成四的子影像。
如果子影像的P為FALSE則繼續分割成四個子影像。
63
Region-Based Segmentation
Region Splitting and Merging
64
Region-Based Segmentation

Region Splitting and Merging



Split into four disjoint quadrants any region Ri for
which P(Ri)=FALSE.
Merge any adjacent regions Rj and Rk for which
P(Rj U Rk)=TRUE.
Stop when no further merging or splitting is
possible.
65
Region-Based Segmentation
若Ri中有80%的像素點具有
|zj-mi|<=2si的特性。則P(Ri)=TRUE。
原始楓葉影像
Threshold後,葉柄不見了。
66
Segmentation by Morphological Watersheds

Basic Concepts

將原始影像的灰階值構成一立體地形圖
(topographic)。

考慮三種點的型態:




區域最小值的點。
一滴水的點 (單一最小值) 。形成集水盆(catchment basin)或
分水嶺(watershed)
水可能會掉入的多個最小值的點。形成峰線(crest line)
此法的目標在於找出watershed line。
67
Segmentation by Morphological Watersheds
原始影像
在區域最小值的
地方打洞,將水
注入
水位慢慢上升
(灰階愈來愈大)
原始影像的
地形圖
水開始溢入
第二的區域
68
Segmentation by Morphological Watersheds
水持續溢入第
二個集水區
開始構築水
壩(dam)
最後的水壩代
表分割的結果
69
Segmentation by Morphological Watersheds

Watershed法的優點:


Watershed line可得到連續的boundary
Watershed segmentation可用來擷取塊狀的物件。
70
Dam Construction
使用二元化影像的dilation
在第n-1次注入水後
的集水區1,Cn1(M1)
在第n-1次注入水後
的集水區2, Cn-1(M2)
C[n-1]
第n次注入水後
的集水區q
第一次
dilation
第二次
dilation
將二次dilation重疊的
區域建成水壩
71
原始影像
Chapter 10
Image Segmentation
梯度影像
將分水嶺線疊
回原始影像
分水嶺線
72
Segmentation by Morphological Watersheds



直接應用watershed segmentation會導致over segmentation
可使用marker來控制over segmentation。
Marker 是影像中相連接的元件。


Internal marker結合有興趣的物件。
External marker結合背景。
73
Segmentation by Morphological Watersheds

The use of marker

Marker的選擇包含兩個主要步驟:


前處理:利用smoothing filter去除不必要的細節。
定義一組marker必須滿足的criteria:



Region是由高海拔所圍繞的區域。
Region內的點是相連的元件。
這些相連的元件具有相同的灰階值。
74
Segmentation by Morphological Watersheds
1. 先找出internal marker
2. 再以watershed找出watershed line
75
The Use of Motion in Segmentation

Spatial Techniques
偵測兩張不同frame, f(x, y, ti)及f(x,y, tj)影像的差異,可以
pixel-by-pixel的方式來比較其差異。
1 f ( x, y, ti )  f ( x, y, t j )  T
d ij ( x, y )  
0 otherwise


dij(x,y)為1的像素點代表物件的移動,但因為雜訊也會造成單
獨點的dij(x,y)為1,因此可利用4或8-connected來將少於特
定點數的點(區域)刪除。
76
The Use of Motion in Segmentation

Accumulative differences

Accumulative difference image (ADI)

將序列影像的每張影像ti和參考影像的差累計加總。
 A ( x, y )  1 R ( x, y )  f ( x, y , k )  T
Ak ( x, y )   k 1
Absolute ADI

Positive ADI


Negative ADI
otherwise
 Ak 1 ( x, y )
 P ( x, y )  1 R ( x, y )  f ( x, y, k )  T
Pk ( x, y )   k 1
otherwise
 Pk 1 ( x, y )
 N ( x, y )  1 R ( x, y )  f ( x, y, k )  T
N k ( x, y )   k 1
otherwise
 N k 1 ( x, y )
77
The Use of Motion in Segmentation
Example 10.19
Image size: 256x256, object szie:75x50, moving speed 5sqrt(2)
1. Positive ADI中非零的區域代表移動物體的大小,及移動物體在參考影像中的位置
2. Absolute ADI包含positive和negative ADI的區域
3. 移動物體的方向和速度可由absolute及negative ADI中決定。
Negative
ADI
Absolute
ADI
Positive
ADI
78
The Use of Motion in Segmentation

Establishing a reference image




序列影像中的第一張為參考影像。
當參考影像中非固定的成分移動其位置時,則將目
前frame中相對應的位置複製到參考影像。
當所有移動的物件均離開其原始位置,則將建立一
張只有固定物體的影像。
物件的移動可由positive ADI的改變來建立。
79
Chapter 10
Image Segmentation
行駛中的汽車
Frame 1
行駛中的汽車
Frame 2
汽車已被移除
Result
80
Chapter 10
Image Segmentation
81
Chapter 10
Image Segmentation
82
Chapter 10
Image Segmentation
83
Chapter 10
Image Segmentation
84
Download