Image and Multidimensional Signal...
Transcript of Image and Multidimensional Signal...
![Page 1: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/1.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Colorado School of Mines
Image and Multidimensional Signal Processing
Professor William Hoff
Dept of Electrical Engineering &Computer Science
http://inside.mines.edu/~whoff/
![Page 2: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/2.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science
Morphological Image Processing
2
![Page 3: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/3.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Preview
• “Morphological” = shape, form, structure
• Notes
– Useful for extracting and describing image component regions
– Usually applied to binary (black & white, or 0 & 1) images
– Based on set theory
• Key topics:
– Set theory
– Binary operations: dilation, erosion, opening, closing
– Connected components
– Morphological algorithms
– Gray scale morphology
3
![Page 4: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/4.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Binary Images
• Obtained from – Thresholding gray level images (e.g., Matlab’s “im2bw”)
– Or, as a resulting product of feature detectors
• Often want to count or measure shape of 2D binary image regions
• Typical applications – Objects on a conveyor belt
– Characters and text, maps
– Chromosomes
– Fingerprints
– Circuit boards
– Overhead aerial images
4
![Page 5: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/5.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Set Theory Concepts
• For 2D binary images, A is the (unordered) set of pairs (x,y) such
that the image value at (x,y) is equal to 1
• “Union” of two sets A and B
– The set of elements belonging to A, B, or both
• “Intersection” of two sets A and B
– The set of elements belonging to both A and B
• w “is an element of” set A
, | ( , ) 1AA x y I x y
The vertical bar means “such that”
A B
A B
w A
5
![Page 6: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/6.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Set Theory Concepts
• “Complement”
– The set of elements that are not in A
• “Difference” of two sets A and B
– The set of elements belonging to A, but not to B
• “Subset”
– A is a subset of B if every element of A is also in B
• The empty set { }
|cA w w A
| ,A B w w A w B
A B
Comma means “and”
6
![Page 7: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/7.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Set Operations
, | ( , ) 1 , , | ( , ) 1A BA x y I x y B x y I x y
7
![Page 8: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/8.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Reflection and Translation
ˆ ,B w w b for b B
,z
B c c b z for b B
8
![Page 9: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/9.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Structuring Elements
• Morphological operations are defined based on “structuring
elements”
• A structuring element is a small set or subimage, used to probe for
structure
• Examples
9
![Page 10: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/10.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Erosion
• The erosion of set A by set (i.e., structuring element) B is
AӨB =
• Interpretation: shift B by z, if it is completely inside A, output a 1
• Example
10
ABz z |
1 1 1
1
1
1
1 1 1 1 1
A
B
Origin of B
AӨB
![Page 11: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/11.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Erosion Examples
w
w
w/2
AӨB
Radius r r
AӨB
w w
w AӨB
11
![Page 12: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/12.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Erosion
• Erosion enlarges holes,
breaks thin parts, shrinks
object
• Is not commutative
B A
AӨB ≠ BӨA
12
AӨB
![Page 13: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/13.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Dilation
• The dilation of set A by set (structuring element) B is
• Interpretation: reflect B, shift by z, if it overlaps with A, output a 1 at
the center of B
• Example
13
ˆ|z
A B z B A
A B
1
1
1
1
1
1
1
1 1
A
B
Origin of B
B̂
1 1
![Page 14: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/14.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science
Another dilation example
• Example
1
1
1
1 1
1
1
1
A
B
Origin of B
B̂
A B
14
![Page 15: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/15.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Dilation Examples
w
w
w/2
A B
w
A B
w
w
Radius r r
A B
15
![Page 16: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/16.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Dilation Example
A BA
B
16
![Page 17: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/17.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Dilation
• Dilation fills in holes,
thickens thin parts, grows
object
B A
17
A B
![Page 18: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/18.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Dilation Properties
• Is commutative
• and associative
• Proof of commutative property
– If we translate both sets, the intersection
area is the same
– If we reflect both sets, the intersection
area is the same
A B B A
A B C A B C
ˆ|z
A B z B A
ˆ|z
z B A
ˆ|z
z B A B A
B̂B
A
z
18
![Page 19: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/19.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Duality of Dilation and Erosion
BAc ˆ (AӨB)c =
• Proof
Recall that Ac means the
complement of set A
ABz z |AӨB =
| c
zz B A
(AӨB)c = |c
c
zz B A
|
ˆ
c
z
c
z B A
A B
If set (B)z is contained in A, then
the intersection of (B)z with the
complement of A is empty
Complement both sides
By the definition of dilation
19
![Page 20: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/20.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Example
1
1
1
1
1 1
A
B
Origin of B
1
Origin of A
AӨB
(AӨB)c
cA
BAc ˆ
20
![Page 21: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/21.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Matlab examples
• Make a structuring element
– SE = strel('square', W)
or
– SE = strel('disk', R )
• Dilation and erosion
– imdilate(IM, SE)
– imerode(IM, SE)
• Try image ‘blobs.png’
21
![Page 22: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/22.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science
Opening
• Opening – an erosion followed by a dilation
– Use the same structuring element B for both
• Is the union of all translates of B, that fit into A
BBABA
|z z
A B B B A
http://en.wikipedia.
org/wiki/Mathemat
ical_morphology
The opening of the
dark-blue square by a
disk, resulting in the
light-blue square with
round corners.
22
![Page 23: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/23.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science
Opening
• Intuitive description
– Let B be a disk
– The boundary of the opening is the points in B that reach the
farthest into A as B is rolled around inside of A
23
![Page 24: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/24.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science
Closings
• Closing – a dilation followed by an erosion
– Use the same structuring element B for both
• Take the union of all the translates of B that do not intersect A;
the closing is the complement of that
BBABA
The closing of the dark-blue
shape (union of two squares)
by a disk, resulting in the
union of the dark-blue shape
and the light-blue areas.
http://en.wikipedia.
org/wiki/Mathemat
ical_morphology
24
![Page 25: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/25.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science
Closings
• Intuitive description
– Let B be a disk
– We roll B around the outside of A
– The boundary of the closing is the points of B that just touch A
25
![Page 26: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/26.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Example - opening
B
26
![Page 27: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/27.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Example - closing
B
27
![Page 28: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/28.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science
Openings and Closings
• Are duals of each other
• Properties
is a subset of A
A is a subset of
• Once an image has been opened (or closed), the re-application of
the same operation has no effect
BABA cc ˆ
BABBA
BABBA
A B
A B
28
![Page 29: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/29.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
29
![Page 30: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/30.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Matlab examples
• Make a structuring element
– SE = strel('square', W)
or
– SE = strel('disk', R, N)
• Dilation and erosion
– imopen(IM, SE)
– imclose(IM, SE)
• Try image ‘blobs.png’
30
![Page 31: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/31.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Connected Components
• Define adjacency
– 4-adjacent
– 8-adjacent
• Two pixels are connected in S if there is a path between them consisting entirely of pixels in S
• S is a (4- or 8-) connected component (“blob”) if there exists a path between every pair of pixels
• “Labeling” is the process of assigning the same label number to every pixel in a connected component
4-connected 8-connected
31
![Page 32: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/32.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science
Example
1 1
1 1
1 1
1 1 1
1 1 1
• Hand label simple binary image
Binary image Labeled image
(4-connected)
Labeled image
(8-connected)
32
![Page 33: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/33.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
A Fast Labeling Algorithm
• One pass through image to assign temporary labels and
record equivalences
• Second pass to replace temporary labels with
equivalence labels
• Let
– B(r,c) is the input binary image
– L(r,c) is the output image of labels
• Side note – faster labeling algorithms do exist. They use 2x2 blocks to search for connected
components and use the fact that all the pixels within the block are 8-connected.
• C. Grana, D. Borghesani, and R. Cucchiara. “Fast block based connected components labeling.”
Proc of ICIP, pages 4061-4064, 2009.
33
![Page 34: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/34.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
for c=1 to MAXCOL {
for r=1 to MAXROW {
if B(r,c) == 0 then
L(r,c) = 0; % if pixel not white, assign no label
else {
34
![Page 35: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/35.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science
Example
1 1 1
1 1 1
1 1 1
1 1 1
Binary image Temporary labels
after 1st pass Final (equivalence)
labels after 2nd pass
35
![Page 36: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/36.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Matlab Example
• Labeling connected components (white blobs) – im2bw
• threshold to convert to binary image
– bwlabel
• do connected component labeling
• generate an image of labels
– label2rgb
• for visualization
• converts each label to a random color
• If we want to find black blobs – imcomplement
• Flip black and white regions
– then repeat steps
Image Fig9-16(a).jpg
36
![Page 37: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/37.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
>> I = imread('Fig9.16(a).jpg');
>> imshow(I,[])
>> whos
Name Size Bytes Class Attributes
I 512x512 262144 uint8
>> BW = im2bw(I, graythresh(I));
>> figure, imshow(BW)
>> [L,num] = bwlabel(BW);
>> figure, imshow(L,[])
>> num
num =
17
>> RGB = label2rgb(L);
>> figure, imshow(RGB)
>> BW = imcomplement(BW);
>> [L,num] = bwlabel(BW);
>> RGB = label2rgb(L);
>> figure, imshow(RGB)
37
![Page 38: Image and Multidimensional Signal Processinginside.mines.edu/~whoff/courses/EENG510/lectures/...Connected Components • Define adjacency – 4-adjacent – 8-adjacent • Two pixels](https://reader034.fdocuments.in/reader034/viewer/2022042622/5f8f596ca1c0192288062cf2/html5/thumbnails/38.jpg)
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science
Summary / Questions
• Morphological operations on binary images
involve a “structuring element”.
– A structuring element is a small subimage, used to
probe for structure.
• Morphological operations are useful for:
– Eliminating small regions or filling in “holes”.
– Finding “connected components”.
• What is a “connected component”?
38