mathematical morphology & voting filters 姓名 : 陳慧敏 授課老師 : 張顧耀 教授...
TRANSCRIPT
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
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 處理
4
Structuring element
Structuring element– a small array of pixels, each pixel to 0 or 1.
Example:
5
Dilation
Fig.6.Structuring element
Fig.5. 原始影像
6
Dilation
Fig.7. 做完 Dilation 結果
7
Dilation
Fig.8. 原始影像 Fig.9. 經過 Dilation 處理
Fig.10.Structuring element
8
Erosion
Fig.11. 原始影像
Fig.12.Structuring element
9
Erosion
Fig.13. 做完 Erosion 結果
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
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
12
Mathematical Morphology
Binary Filters– Header
#include "itkBinaryBallStructuringElement.h"
#include "itkBinaryErodeImageFilter.h" #include "itkBinaryDilateImageFilter.h"
13
Mathematical Morphology
Structuring element 設定 : structuringElementType structuringElement; structuringElement.SetRadius( 1 ); // 3x3 structuring element structuringElement.CreateStructuringElement(); binaryErode->SetKernel( structuringElement ); binaryDilate->SetKernel( structuringElement );
14
Mathematical Morphology
Grayscale Filters– 觀念、寫法與 Binary Filters 大致相同
#include "itkBinaryErodeImageFilter.h" 修改
#include "itkGrayscaleErodeImageFilter.h"
15
Input Image (DICOM)
型態轉換 signed short unsigned char
Image type?
BinaryErodeImageFilterBinaryDilateImageFilter
GrayscaleErodeImageFilterGrayscaleDilateImageFilter
binary grayscale
設定 structuringElement
Binary threshold
設定 structuringElement
型態轉換 unsigned char signed short
Output image
16
Mathematical Morphology
Fig.16.Effect of erosion and dilation in a binary image.
17
Mathematical Morphology
Fig.17.Effect of erosion and dilation in a binary image.
Radius =1
18
Mathematical Morphology
Fig.18.Effect of erosion and dilation in a grayscale image.
19
Mathematical Morphology
Fig.19.Effect of erosion and dilation in a grayscale image.
Radius =1
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
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
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
23
Binary Median Filter
Header– #include "itkBinaryMedianImageFilter.h“
indexRadius[0] = radiusX; // radius along x indexRadius[1] = radiusY; // radius along y filter->SetRadius( indexRadius );
24
Binary Median Filter
Fig.21. Effect of the BinaryMedianImageFilter on a slice from a MRI
Radius of 2,2
25
Binary Median Filter
Fig.23. Effect of the BinaryMedianImageFilter on a slice from a MRIRadius of 1,1
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.
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
28
Hole Filling Filter
Header#include "itkVotingBinaryHoleFillingImageFilter.h“
設定 majority threshold– filter->SetMajorityThreshold( 2 );
29
Hole Filling Filter
Fig.25.Effect of the VotingBinaryHoleFillingImageFilter on a slice from a MRI, radius1 ,2and 3 respectively, majority threshold=2
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
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.
32
Iterative Hole Filling Filter
To decide maximum number of iterations that this filter should be run.
#include "itkVotingBinaryIterativeHoleFillingImageFilter.h“;
filter->SetMaximumNumberOfIterations(numberOfIterations );
33
Iterative Hole Filling Filter
Fig.27. Effect of 1, 10 and 20 iterations of the VotingBinaryIterativeHoleFillingImageFilter using a 3x3 window.
majority threshold=2
34
原圖 numberOfIterations=1
numberOfIterations=10 numberOfIterations=20
5x5 window
majority = 1
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
36
參考文獻
ItkSoftwareGuide
林國祥老師 投影片數位影像處理 繆紹綱 譯
37
The end