digital image processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… ·...

48
Course Website: http://www.comp.dit.ie/bmacnamee Digital Image Processing Morphological Image Processing

Upload: others

Post on 01-Nov-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

Course Website: http://www.comp.dit.ie/bmacnamee

Digital Image Processing

Morphological Image Processing

Page 2: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

2

of

39Contents

Once segmentation is complete,

morphological operations can be used to

remove imperfections in the segmented

image and provide information on the form

and structure of the image

In this lecture we will consider

– What is morphology?

– Simple morphological operations

– Compound operations

– Morphological algorithms

Page 3: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

3

of

391, 0, Black, White?

Throughout all of the following slides

whether 0 and 1 refer to white or black is a

little interchangeable

All of the discussion that follows assumes

segmentation has already taken place and

that images are made up of 0s for

background pixels and 1s for object pixels

After this it doesn’t matter if 0 is black, white,

yellow, green…….

Page 4: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

4

of

39What Is Morphology?

Morphological image processing (or

morphology) describes a range of image

processing techniques that deal with the

shape (or morphology) of features in an

image

Morphological operations are typically

applied to remove imperfections introduced

during segmentation, and so typically

operate on bi-level images

Page 5: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

5

of

39Quick Example

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Image after segmentation Image after segmentation and

morphological processing

Page 6: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

6

of

39Structuring Elements, Hits & Fits

B

AC

Structuring Element

Fit: All on pixels in the

structuring element cover

on pixels in the image

Hit: Any on pixel in the

structuring element covers

an on pixel in the image

All morphological processing operations are based

on these simple ideas

Page 7: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

7

of

39Structuring Elements

Structuring elements can be any size and

make any shape

However, for simplicity we will use

rectangular structuring elements with their

origin at the middle pixel

1 1 1

1 1 1

1 1 1

0 0 1 0 0

0 1 1 1 0

1 1 1 1 1

0 1 1 1 0

0 0 1 0 0

0 1 0

1 1 1

0 1 0

Page 8: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

8

of

39Fitting & Hitting

0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 1 1 0 0 0 0 0 0 0

0 0 1 1 1 1 1 0 0 0 0 0

0 1 1 1 1 1 1 1 0 0 0 0

0 1 1 1 1 1 1 1 0 0 0 0

0 0 1 1 1 1 1 1 0 0 0 0

0 0 1 1 1 1 1 1 1 0 0 0

0 0 1 1 1 1 1 1 1 1 1 0

0 0 0 0 0 1 1 1 1 1 1 0

0 0 0 0 0 0 0 0 0 0 0 0

B C

A

1 1 1

1 1 1

1 1 1

Structuring

Element 1

0 1 0

1 1 1

0 1 0

Structuring

Element 2

Page 9: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

9

of

39Fundamental Operations

Fundamentally morphological image

processing is very like spatial filtering

The structuring element is moved across

every pixel in the original image to give a

pixel in a new processed image

The value of this new pixel depends on the

operation performed

There are two basic morphological

operations: erosion and dilation

Page 10: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

10

of

39Erosion

Erosion of image f by structuring element s

is given by f s

The structuring element s is positioned with

its origin at (x, y) and the new pixel value is

determined using the rule:

otherwise 0

