digital image processing j. shanbehzadeh, m. mahdijo j. shanbehzadeh, m. mahdijo...

58
DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo [email protected] Khwarizmi University of Tehran Chapter 9 – Morphological Image Processing

Upload: kerry-hood

Post on 17-Dec-2015

232 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

DIGITAL IMAGE PROCESSING

J Shanbehzadeh M MahdijoShanbehzadehgmailcom

Khwarizmi University of Tehran

Chapter 9 ndash Morphological Image Processing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Table of Contents2

Preview

91 Preliminaries

92 Erosion and Dilation

bull 921 Erosionbull 922 Dilationbull 923 Duality

93 Opening and Closing

94 Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Preview3

Morphology form and structure Extracting image components for

representation and description of region shape From

Image processing methods

Input Image Output Image To

Image processing methods

Input Image Output Attributes

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries4

Reflection and Translation

Translation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries5

Structuring Elements

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries6

Structuring Elements

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation7

Erosion

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation8

Computing the Erosion of a Binary Image

9

For each foreground pixel we superimpose the structuring element on top of the input image so that the origin of the structuring element coincides with the input pixel coordinates

If for every pixel in the structuring element

the corresponding pixel in the image underneath is a foreground pixel then the input pixel is left as it

is Otherwise it is set to background value

The effect of Erosion10

removing any foreground pixel that is not completely surrounded by other white pixels (assuming 8-connectedness)

Such pixels must lie at the edges of white regions and so the practical upshot is that foreground regions shrink (and holes inside a region grow)

11

Effect of Erosion Using a 3times3 Square Structuring Element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion12

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 2: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Table of Contents2

Preview

91 Preliminaries

92 Erosion and Dilation

bull 921 Erosionbull 922 Dilationbull 923 Duality

93 Opening and Closing

94 Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Preview3

Morphology form and structure Extracting image components for

representation and description of region shape From

Image processing methods

Input Image Output Image To

Image processing methods

Input Image Output Attributes

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries4

Reflection and Translation

Translation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries5

Structuring Elements

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries6

Structuring Elements

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation7

Erosion

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation8

Computing the Erosion of a Binary Image

9

For each foreground pixel we superimpose the structuring element on top of the input image so that the origin of the structuring element coincides with the input pixel coordinates

If for every pixel in the structuring element

the corresponding pixel in the image underneath is a foreground pixel then the input pixel is left as it

is Otherwise it is set to background value

The effect of Erosion10

removing any foreground pixel that is not completely surrounded by other white pixels (assuming 8-connectedness)

Such pixels must lie at the edges of white regions and so the practical upshot is that foreground regions shrink (and holes inside a region grow)

11

Effect of Erosion Using a 3times3 Square Structuring Element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion12

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 3: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Preview3

Morphology form and structure Extracting image components for

representation and description of region shape From

Image processing methods

Input Image Output Image To

Image processing methods

Input Image Output Attributes

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries4

Reflection and Translation

Translation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries5

Structuring Elements

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries6

Structuring Elements

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation7

Erosion

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation8

Computing the Erosion of a Binary Image

9

For each foreground pixel we superimpose the structuring element on top of the input image so that the origin of the structuring element coincides with the input pixel coordinates

If for every pixel in the structuring element

the corresponding pixel in the image underneath is a foreground pixel then the input pixel is left as it

is Otherwise it is set to background value

The effect of Erosion10

removing any foreground pixel that is not completely surrounded by other white pixels (assuming 8-connectedness)

Such pixels must lie at the edges of white regions and so the practical upshot is that foreground regions shrink (and holes inside a region grow)

11

Effect of Erosion Using a 3times3 Square Structuring Element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion12

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 4: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries4

Reflection and Translation

Translation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries5

Structuring Elements

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries6

Structuring Elements

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation7

Erosion

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation8

Computing the Erosion of a Binary Image

9

For each foreground pixel we superimpose the structuring element on top of the input image so that the origin of the structuring element coincides with the input pixel coordinates

If for every pixel in the structuring element

the corresponding pixel in the image underneath is a foreground pixel then the input pixel is left as it

