Chapter 10 Image Segmentation 國立雲林科技大學 電子工程系 張傳育 (Chuan-Yu Chang ) 博士 Office: ES 709 TEL: 05-5342601 ext. 4337

Slides:



Advertisements
Similar presentations
Spatial Filtering.
Advertisements

Chapter 3 Image Enhancement in the Spatial Domain.
Regional Processing Convolutional filters. Smoothing  Convolution can be used to achieve a variety of effects depending on the kernel.  Smoothing, or.
DREAM PLAN IDEA IMPLEMENTATION Introduction to Image Processing Dr. Kourosh Kiani
Sliding Window Filters and Edge Detection Longin Jan Latecki Computer Graphics and Image Processing CIS 601 – Fall 2004.
Image Segmentation Image segmentation (segmentace obrazu) –division or separation of the image into segments (connected regions) of similar properties.
Image Segmentation Region growing & Contour following Hyeun-gu Choi Advisor: Dr. Harvey Rhody Center for Imaging Science.
1Ellen L. Walker Edges Humans easily understand “line drawings” as pictures.
Content Based Image Retrieval
EE 7730 Image Segmentation.
Thresholding Otsu’s Thresholding Method Threshold Detection Methods Optimal Thresholding Multi-Spectral Thresholding 6.2. Edge-based.
Chapter 10 Image Segmentation.
Machinen Vision and Dig. Image Analysis 1 Prof. Heikki Kälviäinen CT50A6100 Lectures 8&9: Image Segmentation Professor Heikki Kälviäinen Machine Vision.
EE663 Image Processing Edge Detection 2 Dr. Samir H. Abdul-Jauwad Electrical Engineering Department King Fahd University of Petroleum & Minerals.
Segmentation Divide the image into segments. Each segment:
Image Segmentation. Introduction The purpose of image segmentation is to partition an image into meaningful regions with respect to a particular application.
Chapter 10 Image Segmentation.
Machinen Vision and Dig. Image Analysis 1 Prof. Heikki Kälviäinen CT50A6100 Lectures 8&9: Image Segmentation Professor Heikki Kälviäinen Machine Vision.
DIGITAL IMAGE PROCESSING Instructors: Dr J. Shanbehzadeh M.Yekke Zare M.Yekke Zare ( J.Shanbehzadeh M.Yekke Zare )
October 8, 2013Computer Vision Lecture 11: The Hough Transform 1 Fitting Curve Models to Edges Most contours can be well described by combining several.
Chapter 2. Image Analysis. Image Analysis Domains Frequency Domain Spatial Domain.
Chapter 10: Image Segmentation
What is Image Segmentation?
G52IIP, School of Computer Science, University of Nottingham 1 Edge Detection and Image Segmentation.
Edge Linking & Boundary Detection
Lecture 16 Image Segmentation 1.The basic concepts of segmentation 2.Point, line, edge detection 3.Thresh holding 4.Region-based segmentation 5.Segmentation.
Digital Image Processing In The Name Of God Digital Image Processing Lecture8: Image Segmentation M. Ghelich Oghli By: M. Ghelich Oghli
Chap. 9: Image Segmentation Jen-Chang Liu, Motivation Segmentation subdivides an image into its constituent regions or objects Example: 生物細胞在影像序列中的追蹤.
© by Yu Hen Hu 1 ECE533 Digital Image Processing Image Segmentation.
Edges. Edge detection schemes can be grouped in three classes: –Gradient operators: Robert, Sobel, Prewitt, and Laplacian (3x3 and 5x5 masks) –Surface.
Joonas Vanninen Antonio Palomino Alarcos.  One of the objectives of biomedical image analysis  The characteristics of the regions are examined later.
Digital Image Processing Lecture 18: Segmentation: Thresholding & Region-Based Prof. Charlene Tsai.
Chapter 10 Image Segmentation.
Image Segmentation Chapter 10.
Chapter 10, Part II Edge Linking and Boundary Detection The methods discussed in the previous section yield pixels lying only on edges. This section.
Chapter 4 Image Segmentation
G52IVG, School of Computer Science, University of Nottingham 1 Edge Detection and Image Segmentation.
Image Processing Segmentation 1.Process of partitioning a digital image into multiple segments (sets of pixels). 2. Clustering pixels into salient image.
Chapter 10, Part I.  Segmentation subdivides an image into its constituent regions or objects.  Image segmentation methods are generally based on two.
Pixel Connectivity Pixel connectivity is a central concept of both edge- and region- based approaches to segmentation The notation of pixel connectivity.
Image Segmentation and Edge Detection Digital Image Processing Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng.
Spatial Filtering.
EE 4780 Edge Detection.
Digital Image Processing Lecture 16: Segmentation: Detection of Discontinuities Prof. Charlene Tsai.
Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki.
主講者 : 陳建齊. Outline & Content 1. Introduction 2. Thresholding 3. Edge-based segmentation 4. Region-based segmentation 5. conclusion 2.
Digital Image Processing
Evaluation of Image Segmentation algorithms By Dr. Rajeev Srivastava.
Digital Image Processing Lecture 16: Segmentation: Detection of Discontinuities May 2, 2005 Prof. Charlene Tsai.
Image Segmentation Prepared by:- Prof. T.R.Shah Mechatronics Engineering Department U.V.Patel College of Engineering, Ganpat Vidyanagar.
Course 5 Edge Detection. Image Features: local, meaningful, detectable parts of an image. edge corner texture … Edges: Edges points, or simply edges,
Digital Image Processing Lecture 17: Segmentation: Canny Edge Detector & Hough Transform Prof. Charlene Tsai.
Machine Vision Edge Detection Techniques ENT 273 Lecture 6 Hema C.R.
Thresholding Foundation:. Thresholding In A: light objects in dark background To extract the objects: –Select a T that separates the objects from the.
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Unit-VII Image Segmentation.
Chapter 10: Image Segmentation The whole is equal to the sum of its parts. Euclid The whole is greater than the sum of its parts. Max Wertheimer.
Machine Vision ENT 273 Lecture 4 Hema C.R.
Chapter 10 Image Segmentation
Digital Image Processing Lecture 16: Segmentation: Detection of Discontinuities Prof. Charlene Tsai.
Detection of discontinuity using
Image Segmentation – Edge Detection
Mean Shift Segmentation
Fitting Curve Models to Edges
Computer Vision Lecture 9: Edge Detection II
Chap 10 Image Segmentation
ECE 692 – Advanced Topics in Computer Vision
Digital Image Processing
Image Segmentation Image analysis: First step:
Digital Image Processing
Presentation transcript:

