AREA PROCESS Area processes use the input pixel as well as the pixels around it to generate a new ouput pixel Topik Bahasan – Konvolusi (convolution) – Filtering (nonmask convolution) – Filter Morfologis
Pengolahan Citra Dijital
3.1
Setiawan Hadi
KONVOLUSI
• Konvolusi diskrit
banyak digunakan dalam pengolahan citra untuk image smoothing, edge detection dan efek-efek lainnya
• Konvolusi dilakukan tetangga
berdasarkan jumlah bobot dari piksel-piksel
• Bobot ditentukan
berdasarkan ukuran window berupa matriks berukuran kecil yang biasa disebut convolution mask atau convolution kernel
• Orde matriks
biasanya ganjil sehingga hasil konvolusi tepat berada di tengah-tengah
• Window atau disebut juga sliding window bergerak sepanjang piksel yang ada pada citra
• Perlu diperhatikan
bahwa nilai piksel hasil konvolusi JANGAN disertakan pada perhitungan konvolusi piksel berikutnya.
• Semakin
besar ukuran window, beban komputasi akan semakin meningkat Pengolahan Citra Dijital
3.2
Setiawan Hadi
Formulasi Matematika I ' ( x, y ) I ( x, y ) * W ( x, y )
I (u, v)W (u x, v y)
u v
Pengolahan Citra Dijital
3.3
Setiawan Hadi
Image Filtering
1
6
3
2
9
1/9
1/9
1/9
2
11
3
10
0
1/9
1/9
1/9
5
10
6
9
7
1/9
1/9
1/9
3
1
0
2
8
4
4
2
9
Filter/mask/ operator
New value: 6/9 + 9/9 + 7/9 + 0/9 + 2/9 + 8/9 + 2/9 + 9/9 + 10/9 = 5.889
10
Image
Pengolahan 03Citra Dijital
3.5
Setiawan Hadi
Image Filtering Original Image:
Filtered Image:
11/9 61/9 31/9 2
9
0
0
0
0
21/9 11 1/9 31/9 10
0
0
51/9 10 1/9 61/9 9
7
0
0
3
1
0
2
8
0
0
4
4
2
9
10
0
0
5
0
0
0
value = 1x1/9 + 6x1/9 + 3x1/9 + 2x1/9 + 11x1/9 + 3x1/9 + 5x1/9 + 10x1/9 + 6x1/9 = 47/9 = 5.222
Pengolahan 03Citra Dijital
3.6
0
Setiawan Hadi
0
Image Filtering Original Image:
Filtered Image:
1
6 3 2 9 1/9 1/9 1/9
0
0
2
11 3 10 0 1/9 1/9 1/9
0
5
10 1/9 61/9 91/9 7
0
0
3
1
0
2
8
0
0
4
4
2
9
10
0
5
0
0
0
0
7
0
0
value = 6x1/9 + 3x1/9 + 2x1/9 + 11x1/9 + 3x1/9 + 10x1/9 + 10x1/9 + 6x1/9 + 9x1/9 = 60/9 = 6.667
Pengolahan 03Citra Dijital
3.7
0
Setiawan Hadi
0
Image Filtering Original Image:
Filtered Image:
1
6
3
2
9
0
2
11
3
10
0
0
5
10
6
9
7
3
1
0
2
4
4
2
9
Pengolahan 03Citra Dijital
0
0
0
5
7
5
0
0
5
6
5
0
8
0
4
5
6
0
10
0
0
0
3.8
0
0
0
Setiawan Hadi
PROBLEM PADA KONVOLUSI
•
Bagaimana untuk menentukan piksel-piksel yang berada pada batas citra
•
Solusi: 1. Zero padding –
Treat the empty cells in the convolution window as zero
2. Fit-Position –
Start convolving at the first position where the window doesn’t overlap the image
3. Enlarging –
Enlarging the original image before convolving by duplicating the edges
4. Wrapping –
Wrap the image.
Pengolahan Citra Dijital
3.9
Setiawan Hadi
EFEK-EFEK HASIL KONVOLUSI
• Embossing • Blurring – – – –
low-pass spatial filtering Simulasi out-of-focus Mengaburkan latar belakang Mengurangi Gaussian noise
• Sharpening – High-pass spatial filtering – Crispening, mempertajam – Metode lain: unsharp masking, high-boost filtering
HighBoost Original Lowpass
Pengolahan Citra Dijital
3.10
Setiawan Hadi
Ilustrasi
original
Pengolahan Citra Dijital
3x3
9x9
3.11
15x15
Setiawan Hadi
CONVOLUTION MASKS
• Embossing
•
Blurring
1 0 0 0 0 0 0 0 1
•
1 16 1 8 1 16
Sharpening
0 1 0 1 5 1 0 1 0
1 1 1 1 9 1 1 1 1
1 1 8 16 1 1 4 8 1 1 8 16 1 2 1 2 5 2 1 2 1 W=9a-1
Pengolahan Citra Dijital
3.12
1 9 1 9 1 9
Setiawan Hadi
1 9 W 9 1 9
1 9 1 9 1 9
EDGE DETECTION
• Jenis-jenis edge
• Non-convolution methods – Homogeneity operator Subtracts each 8 surrounding pixels from the center pixel of
3 x 3 window. The output is the maximum of the absolute value of each difference
– Difference operator Upperleft-lowerright, middleleft-middleright, lowerleft-
upperright, topmiddle-bottommiddle
• Convolution methods – First order derivative operator – Second order derivative operator – Compass Gradient operator Pengolahan Citra Dijital
3.13
Setiawan Hadi
Ilustrasi Edge Detection (Deteksi Tepi)
Pengolahan Citra Dijital
3.14
Setiawan Hadi
Laplacian Filters
33 Laplacian
Pengolahan Citra Dijital
5x5 Laplacian
3.15
7x7 Laplacian
Setiawan Hadi
Mask/Operator/Filter • First Order Operator: Roberts
Prewitt
Sobel
Frei-Chen
Hr 0 0 0 1 1 1 1 2 1
Hc
0 1 1 0 0 0
1 0 0 0 1 0 0 0 0
0 1 0 1 0 1 0 1 0 2 0 1
1 0 1 2 0 2 1 0 1
• Second Order Operator – Laplacian
Pengolahan Citra Dijital
1 1 0 0 1 1 1 2 0 0 1 2 1 2 0 0 2 1
0 1 0 1 4 1 0 1 0 3.16
1 0 1 1 0 1 1 0 1
1 1 1 1 8 1 1 1 1 Setiawan Hadi
FILTERING
• Median Filtering
– Menghilangkan impulse noise (bedakan dengan Gaussian Noise yang dapat dihilangkan dengan Low-pass filter) – Impulse noise has a number of pixels that have conspicuosly wrong intensities like 0 or 255
• Averaging Filter
– Mengganti nilai piksel fokus dengan rata-rata jumlah piksel dalam window
• Minimum/Maksimum Filter – Mengganti nilai piksel fokus dengan nilai piksel minimum/maksimum piksel sekitar
Pengolahan Citra Dijital
3.17
Setiawan Hadi
Ilustrasi Median Filter
3x3 median
Pengolahan Citra Dijital
3.18
7x7 median
Setiawan Hadi
Filter Morfologis • Kasus Khusus Filtering • Dua operasi dasar: – erosi : menipiskan – Dilasi : menebalkan
• Operasi gabungan: – opening : an erosion followed by a dilation – closing: a dilation followed by an erosion
• Menggunakan mask/operator yang disebut structuring element • Jenis Structuring element: Block, Plus, Cross, Ring, Square • Definisi:
Pengolahan Citra Dijital
3.19
Setiawan Hadi
Proses Filtering Morfologis
Erosi
Pengolahan Citra Dijital
3.20
Setiawan Hadi
Proses Filtering Morfologis
Dilasi
Pengolahan Citra Dijital
3.21
Setiawan Hadi
Ilustrasi
Pengolahan Citra Dijital
3.22
Setiawan Hadi
Ilustrasi Filter Morfologis
Pengolahan Citra Dijital
3.23
Setiawan Hadi
Ilustrasi Filter Morfologis
Pengolahan Citra Dijital
3.24
Setiawan Hadi
Ilustrasi Filter Morfologis
Pengolahan Citra Dijital
3.25
Setiawan Hadi
Ilustrasi Filter Morfologis
Pengolahan Citra Dijital
3.26
Setiawan Hadi
BLOB Separation
Pengolahan Citra Dijital
3.27
Setiawan Hadi
Small Hole Removal
Pengolahan Citra Dijital
3.28
Setiawan Hadi
Morphological Edge Detector
Pengolahan Citra Dijital
3.29
Setiawan Hadi
Morphological Edge Detector
Pengolahan Citra Dijital
3.30
Setiawan Hadi
Morphological Noise FIlter
Pengolahan Citra Dijital
3.31
Setiawan Hadi
“Salt & Pepper” Noise Generator
Pengolahan Citra Dijital
3.32
Setiawan Hadi
Noise Removal Using Morphological Filter
Pengolahan Citra Dijital
3.33
Setiawan Hadi
Cointing Coins
Pengolahan Citra Dijital
3.34
Setiawan Hadi
Demo Program
•MorfMath •ConnComp
Pengolahan Citra Dijital
3.35
Setiawan Hadi