SlideShare a Scribd company logo
1 of 87
Preview
 “Morphology “ – a branch in biology that deals with the form and
structure of animals and plants.
 “Mathematical Morphology” – as a tool for extracting
image components, that are useful in the representation and
description of region shape
 What are the applications of Morphological Image Filtering?
boundaries extraction
skeletons
convex hull
morphological filtering
thinning
Pruning
 The language of mathematical morphology is – Set theory.
 Unified and powerful approach to numerous image processing
problems
Sets in mathematical morphology represent objects in an
image:
 binary image (0 = black, 1 = white) :
the element of the set is the coordinates (x,y) of pixel
belong to the object Z2
 gray-scaled image :
the element of the set is the coordinates (x,y) of pixel
belong to the object and the gray levels Z3
Image Attributes Extracted from ImageMorphological
Image
Processing
9.1 Basic Concepts in Set Theory
 Subset
 Union
 Intersection
disjoint / mutually exclusive
 Complement
 Difference
 Reflection
 Translation
Logic Operations Involving Binary
Pixels and Images
 The principal logic operations used in image processing
are: AND, OR, NOT (COMPLEMENT).
 These operations are functionally complete.
 Logic operations are preformed on a pixel by pixel basis
between corresponding pixels (bitwise).
 Other important logic operations :
XOR (exclusive OR), NAND (NOT-AND)
 Logic operations are just a private case for a binary set
operations, such : AND – Intersection , OR – Union,
NOT-Complement.
Structuring Elements (SE)
 Structuring Elements(SE): small sets or subimages used to probe
an image under study for properties of interest.
 The origin of the SE is indicated by a black dot.
 When SE is symmetric and no dot is show the origin is at the center
of symmetry.
 When SE is symmetric B = (reflection of B)
 When working with images
 SE must be in a Rectangular Arrays (padding with the smallest
possible number of background elements).
 Images must be in a Rectangular Arrays (padding with the
smallest possible number of background elements).
 For Images a background border is provided to accommodate
the entire SE when its origin is on the border.
9.2.1 Erosion
 Erosion is used for shrinking of element A by using element B
 Erosion for Sets A and B in Z2, is defined by the
following equation:
 This equation indicates that the erosion of A by B is the set of
all points z such that B, translated by z, is contained in A.
 Erosion can be used to
 Shrinks or thins objects in binary images
 Remove image components(how?)
 Erosion is a morphological filtering operation in which
image details smaller than the structuring elements are
filtered(removed)
9.2.1 Erosion – Example 1
9.2.1 Erosion – Example 2
Suppose that the structuring element is a 3×3 square
Note that in subsequent diagrams, foreground pixels are
represented by 1's and background pixels by 0's.
The structuring element is now superimposed over each
foreground pixel ( input pixel ) in the image. If all the
pixels below the structuring element are foreground
pixels then the input pixel retains it’s value. But if any
of the pixels is a background pixel then the input pixel
gets the background pixel value.
1 1 1
1 1 1
1 1 1
Structuring element
9.2.2 Dilation
 Dilation is used for expanding an element A by using structuring
element B
 Dilation of A by B and is defined by the following equation:
 This equation is based 0n obtaining the reflection 0f B
about its origin and shifting this reflection by z.
 The dilation of A by B is the set of all displacements z,
such that and A overlap by at least one element. Based
On this interpretation the equation of (9.2-1) can be
rewritten as:
 Relation to Convolution mask:
- Flipping
- Overlapping
9.2.2 Dilation – Example 1
9.2.2 Dilation – Example 2
Suppose that the structuring element is a 3×3 square .
Note that in subsequent diagrams, foreground pixels are
represented by 1's and background pixels by 0's.
To compute the dilation of a binary input image by this structuring
element, we superimpose the structuring element on top of the
input image so that the origin of the structuring element
coincides with the input pixel position.
If the center pixel in the structuring element coincides with a
foreground pixel in the image underneath, then the input pixel
is set to the foreground value.
1 1 1
1 1 1
1 1 1
Structuring element
9.2.2 Dilation – A More interesting
Example (bridging gaps)
Duality between dilation and erosion
 Dilation and erosion are duals of each other with respect to set
complementation and reflection. That,
Prove of (9.2-5)
 One of the simplest uses of erosion is for eliminating irrelevant details
(in terms of size) from a binary image
Erosion and Dilation summary
Erosion vs. Dilation
 Erosion:
 Shrinks or thins objects in binary images
 Remove image components(how?)
 Erode away the boundaries of regions of foreground
pixels
 Areas of foreground pixels shrink in size, and holes
within those areas become larger
 Dilation:
 Grows or thickens object in a binary image
 Bridging gaps
 Fill small holes of sufficiently small size
9.3 Opening And Closing
 Opening – smoothes contours , eliminates protrusions
 Closing – smoothes sections of contours, fuses narrow
breaks and long thin gulfs, eliminates small holes and
fills gaps in contours
 These operations are dual to each other
 These operations are can be applied few times, but has
effect only once
9.3 Opening And Closing
 Opening –
 First – erode A by B, and then dilate the result by B
 In other words, opening is the unification of all B objects
Entirely Contained in A
9.3 Opening And Closing
 Closing –
 First – dilate A by B, and then erode the result by B
 In other words, closing is the group of points, which the
intersection of object B around them with object A – is
not empty
Use of opening and closing for morphological filtering
9.4 The Hit-or-Miss Transformation
 A basic morphological tool for shape detection.
 Let the origin of each shape be located at its center of
gravity.
 If we want to find the location of a shape , say – X ,
at (larger) image, say – A :
 Let X be enclosed by a small window, say – W.
 The local background of X with respect to W is defined as
the set difference (W - X).
 Apply erosion operator of A by X, will get us the set of
locations of the origin of X, such that X is completely
contained in A.
 It may be also view geometrically as the set of all locations of
the origin of X at which X found a match (hit) in A.
9.4 The Hit-or-Miss Transformation
Cont.
 Apply erosion operator on the complement of A by the local
background set (W – X).
 Notice, that the set of locations for which X exactly fits inside
A is the intersection of these two last operators above.
This intersection is precisely the location sought.
Formally:
If B denotes the set composed of X and it’s background –
B = (B1,B2) ; B1 = X , B2 = (W-X).
The match (or set of matches) of B in A, denoted is:
Hit-or-Miss exp:
9.4 The Hit-or-Miss Transformation
 The reason for using these kind of structuring element –
B = (B1,B2) is based on an assumed definition that,
two or more objects are distinct only if they are disjoint
(disconnected) sets.
 In some applications , we may interested in detecting
certain patterns (combinations) of 1’s and 0’s.
and not for detecting individual objects.
 In this case a background is not required.
and the hit-or-miss transform reduces to simple erosion.
 This simplified pattern detection scheme is used in some of
the algorithms for – identifying characters within a text.
9.5 Basic Morphological Algorithms
(Applications)
 1 – Boundary Extraction
 2 – Region Filling
 3 – Extraction of Connected Components
 4 – Convex Hull
 5 – Thinning
 6 – Thickening
 7 – Skeletons
 8 – Pruning
9.5.1 Boundary Extraction
 First, erode A by B, then make set difference between
A and the erosion
 The thickness of the contour depends on the size of
constructing object – B
9.5.1 Boundary Extraction
9.5.2 Region Filling
 This algorithm is based on a set of dilations,
complementation and intersections
 p is the point inside the boundary(given) , with the value of 1

 The process stops when
 The result that given by union of A and X(k), is a set contains
the filled set and the boundary
9.5.2 Region Filling
9.5.3 Extraction of Connected
Components
 This algorithm extracts a component by selecting a
point on a binary object A
 Works similar to region filling, but this time we use in
the conjunction the object A, instead of it’s
complement
This shows automated
inspection of chicken-
breast, that contains
bone fragment
The original image is
thresholded
We can get by using
this algorithm the
number of pixels in
each of the connected
components
Now we could know if
this food contains big
enough bones and
prevent hazards
9.5.4 Convex Hull
 A is said to be convex if a straight line segment joining any
two points in A lies entirely within A
 The convex hull H of set S is the smallest convex set
containing S
 Convex deficiency is the set difference H-S
 Useful for object description
 This algorithm iteratively:
 Apply the hit-or-miss transform to A with the first B element
Unions it with A
Repeat with second B element
Let The convex hull is :
9.5.5 Thinning
 The thinning of a set A by a structuring element B, can
be defined by terms of the hit-and-miss transform:
 9.5-6
 A more useful expression for thinning A symmetrically
is based on a sequence of structuring elements:
{B}={B1, B2, B3, …, Bn}
 Where Bi is a rotated version of Bi-1. Using this concept
we define thinning by a sequence of structuring
elements:
9.5.5 Thinning cont
 The process is to thin by one pass with B1 , then thin
the result with one pass with B2, and so on until A is
thinned with one pass with Bn.
 The entire process is repeated until no further changes
occur.
 Each pass is preformed using the equation:
9.5.5 Thinning example
9.5.6 Thickening
 Thickening is a morphological dual of thinning.
 Definition of thickening .
 As in thinning, thickening can be defined as a
sequential operation:
 the structuring elements used for thickening have the
same form as in thinning, but with all 1’s and 0’s
interchanged.
9.5.6 Thickening - cont
 A separate algorithm for thickening is often used in
practice, Instead the usual procedure is to thin the
background of the set in question and then complement
the result.
 In other words, to thicken a set A, we form C=Ac , thin C
and than form Cc.
 depending on the nature of A, this procedure may result in
some disconnected points. Therefore thickening by this
procedure usually require a simple post-processing step to
remove disconnected points.
9.5.6 Thickening example preview
 We will notice in the next example 9.22(c) that the
thinned background forms a boundary for the
thickening process, this feature does not occur in the
direct implementation of thickening
 This is one of the reasons for using background
thinning to accomplish thickening.
9.5.6 Thickening example
9.5.7 Skeleton
 The notion of a skeleton of a set A :S(A) is intuitively
defined, we deduce from this figure that:
a) If z is a point of S(A) and (D)z is the largest disk
centered at z and contained in A (one cannot find a
larger disk that fulfils this terms) – this disk is called
“maximum disk”.
b) The disk (D)z touches the boundary of A at two or
more different places.
9.5.7 Skeleton
 The skeleton of A is defined by terms of erosions and
openings:
 with
 Where B is the structuring element and indicates k
successive erosions of A:
 k times, and K is the last iterative step before A erodes to an empty
set, in other words:
 in conclusion S(A) can be obtained as the union of skeleton
subsets Sk(A).
9.5.7 Skeleton Example
9.5.7 Skeleton
 A can be also reconstructed from subsets Sk(A) by
using the equation:
 Where denotes k successive dilations of
Sk(A) that is:
9.5.8 Pruning
 Removing parasitic component
 Complement to thinning and skeletonizing by successive
elimination its end point.
Morphological Reconstruction
 Involve two images and SE
 Marker(F): starting point for transformation.
 Mask(G): constrains the transformation.
 SE: define connectivity.
 F and G are both binary images and
Geodesic Dilation & Erosion
 The geodesic dilation of size 1 of the marker image F with
respect to the mask G
 Where ∩ is logical AND
 The geodesic dilation of size n of the F with respect to G
 Where
 The geodesic erosion of size 1 of the marker image F with
respect to the mask G
 Where ∪ is logical OR
 The geodesic erosion of size n of the F with respect to G
 Where
Morphological reconstruction by
dilation & erosion
(1) Morphological reconstruction by dilation of a mask image
G from a marker image F
(1) Morphological reconstruction by erosion of a mask image
G from a marker image F
Example:
Sample Applications
 (1) Opening by reconstruction:
 Restore exactly the shapes of the objects that remain after
erosion.
 The opening by reconstruction of size n of an image F is the
reconstruction by dilation of F from the erosion of size n of F:
 (2) Filling holes
 If I(x,y) is a binary image A marker image F is defined:
 is a binary image equal to I with all holes filled.
Sample Apps. Cont.
 (3) Border clearing:
1. Removing objects that touch (are connected to)the
border
2. Subtract from original image
Summary
9.6 Gray-Scale Images
 f(x,y): the input image
 b(x,y): a structuring element (a subimage function)
 (x,y) are integers.
 f(x,y) and b(x,y) are functions that assign a gray-level
value (real number or real integer) to each distinct pair
of coordinate (x,y)
 For example the domain of gray values can be 0-255,
whereas 0 – is black, 255- is white.
9.6 Gray-Scale Images
9.6.1 Erosion – Gray-Scale
 The erosion of f by a flat structuring element b at any
location (x,y) is defined as the minimum value of the
image in the region coincides with b when the origin
of b is at (x,y).
 The erosion of f by a non flat structuring element :
9.6.1 Erosion– Gray-Scale example 1
9.6.1 Erosion– Gray-Scale (cont)
 General effect of performing an erosion in grayscale
images:
1. If all elements of the structuring element are positive, the
output image tends to be darker than the input image.
2. The effect of bright details in the input image that are
smaller in area than the structuring element is reduced,
with the degree of reduction being determined by the
grayscale values surrounding by the bright detail and by
shape and amplitude values of the structuring element
itself.
9.6.1 Dilation – Gray-Scale
 The Dilation of f by a flat structuring element b at any
location (x,y) is defined as the maximum value of the
image in the region outlined by when the origin of is
at (x,y).
 The Dilation of f by a non flat structuring element :
9.6.1 Dilation – Gray-Scale (cont)
 The general effects of performing dilation on a gray
scale image is twofold:
1. If all the values of the structuring elements are positive
than the output image tends to be brighter than the
input.
2. Dark details either are reduced or eliminated,
depending on how their values and shape relate to the
structuring element used for dilation
9.6.1 Dilation – Gray-Scale example
9.6.1 Dilation & Erosion– Gray-Scale
 Similar to binary image grayscale erosion and dilation
are duals with respect to function complementation and
reflection.
9.6.2 Opening And Closing
 Similar to the binary algorithms
 Opening –
 Closing –
 In the opening of a gray-scale image, we remove
small light details, while relatively undisturbed
overall gray levels and larger bright features
 In the closing of a gray-scale image, we remove small
dark details, while relatively undisturbed overall gray
levels and larger dark features
9.6.2 Opening And Closing
 Opening a G-S picture is describable as pushing object
B under the scan-line graph, while traversing the
graph according the curvature of B
9.6.2 Opening And Closing
 Closing a G-S picture is describable as pushing object
B on top of the scan-line graph, while traversing the
graph according the curvature of B
 The peaks are usually
remains in their
original form
9.6.2 Opening And Closing
Opening: Decreased size
of small bright details. No
changes to dark region
Closing: Decreased size
of small dark details. No
changes to bright region
9.6.3 Some Applications of Gray-Scale
Morphology
1) Morphological smoothing
2) Morphological gradient
3) Top-hat & bottom-hat transformation
4) Textural segmentation
5) Granulometry
9.6.3 Some Applications of Gray-
Scale Morphology
 Morphological smoothing
 Perform opening followed by a closing
 The net result of these two operations is to remove or
attenuate both bright and dark artifacts or noise.
 Morphological gradient
 Dilation and erosion are use to compute the morphological
gradient of an image, denoted g:
 It uses to highlights sharp gray-level transitions in the
input image.
 Obtained using symmetrical structuring elements tend to
depend less on edge directionality.
9.6.3 Some Applications of Gray-
Scale Morphology
 Morphological smoothing
 Morphological gradient
9.6.3 Some Applications of Gray-
Scale Morphology
 Top-hat transformation
 Called (white top-hat) and Is defined as:
 Detect structures of a certain size.
 Light objects on a dark background.
 Bottom-hat transformation
 Called (black top-hat )and Is defined as:
 Detect structures of a certain size.
 Dark objects on a bright background
