SlideShare a Scribd company logo
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
• The word morphology refers to the scientific branch that deals the forms and
structures of animals/plants.
•Morphology in image processing is a tool for extracting image components
that are useful in the representation and description of region shape, such as
boundaries and skeletons.
•Furthermore, the morphological operations can be used for filtering, thinning
and pruning.
•The language of the Morphology comes from the set theory, where image
objects can be represented by sets. For example an image object containing
black pixels can be considered a set of black pixels in 2D space of Z2
.
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Set Theory Fundamentals
• Given that A is a set in Z2
and a=(a1,a2), then
a is an element in A:
a is not an element in A:
a A

• given sets A and B, A is said to be the subset of B:
•The union of A and B is denoted by:
•The intersection of A and B is denoted by:
•Two sets are disjoint/mutually exclusive if
•The complement of set A is the set of elements not contained in A,
•The difference of two sets:
a A

A B

C A B
 
D A B
 
A B 

 
c
A A
 
 
 
, c
A B A B A B
  
     
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Set Theory Fundamentals
Given 2 sets A and B
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Set Theory Fundamentals
• The reflection of set B is defined by:
 
ˆ ,
B b for b B
 
  
• The translation of set A by point z=(z1,z2) is defined by:
 
( ) ,
z
A a z for a A
 
   
Translation of A by z. Reflection of B
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Logic operation involving Binary Images
• Given 1-bit binary images, A and B, the basic logical operations are
illustrated:
• Note that the black indicates
binary 1 and white indicates binary
0 here.
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Dilation and Erosion
• Dilation and erosion are the two fundamental operations used in
morphological image processing. Almost all morphological algorithms depend on
these two operations:
• Dilation: Given A and B sets in Z2
, the dilation of A by B, is defined by:
 
ˆ
( )z
A B z B A
  

•The dilation of A and B is a set of all displacements, z , such that B and A
overlap by at least one element. The definition can also be written as:
^
 
ˆ
( )z
A B z B A A
 
  
 

•Set B is referred to as the structuring element and used in dilation as well as in
other morphological operations. Dilation expands/dilutes a given image.
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Dilation and Erosion
• Dilation: Given the structuring element B and set A.
origin
Shaded area is the dilation
of A by B
•The structuring element B
enlarges the size of A at its
boundaries. Dilation simply
expands a given image.
•The structuring element B enlarges the size of
A at its boundaries, in relation to the distance
from the origin of the structuring element .
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Dilation and Erosion
• Dilation: Given the following distorted text image where the maximum length
of the broken characters are 2 pixels. The image can be enhanced by bridging
the gaps by using the structuring element given below:
3x3 structuring
element
A B

A
B
•Note that the broken characters are joined.
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Dilation and Erosion
• Erosion: Given A and B sets in Z2
, the erosion of A by structuring element B, is
defined by:
 
( )z
A B z B A
 

•The erosion of A by structuring element B is the set of all points z, such that B,
translated by z, is contained in A.
structuring
element
Shaded area is the erosion
of A by B
•Note that in erosion the structuring element B erodes the input image A at its boundaries.
Erosion shrinks a given image.
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Dilation and Erosion
• Erosion: Given the structuring element B and set A.
structuring
element
Shaded line is what is left
from the erosion of A by B
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Dilation and Erosion
• Erosion: Given the following binary image with squares on size 1,3,5,7,9 and
15. You can get rid of all the squares less than size of 15 by erosion followed by
dilation of a structuring element of 13x13.
13x13 structuring
element
A B

A
B
Erosion of A by B
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Dilation and Erosion
• Dilation: Cont. from the previous slide. Note that erosion followed by
dilation helps to perform filtering.
13x13 structuring
element
B
dilation by B
A B
 ( )
A B B


EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Opening and closing
• Opening: The process of erosion followed by dilation is called opening. It has
the effect of eliminating small and thin objects, breaking the objects at thin
points and smoothing the boundaries/contours of the objects.
• Closing: The process of dilation followed by erosion is called closing. It has the effect of
filling small and thin holes, connecting nearby objects and smoothing the
boundaries/contours of the objects.
•Given set A and the structuring element B. Closing of A by structuring element B is
defined by:
B
B
A
B
A 

 )
(

B
B
A
B
A 


 )
