Digital image processing Chapter 6. Image enhancement IMAGE ENHANCEMENT Introduction Image enhancement algorithms & techniques Point-wise operations Contrast enhancement; contrast stretching Grey scale clipping; image binarization (thresholding) Image inversion (negative) Grey scale slicing Bit extraction Contrast compression Image subtraction Histogram modeling: histogram equalization/ modification Spatial operations Spatial low-pass filtering Unsharp masking and crispening Spatial high-pass and band-pass filtering Inverse contrast ratio mapping and statistical scaling Magnification and interpolation (image zooming) Digital image processing Chapter 6. Image enhancement Transform domain image processing Generalized linear filtering Non-linear filtering Generalized cepstrum and homomorphic filtering Image pseudo-coloring Color image enhancement Applications: biomedical image enhancement Types and characteristics of biomedical images Contour detection in biomedical images Anatomic segmentation of biomedical images Histogram equalization and pseudo-coloring in biomedical images Digital image processing Chapter 6. Image enhancement Introduction • Def.: Image enhancement = class of image processing operations whose goal is to produce an output digital image that is visually more suitable as appearance for its visual examination by a human observer The relevant features for the examination task are enhanced The irrelevant features for the examination task are removed/reduced • Specific to image enhancement: - input = digital image (grey scale or color) - output = digital image (grey scale or color) • Examples of image enhancement operations: - noise removal; - geometric distortion correction; - edge enhancement; - contrast enhancement; - image zooming; - image subtraction; - pseudo-coloring. • Classification of image enhancement operations: - Based on the type of the algorithms: grey scale transformations; spatial operations; transform domain processing; pseudo-coloring - Based on the class of applications – as in the examples above. Digital image processing Chapter 6. Image enhancement A. Point-wise operations Def.: The new grey level (color) value in a spatial location (m,n) in the resulting image depends only on the grey level (color) in the same spatial location (m,n) in the original image => “point-wise” operation, or grey scale transformation (for grey scale images). v(m, n) f u(m, n), m 0,1,...,M 1; n 0,1,...,N 1; f : 0,1,...,LMax 0,1,...,LMax U[M×N] V[M×N] m m n u(m,n) n Point-wise operation (grey scale transformation) f(∙) => v=f(u) v(m,n) = f(u(m,n)) Digital image processing Chapter 6. Image enhancement Contrast enhancement/contrast stretching V VL Vb mu , 0 u a , m tg v n(u a) v a , a u b , n tg p(u b) v ,b u L , p tg b Va U a b Contrast enhancement, if: m<1, for the dark regions (under aL/3). n>1, for the medium grey scale (between a and b, b(2/3)L) p<1, for the bright regions (above b). Digital image processing Chapter 6. Image enhancement Grey scale clipping; image thresholding •Grey scale clipping is a particular case of contrast enhancement, for m=p=0: 0 ,0 u a f(u) nu , a u b L ,b u L (6.2) V U a b Fig. 6.3. Grey scale clipping V U Fig. 6.4 Image thresholding Processed histogram Original histogram Digital image processing Chapter 6. Image enhancement Fig. 6.5 Image thresholding - example The inverse image (negative image): v = L-u v (6.3) v v L L L Fig. 6.6 Image inverting U L a b U a b Fig. 6.7 Grey scale slicing (windowing) U Digital image processing Chapter 6. Image enhancement GREY SCALE SLICING (WINDOWING): L , a u b v 0 ,otherwise L , a u b v u ,otherwise or (6.4) (6.5) BIT EXTRACTION: u=k12B-1+k22B-2+...+kB-12+kB L ,if kn 1 v 0 , otherwise (6.6) (6.7) CONTRAST COMPRESSION: v = clog(1+|u|) (6.8) CONTRAST COMPRESSION – EXAMPLE: v = clog(1+|u|) IMAGE SUBTRACTION: _ Digital image processing Chapter 6. Image enhancement HISTOGRAM MODELING. HISTOGRAM EQUALIZATION/MODIFICATION Hlin,U(u) Def. Linear grey level histogram of a digital grey scale image U[M×N]: = the function Hlin,U:{0,1,…,LMax}→{0,1,…,MN}, Hlin,U(u)=nbr. of pixels with grey level u from U. Def. Normalized linear grey level histogram of the image U[M×N]: = the function hlin,U:{0,1,…,LMax}→[0;1], u Ideally – histogram hlin,U(u)=Hlin,U(u)/(MN). equalization Def. Cumulative grey level histogram of a digital grey scale image U[M×N]: = the function Hcum,U:{0,1,…,LMax}→{0,1,…,MN}, Hlin,V(v) u H cum,U (u ) H lin ,U (l ). l 0 Def. Normalized cumulative grey level histogram of the image U[M×N]: = the function hcum,U:{0,1,…,LMax}→[0;1], hcum,U(u)=Hcum,U(u)/(MN). v u H lin,U (l ) l 0 MN v f Equalization u L L u H lin,U (l ), u {0,1,..., LMax}. MN l 0 Digital image processing Chapter 6. Image enhancement u p u u (x i ) xi V Uniform quantizer v` pu(xi) Fig. 6.8. Histogram equalization a b Fig. 6.9 Low contrast image a b Fig. 6.10 The resulting image after histogram equalization Digital image processing Chapter 6. Image enhancement u f(u) Uniform quantizer v v' Fig. 6.11 Histogram modification n v = f(u) = p (x ) u i (6.15) x i=0 n p f(u) = xi x L-1 x i=0 1 n u 1 n( ) i u p x , n = 2, 3,... (6.15.a) Digital image processing Chapter 6. Image enhancement SPATIAL OPERATIONS: most of them can be implemented by convolution v( m,n) (k,l)W a( k,l)u( m- k,n - l) a 1,1 A a 0,1 a 1,1 AM a 1,0 a 0,0 a 1,0 a 1,1 a 0,1 a 1,1 A[ K L] a k , l - Convolution mask a 1,1 A ' a 0,1 a 1,1 a 1,0 a 0,0 a 1,0 a 1,1 a 0,1 a 1,1 a 1,1 a 0,1 a 1,1 a 1,0 a 0,0 a 1,0 a 1,1 a 0,1 A M a 1,1 Digital image processing Chapter 6. Image enhancement Spatial averaging. Low-pass spatial filtering: v(m,n) (6.18) a(k,l)y(m - k,n - l) (k,l)W 1 y(m - k, n - l ) N ( k,l)W (6.19) v(m,n)=1/2[y(m,n)+1/4{y(m-1,n)+y(m+1,n)+y(m,n-1)+y(m,n+1)}] (6.20) v(m,n) = l l 0 -1 1 0 1/4 1/4 k 1 1/4 1/4 2x2 window 0 l 1 -1 1/9 1/9 1/9 k 0 1/9 1 1/9 1/9 1/9 1/9 1/9 3x3 window -1 -1 0 1 0 1/8 0 k 0 1 1/8 1/2 1/8 0 1/8 0 5 points weighted averaging Fig. 6.12 Convolution windows used in low-pass spatial filtering - examples Filtering by spatial averaging – the effect on the noise power reduction: v(m,n) = u(m,n) + (m,n) 1 v(m,n) = u(m - k,n - l)+ (m,n) N w (k,l)W (6.21) (6.22) Digital image processing Chapter 6. Image enhancement Directional low-pass spatial filtering: v(m,n: ) = W0 1 N 0 0 0 0 0 0 0 0 0 0 y(m - k,n - l) (k,l)W 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (6.23) l K Fig. 6.13 Directional spatial filtering Median filtering: v(m ,n)= m edian{y(m - k,n - l),(k,l) W } (6.24) v(m,n) = the element in the middle of the brightness row, with increasing brightness values a b Fig. 6.14 Additive noise attenuation by mean filtering Digital image processing Chapter 6. Image enhancement a b Fig. 6.15 Gaussian noise reduction by median filtering UNSHARP MASKING AND EDGE CRISPENING: v(m,n) = u(m,n)+ g(m,n) (6.25) 1 g(m,n) = u(m,n) - [u(m - 1,n)+ u(m,n - 1)+ u(m+ 1,n)+ u(m,n + 1)] (6.26) 4 Signal Low pass filtering High pass filtering a+c a-b a b Fig. 6.16 Edge crispening algorithm c d Digital image processing Chapter 6. Image enhancement Original image Resulting image Fig. 6.17 Edge crispening using a Laplacian operator HIGH-PASS SPATIAL FILTERING hTS (m ,n)= (m ,n) - hTJ (m ,n) u(m,n) Spatial averaging vTJ(m,n) (mean filtering) Fig. 6.18 Low-pass filtering (6.27) u(m,n) Spatial Low-Pass Filter + vTS(m,n) _+ Fig. 6.19 High-pass filtering Digital image processing Chapter 6. Image enhancement BAND-PASS SPATIAL FILTERING: hTB (m,n) = hTJ 1 (m,n) - hTJ 2 (m,n) FTJ hTJ1(m,n) u(m,n) + + vTB(m,n) _ (6.28) FTJ hTJ2(m,n) Fig. 6.20 Band-pass image filtering a c b d Fig. 6.21 The results of LPF (Fig. c), HPF (Fig. b),BPF (Fig. d) for a grey level image (Fig. a – original image) Digital image processing Chapter 6. Image enhancement INVERSE CONTRAST RATIO MAPPING; STATISTICAL SCALING: = (6.29) v(m,n) = (m,n) (m,n) (m,n) = (m,n) = { v( m,n) = 1 NW 1 (6.30) u(m - k,n - l) [u(m- k, n - l) - (m,n) ] 2 }1/2 (6.31) (k,l)W N W ( k,l)W u( m,n) ( m,n) (6.32) (6.33) MAGNIFICATION AND INTERPOLATION (IMAGE ZOOMING): • Zooming by pixel replication: H 1 1 1 1 (6.34) The resulting image is obtained as: v(m,n) = u(k,l) with k = Int[ m n ], l = Int[ ] 2 2 (6.35) m,n =0, 1, 2,... Digital image processing Chapter 6. Image enhancement a b c Fig. 6.22 Image zooming by pixel replication by a factor of: b) 2; c) 4, on each direction Zooming by linear interpolation: v i (m,2n) = u(m,n), v i (m,2n + 1) = o m M - 1, [u(m,n)+ u(m,n + 1)] , 2 o n N -1 (6.36) 0 m< M -1 (6.37) (6.38) v(2m,n) = v i (m,n) v(2m+ 1,n) = [ v i (m,n)+ v i (m+ 1,n)] , 0 m M - 1, 0 n 2N - 1 2 1/ 4 1/ 2 1/ 4 H 1/ 2 1/ 4 1 7 3 1 Zeros interlacing 1 0 3 0 0 7 0 0 0 0 0 1 0 0 0 0 1 1/ 2 1/ 2 1/ 4 Rows interpolation 1 0 3 0 4 7 3,5 0 0 0 2 1 0,5 0 0 0 (6.39) (6.40) Columns interpolation 1 2 3 1,5 4 7 3,5 3 4 2 2 1 0,5 1 0,5 0,25 Fig. 6.23 Digital image processing Chapter 6. Image enhancement 6.6 TRANSFORM DOMAIN IMAGE PROCESSING u(m,n) Unitary transform Point-wise operations f() v(k,l) AUAT Inverse transform u’(m,n) v’(k,l) A-1 V [AT] Fig. 6.24 Image enhancement in the transformed domain • Generalized linear filtering v(k,l)= g(k,l) v(k,l) (6.41) where g(k,l) is called regional mask (i.e., it is 0 outside the selected region) 0 a b N-b N-a FTJ K c FTJ FTB -1 0 p q K FTJ FTB d r FTS FTB N-d N-c FTB FTJ FTB s FTJ N-1 a b Fig. 6.25 Regional masks for the generalized linear filtering FTS Digital image processing Chapter 6. Image enhancement E.g.: - the inverse Gaussian filter has the following regional mask: k2 l2 exp , g(k,l)= 2 2 g(N k, N l), 0 k,l N/2 (6.42) otherwise - for other orthogonal transforms: (k 2 l 2 ) g( k , l ) exp , 2 2 0 k, l N 1 (6.43) Non-linear filtering v(k,l) =|v(k,l)| e j (k,l) v , (k,l) |v(k,l)|a e j (k,l) (6.44) 0 a 1 (6.45) Generalized cepstrum and homomorphic filtering u(m,n) T v(k,l) AUA Logv(k,l)e je (k,l) s(k,l) -1 T -1 c(m,n) T -1 u’(m,n) A S (A ) s(k,l) = [log|v(k,l)| ] e j (k,l) , |v(k,l > 0 c’(m,n) T ACA s’(k,l) exps’(k,l)e je (k,l) v’(k,l) -1 A V (A ) Digital image processing Chapter 6. Image enhancement IMAGE PSEUDO-COLORING R v1(m,n) u(m,n) Feature extraction v2(m,n) v3(m,n) Color space transformation G A-1 S (AT)-1 c(m,n) B Fig. 6.27 Monochrome image pseudo-coloring COLOR IMAGE ENHANCEMENT Monochrome image enhancement algorithm R G Input image Color space transform Monochrome image enhancement algorithm Inverse color space transform B Monochrome image enhancement algorithm Fig. 6.28 Color image enhancement block diagram Output image rendering Digital image processing Chapter 6. Image enhancement BIOMEDICAL IMAGE ENHANCEMENT - APPLICATIONS Biomedical image types & features Fig. 6.42 Fig. 6.44 Fig. 6.43 Fig. 6.45 Digital image processing Chapter 6. Image enhancement Contour extraction in biomedical images: Table 6.1 1 1 1 H L 1 9 1 1 1 1 Operator (6.76) Fig. 6.46 a11 a12 a13 a21 a22 a23 a31 a32 a33 Gradient directional E Gradient directional NE Gradient directional SW Filtru trece-sus 1 Filtru trece-sus 2 Laplacian Laplacian diagonal Laplacian orizontal Laplacian vertical Prewitt orizontal Prewitt vertical Sobel orizontal Sobel vertical Kirsch orizontal Kirsch vertical Fig. 6.47 1 1 1 0 0 -1 -1 0 0 -1 1 1 1 -3 5 1 1 1 -1 -1 -1 0 -1 0 -1 0 2 0 -3 5 1 1 -1 0 0 -1 -1 0 0 -1 -1 1 -1 5 5 1 1 1 -1 -1 -1 0 0 -1 0 1 0 2 -3 -3 -2 -2 -2 5 4 9 4 2 2 0 0 0 0 0 0 1 -1 -1 -1 -1 -1 0 0 -1 0 -1 0 -2 5 -3 -1 1 1 0 0 -1 -1 0 0 1 1 -1 1 -3 -3 -1 -1 1 -1 -1 -1 0 -1 0 1 0 -2 0 -3 -3 -1 -1 -1 0 0 -1 -1 0 0 1 -1 -1 -1 5 -3 Digital image processing Chapter 6. Image enhancement Histogram equalization and pseudo-coloring in biomedical images: a b Fig. 6.48 Fig. 6.49 Fig. 6.50 Digital image processing Chapter 6. Image enhancement Fig. 6.51 Fig. 6.52 Fig. 6.53 Fig. 6.54