Lecture 06,07,08 segmentation

45 55 0
Lecture 06,07,08   segmentation

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Image Segmentation Digital Image Processing Lecture 6,7,8 – Image Segmentation Lecturer: Ha Dai Duong Faculty of Information Technology I Introduction „ „ „ Segmentation is to subdivide an image into its constituent regions or objects Segmentation should stop when the objects of interest in an application have been isolated Segmentation algorithms generally are based on one of basis properties of intensity values: ‰ ‰ Discontinuity : To partition an image based on abrupt changes in intensity (such as edges) Similarity: To partition an image into regions that are similar according to a set of predefined criteria Digital Image Processing Image Segmentation I Introduction „ Detection of Discontinuities: detect the three basic types of gray-level discontinuities ‰ ‰ ‰ „ Points Lines Edges Detection of Similarity: ‰ ‰ ‰ Thresholding Regions … Digital Image Processing II.1 Points Detection/Discontinuities „ A point has been detected at the location on which the mark is centered if |R| ≥ T where „ „ T is a nonnegative threshold R is the sum of products of the coefficients with the gray levels contained in the region encompassed by the mark Note: that the mark is the same as the mask of Laplacian Operation (in previous lecture) Digital Image Processing Image Segmentation II.1 Points Detection/Discontinuities „ Example Digital Image Processing II.2 Lines Detection/Discontinuities „ „ „ Horizontal mask will result with max response when a line passed through the middle row of the mask with a constant background The similar idea is used with other masks Note: the preferred direction of each mask is weighted with a larger coefficient (i.e.,2) than other possible directions Digital Image Processing Image Segmentation II.2 Lines Detection/Discontinuities „ „ Apply every masks on the image Let R1, R2, R3, R4 denotes the response of the horizontal, +45 degree, vertical and -45 degree masks, respectively ‰ 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 Digital Image Processing II.2 Lines Detection/Discontinuities „ „ „ „ Apply every masks on the image Let R1, R2, R3, R4 denotes the response of the horizontal, +45 degree, vertical and -45 degree masks, respectively ‰ 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 Alternatively, if we are interested in detecting all 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 points that are left are the strongest responses, which, for lines one pixel thick, correspond closest to the direction defined by the mask Digital Image Processing Image Segmentation II.2 Lines Detection/Discontinuities Digital Image Processing II.3 Edges Detection „ „ The most common approach for detecting meaningful discontinuities in gray level We discuss approaches for implementing ‰ ‰ „ „ First-order derivative (Gradient operator) Second-order derivative (Laplacian operator) Here, we will talk only about their properties for edge detection We have introduced both derivatives in previous lecture Digital Image Processing 10 Image Segmentation II.3 Edges Detection „ „ An edge is a set of connected pixels that lie on the boundary between two regions An edge is a “local” concept whereas a region boundary, owing to the way it is defined, is a more global idea 11 Digital Image Processing II.3 Edges Detection because of optics, sampling, image acquisition imperfection Digital Image Processing 12 Image Segmentation II.3 Edges Detection „ Thick edge ‰ ‰ ‰ ‰ ‰ ‰ The slope of the ramp is inversely proportional to the degree of blurring in the edge We no longer have a thin (one pixel thick) path Instead, an edge point now is any point contained in the ramp, and an edge would then be a set of such points that are connected The thickness is determined by the length of the ramp The length is determined by the slope, which is in turn determined by the degree of blurring Blurred edges tend to be thick and sharp edges tend to be thin Digital Image Processing 13 II.3 Edges Detection the signs of the derivatives would be reversed for an edge that transitions from light to dark Digital Image Processing 14 Image Segmentation II.3 Edes Detection „ Second derivatives ‰ ‰ „ Produces values for every edge in an image (an undesirable feature) An imaginary straight line joining the extreme positive and negative values of the second derivative would cross zero near the midpoint of the edge (zerocrossing property) property Zero-crossing ‰ ‰ Quite useful for locating the centers of thick edges We will talk about it again later Digital Image Processing 15 II.3 Edges Detection „ ‰ ‰ ‰ Noise Images First column: images and graylevel profiles of a ramp edge corrupted by random Gaussian noise of mean and σ = 0.0, 0.1, 1.0 and 10.0, respectively Second column: first-derivative images and gray-level profiles Third column : second-derivative images and gray-level profiles Digital Image Processing 16 Image Segmentation II.3 Edges Detection „ Keep in mind ‰ ‰ Fairly little noise can have such a significant impact on the two key derivatives used for edge detection in images Image smoothing should be serious consideration prior to the use of derivatives in applications where noise is likely to be present Digital Image Processing 17 II.3 Edges Detection „ To determine a point as an edge point ‰ ‰ ‰ „ the transition in grey level associated with the point has to be significantly stronger than the background at that point use threshold to determine whether a value is “significant” or not the point’s two-dimensional first-order derivative must be greater than a specified threshold Segmentation Problem ‰ To assemble edge segments into longer edges Digital Image Processing 18 Image Segmentation II.3 Edges Detection „ Gradient Operators ‰ ⎡ ∂f ⎤ ⎡G x ⎤ ⎢ ⎥ ∇ f = ⎢ ⎥ = ⎢ ∂∂fx ⎥ ⎣G y ⎦ ⎢ ⎥ ⎣⎢ ∂ y ⎦⎥ First derivatives are implemented using the magnitude of the gradient gradient ∇ f = mag ( ∇ f ) = [ G x2 + G y2 ] ⎡⎛ ∂ f ⎞ ⎛ ∂ f ⎞ ⎤ ⎟⎟ ⎥ = ⎢⎜ ⎟ + ⎜⎜ ⎢⎣ ⎝ ∂ x ⎠ ⎝ ∂ y ⎠ ⎥⎦ 1 2 commonly approx ∇f ≈ Gx + G y Digital Image Processing 19 II.3 Edges Detection „ Gradient Direction ‰ Let α (x,y) represent the direction angle of the vector ∇f at (x,y) Digital Image Processing 20 10 Image Segmentation III.2 Optimum Global Thresholding Using Otsu’s Method The mean intensity value of the pixels assigned to class C1 is k m1 (k ) = ∑ iP (i / C1 ) = i =0 k ∑ ipi P1 (k ) i =0 The mean intensity value of the pixels assigned to class C2 is m2 (k ) = L −1 ∑ iP(i / C2 ) = i = k +1 L −1 ∑ ipi P2 (k ) i = k +1 Pm 1 + P2 m2 = mG (Global mean value) 61 Digital Image Processing III.2 Optimum Global Thresholding Using Otsu’s Method The optimum threshold is the value, k*, that maximizes σ B2 (k *), σ B2 (k *) = max σ B2 (k ) ⎧1 g ( x, y ) = ⎨ ⎩0 ≤ k ≤ L −1 if f ( x, y ) > k * if f ( x, y ) ≤ k * σ B2 Separability measure η = σG Digital Image Processing 62 31 Image Segmentation III.2 Optimum Global Thresholding Using Otsu’s Method Otsu’s Algorithm: Summary ƒ Compute the normalized histogram of the input image Denote the components of the histogram by pi, i=0, 1, …, L-1 Compute the cumulative sums, P1(k), for k = 0, 1, …, L-1 Compute the cumulative means, m(k), for k = 0, 1, …, L-1 Compute the global intensity mean, mG Compute the between-class variance, for k = 0, 1, …, L-1 Obtain the Otsu’s threshold, k* Obtain the separability measure Digital Image Processing 63 III.2 Optimum Global Thresholding Using Otsu’s Method Digital Image Processing 64 32 Image Segmentation III.3 Improve Global Thresholding Using Image smoothing Digital Image Processing 65 III.4 Improve Global Thresholding Using Edges Compute an edge image as either the magnitude of the gradient, or absolute value of the Laplacian of f(x,y) Specify a threshold value T Threshold the image and produce a binary image, which is used as a mask image; and select pixels from f(x,y) corresponding to “strong” edge pixels Compute a histogram using only the chosen pixels in f(x,y) Use the histogram from step to segment f(x,y) globally Digital Image Processing 66 33 Image Segmentation Digital Image Processing 67 Digital Image Processing 68 34 Image Segmentation III.5 Multiple Thresholds In the case of K classes, C1 , C2 , , CK , the between-class variance is K σ B2 = ∑ Pk ( mk − mG ) k =1 where Pk = ∑ pi and mk = i∈Ck Pk ∑ ip i∈Ck i The optimum threshold values, k1*, k2 *, , k K −1 * that maximize σ B2 (k1*, k2 *, , k K −1*) = max σ B2 (k1 , k2 , , k K −1 ) ≤ k ≤ L −1 Digital Image Processing 69 III.5 Multiple Thresholds Digital Image Processing 70 35 Image Segmentation III.6 Variable Thresholding: Image Partitioning Subdivide rectangles an image into nonoverlapping The rectangles are chosen small enough so that the illumination of each is approximately uniform Digital Image Processing 71 14 Variable Thresholding: Image Partitioning Digital Image Processing 72 36 Image Segmentation IV Region Based Segmentation „ Basic Formulation n (a ) ∪ Ri = R i =1 (b) Ri is a connected region, i = 1, , , 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 P(Ri) is a logical predicate property defined over the points in set Ri ex P(Ri) = TRUE if all pixel in Ri have the same gray level Digital Image Processing 73 IV.1 Region Growing „ „ „ Start with a set of “seed” points Growing by appending to each seed those neighbors that have similar properties such as specific ranges of gray level Region growing based techniques are better than the edge-based techniques in noisy images where edges are difficult to detect Digital Image Processing 74 37 Image Segmentation IV.1 Region Growing 75 Digital Image Processing IV.1 Region Growing 4-connectivity Digital Image Processing 76 38 Image Segmentation IV.1 Region Growing 8-connectivity Digital Image Processing 77 IV.1 Region Growing criteria: the absolute gray-level difference between any pixel and the seed has to be less than 65 the pixel has to be 8-connected to at least one pixel in that region (if more, the regions are merged) Digital Image Processing 78 39 Image Segmentation IV.2 Region Splitting and Merging R : entire image Ri :entire image Q: predicate For any region Ri , If Q( Ri ) = FALSE, we divide the image Ri into quadrants When no further splitting is possible, merge any adjacent regions R j and Rk for which Q( R j ∪ Rk ) = TRUE Stop when no further merging is possible Digital Image Processing 79 IV.2 Region Splitting and Merging Digital Image Processing 80 40 Image Segmentation IV.2 Region Splitting and Merging Q(Ri) = TRUE if at least 80% of the pixels in Ri have the property |zj-mi| ≤ 2σi, where zj is the gray level of the jth pixel in Ri mi is the mean gray level of that region σi is the standard deviation of the gray levels in Ri Digital Image Processing 81 IV.3 Use of Motion Digital Image Processing 82 41 Image Segmentation IV.4 K-means clustering „ „ Partition the data points into K clusters randomly Find the centroids of each cluster For each data point: ‰ ‰ Calculate the distance from the data point to each cluster Assign the data point to the closest cluster „ Recompute the centroid of each cluster „ Repeat steps and until there is no further change in the assignment of data points (or in the centroids) Digital Image Processing 83 IV.4 K-means clustering Digital Image Processing 84 42 Image Segmentation IV.4 K-means clustering Digital Image Processing 85 IV.4 K-means clustering Digital Image Processing 86 43 Image Segmentation IV.4 K-means clustering Digital Image Processing 87 IV.4 K-means clustering Digital Image Processing 88 44 Image Segmentation IV.4 K-means clustering Digital Image Processing 89 IV.4 K-means clustering Digital Image Processing 90 45 ... Note: that the mark is the same as the mask of Laplacian Operation (in previous lecture) Digital Image Processing Image Segmentation II.1 Points Detection/Discontinuities „ Example Digital Image Processing... properties for edge detection We have introduced both derivatives in previous lecture Digital Image Processing 10 Image Segmentation II.3 Edges Detection „ „ An edge is a set of connected pixels... derivative must be greater than a specified threshold Segmentation Problem ‰ To assemble edge segments into longer edges Digital Image Processing 18 Image Segmentation II.3 Edges Detection „ Gradient

Ngày đăng: 01/04/2019, 10:40

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan