370 likes | 396 Views
Mathematical Morphology & Voting Filters. 姓名 : 陳慧敏 授課老師 : 張顧耀 教授 日期 :2007/6/12. outline. What is morphology? Dilation Erosion Mathematical Morphology Binary Filters Grayscale Filters Voting Filter Binary Median Filter Hole Filling Filter
E N D
Mathematical Morphology & Voting Filters 姓名:陳慧敏 授課老師:張顧耀 教授 日期:2007/6/12
outline • What is morphology? • Dilation • Erosion • Mathematical Morphology • Binary Filters • Grayscale Filters • Voting Filter • Binary Median Filter • Hole Filling Filter • Iterative Hole Filling Filter
What is morphology? • A range of methods that deal with (alter) structure and shape in images. • Dilation • Erosion => Fig.2.經過Dilation處理 Fig.1.原圖 => Fig.4.經過Erosion處理 Fig.3.原圖
Structuring element • Structuring element • a small array of pixels, each pixel to 0 or 1. • Example:
Dilation Fig.6.Structuring element Fig.5.原始影像
Dilation Fig.7.做完Dilation結果
Dilation Fig.8.原始影像 Fig.9.經過Dilation處理 Fig.10.Structuring element
Erosion Fig.12.Structuring element Fig.11.原始影像
Erosion Fig.13.做完Erosion結果
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
outline • What is morphology? • Dilation • Erosion • Mathematical Morphology • Binary Filters • Grayscale Filters • Voting Filter • Binary Median Filter • Hole Filling Filter • Iterative Hole Filling Filter
Mathematical Morphology • Binary Filters • Header #include "itkBinaryBallStructuringElement.h" #include "itkBinaryErodeImageFilter.h" #include "itkBinaryDilateImageFilter.h"
Mathematical Morphology • Structuring element 設定: structuringElementType structuringElement; structuringElement.SetRadius( 1 ); // 3x3 structuring element structuringElement.CreateStructuringElement(); binaryErode->SetKernel( structuringElement ); binaryDilate->SetKernel( structuringElement );
Mathematical Morphology • Grayscale Filters • 觀念、寫法與Binary Filters大致相同 #include "itkBinaryErodeImageFilter.h" 修改 #include "itkGrayscaleErodeImageFilter.h"
Input Image (DICOM) signed short unsigned char 型態轉換 binary Image type ? grayscale BinaryErodeImageFilter BinaryDilateImageFilter GrayscaleErodeImageFilter GrayscaleDilateImageFilter 設定 structuringElement 設定 structuringElement Binary threshold unsigned char signed short 型態轉換 Output image
Mathematical Morphology Fig.16.Effect of erosion and dilation in a binary image.
Mathematical Morphology Fig.17.Effect of erosion and dilation in a binary image. Radius =1
Mathematical Morphology Fig.18.Effect of erosion and dilation in a grayscale image.
Mathematical Morphology Fig.19.Effect of erosion and dilation in a grayscale image. Radius =1
outline • What is morphology? • Dilation • Erosion • Mathematical Morphology • Binary Filters • Grayscale Filters • Voting Filter • Binary Median Filter • Hole Filling Filter • Iterative Hole Filling Filter
Voting Filter • Counting the number of pixels in its neighborhood by applying a rule. • Binary Median Filter • Hole Filling Filter • Iterative Hole Filling Filter
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
Binary Median Filter • Header • #include "itkBinaryMedianImageFilter.h“ • indexRadius[0] = radiusX; // radius along x indexRadius[1] = radiusY; // radius along y filter->SetRadius( indexRadius );
Binary Median Filter Radius of 2,2 Fig.21. Effect of the BinaryMedianImageFilter on a slice from a MRI
Binary Median Filter Fig.23. Effect of the BinaryMedianImageFilter on a slice from a MRI Radius of 1,1
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) surpass the number of background neighbors (pixel value=0) by the majority value.
Hole Filling Filter Example: Neighborhood size : 3x3 majority threshold: 2 If foreground neighbors(=1) (3x3-1)/2+majority = 6 then background pixelconverting into a foreground pixel 01
Hole Filling Filter • Header #include "itkVotingBinaryHoleFillingImageFilter.h“ • 設定majority threshold • filter->SetMajorityThreshold( 2 );
Hole Filling Filter Fig.25.Effect of the VotingBinaryHoleFillingImageFilter on a slice from a MRI, radius1 ,2and 3 respectively, majority threshold=2
原圖 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
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.
Iterative Hole Filling Filter • To decide maximum number of iterations that this filter should be run. #include "itkVotingBinaryIterativeHoleFillingImageFilter.h“; filter->SetMaximumNumberOfIterations(numberOfIterations );
Iterative Hole Filling Filter Fig.27. Effect of 1, 10 and 20 iterations of the VotingBinaryIterativeHoleFillingImageFilter using a 3x3 window. majority threshold=2
5x5 window majority = 1 原圖 numberOfIterations=1 numberOfIterations=10 numberOfIterations=20
Input Image (DICOM) 型態轉換 signed short unsigned char BinaryMedianImageFilter VotingBinaryHoleFillingImageFilter VotingBinaryIterativeHoleFillingImageFilter indexRadius[0] = radiusX; // radius along x indexRadius[1] = radiusY; // radius along y Filter ? IterativeHoleFilling Median 設定MajorityThreshold HoleFilling 型態轉換 設定MajorityThreshold 設定重複做的次數 Output image Binary threshold
參考文獻 • ItkSoftwareGuide • 林國祥老師 投影片 • 數位影像處理 繆紹綱 譯