Chapter 10 Image Segmentation 國立雲林科技大學 電子工程系 張傳育 (Chuan-Yu Chang ) 博士 Office: ES 709 TEL: ext

2 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.

3 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) (10.1-1)

4 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 where T is a nonnegative threshold. 飛機渦輪 葉片的 X 光 影像 有小破洞 Mask 計算 後的結果 取 (c) 圖最大灰 階的 90% 作為 threshold 後的 結果

5 Detection of discontinuities Line detection  Let R 1, R 2, R 3, and R 4 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, | R i |>| R j |, 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.

6 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 偵測到的 45 度 line 強度最強的 line

7 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.

8 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 an edge pixel lies on the dark or light side of an edge.

9 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.

10 Detection of discontinuities The entire transition from black to white is a single edge. Image and gray-level profiles of a ramp edge First derivative image and the gray-level profile Second derivative image and the gray- level profile  =0.1  =1  =10  =0

11 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.

12 Detection of discontinuities Gradient operator  The gradient of an image f(x,y) at location (x,y) is defined as the vector 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  The direction of the gradient vector denoted by The angle is measured with respect to the x-axis.

13 Detection of discontinuities Roberts cross-gradient operator  G x =(z 9 -z 5 )  G y =(z 8 -z 6 )  Masks of size 2x2 are awkward to implement because they do not have a clear center. Prewitt operator  G x =(z 7 +z 8 +z 9 )-(z 1 +z 2 +z 3 )  G y =(z 3 +z 6 +z 9 )-(z 1 +z 4 +z 7 ) Sobel operator  Uses a weight of 2 in the center coefficient.  G x =(z 7 +2z 8 +z 9 )-(z 1 +2z 2 +z 3 )  G y =(z 3 +2z 6 +z 9 )-(z 1 +2z 4 +z 7 )

