Chapter 9: Morphological Image Processingdylucknow.weebly.com/.../6731187/morphological...i.pdf ·...

Post on 17-Aug-2020

14 views 0 download

Transcript of Chapter 9: Morphological Image Processingdylucknow.weebly.com/.../6731187/morphological...i.pdf ·...

Morphological Image Processing

Presented By:Diwakar Yagyasen

Sr. LecturerCS&E, BBDNITM, Lucknow

Digital Image Processing

Preview

Morphology

About the form and structure of animals and plants

Mathematical morphology

Using set theory

Extract image component

Representation and description of region shape

2Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Preview (cont.)

Sets in mathematical morphology represent objects in an image

Example

Binary image: the elements of a set is the coordinate (x,y) of the pixels, in Z2

Gray-level image: the element of a set is the triple, (x, y, gray-value), in Z3

3Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Outline

Preliminaries – set theory

Dilation and erosion

Opening and closing

Hit-or-miss transformation

Some basic morphological algorithms

Extensions to gray-scale images

Binaryimages

4Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Preliminaries – set theory

A be a set in Z2.

a = (a1, a2) is an element of A.

a is not an element of A

Null (empty) set:

Aa

Aa

5Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Set theory (cont.)

Explicit expression of a set

Example:

naaaA ,...,, 21

elementsset for condition elementA

DddwwC for ,

1

2

6Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Set operations

A is a subset of B: every element of A is an element of another set B

Union

Intersection

Mutually exclusive

BA

BAC

BAC

BA

7Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Graphical examples

8Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Graphical examples (cont.)

AwwAc BwAwwBA ,

9Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Logic operations on binary images

Functionally complete operations

AND, OR, NOT

10Diwakar Yagyasen, Deptt of CSE,

BBDNITM

BA

BA

AB 11

Diwakar Yagyasen, Deptt of CSE, BBDNITM

Special set operationsfor morphology

translation

AazaccA z for ,)(

reflection

BbbwwB for ,ˆ

12Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Outline

Preliminaries

Dilation and erosion

Opening and closing

Hit-or-miss transformation

Some basic morphological algorithms

Extensions to gray-scale images

13Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Dilation

)ˆ( ABzBA z B:structuringelement

14Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Dilation: another formulation

AABzBA z )ˆ(

15Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Application of dilation: bridging gaps in images

Structuringelement

max. gap=2 pixels

Effects: increase size, fill gap

16Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Erosion

ABzBA z )(

z: displacement

B:structuringelement

17Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Erosion (cont.)

18Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Application of erosion: eliminate irrelevant detail

original image

Squares of size1,3,5,7,9,15 pels

erosion

Erode with13x13 square

dilation

19Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Dilation and erosion are duals

c

z

c ABzBA )( ) (

cc

z ABz )(

)( c

z ABz

)ˆ( ABzBA z

BAc ˆ

20Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Application: Boundary extraction

Extract boundary of a set A:

First erode A (make A smaller)

A – erode(A)

) ( BAA=

21Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Application: boundary extraction

Using 5x5 structuring elementoriginal image

22Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Outline

Preliminaries

Dilation and erosion

Opening and closing

Hit-or-miss transformation

Some basic morphological algorithms

Extensions to gray-scale images

23Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Opening

Dilation: expands image w.r.t structuring elements

Erosion: shrink image

erosion+dilation = original image ?

Opening= erosion + dilation

BBABA ) (

24Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Opening (cont.)

25Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Opening (cont.)

Smooth the contour of an image, breaks narrow isthmuses, eliminates thin protrusions

Find contour Fill in contour

26Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Closing

Dilation+erosion = erosion + dilation ?

Closing = dilation + erosion

BBABA )(

27Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Closing (cont.)

Find contour Fill in contour

Smooth the object contour, fuse narrow breaks and longthin gulfs, eliminate small holes, and fill in gaps

28Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Properties of opening and closing

Opening

Closing

ABA of (subimage)subset a is (i)

BDBCC ofsubset a is then D,ofsubset a is If (ii)

BABBA )( (iii)

BAA of (subimage)subset a is (i)

BDBCC ofsubset a is then D,ofsubset a is If (ii)

BABBA )( (iii)

29Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Noisyimage

opening

Removeouternoise

Removeinnernoise

closing

30Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Outline

Preliminaries

Dilation and erosion

Opening and closing

Hit-or-miss transformation

Some basic morphological algorithms

Extensions to gray-scale images

31Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Hit-or-miss transformation

Find the location of certain shape

erosion

Find the set of pixels thatcontain shape X

X

32Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Hit-or-miss transformation

Erosionwith (W-X)

Detect object via background

33Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Hit-or-miss transformation

Eliminate un-necessary parts

AND

34Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Outline

Preliminaries

Dilation and erosion

Opening and closing

Hit-or-miss transformation

Some basic morphological algorithms

Extensions to gray-scale images

35Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Basic morphological algorithms

Extract image components that are useful in the representation and description of shape

Boundary extraction

Region filling

Extract of connected components

Convex hull

Thinning

Thickening

Skeleton

Pruning

36Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Region filling

How?

Idea: place a point inside the region, then dilate that point iteratively

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

kk

pX 0

Until 1 kk XX

Bound the growth

37Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Region filling (cont.)

stop38

Diwakar Yagyasen, Deptt of CSE, BBDNITM

Application: region filling

Original image

The first filledregion

Fill all regions

39Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Extraction of connected components

Idea: start from a point in the connected component, and dilate it iteratively

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

pX 0

Until 1 kk XX

40Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Extraction of connected components (cont.)

41Diwakar Yagyasen, Deptt of CSE,

BBDNITM

original

thresholding

erosion

42Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Skeletons

Set A Maximum disk

1. The largest disk Centered at a pixel2. Touch the boundaryof A at two or more places

Recall: Balls of erosion!

How to define a Skeletons?

43Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Skeleton

Idea: erosion

Erosion k 次直到空集合

44Diwakar Yagyasen, Deptt of CSE,

BBDNITM

45Diwakar Yagyasen, Deptt of CSE,

BBDNITM

Problem

The scanned image is not adjusted well

How to detection the direction of lines?

How to rotate?

46Diwakar Yagyasen, Deptt of CSE,

BBDNITM