STMIK AMIKOM PURWOKERTO
PENGOLAHAN CITRA DIGITAL
1
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
2
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Representasi Image
1 bit
8 bits
3
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
24 bits 4
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Apakah itu histogram?
(3, 8, 5)
Histogram memberikan deskripsi global dari penampakan sebuah image. 5
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Hi s togr a m dar i i ma ge di g i ta l dengan gray levels dari 0 sampai L-1 adalah fungsi diskrit h(rk)=nk, i m a a : d n
rk adalah nilai gray level ke k nk adalah jumlah pixels dalam image yang memiliki gray level k n adalah jumlah keselirihan pixel pada image k = 0, 1, 2, …, L-1
6
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Histogram dari image digital dengan gray level [0, L-1] adalah sebuah yang berada dalam range f u n g s i d i s k r i t h(rk) = nk dimana rk adalah nilai gray level ke k dan nk adalah jumlah pixel yang memiliki nilai gray level rk . Number of Occurrences 0
255 Pixel Value
7
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
8
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
9
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
10
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Image colors
red
green
blue 11
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Sifat – Sifat Histogram
Histogram adalah pemetaan Many-to-One Image yang berbeda dimungkinkan untuk memiliki histogram yang sama.
A
1 3
2
4
Images B Histograms 12
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Histogram sebuah image tidak berubah bila image dikenakan operasi tertentu seperti : Rotation, scaling, flip. Rotate Clockwise Flip Scale 13
ABDUL AZIS, M.KOM
Ekualisasi Histogram
STMIK AMIKOM PURWOKERTO
Adalah proses Mapping dari Grey Levels ”p” menjadi Grey Levels “q” sedemikian sehingga distribusi dari Grey Levels pada “q” mendekati bentuk Uniform
14
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Bila p(k) = image histogram pada k = [0..1] Tu j u a n : mencari transformasi contrast stretching T(k) sedemikian sehingga I2 = T(I) and p2 = 1(uniform)
p(k)
p2 15
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Dengan Histogram informasi spasial dari image diabaikan dan hanya mempertimbangkan frekuensi relatif p e n a m p i l a n g r a y l e v e l .
16
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Normalisasi Histogram
Normalized histogram: p(rk)=nk/n
Jumlah keseluruhan komponen = 1
Adalah membagi setiap nilai dari histogram dengan jumlah pixel d a r i i m a g e ( n ) , p(rk) = nk /n. Normalisasi Histogram berguna untuk melihat statistika dari i m a g e . 17
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
18
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Diberikan sebuah image 8-level berukuran 64 x 64 dengan nilai gray value (0, 1, …, 7). Nilai normalisasi dari gray value adalah (0, 1/7, 2/ 7, …, …, ….,…., 1).
19
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
20
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Hanya ada 5 nilai gray level yang berbeda yang berpengaruh dalam image tsb.
Hasil ekualisasi adalah pendekatan terhadap bentuk histogram yang u n i f o r m 21
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
22
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
23
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
24
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
25
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Spatial Filtering
2D FIR filtering
Mask filtering: operasi konvolusi image dengan 2 D masking Applikasinya antara lain untuk image enhancement: Smoothing: low pass Sharpening: high pass
Data-dependent nonlinear filters Local histogram Order statistic filters Medium filter
26
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Spatial filtering adalah operasi y a n g d i l a k u k a n Terhadap intensitas pixel dari s u a t u i m a g e Dan bukan terhadap komponen frekuensi dari image
a
b
g(x, y)
w(s, t) f (x s, y t) s
at
a = (m - 1) / 2
b
b = (n - 1) / 2 27
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Konvolusi Image
28
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Smoothing Spatial Filters _ Linear averaging (lowpass) filters Smoothing filters are used - Noise reduction - Smoothing of false contours - Reduction of irrelevant detail Undesirable side effect of smoothing filters - Blur edges
Weighted average filter reduces blurring in the smoothing process. Box filter
Weighted average
29
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Smoothing Linear Filters
I
J
w(i, j) f (m i, n g(m, n)
i
I j
j)
J I
J
w(i, j) i
I j
J
Normalization of coefficient to ensure 0 ≤ g(m,n) ≤ L-1
30
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Averaging dan Threshold filter size n = 15
Thrsh = 25% of highest intensity
31
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Sharpening Linear Filters
High boosting filter:
Laplacian operator:
2 2
A≥1
f (x, y)
f (x 1, y)
f (x, y) x2 f (x 1, y)
2
f (x, y) y2 f (x, y 1)
f (x, y 1) 4 f (x, y)
Derivative filter:
Use derivatives to approximate high pass filters. Usually 2nd derivatives are preferred. The most common one is the Laplacian operator.
32
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Order Statistics Filters
Order-statistics filters are nonlinear spatial filters whose response is based on ordering (ranking) the pixels contained in the image area encompassed by the filter, and then replacing the value of the center pixel with the value determined by the ranking result. 3 3 3
3 Median filter [10 125 125 135 141 141 144 230 240] = 141 3 Max filter [10 125 125 135 141 141 144 230 240] = 240 3 Min filter [10 125 125 135 141 141 144 230 240] = 10
Median filter eliminates isolated clusters of pixels that are light or dark with respect to their neighbors, and whose area is less than n2/2. 33
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Order Statistics Filters
n=3 Average filter
n=3 Median filter
34
ABDUL AZIS, M.KOM
2-D, 2ndPURWOKERTO Order Derivatives STMIK AMIKOM for Image Enhancement
Isotropic filters: rotation invariant Laplacian (linear operator): 2 2
f
f
x2 Discrete version:
2
f
y2
2
f 2 2 x 2 f 2 2 y
f (x 1, y)
f (x 1, y) 2 f (x, y)
f (x, y 1)
f (x, y 1) 2 f (x, y) 35
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Laplacian
2
Digital implementation: f
[ f (x 1, y)
f (x 1, y)
f (x, y 1)
f (x, y 1)] 4 f (x, y)
Two definitions of Laplacian: one is the negative of the other Accordingly, to recover background features:
g(x, y)
f ( x,y )
{ f ( x,y )
2 f ( x,y )( I ) 2 f ( x,y )( II )
I: if the center of the mask is negative II: if the center of the mask is positive 36
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Simplification
Filter and recover original part in one step: g(x,y) f (x,y) [f (x 1,y) f (x 1,y) f (x,y 1) f (x,y 1)] 4f (x,y) g(x, y) 5 f (x, y) [ f (x 1, y) f (x 1, y) f (x, y 1) f (x, y 1)]
37
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
38
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
39
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
40
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
H igh-boost Filtering
Unsharp masking: f s (x, y) f (x, y) f (x, y) Highpass filtered image = Original – lowpass filtered image.
If A is an amplification factor then:
High-boost = A · original – lowpass (blurred) = (A-1) · original + original – lowpass = (A-1) · original + highpass
41
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
High-boost Filtering
A=1 : standard highpass result A>1 : the high-boost image looks more like the original with a degree of edge enhancement, depending on the value of A. w=9A-1, A≥1
42
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
43
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
1st Derivatives
The most common method of differentiation in Image Processing is the gradient: f F
Gx Gy
x f y
at (x,y)
• The magnitude of this vector is: 1
f
mag( f ) [G
2 x
2 2 y
G ]
f x
2
f y
2 1/ 2
44
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
The Gradient
Non-isotropic Its magnitude (often call the gradient) is rotation invariant Computations: f Gx Gy Roberts uses:
Gx Gy
(z9 (z8
z5 ) z6 )
Approximation (Roberts Cross-Gradient Operators): f z9 z5 z8 z6 45
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
46
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Derivative Filters
At z5, the magnitude can be approximated as:
f
[(z5 z8 ) 2 (z5 f | z5
z8 | | z 5
z6 )2 ]1/ 2 z6 | 47
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Derivative Filters
Another approach is: f
[(z5 f | z5
z9 ) 2 (z6 z9 | | z 6
z8 ) 2 ]1/ 2 z8 |
• One last approach is (Sobel Operators): f
(z7 2z8
z9 ) (z1 2z2
z3 )
(z3 2z6
z9 ) (z1 2z4
z7 )
48
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
Robert operator
Sobel operators 49
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
50
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
51
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
(b)
52
ABDUL AZIS, M.KOM
STMIK AMIKOM PURWOKERTO
53
ABDUL AZIS, M.KOM