fast algorithms for binary morphological operations using

48
Fast algorithms for binary morphological operations using run-length encoding Gregor Ehrensperger Universit¨ at Innsbruck :: Datacon Technology Workshop Bad Herrenalb 15 02 13 [email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 1

Upload: others

Post on 11-Feb-2022

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Fast algorithms for binary morphological operations using

Fast algorithms for binary morphologicaloperations using run-length encoding

Gregor Ehrensperger

Universitat Innsbruck :: Datacon Technology

Workshop Bad Herrenalb15 02 13

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 1

Page 2: Fast algorithms for binary morphological operations using

1 Examples

2 Definitions

3 ErosionVariant 1Variant 2

4 Dilation

5 Run-time Analysis

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 2

Page 3: Fast algorithms for binary morphological operations using

example 1/4 - barcode

image source: Datacon [email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 3

Page 4: Fast algorithms for binary morphological operations using

example 1/4 - barcode

image source: Datacon [email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 3

Page 5: Fast algorithms for binary morphological operations using

example 2/4 - bump inspection

image source: Datacon [email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 4

Page 6: Fast algorithms for binary morphological operations using

example 3/4 - glue

image source: Datacon [email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 5

Page 7: Fast algorithms for binary morphological operations using

example 4/4

image source: http://www.imageprocessingplace.com/[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 6

Page 8: Fast algorithms for binary morphological operations using

1 Examples

2 Definitions

3 ErosionVariant 1Variant 2

4 Dilation

5 Run-time Analysis

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 7

Page 9: Fast algorithms for binary morphological operations using

binary images

raster graphic:{(0, 0), (0, 1), (0, 2), (1, 2), (1, 3), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (4, 1), (4, 2), (4, 3)}

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 8

Page 10: Fast algorithms for binary morphological operations using

binary images

raster graphic:{(0, 0), (0, 1), (0, 2), (1, 2), (1, 3), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (4, 1), (4, 2), (4, 3)}

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 8

Page 11: Fast algorithms for binary morphological operations using

erosion and dilation

erosion and dilation

εB(X ) ={p ∈ Z2 | Bp ⊆ X

}

B

XεB(X )

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 9

Page 12: Fast algorithms for binary morphological operations using

erosion and dilation

erosion and dilation

εB(X ) ={p ∈ Z2 | Bp ⊆ X

}and δB(X ) =

{p ∈ Z2 | (B t)p ∩ X 6= ∅

}

B

X

δB(X )

εB(X )

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 9

Page 13: Fast algorithms for binary morphological operations using

binary images

raster graphic: {(0, 0), (0, 1), (0, 2), (1, 2), (1, 3), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (4, 1), (4, 2), (4, 3)}

run-length encoding:〈0, 2, 0〉 ∪ 〈2, 3, 1〉 ∪ 〈0, 1, 3〉 ∪ 〈3, 4, 3〉 ∪ 〈1, 3, 4〉

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 10

Page 14: Fast algorithms for binary morphological operations using

binary images

raster graphic: {(0, 0), (0, 1), (0, 2), (1, 2), (1, 3), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (4, 1), (4, 2), (4, 3)}

run-length encoding:〈0, 2, 0〉 ∪ 〈2, 3, 1〉 ∪ 〈0, 1, 3〉 ∪ 〈3, 4, 3〉 ∪ 〈1, 3, 4〉

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 10

Page 15: Fast algorithms for binary morphological operations using

binary images

raster graphic: {(0, 0), (0, 1), (0, 2), (1, 2), (1, 3), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (4, 1), (4, 2), (4, 3)}

run-length encoding:〈0, 2, 0〉 ∪ 〈2, 3, 1〉 ∪ 〈0, 1, 3〉 ∪ 〈3, 4, 3〉 ∪ 〈1, 3, 4〉

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 10

Page 16: Fast algorithms for binary morphological operations using

binary images

raster graphic: {(0, 0), (0, 1), (0, 2), (1, 2), (1, 3), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (4, 1), (4, 2), (4, 3)}

run-length encoding:〈0, 2, 0〉 ∪ 〈2, 3, 1〉 ∪ 〈0, 1, 3〉 ∪ 〈3, 4, 3〉 ∪ 〈1, 3, 4〉

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 10

Page 17: Fast algorithms for binary morphological operations using

1 Examples

2 Definitions

3 ErosionVariant 1Variant 2

4 Dilation

5 Run-time Analysis

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 11

Page 18: Fast algorithms for binary morphological operations using

1 Examples

2 Definitions

3 ErosionVariant 1Variant 2

4 Dilation

5 Run-time Analysis

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 12

Page 19: Fast algorithms for binary morphological operations using

erosion variant 1 (compare Machado and Hashimoto [2009])

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 13

Page 20: Fast algorithms for binary morphological operations using

erosion variant 1 (compare Machado and Hashimoto [2009])

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 13

Page 21: Fast algorithms for binary morphological operations using

erosion variant 1 (compare Machado and Hashimoto [2009])

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 13

Page 22: Fast algorithms for binary morphological operations using

erosion variant 1 (compare Machado and Hashimoto [2009])

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 13

Page 23: Fast algorithms for binary morphological operations using

erosion variant 1 (compare Machado and Hashimoto [2009])

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 13

Page 24: Fast algorithms for binary morphological operations using

erosion variant 1 (compare Machado and Hashimoto [2009])

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 13

Page 25: Fast algorithms for binary morphological operations using

1 Examples

2 Definitions

3 ErosionVariant 1Variant 2

4 Dilation

5 Run-time Analysis

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 14

Page 26: Fast algorithms for binary morphological operations using

erosion variant 2

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 15

Page 27: Fast algorithms for binary morphological operations using

erosion variant 2

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 15

Page 28: Fast algorithms for binary morphological operations using

erosion variant 2

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 15

Page 29: Fast algorithms for binary morphological operations using

erosion variant 2

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 15

Page 30: Fast algorithms for binary morphological operations using

erosion variant 2

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 15

Page 31: Fast algorithms for binary morphological operations using

erosion variant 2

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 15

Page 32: Fast algorithms for binary morphological operations using

erosion variant 2

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 15

Page 33: Fast algorithms for binary morphological operations using

1 Examples

2 Definitions

3 ErosionVariant 1Variant 2

4 Dilation

5 Run-time Analysis

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 16

Page 34: Fast algorithms for binary morphological operations using

dilation

δB(X ) =(

(εBt (X c))c

B

X

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 17

Page 35: Fast algorithms for binary morphological operations using

dilation

δB(X ) =(

(εBt (X c))c

B

X

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 17

Page 36: Fast algorithms for binary morphological operations using

dilation

δB(X ) =(

(εBt (X c))c

B

X

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 17

Page 37: Fast algorithms for binary morphological operations using

dilation

δB(X ) =(

(εBt (X c))c

B

X

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 17

Page 38: Fast algorithms for binary morphological operations using

1 Examples

2 Definitions

3 ErosionVariant 1Variant 2

4 Dilation

5 Run-time Analysis

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 18

Page 39: Fast algorithms for binary morphological operations using

run-time analysis (1/5)

image source: http://www.imageprocessingplace.com/[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 19

Page 40: Fast algorithms for binary morphological operations using

run-time analysis (2/5) - erosion

0 50 100 150 200 250 300

0

500

1000

1500

size of the square-shaped structuring element

run

-tim

e[m

s]

MachadoOpenCVEhren2

0 50 100 150 200 250 300

0

500

1000

1500

size of the diamond-shaped structuring element

run

-tim

e[m

s]

MachadoOpenCVEhren2

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 20

Page 41: Fast algorithms for binary morphological operations using

run-time analysis (2/5) - erosion

0 50 100 150 200 250 300

0

500

1000

1500

size of the square-shaped structuring element

run

-tim

e[m

s]

MachadoOpenCVEhren2

0 50 100 150 200 250 300

0

500

1000

1500

size of the diamond-shaped structuring element

run

-tim

e[m

s]

MachadoOpenCVEhren2

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 20

Page 42: Fast algorithms for binary morphological operations using

run-time analysis (3/5) - dilation

0 50 100 150 200 250 300

0

200

400

600

800

size of the square-shaped structuring element

run

-tim

e[m

s]

dOpenCVdEhren

0 50 100 150 200 250 300

0

500

1000

1500

2000

size of the diamond-shaped structuring element

run

-tim

e[m

s]

dOpenCVdEhren

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 21

Page 43: Fast algorithms for binary morphological operations using

run-time analysis (3/5) - dilation

0 50 100 150 200 250 300

0

200

400

600

800

size of the square-shaped structuring element

run

-tim

e[m

s]

dOpenCVdEhren

0 50 100 150 200 250 300

0

500

1000

1500

2000

size of the diamond-shaped structuring element

run

-tim

e[m

s]

dOpenCVdEhren

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 21

Page 44: Fast algorithms for binary morphological operations using

run-time analysis (4/5) - circle-shaped SE

0 50 100 150 200 250 3000

2000

4000

6000

size of the circle-shaped structuring element

run

-tim

e[m

s]

OpenCVdOpenCVEhren2dEhren

0 100 200 3000

200

400

size of the circle-shaped structuring element

run

-tim

e[m

s]

Ehren2dEhren

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 22

Page 45: Fast algorithms for binary morphological operations using

run-time analysis (4/5) - circle-shaped SE

0 50 100 150 200 250 3000

2000

4000

6000

size of the circle-shaped structuring element

run

-tim

e[m

s]

OpenCVdOpenCVEhren2dEhren

0 100 200 3000

200

400

size of the circle-shaped structuring element

run

-tim

e[m

s]Ehren2dEhren

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 22

Page 46: Fast algorithms for binary morphological operations using

run-time analysis (5/5) - circle-shaped SE

0 100 200 300

50

100

150

size of the circle-shaped structuring element

run

-tim

e[m

s]

dist. transf.erode v2

0 100 200 300

100

200

300

size of the circle-shaped structuring element

run

-tim

e[m

s]

dist. transf.dilate

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 23

Page 47: Fast algorithms for binary morphological operations using

run-time analysis (5/5) - circle-shaped SE

0 100 200 300

50

100

150

size of the circle-shaped structuring element

run

-tim

e[m

s]

dist. transf.erode v2

0 100 200 300

100

200

300

size of the circle-shaped structuring element

run

-tim

e[m

s]

dist. transf.dilate

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 23

Page 48: Fast algorithms for binary morphological operations using

Gregor Ehrensperger. Schnelle Algorithmen zur Berechnung von Erosionund Dilatation auf lauflangenkodierten Binarbildern. Master’s thesis,University of Innsbruck, 2012.

Wook-Joong Kim, Seong-Dae Kim, and Kyuheon Kim. Fast algorithmsfor binary dilation and erosion using run-length encoding. Electronicsand Telecommunications Research Institute Journal, 27(6):814–817,2005. URL http://dx.doi.org/10.4218/etrij.05.0205.0013.

Anderson Fraiha Machado and Ronaldo Fumio Hashimoto. Jump-missbinary erosion algorithm. In SIBGRAPI 2009, Proceedings of the XXIIBrazilian Symposium on Computer Graphics and Image Processing,Rio de Janeiro, Brazil, 11-15 October 2009, pages 149–155. IEEEComputer Society, 2009.

[email protected] G. Ehrensperger Fast algorithms for morphological operations using RLE 24