mathematical morphology & voting filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授...

37
Mathematical Morphology & Voting Filters 姓姓 : 姓姓姓 姓姓姓姓 : 姓姓姓 姓姓 姓姓 :2007/6/12

Upload: eleanor-hensley

Post on 17-Dec-2015

266 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

Mathematical Morphology & Voting Filters

姓名 : 陳慧敏授課老師 : 張顧耀 教授日期 :2007/6/12

Page 2: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

2

outline

What is morphology?– Dilation– Erosion

Mathematical Morphology– Binary Filters– Grayscale Filters

Voting Filter– Binary Median Filter– Hole Filling Filter– Iterative Hole Filling Filter

Page 3: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

3

What is morphology?

A range of methods that deal with (alter) structure and shape in images.– Dilation

– Erosion

=>

Fig.1. 原圖

Fig.2. 經過 Dilation 處理

=>Fig.3. 原圖

Fig.4. 經過 Erosion 處理

Page 4: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

4

Structuring element

Structuring element– a small array of pixels, each pixel to 0 or 1.

Example:

Page 5: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

5

Dilation

Fig.6.Structuring element

Fig.5. 原始影像

Page 6: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

6

Dilation

Fig.7. 做完 Dilation 結果

Page 7: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

7

Dilation

Fig.8. 原始影像 Fig.9. 經過 Dilation 處理

Fig.10.Structuring element

Page 8: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

8

Erosion

Fig.11. 原始影像

Fig.12.Structuring element

Page 9: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

9

Erosion

Fig.13. 做完 Erosion 結果

Page 10: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

10

Dilation & Erosion

Dilation:

Fig.14. Original, dilated by 3x3 square, dilated by 5x5 square

Erosion:

Fig.15. Original, dilated by 3x3 square, dilated by 5x5 square

Page 11: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

11

outline

What is morphology?– Dilation– Erosion

Mathematical Morphology– Binary Filters– Grayscale Filters

Voting Filter– Binary Median Filter– Hole Filling Filter– Iterative Hole Filling Filter

Page 12: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

12

Mathematical Morphology

Binary Filters– Header

#include "itkBinaryBallStructuringElement.h"

#include "itkBinaryErodeImageFilter.h" #include "itkBinaryDilateImageFilter.h"

Page 13: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

13

Mathematical Morphology

Structuring element 設定 : structuringElementType structuringElement; structuringElement.SetRadius( 1 ); // 3x3 structuring element structuringElement.CreateStructuringElement(); binaryErode->SetKernel( structuringElement ); binaryDilate->SetKernel( structuringElement );

Page 14: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

14

Mathematical Morphology

Grayscale Filters– 觀念、寫法與 Binary Filters 大致相同

#include "itkBinaryErodeImageFilter.h" 修改

#include "itkGrayscaleErodeImageFilter.h"

Page 15: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

15

Input Image (DICOM)

型態轉換 signed short unsigned char

Image type?

BinaryErodeImageFilterBinaryDilateImageFilter

GrayscaleErodeImageFilterGrayscaleDilateImageFilter

binary grayscale

設定 structuringElement

Binary threshold

設定 structuringElement

型態轉換 unsigned char signed short

Output image

Page 16: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

16

Mathematical Morphology

Fig.16.Effect of erosion and dilation in a binary image.

Page 17: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

17

Mathematical Morphology

Fig.17.Effect of erosion and dilation in a binary image.

Radius =1

Page 18: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

18

Mathematical Morphology

Fig.18.Effect of erosion and dilation in a grayscale image.

Page 19: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

19

Mathematical Morphology

Fig.19.Effect of erosion and dilation in a grayscale image.

Radius =1

Page 20: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

20

outline

What is morphology?– Dilation– Erosion

Mathematical Morphology– Binary Filters– Grayscale Filters

Voting Filter– Binary Median Filter– Hole Filling Filter– Iterative Hole Filling Filter

Page 21: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

21

Voting Filter

Counting the number of pixels in its neighborhood by applying a rule.– Binary Median Filter– Hole Filling Filter– Iterative Hole Filling Filter

Page 22: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

22

Binary Median Filter

Binary Median Filter– robust approach for noise reduction– optimize the execution of the filter

0 0 0 0 0 0 1 1 1

median

Page 23: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

23

Binary Median Filter

Header– #include "itkBinaryMedianImageFilter.h“

indexRadius[0] = radiusX; // radius along x indexRadius[1] = radiusY; // radius along y filter->SetRadius( indexRadius );

Page 24: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

24

Binary Median Filter

Fig.21. Effect of the BinaryMedianImageFilter on a slice from a MRI

Radius of 2,2

Page 25: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

25

Binary Median Filter

Fig.23. Effect of the BinaryMedianImageFilter on a slice from a MRIRadius of 1,1

Page 26: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

26

Hole Filling Filter

Hole Filling Filter– smoothing contours– filling holes in binary images

Converting a background pixel into a foreground pixel by majority threshold.– if the number of foreground neighbors(pixel value=1) su

rpass the number of background neighbors (pixel value=0) by the majority value.

Page 27: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

27

Hole Filling Filter

Neighborhood size : 3x3

majority threshold: 2

Example:

If foreground neighbors(=1) (3x3-1)/2+majority = 6

then background pixel converting into a foreground pixel

0 1

Page 28: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

28

Hole Filling Filter

Header#include "itkVotingBinaryHoleFillingImageFilter.h“

設定 majority threshold– filter->SetMajorityThreshold( 2 );

Page 29: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

29

Hole Filling Filter

Fig.25.Effect of the VotingBinaryHoleFillingImageFilter on a slice from a MRI, radius1 ,2and 3 respectively, majority threshold=2

Page 30: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

30

Radius=1

Radius=2 Radius=3

原圖

Fig.26.Effect of the VotingBinaryHoleFillingImageFilter on a slice from a MRI, radius1 ,2and 3 respectively , majority threshold=1

Page 31: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

31

Iterative Hole Filling Filter

Iterative Hole Filling Filter– smoothing contours– filling holes in binary images

The filter can be used in an iterative way, by applying it repeatedly until no pixel changes.

Page 32: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

32

Iterative Hole Filling Filter

To decide maximum number of iterations that this filter should be run.

#include "itkVotingBinaryIterativeHoleFillingImageFilter.h“;

filter->SetMaximumNumberOfIterations(numberOfIterations );

Page 33: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

33

Iterative Hole Filling Filter

Fig.27. Effect of 1, 10 and 20 iterations of the VotingBinaryIterativeHoleFillingImageFilter using a 3x3 window.

majority threshold=2

Page 34: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

34

原圖 numberOfIterations=1

numberOfIterations=10 numberOfIterations=20

5x5 window

majority = 1

Page 35: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

35

Input Image (DICOM)

型態轉換 signed short unsigned char

BinaryMedianImageFilter VotingBinaryHoleFillingImageFilter VotingBinaryIterativeHoleFillingImageFilter

indexRadius[0] = radiusX; // radius along xindexRadius[1] = radiusY; // radius along y

Binary threshold

設定 MajorityThreshold 設定重複做的次數

Filter ?Median IterativeHoleFilling

HoleFilling

設定 MajorityThreshold

型態轉換

Output image

Page 36: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

36

參考文獻

ItkSoftwareGuide

林國祥老師 投影片數位影像處理 繆紹綱 譯

Page 37: Mathematical Morphology & Voting Filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12

37

The end