(
• Given set A and the structuring element B. Opening of A by structuring element
B is defined by:
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Opening and closing
• Opening: The opening of A by the structuring element B is obtained by taking
the union of all translates of B that fit into A.
•The opening operation can also be expressed by the following formula:
 
A
B
B
B
A z
z 
 )
(


Origin of B
Circular structuring element
Outer boundary of A
Possible translations of B in A
Shaded area: complete opening
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Opening and closing
• Closing: The closing has a similar geometric interpretation except that we roll
B on the outside of the boundary.
•The opening operation can also be expressed by the following formula:
 



 A
B
B
B
A z
z 
 )
(
)
(
Outer boundaries of closing
Outer boundary of A
Possible translations of B on the outer boundaries of A
Shaded area: complete closing
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Opening and closing
result of erosion of A by B
result of opening of A by B
result of dilation of A by B
result of closing of A by B
B
circular structuring
element
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Opening and closing
• Noise Filtering: The morphological operations can be used to remove the noise
as in the following example:
result of opening followed by closing
Note that impulsive noise within the
background and the fingerprints is removed.
after
opening
3x3 square
structuring
element
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Hit-or-Miss Transform (Template Matching)
• Hit-or-miss transform can be used for shape detection/ Template matching.
•Given the shape as the structuring element B1 the Hit-or-miss transform is
defined by:
• Where B2 =W-X and B1=X. W is the window enclosing B1. Windowing is used to
isolate the structuring element/object.
)
(
)
( 2
1 B
A
B
A
B
A c



 
*
Shape that we are searching for
Used as the structuring element (B1=X)
B2=W-X, used as the second
structuring element.
Complement of B1
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Hit-or-Miss Transform
)
(
)
( 2
1 B
A
B
A
B
A c



 
*
B2
B1
The location of the matched object/shape,
Complement of A
Erosion of A by B1
Erosion of comp of AC
by B2
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Basic Morphological Algorithms
• Boundary Extraction: The boundaries/edges of a region/shape can be
extracted by first applying erosion on A by B and subtracting the eroded A from
A.
)
(
)
( B
A
A
A 



Ex 1: 3x3 Square structuring element is used
for boundary extraction.
Ex 2: The same structuring element in Ex1 is used.
Note that thicker boundaries can be obtained by
increasing the size of structuring element.
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Basic Morphological Algorithms
• Region Filling: Region filling can be performed by using the following
definition. Given a symmetric structuring element B, one of the non-boundary
pixels (Xk) is consecutively diluted and its intersection with the complement of A
is taken as follows:
c
k
k A
B
X
X 
)
( 1 
 
)
(
1
,...
3
,
2
,
1
0
1
pixel
inner
X
X
X
when
terminates
k
k
k




•Following consecutive dilations and their intersection with the complement of A,
finally resulting set is the filled inner boundary region and its union with A gives
the filled region F(A).
A
X
A
F k 

)
(
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Basic Morphological Algorithms
• Region Filling:
Ex 1: X0=1 (Assume that the shaded boundary points are
1 and the white pixels are 0)
This region is filled first.
Filling of all the other regions
A non-boundary pixel
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Basic Morphological Algorithms
• Connected Component Extraction: The following iterative expression can be
used to determine all the pixels in component Y which is in A.
A
B
X
X k
k 
)
( 1 
 
• X0=1 corresponds to one of the pixels on the
component Y. Note that one of the pixel
locations on the component must be known.
• Consecutive dilations and their intersection
with A, yields all elements of component Y.
)
(
1
,...
3
,
2
,
1
0
1
pixel
boundary
X
X
X
when
terminates
k
k
k




Known pixel, p
Result of first iteration
Result of second iteration Result of last iteration
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Basic Morphological Algorithms
• Connected Component Extraction:
Input image
(Chicken fillet)
15 connected
components with
different number of
pixels
Thresholded image
After erosion by 5x5
square structuring
element of 1’s
EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Basic Morphological Algorithms
• Thinning: Thinning of A by the structuring element B is defined by:
)
( B
A
A
B
A 



• Note that we are only interested in pattern matching of B in A, so no background
operation is required of the hit-miss-transform.
•The structuring element B consists of a sequence of structuring elements, where Bi
is the
rotated version of Bi-1
. Each structuring elements helps thinning in one direction. If there
are 4 structuring elements thinning is performed from 4 directions separated by 90o
. If 8
structuring elements are used the thinning is performed in 8 directions separated by 45o
.
•The process is to thin A by one pass with B1
, then the result with one pass of B2
, and
continue until A is thinned with one pass of Bn
.
*
hit-or-miss transform/template matching
}
,...,
,
,
{
}
{ 3
2
1 n
B
B
B
B
B 
)
)...)
)
((...((
}
{ 2
1 n
B
B
B
A
B
A 




EE-583: Digital Image Processing
Prepared By: Dr. Hasan Demirel, PhD
Morphological Image Processing
Basic Morphological Algorithms
• Thinning: The following set of structuring elements are used for thinning operation.
...
If there is no change any
more. Declared to be the
thinned object

More Related Content

PPT
dokumen.tips_computer-graphics-image-processing-chapter-9-computer-graphics-i...
PPTX
Morphological Operations (2).pptx
PDF
Ee 583 lecture10
PPTX
Chapter 9 morphological image processing
PPT
4_14755_CS213_20172018_1__2_1_Lecture_5.ppt
PPTX
Morphological image processing basic.pptx
PDF
Morphological.pdf
PPTX
Morphological image processing
dokumen.tips_computer-graphics-image-processing-chapter-9-computer-graphics-i...
Morphological Operations (2).pptx
Ee 583 lecture10
Chapter 9 morphological image processing
4_14755_CS213_20172018_1__2_1_Lecture_5.ppt
Morphological image processing basic.pptx
Morphological.pdf
Morphological image processing

Similar to Morphological operations on digital image processing (20)

PPT
morphological image processing
PPTX
Chapter 9 morphological image processing
PPTX
Chapter 9 morphological image processing
PDF
Morphological image processing motes.pdf
PPT
Morphological Image Processing
PDF
CV_Chap 3 Features Detection
PDF
Lec_9_ Morphological ImageProcessing .pdf
PPTX
7 morphological-image-processing-combined
PPT
Chapter_9_Morphological_Image_Processing.ppt
PPT
morphological image processing
PPT
morphological tecnquies in image processing
PDF
Image restoration based on morphological operations
PDF
IMAGE RESTORATION BASED ON MORPHOLOGICAL OPERATIONS
PPT
Boundary Extraction
PPTX
Lec7_AIP.pptx6666666666666666666666666666666666666666666666
PPT
DigitalImageProcessing 9-Morphology.ppt
PPT
Lec07-CH9-MORPHOL [Recovered].ppt
PPTX
Chapter 9 newer
PPTX
Unit 5 Morphological Image Processing Advanced Topics in Digital Image Proce...
morphological image processing
Chapter 9 morphological image processing
Chapter 9 morphological image processing
Morphological image processing motes.pdf
Morphological Image Processing
CV_Chap 3 Features Detection
Lec_9_ Morphological ImageProcessing .pdf
7 morphological-image-processing-combined
Chapter_9_Morphological_Image_Processing.ppt
morphological image processing
morphological tecnquies in image processing
Image restoration based on morphological operations
IMAGE RESTORATION BASED ON MORPHOLOGICAL OPERATIONS
Boundary Extraction
Lec7_AIP.pptx6666666666666666666666666666666666666666666666
DigitalImageProcessing 9-Morphology.ppt
Lec07-CH9-MORPHOL [Recovered].ppt
Chapter 9 newer
Unit 5 Morphological Image Processing Advanced Topics in Digital Image Proce...
Ad

Recently uploaded (20)

PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
Geodesy 1.pptx...............................................
PDF
composite construction of structures.pdf
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Digital Logic Computer Design lecture notes
PDF
PPT on Performance Review to get promotions
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Construction Project Organization Group 2.pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Well-logging-methods_new................
PPTX
Welding lecture in detail for understanding
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
additive manufacturing of ss316l using mig welding
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Geodesy 1.pptx...............................................
composite construction of structures.pdf
UNIT 4 Total Quality Management .pptx
Digital Logic Computer Design lecture notes
PPT on Performance Review to get promotions
Automation-in-Manufacturing-Chapter-Introduction.pdf
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Construction Project Organization Group 2.pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
Well-logging-methods_new................
Welding lecture in detail for understanding
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
additive manufacturing of ss316l using mig welding
Ad

Morphological operations on digital image processing

  • 1. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing • The word morphology refers to the scientific branch that deals the forms and structures of animals/plants. •Morphology in image processing is a tool for extracting image components that are useful in the representation and description of region shape, such as boundaries and skeletons. •Furthermore, the morphological operations can be used for filtering, thinning and pruning. •The language of the Morphology comes from the set theory, where image objects can be represented by sets. For example an image object containing black pixels can be considered a set of black pixels in 2D space of Z2 .
  • 2. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Set Theory Fundamentals • Given that A is a set in Z2 and a=(a1,a2), then a is an element in A: a is not an element in A: a A  • given sets A and B, A is said to be the subset of B: •The union of A and B is denoted by: •The intersection of A and B is denoted by: •Two sets are disjoint/mutually exclusive if •The complement of set A is the set of elements not contained in A, •The difference of two sets: a A  A B  C A B   D A B   A B     c A A       , c A B A B A B         
  • 3. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Set Theory Fundamentals Given 2 sets A and B
  • 4. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Set Theory Fundamentals • The reflection of set B is defined by:   ˆ , B b for b B      • The translation of set A by point z=(z1,z2) is defined by:   ( ) , z A a z for a A       Translation of A by z. Reflection of B
  • 5. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Logic operation involving Binary Images • Given 1-bit binary images, A and B, the basic logical operations are illustrated: • Note that the black indicates binary 1 and white indicates binary 0 here.
  • 6. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Dilation and Erosion • Dilation and erosion are the two fundamental operations used in morphological image processing. Almost all morphological algorithms depend on these two operations: • Dilation: Given A and B sets in Z2 , the dilation of A by B, is defined by:   ˆ ( )z A B z B A     •The dilation of A and B is a set of all displacements, z , such that B and A overlap by at least one element. The definition can also be written as: ^   ˆ ( )z A B z B A A         •Set B is referred to as the structuring element and used in dilation as well as in other morphological operations. Dilation expands/dilutes a given image.
  • 7. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Dilation and Erosion • Dilation: Given the structuring element B and set A. origin Shaded area is the dilation of A by B •The structuring element B enlarges the size of A at its boundaries. Dilation simply expands a given image. •The structuring element B enlarges the size of A at its boundaries, in relation to the distance from the origin of the structuring element .
  • 8. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Dilation and Erosion • Dilation: Given the following distorted text image where the maximum length of the broken characters are 2 pixels. The image can be enhanced by bridging the gaps by using the structuring element given below: 3x3 structuring element A B  A B •Note that the broken characters are joined.
  • 9. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Dilation and Erosion • Erosion: Given A and B sets in Z2 , the erosion of A by structuring element B, is defined by:   ( )z A B z B A    •The erosion of A by structuring element B is the set of all points z, such that B, translated by z, is contained in A. structuring element Shaded area is the erosion of A by B •Note that in erosion the structuring element B erodes the input image A at its boundaries. Erosion shrinks a given image.
  • 10. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Dilation and Erosion • Erosion: Given the structuring element B and set A. structuring element Shaded line is what is left from the erosion of A by B
  • 11. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Dilation and Erosion • Erosion: Given the following binary image with squares on size 1,3,5,7,9 and 15. You can get rid of all the squares less than size of 15 by erosion followed by dilation of a structuring element of 13x13. 13x13 structuring element A B  A B Erosion of A by B
  • 12. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Dilation and Erosion • Dilation: Cont. from the previous slide. Note that erosion followed by dilation helps to perform filtering. 13x13 structuring element B dilation by B A B  ( ) A B B  
  • 13. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Opening and closing • Opening: The process of erosion followed by dilation is called opening. It has the effect of eliminating small and thin objects, breaking the objects at thin points and smoothing the boundaries/contours of the objects. • Closing: The process of dilation followed by erosion is called closing. It has the effect of filling small and thin holes, connecting nearby objects and smoothing the boundaries/contours of the objects. •Given set A and the structuring element B. Closing of A by structuring element B is defined by: B B A B A    ) (  B B A B A     ) ( • Given set A and the structuring element B. Opening of A by structuring element B is defined by:
  • 14. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Opening and closing • Opening: The opening of A by the structuring element B is obtained by taking the union of all translates of B that fit into A. •The opening operation can also be expressed by the following formula:   A B B B A z z   ) (   Origin of B Circular structuring element Outer boundary of A Possible translations of B in A Shaded area: complete opening
  • 15. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Opening and closing • Closing: The closing has a similar geometric interpretation except that we roll B on the outside of the boundary. •The opening operation can also be expressed by the following formula:       A B B B A z z   ) ( ) ( Outer boundaries of closing Outer boundary of A Possible translations of B on the outer boundaries of A Shaded area: complete closing
  • 16. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Opening and closing result of erosion of A by B result of opening of A by B result of dilation of A by B result of closing of A by B B circular structuring element
  • 17. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Opening and closing • Noise Filtering: The morphological operations can be used to remove the noise as in the following example: result of opening followed by closing Note that impulsive noise within the background and the fingerprints is removed. after opening 3x3 square structuring element
  • 18. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Hit-or-Miss Transform (Template Matching) • Hit-or-miss transform can be used for shape detection/ Template matching. •Given the shape as the structuring element B1 the Hit-or-miss transform is defined by: • Where B2 =W-X and B1=X. W is the window enclosing B1. Windowing is used to isolate the structuring element/object. ) ( ) ( 2 1 B A B A B A c      * Shape that we are searching for Used as the structuring element (B1=X) B2=W-X, used as the second structuring element. Complement of B1
  • 19. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Hit-or-Miss Transform ) ( ) ( 2 1 B A B A B A c      * B2 B1 The location of the matched object/shape, Complement of A Erosion of A by B1 Erosion of comp of AC by B2
  • 20. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Basic Morphological Algorithms • Boundary Extraction: The boundaries/edges of a region/shape can be extracted by first applying erosion on A by B and subtracting the eroded A from A. ) ( ) ( B A A A     Ex 1: 3x3 Square structuring element is used for boundary extraction. Ex 2: The same structuring element in Ex1 is used. Note that thicker boundaries can be obtained by increasing the size of structuring element.
  • 21. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Basic Morphological Algorithms • Region Filling: Region filling can be performed by using the following definition. Given a symmetric structuring element B, one of the non-boundary pixels (Xk) is consecutively diluted and its intersection with the complement of A is taken as follows: c k k A B X X  ) ( 1    ) ( 1 ,... 3 , 2 , 1 0 1 pixel inner X X X when terminates k k k     •Following consecutive dilations and their intersection with the complement of A, finally resulting set is the filled inner boundary region and its union with A gives the filled region F(A). A X A F k   ) (
  • 22. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Basic Morphological Algorithms • Region Filling: Ex 1: X0=1 (Assume that the shaded boundary points are 1 and the white pixels are 0) This region is filled first. Filling of all the other regions A non-boundary pixel
  • 23. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Basic Morphological Algorithms • Connected Component Extraction: The following iterative expression can be used to determine all the pixels in component Y which is in A. A B X X k k  ) ( 1    • X0=1 corresponds to one of the pixels on the component Y. Note that one of the pixel locations on the component must be known. • Consecutive dilations and their intersection with A, yields all elements of component Y. ) ( 1 ,... 3 , 2 , 1 0 1 pixel boundary X X X when terminates k k k     Known pixel, p Result of first iteration Result of second iteration Result of last iteration
  • 24. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Basic Morphological Algorithms • Connected Component Extraction: Input image (Chicken fillet) 15 connected components with different number of pixels Thresholded image After erosion by 5x5 square structuring element of 1’s
  • 25. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Basic Morphological Algorithms • Thinning: Thinning of A by the structuring element B is defined by: ) ( B A A B A     • Note that we are only interested in pattern matching of B in A, so no background operation is required of the hit-miss-transform. •The structuring element B consists of a sequence of structuring elements, where Bi is the rotated version of Bi-1 . Each structuring elements helps thinning in one direction. If there are 4 structuring elements thinning is performed from 4 directions separated by 90o . If 8 structuring elements are used the thinning is performed in 8 directions separated by 45o . •The process is to thin A by one pass with B1 , then the result with one pass of B2 , and continue until A is thinned with one pass of Bn . * hit-or-miss transform/template matching } ,..., , , { } { 3 2 1 n B B B B B  ) )...) ) ((...(( } { 2 1 n B B B A B A     
  • 26. EE-583: Digital Image Processing Prepared By: Dr. Hasan Demirel, PhD Morphological Image Processing Basic Morphological Algorithms • Thinning: The following set of structuring elements are used for thinning operation. ... If there is no change any more. Declared to be the thinned object