fits if 1),(

fsyxg

Page 11: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

11

of

39Erosion Example

Structuring Element

Original Image Processed Image With Eroded Pixels

Page 12: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

12

of

39Erosion Example

Structuring Element

Original Image Processed Image

Page 13: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

13

of

39Erosion Example 1

Watch out: In these examples a 1 refers to a black pixel!

Original image Erosion by 3*3

square structuring

element

Erosion by 5*5

square structuring

element

Page 14: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

14

of

39Erosion Example 2

Original

image

After erosion

with a disc of

radius 10

After erosion

with a disc of

radius 20

After erosion

with a disc of

radius 5

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 15: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

15

of

39What Is Erosion For?

Erosion can split apart joined objects

Erosion can strip away extrusions

Watch out: Erosion shrinks objects

Erosion can split apart

Page 16: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

16

of

39Dilation

Dilation of image f by structuring element s is

given by f s

The structuring element s is positioned with

its origin at (x, y) and the new pixel value is

determined using the rule:

otherwise 0

hits if 1),(

fsyxg

Page 17: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

17

of

39Dilation Example

Structuring Element

Original Image Processed Image

Page 18: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

18

of

39Dilation Example

Structuring Element

Original Image Processed Image With Dilated Pixels

Page 19: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

19

of

39Dilation Example 1

Original image Dilation by 3*3

square structuring

element

Dilation by 5*5

square structuring

element

Watch out: In these examples a 1 refers to a black pixel!

Page 20: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

20

of

39Dilation Example 2

Structuring element

Original image After dilation

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 21: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

21

of

39What Is Dilation For?

Dilation can repair breaks

Dilation can repair intrusions

Watch out: Dilation enlarges objects

Page 22: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

22

of

39Compound Operations

More interesting morphological operations

can be performed by performing

combinations of erosions and dilations

The most widely used of these compound

operations are:

– Opening

– Closing

Page 23: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

23

of

39Opening

The opening of image f by structuring

element s, denoted f ○ s is simply an erosion

followed by a dilation

f ○ s = (f s) s

Original shape After erosion After dilation

(opening)

Note a disc shaped structuring element is usedIma

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 24: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

24

of

39Opening Example

Original

Image

Image

After

Opening

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 25: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

25

of

39Opening Example

Structuring Element

Original Image Processed Image

Page 26: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

26

of

39Opening Example

Structuring Element

Original Image Processed Image

Page 27: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

27

of

39Closing

The closing of image f by structuring

element s, denoted f • s is simply a dilation

followed by an erosion

f • s = (f s)s

Original shape After dilation After erosion

(closing)

Note a disc shaped structuring element is usedIma

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 28: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

28

of

39Closing Example

Original

Image

Image

After

Closing

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 29: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

29

of

39Closing Example

Structuring Element

Original Image Processed Image

Page 30: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

30

of

39Closing Example

Structuring Element

Original Image Processed Image

Page 31: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

31

of

39Morphological Processing Example

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 32: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

32

of

39Morphological Algorithms

Using the simple technique we have looked

at so far we can begin to consider some

more interesting morphological algorithms

We will look at:

– Boundary extraction

– Region filling

There are lots of others as well though:

– Extraction of connected components

– Thinning/thickening

– Skeletonisation

Page 33: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

33

of

39Boundary Extraction

Extracting the boundary (or outline) of an

object is often extremely useful

The boundary can be given simply as

β(A) = A – (AB)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 34: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

34

of

39Boundary Extraction Example

A simple image and the result of performing

boundary extraction using a square 3*3

structuring element

Original Image Extracted Boundary

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 35: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

35

of

39Region Filling

Given a pixel inside a boundary, region

filling attempts to fill that boundary with

object pixels (1s)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Given a point inside

here, can we fill the

whole circle?

Page 36: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

36

of

39Region Filling (cont…)

The key equation for region filling is

Where X0 is simply the starting point inside

the boundary, B is a simple structuring

element and Ac is the complement of A

This equation is applied repeatedly until Xk

is equal to Xk-1

Finally the result is unioned with the original

boundary

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

.....3,2,1 )( 1 kABXX c

kk

Page 37: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

37

of

39Region Filling Step By Step

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 38: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

38

of

39Region Filling Example

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Original Image One Region

Filled

All Regions

Filled

Page 39: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

39

of

39Summary

The purpose of morphological processing is

primarily to remove imperfections added during

segmentation

The basic operations are erosion and dilation

Using the basic operations we can perform

opening and closing

More advanced morphological operation can

then be implemented using combinations of all

of these

Page 40: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

40

of

39Structuring Elements, Hits & Fits

Page 41: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

41

of

39

HIT! F

IT!

Page 42: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

42

of

39

MISS!

MISS!

Page 43: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

43

of

39Erosion Example

Structuring Element

Page 44: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

44

of

39Dilation Example

Structuring Element

Page 45: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

45

of

39Opening Example

Structuring Element

Original Image Processed Image

Page 46: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

46

of

39Closing Example

Structuring Element

Original Image Processed Image

Page 47: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

47

of

39Region Filling Step By Step

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 48: Digital Image Processingdylucknow.weebly.com/uploads/6/7/3/1/6731187/morphological_op… · Morphological image processing (or morphology) describes a range of image processing techniques

48

of

39Region Filling Step By Step

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)