Professional Documents
Culture Documents
10-Citra Medis (Edge Detection)
10-Citra Medis (Edge Detection)
Morphological Operation
MATERIKULIAH– [9]:
PENGEMBANGAN APLIKASI INFORMATIKA MEDIS
Tim Pengajar:
Referensi Utama
Noah Snavely. Image Filtering.
2
Outline
3
Kasus
Penajaman Fitur
Citra Biner Fitur tepi objek nantinya dapat
Hasil segmentasi pada citra yang digunakan untuk menghitung
telah melewati Gaussian filtering. keliling sel
4
Sifat tepi
• Tepi objek merupakan posisi piksel yang nilai
intensitasnya berubah secara mencolok.
intensity function
image (along horizontal scanline) first derivative
edges correspond to
5
Source: L. Lazebnik extrema of derivative
Outline
6
Theory of Edge Detection
Ideal edge
y
B1 L(x, y ) = x sin θ − y cos θ + ρ = 0
B1 : L( x, y ) < 0
B2 t B2 : L( x, y ) > 0
x
Unit step function:
1 for t > 0
t
u (t ) = 1 for t = 0 u (t ) = ∫ δ (s )ds
2 −∞
0 for t < 0
• Squared gradient:
2 2
∂I ∂I
s( x, y ) = + = [(B2 − B1 )δ (x sin θ − y cosθ + ρ )]
2
∂x ∂y
Edge Magnitude: s ( x, y )
∂I ∂I
Edge Orientation: arctan / (normal of the edge)
∂y ∂x
8
Rotationally symmetric, non-linear operator
Theory of Edge Detection
• Image intensity (brightness):
∂x ∂y
Rotationally symmetric, linear operator
∂I ∂2I
I
∂x ∂x 2 zero-crossing
x
9
x x
Discrete Edge Operators
∂I 1
≈ ((I i+1, j +1 − I i, j +1 ) + (I i+1, j − I i, j )) I i , j +1 I i +1, j +1
∂x 2ε ε
∂I 1
≈ ((I i +1, j +1 − I i +1, j ) + (I i, j +1 − I i, j )) Ii, j I i +1, j
∂y 2ε
Convolution masks :
∂I 1 −1 1 ∂I 1 1 1
≈ ≈
∂x 2ε ∂y 2ε
−1 1 −1 −1
10
Discrete Edge Operators
• Second order partial derivatives:
2
I i −1, j +1 I i , j +1 I i +1, j +1
∂ I 1
2
≈ 2 (I i −1, j − 2 I i , j + I i +1, j )
∂x ε I i −1, j I i , j I i +1, j
∂2I 1
2
≈ 2 (I i , j −1 − 2 I i , j + I i , j +1 ) I i −1, j −1 I i , j −1 I i +1, j −1
∂y ε
• Laplacian :
2 ∂2I ∂2I
∇ I= 2+ 2
∂x ∂y
Convolution masks :
0 1 0 1 4 1
2 1 1
∇ I≈ 1 −4 1 or 4 − 20 4 (more accurate)
ε2 6ε 2
0 1 0 1 4 1
11
The Sobel Operators
• Better approximations of the gradients exist
-1 0 1 1 2 1
-2 0 2 0 0 0
-1 0 1 -1 -2 -1
12
Penerapan Deteksi Tepi dengan
Operator Sobel
• http://homepages.inf.ed.ac.uk/rbf/HIPR2/sob
el.htm
• Susun matriks kernel sx
• Susun matrix kernel sy
• Gx = konvolusi (I,sx)
• Gy = konvolusi (I,sy)
• Tepi = |Gx|+|Gy|
13
Hasil konvolusi dengan kernel sx
14
Hasil konvolusi dengan kernel sy
15
Hasil Penajaman Fitur Tepi dengan
Operator Sobel
16
17
Comparing Edge Operators
Good Localization
Gradient: Noise Sensitive
Poor Detection
Roberts (2 x 2): 0 1 1 0
-1 0 0 -1
Prewitt (3 x 3):
-1 0 1 1 1 1
-1 0 1 0 0 0
-1 0 1 -1 -1 1
Sobel (5 x 5):
-1 -2 0 2 1 1 2 3 2 1
-2 -3 0 3 2 2 3 5 3 2
Poor Localization
-3 -5 0 5 3 0 0 0 0 0
Less Noise Sensitive
-2 -3 0 3 2 -2 -3 -5 -3 -2 Good Detection
-1 -2 0 2 1 -1 -2 -3 -2 -1
18
Kernel gaussian
• Untuk penapisan derau, dengan kernel
gaussian.
• Untuk penegasan fitur, dapat digunakan
turunan fungsi Gaussian.
1st derivative 2nd derivative
Gaussian of Gaussian of Gaussian
19
Image derivatives
• How can we differentiate a digital image F[x,y]?
– Option 1: reconstruct a continuous image, f, then
compute the derivative
– Option 2: take discrete derivative (finite difference)
: 1 -1 : -1
1
20
Source: S. Seitz
Image gradient
• The gradient of an image:
The gradient points in the direction of most rapid increase in intensity
22
Derivative of Gaussian filter
x-direction y-direction
23
Outline
24
Operasi Morfologi
• http://homepages.inf.ed.ac.uk/rbf/HIPR2/morops.htm
• Menggunakan teori himpunan untuk memproses citra.
Tipe data citra yang digunakan biasanya binary.
• Dapat digunakan untuk deteksi tepi, penghilangan
derau, peningkatan citra, dan segmentasi.
• Operasi dasar yang sering digunakan adalah
erosion (mengikis objek) dan dilation (memperluas
objek).
• Prosesnya membutuhkan dua masukan: citra biner
dan structuring element ( kernel biner).
25
Mathematic Morphology
27
Basic Set Theory
28
Reflection and Translation
ˆ
B = {w | w ∈ −b, for b ∈ B}
( A) z = {c | c ∈ a + z, for a ∈ A}
29
Logic Operations
30
Example
31
Structuring element (SE)
32
Basic idea
• in parallel for each pixel in binary image:
– check if SE is ”satisfied”
– output pixel is set to 0 or 1 depending on used
operation
33
How to describe SE
• many different ways!
• information needed:
– position of origo for SE
– positions of elements belonging to SE
34
Basic morphological operations
• Erosion
• Dilation
– Opening object
– Closening background
35
Erosion
A − B = {z|(B)z ⊆ A}
shrink the object
36
Erosion
37
Erosion
38
Erosion
A − B = {z|(B)z ⊆ A}
39
Penerapan Erosi untuk deteksi tepi
• Susun matriks SE
• Terapkan operasi Erosion
Terkikis = (I,SE);
• Tepi = xor(Terkikis, I);
40
41
42
43
44
Perbandingan Tepi: Sobel vs Operasi
Morfologi
45
Dilation
A ⊕ B = { z|( Bˆ )z ∩ A ≠ Φ }
• grow the object
46
Dilation
47
Dilation
48
Dilation
B = structuring element
ˆ
A ⊕ B = {z|(B)z ∩ A ≠ Φ}
49
Dilation : Bridging gaps
50
useful
• erosion
– removal of structures of certain shape and size,
given by SE
• Dilation
– filling of holes of certain shape and size, given by
SE
51
Combining erosion and dilation
• WANTED:
– remove structures / fill holes
– without affecting remaining parts
• SOLUTION:
• combine erosion and dilation
• (using same SE)
52
Erosion : eliminating irrelevant detail
izzati@uii.ac.id
54