You are on page 1of 48

X L NH S

X l hnh thi hc (Morphological)

2 of 39

Ni dung
Sau khi phn on, chng ta c th s dng cc thao tc morphological loi b cha hon ho trong qu trnh phn on v cung cp thng tin v dng v cu trc ca nh Phn ny, chng ta s xt n
Th no l morphology? Cc thao tc morphological n gin Cc thao tc kt hp Cc thut ton Morphological

3 of 39

1, 0, Black, White?
Trong cc slide sau, c th hon i vic s dng 0 v 1 ch trng v en Trong cc phn sau, chng ta gi thit l thc hin phn on nh v 0 biu din cc pixel nn, 1 biu din cc pixel ca cc i tng

4 of 39

Morphology l g?
X l nh Morphological (or morphology) m t mt dy cc k thut x l nh lin quan n hnh dng (morphology) v cc c im trn nh Cc thao tc Morphological tng c s dng loi b khng hon thin trong qu trnh phn on, do vy thng lm vic vi nh 2 mc

5 of 39

V d

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Image after segmentation

Image after segmentation and morphological processing

6 of 39

Phn t cu trc, Hits & Fits


B
Phn t cu trc

Fit: Tt c cc pixel nm trn phn t cu trc che ph tt c cc pixel trn A nh C Hit: Pixel bt k trn phn t cu trc cho ph mt pixel trn nh Tt c cc theo tc x l morphological u da trn tng c bn ny

7 of 39

Phn t cu trc
Phn t cu trc c th c kch thc v hnh dng bt k Tuy nhin, chng ta s s dng phn t cu trc vung vi tm ng pixel gia
0 0
1 1 1 0

1
1 1 1 1

0
1 1 1 0

0
0 1 0 0

1 1 1

1 1 1

1 1 1

0 1

1 1

0 1

0 1 0 0

8 of 39

Fitting & Hitting


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

0
0

0
0

0
1

1
1 B

1
1

0
1

0
1

0
0

0
0 C

0
0

0
0

0
0

1 1 1

1 1 1

1 1 1

0
0 0 0 0 0 0

1
1 0 0 0 0 0

1
1 1 1 1 0 0

1
1 1 1 1 0 0

1
1 1 1 1 0 0

1
1 1 1 1 1 0

1
1 1 1 1 1 0

1
1 1 1 1 A 1 0

0
0 0 1 1 1 0

0
0 0 0 1 1 0

0
0 0 0 1 1 0

0
0 0 0 0 0 0

Structuring Element 1

0 1 0

1 1 1

0 1 0

Structuring Element 2

9 of 39

Cc thao tc c bn
V c bn, x l morphological ging lc khng gian Phn t cu trc dch qua mi pixel trn nh ban u v to ra pixel nh sau khi x l Gi tr ca pixel to ra ph thuc vo thao tc thc hin C hai thao tc morphological c bn: erosion v dilation

10 of 39

Erosion
Erosion ca nh f s dng phn t cu trc s c nh ngha bi f s Phn t cu trc c nh v ti v tr (x, y) trn nh v gi tr mi ti v tr ny c xc nh bi qui tc :

g ( x, y)

1 if s fits f 0 otherwise

11 of 39 Original Image

V d Erosion
Processed Image With Eroded Pixels

Structuring Element

12 of 39 Original Image

V d Erosion
Processed Image

Structuring Element

13 of 39

V d Erosion

Original image

Erosion by 3*3 square structuring element

Erosion by 5*5 square structuring element

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

14 of 39

V d Erosion

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Original image

After erosion with a disc of radius 10

After erosion with a disc of radius 5

After erosion with a disc of radius 20

15 of 39

ng dng ca Erosion?
Erosion c th tch cc i tng ni nhau

Erosion can split apart

Erosion c th loi b cc extrusions

Watch out: Erosion lm mng i tng

16 of 39

Dilation
Dilation a nh f vi phn t cu trc s nh nh ngha sau f s Phn t cu trc c nh v ti (x, y) v gi tr mi ca im nh c xc nh bi:

g ( x, y)

1 if s hits f 0 otherwise

17 of 39 Original Image

V d Dilation
Processed Image

Structuring Element

18 of 39 Original Image

V d Dilation
Processed Image With Dilated Pixels

Structuring Element

19 of 39

V d Dilation

Original image

Dilation by 3*3 square structuring element

Dilation by 5*5 square structuring element

Watch out: 1 dng ch pixel mu en

20 of 39

V d Dilation
Original image After dilation

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Structuring element

21 of 39

ng dng ca Dilation
Dilation c th khc phc cc nt t

Dilation c th hiu intrusions

Watch out: Dilation lm to i tng

22 of 39

Thao tc kt hp
Kt hp erosions v dilations to ra cc thao tc morphological th v Thao tc kt hp hay dng gm:
Opening Closing

23 of 39

Opening
M (opening) ca mt nh f s dng phn t cu trc s, k hiu f s gm php erosion, tip theo l php dilation f s = (f s) s

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Original shape

After erosion

After dilation (opening)

Ch : s dng phn t cu trc dng a

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

24 of 39

Image After Opening Original Image

V d Opening

25 of 39 Original Image

V d Opening
Processed Image

Structuring Element

26 of 39 Original Image

V d Opening
Processed Image

Structuring Element

27 of 39

Closing
Closing ca nh f s dng phn t cu trc s, c nh ngha f s gm thao tc dilation, tip theo l erosion f s = (f s)s

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Original shape

After dilation

After erosion (closing)

Note a disc shaped structuring element is used

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

28 of 39

Original Image

Image After Closing

V d Closing

29 of 39 Original Image

V d Closing
Processed Image

Structuring Element

30 of 39 Original Image

V d Closing
Processed Image

Structuring Element

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

31 of 39

V d x l Morphological

32 of 39

Cc thut ton Morphological


S dng cc k thut trn, chng ta c th xt n cc thut ton morphological th v:
Tch bin Lp y cc vng

V cc thut ton khc:


Tch cc thnh phn kt ni Lm mng/dy Tch xng nh

33 of 39

Tch bin
Tch bin ca mt i tng thng rt th v Bin ca i tng c th biu din (A) = A (AB)

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

34 of 39

V d tch bin
V d nh ban u v nh tch bin s dng phn t cu trc vung c kch thc 3*3

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Original Image

Extracted Boundary

35 of 39

Lp y vng
Vi mt im cho trc bn trong mt vng, lp y vng s (region filling) s in bin vi cc pixel ca i tng

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Given a point inside here, can we fill the whole circle?

36 of 39

Lp y vng (tt)
Hm dng lp y vng
c

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Xk

(Xk

B)

k 1,2,3.....

Vi X0 l im ban u bn trong i tng bin, B l phn t cu trc v Ac l phn b ca A Hm ny c p dng li i lp li cho n khi Xk = Xk-1 Kt qu cui cng c hp vi bin ban u

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

37 of 39

Lp y vng : tng bc

38 of 39

V d lp y vng

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Original Image

One Region Filled

All Regions Filled

39 of 39

Tm tt
Mc ch ca x l morphological nhm loi b cc khng hon thin xut hin trong qu trnh phn on nh Cc thao tc c bn l erosion v dilation S dng cc thao tc c bn, chng ta c th thc hin opening v closing C th ci t cc tho tc morphological nng cao bng cch kt hp cc thao tc trn

40 of 39

Phn t cu trc, Hits & Fits

41 of 39

HIT!

FIT!

42 of 39

MISS!

MISS!

43 of 39

V d Erosion

Structuring Element

44 of 39

V d Dilation

Structuring Element

45 of 39 Original Image

V d Opening
Processed Image

Structuring Element

46 of 39 Original Image

V d Closing
Processed Image

Structuring Element

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

47 of 39

Lp y vng : tng bc

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

48 of 39

Lp y vng : tng bc

You might also like