14 Detection of discontinuities Computation of the gradient requires G x and G y 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: The two additional Prewitt and Sobel masks for detecting discontinuities in the diagonal directions are shown in Fig 用來偵測對角邊界的 Prewitt 及 Sobel mask 。

15 Detection of discontinuities Fig shows the response of the two components of the gradient, | G x | and | G y |. The gradient image formed the sum of these two components.

16 Detection of discontinuities Figure shows the same sequence of images as in Fig , 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.

17 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 should be used. The absolute responses of the diagonal Sobel masks are shown in Fig The stronger diagonal response of these masks is evident in these figures.

18 Detection of discontinuities The Laplacian of a 2-D function f(x,y) is a second-order derivative defined as For a 3x3 region, one of the two forms encountered most frequently in practice is ( 水平與垂直邊 ) A digital approximation including the diagonal neighbors is given by ( 含水平、垂直、及對角邊 )

19 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.

20 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 where r 2 =x 2 +y 2 and  is the standard deviation.  Convolving this function with an image blurs the image, with the degree of blurring being determined by the value of .  The Laplacian of h is  The function is commonly referred to as the “Laplacian of a Gaussian” (LoG), sometimes is called the ”Mexican hat” function

21 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.

22 Detection of discontinuities Fig (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. ∇ 2 h can be computed by application of (c) followed by (d). The LoG result shown in Fig (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 between black and white.

23 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.

24 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.

25 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)

26 Edge Linking and Boundary Detection An edge pixel with coordinates ( x 0,y 0 ) in a predefined neighborhood of ( x,y ), is similar in magnitude to the pixel at ( x,y ) if An edge pixel at ( x 0,y 0 ) is the predefined neighborhood of ( x,y )has an angle similar to the pixel at ( x,y ) if 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.

27 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 度的點連 起來。

28 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 ( x i, y i ) and the general equation of a straight line in slope- intercept form, y i =ax i +b.  Infinitely many lines pass through ( x i, y i ), but they all satisfy the equation y i =ax i +b for varying values of a and b.  However, writing this equation as b=-x i a+y i and considering the ab -plane yields the equation of a single line for a fixed pair ( x i, y i ).  A second point ( x j,y j ) also has a line in parameter space associated with it, and this line intersects the lines associated with ( x i,y i ) at ( a’, b’).  All points contained on this line have lines in parameter space that intersect at (a’, b’)

29 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 ( x k, y k ) 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=-x k a+y k.  The resulting b ’s are then rounded off to the nearest allowed value in the b -axis.  If a choice of a p results in solution b q , 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=a i x+b j.  The number of subdivisions in the ab-plane determines the accuracy of the colinearity of these points.

30 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

31 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 共線

32 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 ( 依其對應的  找出直線 ) 。

33 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.

34 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 ( n i,n j ) of U is called arc , n i, is said to be a parent , n j 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 ( n i,n j ) can be associated with every arc ( n i,n j ). A sequence of nodes n 1, n 2,…,n k, with each node n i being a successor of node n i - 1, is called a path from n 1 to n k. The cost of the entire path is p q

35 Edge Linking and Boundary Detection 座標 灰階值 成本 Each edge element defined by pixels p and q, has an associated cost, defined as where H is the highest gray-level value in the image, and f(x) is the gray-level value of x.

36 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;  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. (10.2-7)

37 Edge Linking and Boundary Detection

38 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 n i is not marked, set  Step 7: if a successor n i is marked CLOSED or OPEN, update its value by letting 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. Go to Step 2.

39 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.

40 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 T 1 T 2 And to the background if f(x,y) ≤ T 2

41 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 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 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.

42 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 ). 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) (10.3-4) (10.3-5)

43 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).

44 Fig. (a)*Fig(c) 影像 f(x,y) 可看作是反射 量 r(x,y) 和照度 i(x,y) 的乘 積。 電腦產生的反射函數 電腦產生的照度函數 物體和背景的反射特性, 使她們容易被分割,但 差的照明,會使產生的 影像難以分割。 The role of illumination

45 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  1 and  2 for pixels in regions G1 and G2.  Compute a new threshold value T=0.5*(  1 +  2 )  Repeat step 2 through 4 until the difference in T in successive iterations is smaller than a predefined parameter T 0.  The parameter T 0 is used to stop the algorithm after changes become small.

