PENGOLAHAN CITRA DIGITAL 1
2
Representasi Image 1 bit 8 bits 3
24 bits 4
Apakah itu histogram? (3, 8, 5) Histogram memberikan deskripsi global dari penampakan sebuah image. 5
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(r k )=n k, d i m a n a : r k adalah nilai gray level ke k n k adalah jumlah pixels dalam image yang memiliki gray level k n adalah jumlah keselirihan pixel pada image k = 0, 1, 2,, L-1 6
Histogram dari image digital dengan gray level yang berada dalam range [0, L-1] adalah sebuah 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
8
9
10
Image colors red green blue 11
Sifat Sifat Histogram Histogram adalah pemetaan Many-to-One Image yang berbeda dimungkinkan untuk m e m i l i k i h i s t o g r a m y a n g s a m a. 1 A 3 2 4 Images B Histograms 12
Histogram sebuah image tidak berubah bila image dikenakan o p e r a s i t e r t e n t u s e p e r t i : R o t a t i o n, s c a l i n g, f l i p. Rotate Clockwise Scale Flip 13
Ekualisasi Histogram Adalah proses Mapping dari Grey Levels p menjadi Grey Levels q sedemikian sehingga distribusi dari Grey Levels pada q mendekati bentuk Uniform 14
Bila p(k) = image histogram pada k = [0..1] T u j u a n : contrast sehingga m e n c a r i t r a n s f o r m a s i stretching T(k) sedemikian I2 = T(I) and p2 = 1(uniform) p(k) p2 15
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
Normalisasi Histogram Normalized histogram: p(r k )=n k /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
18
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
20
Hanya ada 5 nilai gray level yang berbeda yang berpengaruh dalam image tsb. H a s i l e k u a l i s a s i a d a l a h p e n d e k a t a n t e r h a d a p b e n t u k h i s t o g r a m y a n g u n i f o r m 21
22
23
24
25
Spatial Filtering 2D FIR filtering Mask filtering: operasi konvolusi image 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 dengan 26
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 f r e k u e n s i d a r i i m a g e a b g(x, y) w(s, t) f (x s, y t) s a t b a = (m - 1) / 2 b = (n - 1) / 2 27
Konvolusi Image 28
Smoothing Spatial Filters _ averaging (lowpass) filters Linear Smoothing filters are used - Noise reduction - Smoothing of false contours - Reduction of irrelevant detail Undesirable side effect of - Blur edges smoothing filters Weighted average filter reduces blurring in the smoothing process. Box filter Weighted average 29
Smoothing Linear Filters i I j J g(m, n) I J I J w(i, j) f (m i, n j) i I j J w(i, j) Normalization of coefficient to ensure 0 g(m,n) L-1 30
Averaging dan Threshold filter size n = 15 Thrsh = 25% of highest intensity 31
Sharpening Linear Filters High boosting filter: Laplacian operator: A 1 Derivative filter: Use derivatives to approximate high pass filters. Usually 2 nd derivatives are preferred. The most common one is the Laplacian operator. 2 f (x, y) f (x, y) f (x, y) 2 2 x 2 y 2 f (x 1, y) f (x 1, y) f (x, y 1) f (x, y 1) 4 f (x, y) 32
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 Median filter [10 125 125 135 141 141 144 230 240] = 141 3 3 Max filter [10 125 125 135 141 141 144 230 240] = 240 3 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 n 2 /2. 33
Order Statistics Filters n = 3 Average filter n = 3 Median filter 34
2-D, STMIK AMIKOM 2nd PURWOKERTO Order Derivatives for Image Enhancement Isotropic filters: rotation invariant Laplacian (linear operator): Discrete 2 f 2 f x 2 version: y 2 2 f 2 f 2 x 2 f (x 1, y) f (x 1, y) 2 f (x, y) 2 f f (x, y 1) f (x, y 1) 2 f (x, y) 2 y 2 35
Laplacian Digital implementation: 2 f [ f (x 1, y) f (x 1, y) f (x, y 1) f (x, y 1)] 4 f (x, y) Two definitions negative of the Accordingly, to features: of Laplacian: one is the other recover background 2 f f ( x,y ) ( x,y )( I ) g(x, y) { 2 f ( x,y ) f ( x,y )( II ) I: if the center of the mask is negative II: if the center of the mask is positive 36
Simplification g(x,y) g(x, y) Filter and step: f (x,y) [ f (x 1,y) f (x recover original part in one 1,y) f (x,y 1) f (x,y 1)] 4 f (x,y) 5 f (x, y) [ f (x 1, y) f (x 1, y) f (x, y 1) f (x, y 1)] 37
38
39
40
High-boost Filtering Unsharp masking: Highpass filtered image = f s (x, y) f (x, y) f (x, y) 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
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
43
1st Derivatives The most common method of differentiation in Image Processing the gradient: f F G x x G y f at (x,y) y is The magnitude of this vector is: 2 2 f f f mag( f ) [G x G y ] 2 x y 1 2 2 1/ 2 44
The Gradient Non-isotropic Its magnitude (often rotation invariant call the gradient) is Computations: f G x G y Roberts uses: Approximation Operators): G x (z 9 z 5 ) G y (z 8 z 6 ) (Roberts Cross-Gradient f z 9 z 5 z 8 z 6 45
46
Derivative Filters At z 5, the magnitude can be approximated as: f [(z 5 z 8 ) (z 5 z 6 ) ] f z 5 z 8 z 5 z 6 2 2 1/ 2 47
Derivative Filters Another approach is: f [(z 5 z 9 ) (z 6 z 8 ) ] f z 5 z 9 z 6 z 8 2 2 1/ 2 One last approach is (Sobel Operators): f (z 7 2z 8 z 9 ) (z 1 2z 2 z 3 ) (z 3 2z 6 z 9 ) (z 1 2z 4 z 7 ) 48
Robert operator Sobel operators 49
50
51
(b) 52
53