is Otherwise it is set to background value

The effect of Erosion10

removing any foreground pixel that is not completely surrounded by other white pixels (assuming 8-connectedness)

Such pixels must lie at the edges of white regions and so the practical upshot is that foreground regions shrink (and holes inside a region grow)

11

Effect of Erosion Using a 3times3 Square Structuring Element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion12

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 5: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries5

Structuring Elements

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries6

Structuring Elements

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation7

Erosion

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation8

Computing the Erosion of a Binary Image

9

For each foreground pixel we superimpose the structuring element on top of the input image so that the origin of the structuring element coincides with the input pixel coordinates

If for every pixel in the structuring element

the corresponding pixel in the image underneath is a foreground pixel then the input pixel is left as it

is Otherwise it is set to background value

The effect of Erosion10

removing any foreground pixel that is not completely surrounded by other white pixels (assuming 8-connectedness)

Such pixels must lie at the edges of white regions and so the practical upshot is that foreground regions shrink (and holes inside a region grow)

11

Effect of Erosion Using a 3times3 Square Structuring Element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion12

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 6: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

91 Preliminaries6

Structuring Elements

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation7

Erosion

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation8

Computing the Erosion of a Binary Image

9

For each foreground pixel we superimpose the structuring element on top of the input image so that the origin of the structuring element coincides with the input pixel coordinates

If for every pixel in the structuring element

the corresponding pixel in the image underneath is a foreground pixel then the input pixel is left as it

is Otherwise it is set to background value

The effect of Erosion10

removing any foreground pixel that is not completely surrounded by other white pixels (assuming 8-connectedness)

Such pixels must lie at the edges of white regions and so the practical upshot is that foreground regions shrink (and holes inside a region grow)

11

Effect of Erosion Using a 3times3 Square Structuring Element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion12

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 7: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation7

Erosion

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation8

Computing the Erosion of a Binary Image

9

For each foreground pixel we superimpose the structuring element on top of the input image so that the origin of the structuring element coincides with the input pixel coordinates

If for every pixel in the structuring element

the corresponding pixel in the image underneath is a foreground pixel then the input pixel is left as it

is Otherwise it is set to background value

The effect of Erosion10

removing any foreground pixel that is not completely surrounded by other white pixels (assuming 8-connectedness)

Such pixels must lie at the edges of white regions and so the practical upshot is that foreground regions shrink (and holes inside a region grow)

11

Effect of Erosion Using a 3times3 Square Structuring Element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion12

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 8: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation8

Computing the Erosion of a Binary Image

9

For each foreground pixel we superimpose the structuring element on top of the input image so that the origin of the structuring element coincides with the input pixel coordinates

If for every pixel in the structuring element

the corresponding pixel in the image underneath is a foreground pixel then the input pixel is left as it

is Otherwise it is set to background value

The effect of Erosion10

removing any foreground pixel that is not completely surrounded by other white pixels (assuming 8-connectedness)

Such pixels must lie at the edges of white regions and so the practical upshot is that foreground regions shrink (and holes inside a region grow)

11

Effect of Erosion Using a 3times3 Square Structuring Element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion12

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 9: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

Computing the Erosion of a Binary Image

9

For each foreground pixel we superimpose the structuring element on top of the input image so that the origin of the structuring element coincides with the input pixel coordinates

If for every pixel in the structuring element

the corresponding pixel in the image underneath is a foreground pixel then the input pixel is left as it

is Otherwise it is set to background value

The effect of Erosion10

removing any foreground pixel that is not completely surrounded by other white pixels (assuming 8-connectedness)

Such pixels must lie at the edges of white regions and so the practical upshot is that foreground regions shrink (and holes inside a region grow)

11

Effect of Erosion Using a 3times3 Square Structuring Element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion12

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 10: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

The effect of Erosion10

removing any foreground pixel that is not completely surrounded by other white pixels (assuming 8-connectedness)

Such pixels must lie at the edges of white regions and so the practical upshot is that foreground regions shrink (and holes inside a region grow)

11

Effect of Erosion Using a 3times3 Square Structuring Element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion12

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 11: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

