Download presentation
Presentation is loading. Please wait.
Published byCecilia Gilbert Modified over 9 years ago
1
1 Regions and Binary Images Hao Jiang Computer Science Department Sept. 25, 2014
2
Figure Ground Separation 2
3
Brightness Thresholding 3
4
= - Thresholding Given a grayscale image or an intermediate matrix threshold to create a binary output. Example: background subtraction Looking for pixels that differ significantly from the “empty” background. fg_pix = find(diff > t); Slides from Kristen Grauman
5
Thresholding Given a grayscale image or an intermediate matrix threshold to create a binary output. Example: color-based detection Looking for pixels within a certain hue range. fg_pix = find(hue > t1 & hue < t2); Slides from Kristen Grauman
6
More Binary Images 6 Slide from Kristen Grauman
7
Issues How to demarcate multiple regions of interest? Count objects Compute further features per object What to do with “noisy” binary outputs? Holes Extra small fragments Slide from Kristen Grauman
8
Find Connected Regions 8
9
9 Our target in this image is the largest blob.
10
Connected Components Identify distinct regions of “connected pixels” Shapiro and Stockman
11
Pixel Neighbors 11 4 neighboring pixels of the blue pixel
12
Pixel Neighbors 12 8 neighboring pixels of the blue pixel
13
Recursive Method 13 label = 2 for i = 1 to rows for j = 1 to cols if I(i, j) == 1 labelConnectedRegion(i, j, label) label ++; end
14
Recursive Method 14 function labelConnectedRegion(int i, int j, int label) if (i,j) is labeled or background or out of boundary return I(i,j)=label for (m,n) belongs to neighbors of (i,j) labelConnectedRegion(m,n,label) end
15
Sequential connected components Slide from J. Neira
16
Sequential connected components
17
Example 17 11111 1111 1111 11111 11111 22 33 44 55 66 77 88 99 Image Label equivalence table
18
Example 18 21111 1111 1111 11111 11111 22 33 44 55 66 77 88 99 Image Label equivalence table
19
Example 19 22111 1111 1111 11111 11111 22 33 44 55 66 77 88 99 Image Label equivalence table
20
Example 20 22311 1111 1111 11111 11111 22 33 44 55 66 77 88 99 Image Label equivalence table
21
Example 21 22331 1111 1111 11111 11111 22 33 44 55 66 77 88 99 Image Label equivalence table
22
Example 22 22333 1111 1111 11111 11111 22 33 44 55 66 77 88 99 Image Label equivalence table
23
Example 23 22333 2111 1111 11111 11111 22 33 44 55 66 77 88 99 Image Label equivalence table
24
Example 24 22333 2211 1111 11111 11111 22 33 44 55 66 77 88 99 Image Label equivalence table
25
Example 25 22333 2221 1111 11111 11111 22 33 44 55 66 77 88 99 Image Label equivalence table
26
Example 26 22333 2222 1111 11111 11111 23 33 44 55 66 77 88 99 Image Label equivalence table (2,3)
27
Example 27 22333 2222 2111 11111 11111 23 33 44 55 66 77 88 99 Image Label equivalence table
28
Example 28 22333 2222 2211 11111 11111 23 33 44 55 66 77 88 99 Image Label equivalence table
29
Example 29 22333 2222 2241 11111 11111 23 33 44 55 66 77 88 99 Image Label equivalence table
30
Example 30 22333 2222 2244 11111 11111 23 33 44 55 66 77 88 99 Image Label equivalence table
31
Example 31 22333 2222 2244 51111 11111 23 33 44 55 66 77 88 99 Image Label equivalence table
32
Example 32 22333 2222 2244 55111 11111 23 33 44 53 66 77 88 99 Image Label equivalence table (5,2)
33
Example 33 22333 2222 2244 55211 11111 23 33 44 53 66 77 88 99 Image Label equivalence table
34
Example 34 22333 2222 2244 55241 11111 23 33 44 53 66 77 88 99 Image Label equivalence table
35
Example 35 22333 2222 2244 55244 11111 23 33 44 53 66 77 88 99 Image Label equivalence table
36
Example 36 22333 2222 2244 55244 51111 23 33 44 53 66 77 88 99 Image Label equivalence table
37
Example 37 22333 2222 2244 55244 55111 23 33 44 53 66 77 88 99 Image Label equivalence table
38
Example 38 22333 2222 2244 55244 55511 23 33 44 53 66 77 88 99 Image Label equivalence table
39
Example 39 22333 2222 2244 55244 55551 23 33 44 53 66 77 88 99 Image Label equivalence table (5,2)
40
Example 40 22333 2222 2244 55244 55554 23 33 44 53 66 77 88 99 Image Label equivalence table
41
Example 41 33333 3333 3344 33344 33334 23 33 44 53 66 77 88 99 Image Label equivalence table
42
Region properties Given connected components, can compute simple features per blob, such as: Area (num pixels in the region) Centroid (average x and y position of pixels in the region) Bounding box (min and max coordinates) How could such features be useful? A1=20 0 A2=17 0
43
Issues How to demarcate multiple regions of interest? Count objects Compute further features per object What to do with “noisy” binary outputs? Holes Extra small fragments
44
Morphological operators Change the shape of the foreground regions/ objects. Useful to clean up result from thresholding Basic operators are: Dilation Erosion
45
Dilation Expands connected components Grow features Fill holes Before dilation After dilation
46
Erosion Erode connected components Shrink features Remove bridges, branches, noise Before erosionAfter erosion
47
Structuring elements Masks of varying shapes and sizes used to perform morphology, for example: Scan mask across foreground pixels to transform the binary image >> help strel
48
Dilation At each position: Dilation: OR (MAX) of everything inside the structuring element mask.
49
Example for Dilation (1D) 1000111011 Input image Structuring Element 1 Output Image 111 Adapted from T. Moeslund
50
Example for Dilation 1000111011 Input image Structuring Element 11 Output Image 111
51
Example for Dilation 1000111011 Input image Structuring Element 110 Output Image 111
52
Example for Dilation 1000111011 Input image Structuring Element 1101 Output Image 111
53
Example for Dilation 1000111011 Input image Structuring Element 11011 Output Image 111
54
Example for Dilation 1000111011 Input image Structuring Element 110111 Output Image 111
55
Example for Dilation 1000111011 Input image Structuring Element 1101111 Output Image 111
56
Example for Dilation 1000111011 Input image Structuring Element 11011111 Output Image 111
57
Example for Dilation 1000111011 Input image Structuring Element 110111111 Output Image 111 Note that the object gets bigger and holes are filled. >> help imdilate
58
Example for Dilation 1000111011 Input image Structuring Element 1101111111 Output Image 111 Note that the object gets bigger and holes are filled. >> help imdilate
59
Erosion At each position: Erosion: AND (MIN) of everything inside the structuring element mask.
60
Example for Erosion (1D) 1000111011 Input image Structuring Element 0 Output Image 111 _
61
Example for Erosion (1D) 1000111011 Input image Structuring Element 00 Output Image 111 _
62
Example for Erosion 1000111011 Input image Structuring Element 000 Output Image 111
63
Example for Erosion 1000111011 Input image Structuring Element 0000 Output Image 111
64
Example for Erosion 1000111011 Input image Structuring Element 00000 Output Image 111
65
Example for Erosion 1000111011 Input image Structuring Element 000001 Output Image 111
66
Example for Erosion 1000111011 Input image Structuring Element 0000010 Output Image 111
67
Example for Erosion 1000111011 Input image Structuring Element 00000100 Output Image 111
68
Example for Erosion 1000111011 Input image Structuring Element 000001000 Output Image 111
69
Example for Erosion 1000111011 Input image Structuring Element 0000010000 Output Image 111 Note that the object gets smaller >> help imerode
70
Opening Erode, then dilate Remove small objects, keep original shape Before openingAfter opening Slide from Kristen Grauman
71
Closing Dilate, then erode Fill holes, but keep original shape Before closingAfter closing Slide from Kristen Grauman
72
Morphology Operators on Grayscale Images Dilation and erosion typically performed on binary images. If image is grayscale: for dilation take the neighborhood max, for erosion take the min. originaldilated eroded Slide from Kristen Grauman
73
Matlab Create structure element se = strel(‘disk’, radius); Erosion imerode(image, se); Dilation imdilate(image, se); Opening imopen(image, se); Closing imclose(image, se); More possibilities bwmorph(image, ‘skel’); 73
74
Figure Ground Separation 74
75
Brightness Thresholding 75
76
Opening 76
77
Find the Largest Connected Region 77
78
Example Using Binary Image Analysis: segmentation of a liver Slide credit: Li Shen Slide from Kristen Grauman
79
Example Using Binary Image Analysis: Bg subtraction + blob detection … Slide from Kristen Grauman
80
University of Southern California http://iris.usc.edu/~icohen/projects/vace/detection.htm Example Using Binary Image Analysis: Bg subtraction + blob detection Slide from Kristen Grauman
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.