46 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.

47 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 after three iterations starting with the average gray level and T 0 =0.  The result obtained using T =125 to segment the original image is shown in Fig. (c).

48 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 區塊。

49 圖 10.30(c) 的 (1,2) 及 (2,2) 子影像 灰階值得分佈極不 均勻,全域門限法 注定失敗 分成更多的子影像 Thresholding

50 Thresholding Optimal Global and Adaptive Thresholding background object 影像中任何像素點不是物體就是背景。 總誤差 將物體誤認為背景的機率。 將背景誤認為物體的機率。

51 Thresholding 為求得最小誤差的門限值 T ,須求 E(T) 對 T 的偏微分。 以 gaussian 密度函數來近似 p(z) ( ) 式的通解 如果 variance 相等時。

52 Chapter 10 Image Segmentation Chapter 10 Image Segmentation 原始的心臟影像,打有顯 影劑,目的在於描繪出左 心室的輪廓。 前處理 : (1) 每個像素點經 log function 轉換 (2) 將打藥前與打藥後的影像相減,以消 除脊椎部份。 (3) 將多張心臟影像平均以消除雜訊。

53 Chapter 10 Image Segmentation Chapter 10 Image Segmentation Block A 和 Block B 的影像 histogram

54 Chapter 10 Image Segmentation Chapter 10 Image Segmentation

55 Thresholding Use of boundary characteristics for histogram improvement and local thresholding  如果 histogram 的 peak 是高、宰、對稱,而且被深的山谷給分 隔,則選到好的 threshold 的機會較大。  改善 histogram 形狀的方法是只考慮接近物體與背景邊界的像 素點。 非邊界點標為 0 邊界點的深色邊標為 + 邊界點的亮色邊標為 - 包含有物體的水平 / 垂直掃描線具有如下的結構: (…)(-,+)(o or +)(+, -)(…)

56 以 Eq.( ) 編碼的手寫字 Thresholding

57 Chapter 10 Image Segmentation Chapter 10 Image Segmentation Example 具風景背景的支票 梯度大於 5 的梯度 histogram ,具有相同高 度,及由顯著山谷所分 開的特性 取梯度 histogram 的山谷中間值, 當成 threshold 後的結果。

58 Thresholding Thresholds based on several variables  Multispectral thresholding 相當於 3D 空間中找尋分類點。 例如:在 RGB 影像中分別根據 RGB 來分類。 將 color 影像 以單色顯示。 以接近臉的灰 階來分割 分割紅色的成分

59 Region-Based Segmentation Basic Formulation 所有的像素點必須屬於任一區域 區域內的點必須相連 區域和區域間沒有相連 區域內的像素點有相同的性質 。 區域 Ri 和 Rj 有不同的特性

60 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 的訂立

61 Region-Based Segmentation Example 焊接點的檢測 有缺陷的焊接點 的灰階值有傾向 255 的趨勢 選擇灰階值為 255 的點當 seed point 將和種子點灰階 值差異小於 65 的 點 ” 長 ” 出來 。

62 Region-Based Segmentation 圖 的 histogram ( 無法清楚分離物體與背景 )

63 Region-Based Segmentation Region Splitting and Merging  一開始將影像分割成任意子影像,然後再合併或分割 成滿足條件的 segmentation 。  將整張影像 R 連續的分割成更小的 1/4 影像,直到任 何區域 R i, P(R i )=TRUE 從整張圖 R 開始,如果 P(R)=FALSE ( 表示區域 R 內的 pixel 有不同的灰階值 ) ,則將 R 分成四的子影像。 如果子影像的 P 為 FALSE 則繼續分割成四個子影像。

64 Region-Based Segmentation Region Splitting and Merging

65 Region-Based Segmentation Region Splitting and Merging  Split into four disjoint quadrants any region R i for which P(R i )=FALSE.  Merge any adjacent regions R j and R k for which P(R j U R k )=TRUE.  Stop when no further merging or splitting is possible.

66 Region-Based Segmentation 原始楓葉影像 若 R i 中有 80% 的像素點具有 |z j -m i |<=2  i 的特性。則 P(R i )=TRUE 。 Threshold 後,葉柄不見了。

67 Segmentation by Morphological Watersheds Basic Concepts  將原始影像的灰階值構成一立體地形圖 (topographic) 。 考慮三種點的型態:  區域最小值的點。  一滴水的點 ( 單一最小值 ) 。形成集水盆 (catchment basin) 或 分水嶺 (watershed)  水可能會掉入的多個最小值的點。形成峰線 (crest line)  此法的目標在於找出 watershed line 。

68 原始影像 原始影像的 地形圖 在區域最小值的 地方打洞 , 將水 注入 水位慢慢上升 ( 灰階愈來愈大 ) 水開始溢入 第二的區域 Segmentation by Morphological Watersheds

69 開始構築水 壩 (dam) 水持續溢入第 二個集水區 最後的水壩代 表分割的結果 Segmentation by Morphological Watersheds

70 Segmentation by Morphological Watersheds Watershed 法的優點:  Watershed line 可得到連續的 boundary  Watershed segmentation 可用來擷取塊狀的物件。

71 Dam Construction 使用二元化影像的 dilation 在第 n-1 次注入水後 的集水區 1 , C n-1 (M 1 ) 在第 n-1 次注入水後 的集水區 2 , C n-1 (M 2 ) C[n-1] 第 n 次注入水後 的集水區 q 第一次 dilation 第二次 dilation 將二次 dilation 重疊的 區域建成水壩

72 Chapter 10 Image Segmentation Chapter 10 Image Segmentation 原始影像 梯度影像 分水嶺線 將分水嶺線疊 回原始影像

73 Segmentation by Morphological Watersheds 直接應用 watershed segmentation 會導致 over segmentation 可使用 marker 來控制 over segmentation 。 Marker 是影像中相連接的元件。  Internal marker 結合有興趣的物件。  External marker 結合背景。

74 Segmentation by Morphological Watersheds The use of marker  Marker 的選擇包含兩個主要步驟: 前處理:利用 smoothing filter 去除不必要的細節。 定義一組 marker 必須滿足的 criteria :  Region 是由高海拔所圍繞的區域。  Region 內的點是相連的元件。  這些相連的元件具有相同的灰階值。

75 Segmentation by Morphological Watersheds 1. 先找出 internal marker 2. 再以 watershed 找出 watershed line

76 The Use of Motion in Segmentation Spatial Techniques  偵測兩張不同 frame, f(x, y, t i ) 及 f(x,y, t j ) 影像的差異,可以 pixel-by-pixel 的方式來比較其差異。  d ij (x,y) 為 1 的像素點代表物件的移動,但因為雜訊也會造成單 獨點的 d ij (x,y) 為 1 ,因此可利用 4 或 8-connected 來將少於特 定點數的點 ( 區域 ) 刪除。

77 The Use of Motion in Segmentation Accumulative differences  Accumulative difference image (ADI) 將序列影像的每張影像 ti 和參考影像的差累計加總。 Absolute ADI Positive ADI Negative ADI

78 The Use of Motion in Segmentation Absolute ADI Negative ADI Positive ADI Example Image size: 256x256, object szie:75x50, moving speed 5sqrt(2) 1. Positive ADI 中非零的區域代表移動物體的大小,及移動物體在參考影像中的位置 2. Absolute ADI 包含 positive 和 negative ADI 的區域 3. 移動物體的方向和速度可由 absolute 及 negative ADI 中決定。

79 The Use of Motion in Segmentation Establishing a reference image  序列影像中的第一張為參考影像。  當參考影像中非固定的成分移動其位置時,則將目 前 frame 中相對應的位置複製到參考影像。  當所有移動的物件均離開其原始位置,則將建立一 張只有固定物體的影像。  物件的移動可由 positive ADI 的改變來建立。

80 Chapter 10 Image Segmentation Chapter 10 Image Segmentation 行駛中的汽車 行駛中的汽車 汽車已被移除 Frame 1 Frame 2 Result

81 Chapter 10 Image Segmentation Chapter 10 Image Segmentation

82 Chapter 10 Image Segmentation Chapter 10 Image Segmentation

83 Chapter 10 Image Segmentation Chapter 10 Image Segmentation

84 Chapter 10 Image Segmentation Chapter 10 Image Segmentation