connected component labeling algorithm

38
DIGITAL IMAGE PROCESSING CONNECTED COMPONENT LABELING ALGORITHM Processing of Images which are Digital in nature by means of Digital Computer E C E D E P A R T M E N T

Upload: manas-mantri

Post on 07-Jul-2015

299 views

Category:

Education


2 download

DESCRIPTION

Digital image processing

TRANSCRIPT

Page 1: Connected component labeling algorithm

DIGITAL IMAGE PROCESSING

CONNECTED COMPONENT LABELING

ALGORITHM

Processing of Images which are Digital in nature by means of Digital Computer

ECEDEPARTMENT

Page 2: Connected component labeling algorithm

Connected Component Labeling

Ability to assign different labels to variousdisjoint component of an image is calledconnected component labeling.

This labeling is a fundamental step inautomated image analysis:

a) Shape

b) Area

c) Boundary

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 2

ECEDEPARTMENT

Page 3: Connected component labeling algorithm

Basic Scanning Method

Scan the image from left to right and top tobottom.

Assume 4-adjacency.

Let p be a pixel at any step in the scanningprocess.

Before p the pixel r and t are scanned.

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 3

ECEDEPARTMENT

r

t p

Page 4: Connected component labeling algorithm

Labeling Algorithm

This algorithm makes two passes over the image:

1. The first pass to assign temporary labels andrecord equivalence classes.

2. The second pass to replace each temporarylabel by the smallest label of its equivalenceclass.

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 4

ECEDEPARTMENT

Page 5: Connected component labeling algorithm

Steps in First PassConditions to check:

1. Does the pixel to the left (West) have the same value asthe current pixel?

Yes – We are in the same region. Assign the samelabel to the current pixel

No – Check next condition

2. Do both pixels to the North and West of the current pixelhave the same value as the current pixel but not the samelabel?

Yes –Assign the current pixel the minimum of theNorth and West labels, and record theirequivalence relationship

No – Check next condition

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 5

ECEDEPARTMENT

Page 6: Connected component labeling algorithm

Steps in First Pass..

3. Does the pixel to the left (West) have a differentvalue and the one to the North the same valueas the current pixel?

Yes – Assign the label of the North pixel tothe current pixel

No – Check next condition

4. Do the pixel's North and West neighbors havedifferent pixel values than current pixel?

Yes – Create a new label id and assign it tothe current pixel

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 6

ECEDEPARTMENT

Page 7: Connected component labeling algorithm

Steps in Second Pass

In the First pass we record some equivalencerelationships.

In Second Pass:

1. Process Equivalence pairs to formequivalent classes.

2. Re-label the element with the labelassigned to its equivalent classes.

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 7

ECEDEPARTMENT

Page 8: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 8

ECEDEPARTMENT

Page 9: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 9

ECEDEPARTMENT

1

Page 10: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 10

ECEDEPARTMENT

1 2

Page 11: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 11

ECEDEPARTMENT

1 2

1

Page 12: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 12

ECEDEPARTMENT

1 2

1 2

Page 13: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 13

ECEDEPARTMENT

1 2

1 2 3

Page 14: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 14

ECEDEPARTMENT

1 2

1 2 3 3

Page 15: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 15

ECEDEPARTMENT

1 2

1 2 3 3

1

Page 16: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 16

ECEDEPARTMENT

1 2

1 2 3 3

1 1

Page 17: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 17

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1

Page 18: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 18

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 (1,2) equivalent relation

Page 19: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 19

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4

Page 20: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 20

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 (3,4) equivalent relation

Page 21: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 21

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 3

Page 22: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 22

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 3 3

Page 23: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 23

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 3 3

1

Page 24: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 24

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 3 3

1 1

Page 25: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 25

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 3 3

1 1 3

Page 26: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 26

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 3 3

1 1 3 3

Page 27: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 27

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 3 3

1 1 3 3

5

Page 28: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 28

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 3 3

1 1 3 3

5 1 (1,5) equivalent relation

Page 29: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 29

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 3 3

1 1 3 3

5 1 3

Page 30: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 30

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 3 3

1 1 3 3

5 1 3 3

Page 31: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 31

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 3 3

1 1 3 3

5 1 3 3 3

Page 32: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 32

ECEDEPARTMENT

1 2

1 2 3 3

1 1 1 1 4 3 3 3

1 1 3 3

5 1 3 3 3

5

Page 33: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 33

ECEDEPARTMENT

1 1

1 2 3 3

1 1 1 1 4 3 3 3

1 1 3 3

5 1 3 3 3

5

1<= 1,2,5

Page 34: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 34

ECEDEPARTMENT

1 1

1 1 3 3

1 1 1 1 4 3 3 3

1 1 3 3

5 1 3 3 3

5

1<= 1,2,5

Page 35: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 35

ECEDEPARTMENT

1 1

1 1 3 3

1 1 1 1 3 3 3 3

1 1 3 3

5 1 3 3 3

5

3<= 3,4

Page 36: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 36

ECEDEPARTMENT

1 1

1 1 3 3

1 1 1 1 3 3 3 3

1 1 3 3

1 1 3 3 3

5

1<= 1,2,5

Page 37: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 37

ECEDEPARTMENT

1 1

1 1 3 3

1 1 1 1 3 3 3 3

1 1 3 3

1 1 3 3 3

1 1<= 1,2,5

Page 38: Connected component labeling algorithm

CENTURION INSTITUTE OF TECHNOLOGY, JATNI 38

ECEDEPARTMENT

1 1

1 1 3 3

1 1 1 1 3 3 3 3

1 1 3 3

1 1 3 3 3

1

Here we observed that the image contain two distinct class of regions