9.6.3 Some Applications of Gray-
Scale Morphology
 Top-hat transformation
 Bottom-hat transformation
9.6.3 Some Applications of Gray-
Scale Morphology
 Textural segmentation
 The objective is to find the boundary between
different image regions based on their textural
content.
1. Performing closing with successive larger structuring
element till removing the small blobs
2. Performing Simple opening
3. Performing Simple thresholding
9.6.3 Some Applications of Gray-
Scale Morphology
 Granulometry
 Granulometry is a field that deals principally with
determining the size distribution of particles in an
image.
 Because the particles are lighter than the background, we can
use a morphological approach to determine size distribution.
To construct at the end a histogram of it.
 Based on the idea that opening operations of particular size
have the most effect on regions of the input image that
contain particles of similar size.
 This type of processing is useful for describing regions
with a predominant particle-like character.
9.6.3 Some Applications of Gray-
Scale Morphology
 Granulometry
9.6.4 Gray-Scale Morphological
Reconstruction
 Let f and g denote the marker and mask images
respectively and
 The geodesic erosion of size 1 of f with respect to g:
 where V denotes the point-wise maximum operator
 The geodesic erosion of size n of f with respect to g:
 With
 Reconstruction by erosion of g by f:

9.6.4 Gray-Scale Morphological
Reconstruction
 Let f and g denote the marker and mask images
respectively and
 The geodesic dilation of size 1 of f with respect to g:
 where ^ denotes the point-wise minimum operator
 The geodesic dilation of size n of f with respect to g:
 With
 Reconstruction by dilation of g by f:
9.6.4 Gray-Scale Morphological
Reconstruction
 Opening by reconstruction of size n of an image f:
 Closing by reconstruction of size n of an image f:
 Top-hat by reconstruction:
 Subtracting from an image opening by reconstruction
Chapter 9   morphological image processing

More Related Content

What's hot

morphological image processing
morphological image processingmorphological image processing
morphological image processing
John Williams
 

What's hot (20)

Image Filtering in the Frequency Domain
Image Filtering in the Frequency DomainImage Filtering in the Frequency Domain
Image Filtering in the Frequency Domain
 
Sharpening spatial filters
Sharpening spatial filtersSharpening spatial filters
Sharpening spatial filters
 
Region based segmentation
Region based segmentationRegion based segmentation
Region based segmentation
 
Segmentation
SegmentationSegmentation
Segmentation
 
Image transforms
Image transformsImage transforms
Image transforms
 
Mathematical tools in dip
Mathematical tools in dipMathematical tools in dip
Mathematical tools in dip
 
Image segmentation
Image segmentation Image segmentation
Image segmentation
 
Image restoration and degradation model
Image restoration and degradation modelImage restoration and degradation model
Image restoration and degradation model
 
Morphological image processing
Morphological image processingMorphological image processing
Morphological image processing
 
Image segmentation based on color
Image segmentation based on colorImage segmentation based on color
Image segmentation based on color
 
IMAGE SEGMENTATION.
IMAGE SEGMENTATION.IMAGE SEGMENTATION.
IMAGE SEGMENTATION.
 
Morphological Image Processing
Morphological Image ProcessingMorphological Image Processing
Morphological Image Processing
 
Chapter 9 morphological image processing
Chapter 9 morphological image processingChapter 9 morphological image processing
Chapter 9 morphological image processing
 
Image Representation & Descriptors
Image Representation & DescriptorsImage Representation & Descriptors
Image Representation & Descriptors
 
Intensity Transformation
Intensity TransformationIntensity Transformation
Intensity Transformation
 
Digital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationDigital Image Processing: Image Segmentation
Digital Image Processing: Image Segmentation
 
morphological image processing
morphological image processingmorphological image processing
morphological image processing
 
Hit and-miss transform
Hit and-miss transformHit and-miss transform
Hit and-miss transform
 
morphological image processing
morphological image processingmorphological image processing
morphological image processing
 
Data Redundacy
Data RedundacyData Redundacy
Data Redundacy
 

Similar to Chapter 9 morphological image processing

dokumen.tips_computer-graphics-image-processing-chapter-9-computer-graphics-i...
dokumen.tips_computer-graphics-image-processing-chapter-9-computer-graphics-i...dokumen.tips_computer-graphics-image-processing-chapter-9-computer-graphics-i...
dokumen.tips_computer-graphics-image-processing-chapter-9-computer-graphics-i...
YogeshNeelappa2
 
Image Processing
Image ProcessingImage Processing
Image Processing
Tuyen Pham
 
改进的固定点图像复原算法_英文_阎雪飞
改进的固定点图像复原算法_英文_阎雪飞改进的固定点图像复原算法_英文_阎雪飞
改进的固定点图像复原算法_英文_阎雪飞
alen yan
 
Definite Integral
Definite IntegralDefinite Integral
Definite Integral
Arun Umrao
 
Image segmentation 3 morphology
Image segmentation 3 morphologyImage segmentation 3 morphology
Image segmentation 3 morphology
Rumah Belajar
 

Similar to Chapter 9 morphological image processing (20)

Chapter 9 newer
Chapter 9   newerChapter 9   newer
Chapter 9 newer
 