11

Effect of Erosion Using a 3times3 Square Structuring Element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion12

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 12: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion12

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 13: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion13

Erosion (More examples)

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 14: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion14

Erosion (More examples)

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 15: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

1515

Erosion in removing salt noise15

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 16: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation16

Dilation

(B)z = c | c = b + z for b є B

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 17: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation17

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 18: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Dilation18

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 19: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

Dilation19

The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels

Thus areas of foreground pixels grow in size while holes within those regions become smaller

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 20: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

Dilation Example20

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 21: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

21

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 22: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

Gray level erosion dilation22

1048708 Erosion

1048708 Chose the local minimum over the region defined by the structure element

1048708 Put the minimums value in the same pixel position in the out image Results in darker images and light details are removed

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 23: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

23

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 24: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in noise reduction24

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 25: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

Dilation in edge detection25

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 26: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

92 Erosion and Dilation26

Duality

Proof

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 27: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

27

ClosingOpening

93 Opening and Closing

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 28: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

28

ErosionDilation

Opening Closing

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 29: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

Isthmus29

An isthmus (ˈɪsθməs or ˈɪsməs plural isthmuses from Ancient Greekἰσθμός isthmos ldquoneckrdquo) is a narrow strip of land connecting two larger land areas usually with water on either side[1] A tombolo is an isthmus where the strip of land consists of a spit or bar

The Isthmus of PanamaThe Suez Canal goes across the western side of the Sinai Peninsula

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 30: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

30

promiddottrude (prō-troD oD dprime)v promiddottrudmiddoted promiddottrudmiddoting promiddottrudesvtrTo push or thrust outwardvintrTo jut out project See Synonyms at bulge

Example sentencesThe air-conditioner does not protrude into the alleyThey are large-bodied and display a mouthful ofsharp teeth that protrude in Samanthas face and paws protrude from thecutout doorScrub the mussels and use a paring knife toremove any beards that protrude

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 31: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing31

Opening smoothes the contour of an object breaks narrow

isthmuses and eliminates thin protrusions

Erosion Dilation

Opening is defined as an erosion followed by a dilation using the same structuring element for both operations

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 32: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

Opening32

Opening removes some of the foreground (bright) pixels from the edges of regions of foreground pixels

Opening is less destructive than erosion in general

The exact operation is determined by a

structuring element

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 33: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

Opening33

The effect of the operator is to preserve foreground regions that

have a similar shape to this structuring element

or can completely contain the structuring element

Eliminating all other regions of foreground pixels

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 34: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

Opening34

Effect of opening using a 3times3 square structuring element

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 35: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

Opening35

opening can be very useful for separating out particularly shaped objects from the background

opening is far from being a universal 2-D object recognizersegmenter

Eg if we use a long thin structuring element to locate a pencils in our image any one such element will only find pencils at a particular orientation

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 36: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

Opening36

If it is necessary to find pencils at other orientations then differently oriented elements must be used to look for each desired orientation

It is also necessary to be very careful that the structuring element chosen does not eliminate too many desirable objects or retain too many undesirable ones and sometimes this can be a delicate or even impossible balance

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 37: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening37

Opening

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 38: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening38

Opening

Separate out the circles from the lines so that they can be counted Opening with a disk shaped structuring element 11

pixels in diameter gives

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 39: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening39

Opening

Extracting the horizontal and vertical lines The results of an Opening with a 3times9 vertically and 9x3

horizontally oriented structuring element is shown

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 40: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing40

Opening in removing salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 41: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing41

Opening in removing pepper noise

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 42: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

42

93 Closing42

bull Closing

Smooth sections of contours but as opposed to Opening it generally fuses narrow breaks and long thin gulfs eliminates small holes and fills gaps in the contour

ErosionDilation

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 43: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

Closing43

Closing is opening performed in reverse Closing is the dual of opening

ie closing the foreground pixels with a particular structuring element is equivalent to closing the background with the same element

a dilation followed by an erosion using the same structuring element for both operations

The closing operator requires two inputs an image to be closed a structuring element

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 44: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

Closing44

Effect of closing using a 3times3 square structuring element

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 45: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing45

Closing

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 46: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing exapmles46

Removing the small holes while retaining the large holes

Closing with a disk-shaped structuring element with a diameter larger than the

smaller holes

Closingwith a 22

pixel diameter

disk

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 47: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing examples47

Enhance binary images of objects obtained from thresholding

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 48: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing48

Closing for pepper noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 49: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Closing49

Closing for salt noise

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 50: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing50

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 51: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing51

(a) A o B is a subset (subimage) of A(b) If C is a subset of D then C o B is a subset of D o B(c) (A o B) o B = A o B

(a) A is a subset (subimage) of A bull B(b) If C is a subset of D then C bull B is a subset of D bull B(c) (AbullB)bullB=AbullB

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 52: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

93 Opening and Closing52

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 53: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

94 The Hit-or-Miss Transformation

53

The hit-and-miss transform is a general binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image It is actually the basic operation of binary morphology since almost all the other binary morphological operators can be derived from it

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 54: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

94 The Hit-or-Miss Transformation

54

The structuring element used in the hit-and-miss is a slight extension to the type that has been introduced for erosion and dilation in that it can contain both foreground and background pixels rather than just foreground pixels

Example of the extended type of structuring element used in hit-and-miss operations This particular element can be used to find corner points

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 55: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

94 The Hit-or-Miss Transformation

55

Four structuring elements used for corner finding in binary images using the hit-and-miss transform Note that they are really all the same element but rotated by different amounts

After obtaining the locations of corners in each orientation We can then simply OR all these images together to get the final result showing the locations of all right angle convex corners in any orientation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 56: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation

56

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 57: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

5757

ErosionDilation

Opening Closing

The Hit-or-Miss Transformation

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)
Page 58: DIGITAL IMAGE PROCESSING J. Shanbehzadeh, M. Mahdijo J. Shanbehzadeh, M. Mahdijo Shanbehzadeh@gmail.com Khwarizmi University of Tehran

R

C

Gon

zale

z a

nd R

E

W

oods

D

igita

l Im

age

Pro

cess

ing

New

Jer

sey

Pre

ntic

e H

all

3rd e

ditio

n 2

008

94 The Hit-or-Miss Transformation58

Erosion

Dilation

  • DIGITAL IMAGE PROCESSING
  • Table of Contents
  • Preview
  • 91 Preliminaries
  • 91 Preliminaries (2)
  • 91 Preliminaries (3)
  • 92 Erosion and Dilation
  • 92 Erosion and Dilation (2)
  • Computing the Erosion of a Binary Image
  • The effect of Erosion
  • Slide 11
  • 92 Erosion
  • 92 Erosion (2)
  • 92 Erosion (3)
  • Slide 15
  • 92 Dilation
  • 92 Dilation (2)
  • 92 Dilation (3)
  • Dilation
  • Dilation Example
  • Slide 21
  • Gray level erosion dilation
  • Slide 23
  • Dilation in noise reduction
  • Dilation in edge detection
  • 92 Erosion and Dilation (3)
  • 93 Opening and Closing
  • Slide 28
  • Isthmus
  • Slide 30
  • 93 Opening and Closing (2)
  • Opening
  • Opening (2)
  • Opening (3)
  • Opening (4)
  • Opening (5)
  • 93 Opening
  • 93 Opening (2)
  • 93 Opening (3)
  • 93 Opening and Closing (3)
  • 93 Opening and Closing (4)
  • Slide 42
  • Closing
  • Closing (2)
  • 93 Closing
  • 93 Closing exapmles
  • 93 Closing examples
  • 93 Closing (2)
  • 93 Closing (3)
  • 93 Opening and Closing (5)
  • 93 Opening and Closing (6)
  • 93 Opening and Closing (7)
  • 94 The Hit-or-Miss Transformation
  • 94 The Hit-or-Miss Transformation (2)
  • 94 The Hit-or-Miss Transformation (3)
  • 94 The Hit-or-Miss Transformation (4)
  • Slide 57
  • 94 The Hit-or-Miss Transformation (5)