Morphological image processing
Morphological image processingMorphological image processing
Morphological image processing
 
dokumen.tips_computer-graphics-image-processing-chapter-9-computer-graphics-i...
dokumen.tips_computer-graphics-image-processing-chapter-9-computer-graphics-i...dokumen.tips_computer-graphics-image-processing-chapter-9-computer-graphics-i...
dokumen.tips_computer-graphics-image-processing-chapter-9-computer-graphics-i...
 
Morphological image processing.pdf
Morphological image processing.pdfMorphological image processing.pdf
Morphological image processing.pdf
 
DIP_14_54_boundary extraction in dip .ppt
DIP_14_54_boundary extraction in dip .pptDIP_14_54_boundary extraction in dip .ppt
DIP_14_54_boundary extraction in dip .ppt
 
www.ijerd.com
www.ijerd.comwww.ijerd.com
www.ijerd.com
 
Boundary Extraction
Boundary ExtractionBoundary Extraction
Boundary Extraction
 
Image Segmentation
 Image Segmentation Image Segmentation
Image Segmentation
 
Object class recognition by unsupervide scale invariant learning - kunal
Object class recognition by unsupervide scale invariant learning - kunalObject class recognition by unsupervide scale invariant learning - kunal
Object class recognition by unsupervide scale invariant learning - kunal
 
Interactive graph cuts for optimal boundary and region segmentation of objects
Interactive graph cuts for optimal boundary and region segmentation of objects Interactive graph cuts for optimal boundary and region segmentation of objects
Interactive graph cuts for optimal boundary and region segmentation of objects
 
Fractal Image Compression
Fractal Image CompressionFractal Image Compression
Fractal Image Compression
 
Image Processing
Image ProcessingImage Processing
Image Processing
 
Lec-3 DIP.pptx
Lec-3 DIP.pptxLec-3 DIP.pptx
Lec-3 DIP.pptx
 
改进的固定点图像复原算法_英文_阎雪飞
改进的固定点图像复原算法_英文_阎雪飞改进的固定点图像复原算法_英文_阎雪飞
改进的固定点图像复原算法_英文_阎雪飞
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Image Restoration UsingNonlocally Centralized Sparse Representation and histo...
Image Restoration UsingNonlocally Centralized Sparse Representation and histo...Image Restoration UsingNonlocally Centralized Sparse Representation and histo...
Image Restoration UsingNonlocally Centralized Sparse Representation and histo...
 
[PPT]
[PPT][PPT]
[PPT]
 
Principle of Definite Integra - Integral Calculus - by Arun Umrao
Principle of Definite Integra - Integral Calculus - by Arun UmraoPrinciple of Definite Integra - Integral Calculus - by Arun Umrao
Principle of Definite Integra - Integral Calculus - by Arun Umrao
 
Definite Integral
Definite IntegralDefinite Integral
Definite Integral
 
Image segmentation 3 morphology
Image segmentation 3 morphologyImage segmentation 3 morphology
Image segmentation 3 morphology
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Chapter 9 morphological image processing

  • 1.
  • 2. Preview  “Morphology “ – a branch in biology that deals with the form and structure of animals and plants.  “Mathematical Morphology” – as a tool for extracting image components, that are useful in the representation and description of region shape  What are the applications of Morphological Image Filtering? boundaries extraction skeletons convex hull morphological filtering thinning Pruning  The language of mathematical morphology is – Set theory.  Unified and powerful approach to numerous image processing problems
  • 3. Sets in mathematical morphology represent objects in an image:  binary image (0 = black, 1 = white) : the element of the set is the coordinates (x,y) of pixel belong to the object Z2  gray-scaled image : the element of the set is the coordinates (x,y) of pixel belong to the object and the gray levels Z3 Image Attributes Extracted from ImageMorphological Image Processing
  • 4. 9.1 Basic Concepts in Set Theory  Subset  Union  Intersection disjoint / mutually exclusive  Complement  Difference  Reflection  Translation
  • 5. Logic Operations Involving Binary Pixels and Images  The principal logic operations used in image processing are: AND, OR, NOT (COMPLEMENT).  These operations are functionally complete.  Logic operations are preformed on a pixel by pixel basis between corresponding pixels (bitwise).  Other important logic operations : XOR (exclusive OR), NAND (NOT-AND)  Logic operations are just a private case for a binary set operations, such : AND – Intersection , OR – Union, NOT-Complement.
  • 6.
  • 7. Structuring Elements (SE)  Structuring Elements(SE): small sets or subimages used to probe an image under study for properties of interest.  The origin of the SE is indicated by a black dot.  When SE is symmetric and no dot is show the origin is at the center of symmetry.  When SE is symmetric B = (reflection of B)  When working with images  SE must be in a Rectangular Arrays (padding with the smallest possible number of background elements).  Images must be in a Rectangular Arrays (padding with the smallest possible number of background elements).  For Images a background border is provided to accommodate the entire SE when its origin is on the border.
  • 8. 9.2.1 Erosion  Erosion is used for shrinking of element A by using element B  Erosion for Sets A and B in Z2, is defined by the following equation:  This equation indicates that the erosion of A by B is the set of all points z such that B, translated by z, is contained in A.  Erosion can be used to  Shrinks or thins objects in binary images  Remove image components(how?)  Erosion is a morphological filtering operation in which image details smaller than the structuring elements are filtered(removed)
  • 9. 9.2.1 Erosion – Example 1
  • 10. 9.2.1 Erosion – Example 2
  • 11. Suppose that the structuring element is a 3×3 square Note that in subsequent diagrams, foreground pixels are represented by 1's and background pixels by 0's. The structuring element is now superimposed over each foreground pixel ( input pixel ) in the image. If all the pixels below the structuring element are foreground pixels then the input pixel retains it’s value. But if any of the pixels is a background pixel then the input pixel gets the background pixel value. 1 1 1 1 1 1 1 1 1 Structuring element
  • 12. 9.2.2 Dilation  Dilation is used for expanding an element A by using structuring element B  Dilation of A by B and is defined by the following equation:  This equation is based 0n obtaining the reflection 0f B about its origin and shifting this reflection by z.  The dilation of A by B is the set of all displacements z, such that and A overlap by at least one element. Based On this interpretation the equation of (9.2-1) can be rewritten as:  Relation to Convolution mask: - Flipping - Overlapping
  • 13. 9.2.2 Dilation – Example 1
  • 14. 9.2.2 Dilation – Example 2
  • 15. Suppose that the structuring element is a 3×3 square . Note that in subsequent diagrams, foreground pixels are represented by 1's and background pixels by 0's. To compute the dilation of a binary input image by this structuring element, we superimpose the structuring element on top of the input image so that the origin of the structuring element coincides with the input pixel position. If the center pixel in the structuring element coincides with a foreground pixel in the image underneath, then the input pixel is set to the foreground value. 1 1 1 1 1 1 1 1 1 Structuring element
  • 16. 9.2.2 Dilation – A More interesting Example (bridging gaps)
  • 17. Duality between dilation and erosion  Dilation and erosion are duals of each other with respect to set complementation and reflection. That, Prove of (9.2-5)  One of the simplest uses of erosion is for eliminating irrelevant details (in terms of size) from a binary image
  • 19. Erosion vs. Dilation  Erosion:  Shrinks or thins objects in binary images  Remove image components(how?)  Erode away the boundaries of regions of foreground pixels  Areas of foreground pixels shrink in size, and holes within those areas become larger  Dilation:  Grows or thickens object in a binary image  Bridging gaps  Fill small holes of sufficiently small size
  • 20. 9.3 Opening And Closing  Opening – smoothes contours , eliminates protrusions  Closing – smoothes sections of contours, fuses narrow breaks and long thin gulfs, eliminates small holes and fills gaps in contours  These operations are dual to each other  These operations are can be applied few times, but has effect only once
  • 21. 9.3 Opening And Closing  Opening –  First – erode A by B, and then dilate the result by B  In other words, opening is the unification of all B objects Entirely Contained in A
  • 22.
  • 23. 9.3 Opening And Closing  Closing –  First – dilate A by B, and then erode the result by B  In other words, closing is the group of points, which the intersection of object B around them with object A – is not empty
  • 24.
  • 25. Use of opening and closing for morphological filtering
  • 26. 9.4 The Hit-or-Miss Transformation  A basic morphological tool for shape detection.  Let the origin of each shape be located at its center of gravity.  If we want to find the location of a shape , say – X , at (larger) image, say – A :  Let X be enclosed by a small window, say – W.  The local background of X with respect to W is defined as the set difference (W - X).  Apply erosion operator of A by X, will get us the set of locations of the origin of X, such that X is completely contained in A.  It may be also view geometrically as the set of all locations of the origin of X at which X found a match (hit) in A.
  • 27. 9.4 The Hit-or-Miss Transformation Cont.  Apply erosion operator on the complement of A by the local background set (W – X).  Notice, that the set of locations for which X exactly fits inside A is the intersection of these two last operators above. This intersection is precisely the location sought. Formally: If B denotes the set composed of X and it’s background – B = (B1,B2) ; B1 = X , B2 = (W-X). The match (or set of matches) of B in A, denoted is:
  • 29. 9.4 The Hit-or-Miss Transformation  The reason for using these kind of structuring element – B = (B1,B2) is based on an assumed definition that, two or more objects are distinct only if they are disjoint (disconnected) sets.  In some applications , we may interested in detecting certain patterns (combinations) of 1’s and 0’s. and not for detecting individual objects.  In this case a background is not required. and the hit-or-miss transform reduces to simple erosion.  This simplified pattern detection scheme is used in some of the algorithms for – identifying characters within a text.
  • 30. 9.5 Basic Morphological Algorithms (Applications)  1 – Boundary Extraction  2 – Region Filling  3 – Extraction of Connected Components  4 – Convex Hull  5 – Thinning  6 – Thickening  7 – Skeletons  8 – Pruning
  • 31. 9.5.1 Boundary Extraction  First, erode A by B, then make set difference between A and the erosion  The thickness of the contour depends on the size of constructing object – B
  • 33. 9.5.2 Region Filling  This algorithm is based on a set of dilations, complementation and intersections  p is the point inside the boundary(given) , with the value of 1   The process stops when  The result that given by union of A and X(k), is a set contains the filled set and the boundary
  • 35. 9.5.3 Extraction of Connected Components  This algorithm extracts a component by selecting a point on a binary object A  Works similar to region filling, but this time we use in the conjunction the object A, instead of it’s complement
  • 36. This shows automated inspection of chicken- breast, that contains bone fragment The original image is thresholded We can get by using this algorithm the number of pixels in each of the connected components Now we could know if this food contains big enough bones and prevent hazards
  • 37. 9.5.4 Convex Hull  A is said to be convex if a straight line segment joining any two points in A lies entirely within A  The convex hull H of set S is the smallest convex set containing S  Convex deficiency is the set difference H-S  Useful for object description  This algorithm iteratively:  Apply the hit-or-miss transform to A with the first B element Unions it with A Repeat with second B element Let The convex hull is :
  • 38.
  • 39. 9.5.5 Thinning  The thinning of a set A by a structuring element B, can be defined by terms of the hit-and-miss transform:  9.5-6  A more useful expression for thinning A symmetrically is based on a sequence of structuring elements: {B}={B1, B2, B3, …, Bn}  Where Bi is a rotated version of Bi-1. Using this concept we define thinning by a sequence of structuring elements:
  • 40. 9.5.5 Thinning cont  The process is to thin by one pass with B1 , then thin the result with one pass with B2, and so on until A is thinned with one pass with Bn.  The entire process is repeated until no further changes occur.  Each pass is preformed using the equation:
  • 42. 9.5.6 Thickening  Thickening is a morphological dual of thinning.  Definition of thickening .  As in thinning, thickening can be defined as a sequential operation:  the structuring elements used for thickening have the same form as in thinning, but with all 1’s and 0’s interchanged.
  • 43. 9.5.6 Thickening - cont  A separate algorithm for thickening is often used in practice, Instead the usual procedure is to thin the background of the set in question and then complement the result.  In other words, to thicken a set A, we form C=Ac , thin C and than form Cc.  depending on the nature of A, this procedure may result in some disconnected points. Therefore thickening by this procedure usually require a simple post-processing step to remove disconnected points.
  • 44. 9.5.6 Thickening example preview  We will notice in the next example 9.22(c) that the thinned background forms a boundary for the thickening process, this feature does not occur in the direct implementation of thickening  This is one of the reasons for using background thinning to accomplish thickening.
  • 46. 9.5.7 Skeleton  The notion of a skeleton of a set A :S(A) is intuitively defined, we deduce from this figure that: a) If z is a point of S(A) and (D)z is the largest disk centered at z and contained in A (one cannot find a larger disk that fulfils this terms) – this disk is called “maximum disk”. b) The disk (D)z touches the boundary of A at two or more different places.
  • 47. 9.5.7 Skeleton  The skeleton of A is defined by terms of erosions and openings:  with  Where B is the structuring element and indicates k successive erosions of A:  k times, and K is the last iterative step before A erodes to an empty set, in other words:  in conclusion S(A) can be obtained as the union of skeleton subsets Sk(A).
  • 49. 9.5.7 Skeleton  A can be also reconstructed from subsets Sk(A) by using the equation:  Where denotes k successive dilations of Sk(A) that is:
  • 50. 9.5.8 Pruning  Removing parasitic component  Complement to thinning and skeletonizing by successive elimination its end point.
  • 51.
  • 52. Morphological Reconstruction  Involve two images and SE  Marker(F): starting point for transformation.  Mask(G): constrains the transformation.  SE: define connectivity.  F and G are both binary images and
  • 53. Geodesic Dilation & Erosion  The geodesic dilation of size 1 of the marker image F with respect to the mask G  Where ∩ is logical AND  The geodesic dilation of size n of the F with respect to G  Where  The geodesic erosion of size 1 of the marker image F with respect to the mask G  Where ∪ is logical OR  The geodesic erosion of size n of the F with respect to G  Where
  • 54.
  • 55. Morphological reconstruction by dilation & erosion (1) Morphological reconstruction by dilation of a mask image G from a marker image F (1) Morphological reconstruction by erosion of a mask image G from a marker image F
  • 57. Sample Applications  (1) Opening by reconstruction:  Restore exactly the shapes of the objects that remain after erosion.  The opening by reconstruction of size n of an image F is the reconstruction by dilation of F from the erosion of size n of F:  (2) Filling holes  If I(x,y) is a binary image A marker image F is defined:  is a binary image equal to I with all holes filled.
  • 58. Sample Apps. Cont.  (3) Border clearing: 1. Removing objects that touch (are connected to)the border 2. Subtract from original image
  • 60.
  • 61.
  • 62.
  • 63. 9.6 Gray-Scale Images  f(x,y): the input image  b(x,y): a structuring element (a subimage function)  (x,y) are integers.  f(x,y) and b(x,y) are functions that assign a gray-level value (real number or real integer) to each distinct pair of coordinate (x,y)  For example the domain of gray values can be 0-255, whereas 0 – is black, 255- is white.
  • 65. 9.6.1 Erosion – Gray-Scale  The erosion of f by a flat structuring element b at any location (x,y) is defined as the minimum value of the image in the region coincides with b when the origin of b is at (x,y).  The erosion of f by a non flat structuring element :
  • 67. 9.6.1 Erosion– Gray-Scale (cont)  General effect of performing an erosion in grayscale images: 1. If all elements of the structuring element are positive, the output image tends to be darker than the input image. 2. The effect of bright details in the input image that are smaller in area than the structuring element is reduced, with the degree of reduction being determined by the grayscale values surrounding by the bright detail and by shape and amplitude values of the structuring element itself.
  • 68. 9.6.1 Dilation – Gray-Scale  The Dilation of f by a flat structuring element b at any location (x,y) is defined as the maximum value of the image in the region outlined by when the origin of is at (x,y).  The Dilation of f by a non flat structuring element :
  • 69. 9.6.1 Dilation – Gray-Scale (cont)  The general effects of performing dilation on a gray scale image is twofold: 1. If all the values of the structuring elements are positive than the output image tends to be brighter than the input. 2. Dark details either are reduced or eliminated, depending on how their values and shape relate to the structuring element used for dilation
  • 70. 9.6.1 Dilation – Gray-Scale example
  • 71. 9.6.1 Dilation & Erosion– Gray-Scale  Similar to binary image grayscale erosion and dilation are duals with respect to function complementation and reflection.
  • 72. 9.6.2 Opening And Closing  Similar to the binary algorithms  Opening –  Closing –  In the opening of a gray-scale image, we remove small light details, while relatively undisturbed overall gray levels and larger bright features  In the closing of a gray-scale image, we remove small dark details, while relatively undisturbed overall gray levels and larger dark features
  • 73. 9.6.2 Opening And Closing  Opening a G-S picture is describable as pushing object B under the scan-line graph, while traversing the graph according the curvature of B
  • 74. 9.6.2 Opening And Closing  Closing a G-S picture is describable as pushing object B on top of the scan-line graph, while traversing the graph according the curvature of B  The peaks are usually remains in their original form
  • 75. 9.6.2 Opening And Closing Opening: Decreased size of small bright details. No changes to dark region Closing: Decreased size of small dark details. No changes to bright region
  • 76. 9.6.3 Some Applications of Gray-Scale Morphology 1) Morphological smoothing 2) Morphological gradient 3) Top-hat & bottom-hat transformation 4) Textural segmentation 5) Granulometry
  • 77. 9.6.3 Some Applications of Gray- Scale Morphology  Morphological smoothing  Perform opening followed by a closing  The net result of these two operations is to remove or attenuate both bright and dark artifacts or noise.  Morphological gradient  Dilation and erosion are use to compute the morphological gradient of an image, denoted g:  It uses to highlights sharp gray-level transitions in the input image.  Obtained using symmetrical structuring elements tend to depend less on edge directionality.
  • 78. 9.6.3 Some Applications of Gray- Scale Morphology  Morphological smoothing  Morphological gradient
  • 79. 9.6.3 Some Applications of Gray- Scale Morphology  Top-hat transformation  Called (white top-hat) and Is defined as:  Detect structures of a certain size.  Light objects on a dark background.  Bottom-hat transformation  Called (black top-hat )and Is defined as:  Detect structures of a certain size.  Dark objects on a bright background
  • 80. 9.6.3 Some Applications of Gray- Scale Morphology  Top-hat transformation  Bottom-hat transformation
  • 81. 9.6.3 Some Applications of Gray- Scale Morphology  Textural segmentation  The objective is to find the boundary between different image regions based on their textural content. 1. Performing closing with successive larger structuring element till removing the small blobs 2. Performing Simple opening 3. Performing Simple thresholding
  • 82. 9.6.3 Some Applications of Gray- Scale Morphology  Granulometry  Granulometry is a field that deals principally with determining the size distribution of particles in an image.  Because the particles are lighter than the background, we can use a morphological approach to determine size distribution. To construct at the end a histogram of it.  Based on the idea that opening operations of particular size have the most effect on regions of the input image that contain particles of similar size.  This type of processing is useful for describing regions with a predominant particle-like character.
  • 83. 9.6.3 Some Applications of Gray- Scale Morphology  Granulometry
  • 84. 9.6.4 Gray-Scale Morphological Reconstruction  Let f and g denote the marker and mask images respectively and  The geodesic erosion of size 1 of f with respect to g:  where V denotes the point-wise maximum operator  The geodesic erosion of size n of f with respect to g:  With  Reconstruction by erosion of g by f: 
  • 85. 9.6.4 Gray-Scale Morphological Reconstruction  Let f and g denote the marker and mask images respectively and  The geodesic dilation of size 1 of f with respect to g:  where ^ denotes the point-wise minimum operator  The geodesic dilation of size n of f with respect to g:  With  Reconstruction by dilation of g by f:
  • 86. 9.6.4 Gray-Scale Morphological Reconstruction  Opening by reconstruction of size n of an image f:  Closing by reconstruction of size n of an image f:  Top-hat by reconstruction:  Subtracting from an image opening by reconstruction

Editor's Notes

  1. Structure هو علم بيهتم بدراسة ال Morphology`
  2. SE is look like a mask that perform filtering on an image.
  3. Take B and move over all pixels in A . If B is completely contained in A the shade the new pixel, otherwise left it unshaded
  4. Take SE and move over all pixels in A . If SE is completely contained in A then the new pixel is the foreground pixel(1), otherwise it is background pixel(0)
  5. Take SE reflect it and move over all pixels in A . If at least one pixel of the SE coincides a pixel in A then the new pixel is the foreground pixel(1), otherwise it is background pixel(0)
  6. Convex محدب Hull = frame إطار
  7. All what we have seen are applied to binary images. Now let’s start dealing with gray-scaled images