Image Edge Detection and Image Edge Enhancement

3 downloads 0 Views 1MB Size Report
High level digital image processing such as object recognition, segmentation ... Image processing filters are mainly used to suppress either the high frequencies in the ..... [3] A.K. Jain, Fundamentals of Digital Image Processing, tenth edition.
International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 03 – Issue 04, July 2014

Image Edge Detection and Image Edge Enhancement: Numerical Experiment on High Pass Spatial Filtering Abdul Rasak Zubair

Olasebikan Alade Fakolujo

Department of Electrical/Electronic Engineering University of Ibadan Ibadan, Nigeria

Department of Electrical/Electronic Engineering University of Ibadan Ibadan, Nigeria

Abstract—Edges represent discontinuities of image intensity in an image. High level digital image processing such as object recognition, segmentation and robot vision depend on the accuracy of edge detection. Adding product of the detected image edge and a scaling constant k to the original image is useful for image edge enhancement for better visual perception. Numerical Experiment on high pass spatial filtering for image edge detection and image edge enhancement is presented. Eleven alternative combinations of Mean filtering function hm, Gaussian filtering function hg and three versions of Laplacian filtering functions hL1, hL2 and hL3 are considered. Changes in Frequency Estimate, Brightness and Contrast produced by the eleven alternative combinations of filtering functions are measured and recorded. Results show that Laplacian functions are high pass filtering functions while Mean function and Gaussian function are low pass filtering functions. hL2 is found to be the best among the three versions of Laplacian filtering functions: the output of hL2 has highest Frequency Estimate and Brightness compared with hL1 and hL3. The combination hmhL2 (Laplacian of Mean) is the best choice for image edge detection as it produced image edge of moderate Frequency Estimate and Brightness which is free of false edges (noise). Low pass filtering functions are found to be more suitable for image edge enhancement than high pass filtering functions. The degree of image edge enhancement quality increases as scaling constant k increases from 0 to 0.8 beyond which diminishing returns set in.

Image processing filters are mainly used to suppress either the high frequencies in the image to smooth the image, or the low frequencies in the image to enhance or detect edges in the image [12,13]. An image can be filtered either in the frequency or in the spatial domain. In the spatial domain, filtering is accomplished by convolving the available image or input image x(m,n) with the filter function h(m,n) to obtain the filtered image y(m,n). This can be written as described in Eqn. (1) [2,3,4,5,12,13,14].

y(m,n)  x(m,n) h(m,n)

(1)

The filter function h(m,n) is known as the kernel which stands for the sub image of Fig. 1. It is also referred to as mask. Various standard kernels exist for specific applications, where the size and the form of the kernel determine the characteristics of the operation. Differently sized kernels containing different patterns of numbers give rise to different results under convolution. One of such possible results is image edge detection. Spatial filtering is a local processing because a function of values of x in a predefined neighbourhood of (m,n) is used to determine the value of y at (m,n) [13].

(m,n) 

Keywords-edge; feature extraction; enhancement; spatial filtering; spatial frequency

Figure 1. Neighborhood of point (m,n) defined by a rectangular sub-image

I. INTRODUCTION It is often necessary in medical image processing as well as other applications of image processing to identify the boundary between the objects in an image and separate the objects from each other [1,2,3,4,5]. Edges represent discontinuities of image intensity in an image. Image edge detection is the extraction of the edge of significant objects in an image and is the basis of high level image processing such as object recognition, image segmentation, feature extraction, space science and robot vision [1,6,7,8,9,10,11]. Image edge enhancement is the art of enhancing the edge of significant objects in an image. The objective of image edge enhancement is to improve visual perception of images.

www.ijcit.com

Five types of filter function h(m,n) are used in this work to develop image edge detection and image edge enhancement schemes. Numerical experiment is conducted in this work to study the effects of these schemes on test images. II.

DEVELOPMENT OF IMAGE EDGE DETECTION AND IMAGE EDGE ENHANCEMENT SCHEME

A. Five Filter Functions The five filter functions considered in this work are Mean filter function, Gaussian filter function and three versions of Laplacian filter function which are shown in Fig. 2 [1,3,5,12].

772

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 03 – Issue 04, July 2014

Figure 2. Five filter functions

B. Convolution The available image or input image x is a M by N matrix, filter function h is MH by NH matrix and the filtered image y is also a M by N matrix. For Gaussian filter function, MH  NH  5 . For each of other filter functions, MH  NH  3 . y is the convolution of x and h. Convolution involves arithmetic and logical operations to solve for y as expressed in Eqn. (2) [1,2,3,4,5,12,13,14].

y(m, n) 

MH 1 NH 1

  j (m  p, n  q)h(MH  p, NH  q) p 0

(2)

q 0

where j is a MJ by NJ matrix given by Eqn. (3). MJ=M+MH-1 and NJ=N+NH-1.

if 1  m  ( MH  1) / 2  M & 1  n  ( NH  1) / 2  N , j (m, n)  x(m  ( MH  1) / 2, n  ( NH  1) / 2) Otherwise

(3)

j (m, n)  0

x smooth(m,n)  y(m,n)  x(m,n)  h(m,n)

www.ijcit.com

xsmooth(m, n)  y1 (m, m)  x(m, n)  h1 (m, n)

(4)

(6)

Eleven alternative combinations of filtering functions for generation of image edge are considered in this work. These alternatives are h m, hg, hL1, hL2, hL3, hmhL1, hmhL2, hmhL3, hghL1, hghL2 and hghL3. D. Image Edge Enhancement The image edge image can be used for sharpening or image edge enhancement if it is added back to the original image signal as shown in Eqn. 7 and Fig. 4.

x sharp (m, n)  x(m, n)  k[ xedge (m, n)]

The Laplacian of an image highlights regions of rapid intensity change and is therefore often used for edge detection. Laplacian filter is a high pass filters (HPF). The output of the HPF y is of higher frequency compared with the input x. xedge is equal to y as illustrated in Eqn. (5) and Fig. 3(b). h in Eqn. (5) is applicable to h L1, hL2 and hL3.

xedge (m, n)  y(m, n)  x(m, n)  h(m, n)

Laplacian filter tends to amplify noise and detect false edges. The Laplacian filter is often applied to an image that has first been smoothed with smoothing filter in order to reduce its sensitivity to noise. Low pass filter function is applied first before the laplacian filter function is applied as shown in Fig. 3(c). The image edge produced is related to input image x, low pass filtering function h 1 and high pass function filtering function h2 as described by Eqn. (6). h1 is either hm or hg. h2 can be any of hL1, hL2 and hL3.

xedge (m, n)  y2 (m, n)  xsmooth(m, n)  h2 (m, n)

C. Image Edge Detection Mean filter and Gaussian filter are low pass filters (LPF). The output of the LPF y is blurred and is of lower frequency compared with the input x. LPF smoothens the edge of significant objects in x to obtain xsmooth. Subtracting xsmooth from x gives the image edge xedge as illustrated in Eqn. (4) and Fig. 3(a). h in Eqn. (4) is applicable to h m and hg. Image edge xedge is such that those parts which are edges in the image x appear bright while all other parts remain dark.

xedge(m,n)  x(m,n)-xsmooth(m,n)

Figure 3. Formation of image edge

(7)

where k is a scaling constant. Eleven alternative combinations of filtering functions for generation of image edge and edge enhanced image are coded into computer programs in Matlab working environment [15]. Numerical experiment is carried out to study the effects of the various alternative image edge detection and image edge enhancement filtering functions on test images.

(5)

773

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 03 – Issue 04, July 2014

where M and N are the numbers of rows and columns respectively and NM is the total number of pixels in x(m,n). Brightness, Contrast and Frequency Estimate of x, xsmooth, xedge and xsharp are measured and recorded. The effects of various alternative image edge detection and image edge enhancement filtering functions on these quantities are observed. Figure 4. Example of a figure caption. (figure caption)

TESTS, RESULTS AND DISCUSSIONS

A. Image Edge Detection A test bed of five test images is formed for the numerical experiment [13,16,17,18,19]. B. Measurements The Frequency Estimate F of an image is a measure of the spatial frequency of the image and it is the rate of change of intensity across the image [13,20]. F is given as (8)

where MF

f rows   i 1

NF

3

j 2

t 1

NF

3

i 2

t 1

  xi, j, t   xi, j  1, t 

and MF

f columns   j 1

  xi, j, t   xi  1, j, t 

TABLE I.

Contrast C of an image is the range from the darkest regions of the image to the lightest regions. C is given by Eqn. (9). High-contrast images have large regions of dark and light. Images with good contrast have a good representation of all luminance intensities. As the contrast of an image increases, the viewer perceives an increase in detail. This is purely a perception issue as the amount of information in the image does not increase. Human beings’ perception is sensitive to luminance contrast rather than absolute luminance intensities [2,3,4,5,21].

C

I max  I min I max  I min

The image edge detection numerical experimental results obtained are summarised in Fig. 5. The image edges obtained by the eleven filtering functions for the first and second test images are displayed in Table II. hL2 performed better than both hL1 and hL2 with regard to Brightness of image edge obtained. hL2 gave higher Frequency Estimate and Brightness than hmhL2 and hghL2. However, image edges obtained by hmhL2 and hghL2 are free of false edges (noise) unlike hL2. Therefore, hmhL2 is the best choice for image edge detection closely followed by hghL2.

(9)

Frequency Estimate

S/N

1st Test Image

hm

hg

hL1

hL2

hL3

x

xsmooth

xsmooth

xedge

xedge

xedge

2.94

1.63

1.45

4.13

9.54

3.49

nd

6.18

3.56

3.20

10.18

22.70

10.20

rd

6.79

4.10

3.71

8.17

20.13

5.66

th

11.54

3.77

3.10

27.01

47.13

38.74

th

19.77

9.38

7.85

35.00

60.62

34.75

2 Test Image 3 Test Image

where Imax and Imin are the maximum and minimum intensities in the image.

FREQUENCY ESTIMATE OF OUTPUTS OF FILTERING FUNCTIONS COMPARED WITH I NPUT

Function

1 1 F f rows  f columns 3MF  NF  1 3NF MF  1

Variable

III.

C. Image Edge Detection Numerical Experimental Results The eleven alternative combinations of filtering functions for image edge generation are tested with five test images. Table. I shows the Frequency Estimate of input x, output xsmooth and output xedge obtained with h m, hg, hL1, hL2 and hL3 for the five test images. It is observed in Table. II that the image edge xedge produced by hL1, hL2 and hL3 are of higher frequency compared with the input image x. Thus Laplacian filters are essentially high pass filters. It is also observed in Table. I that xsmooth the output of mean and Gaussian filtering function are of lower frequency compared with the input image x. Thus Mean and Gaussian filters are essentially low pass filters.

4 Test Image 5 Test Image

Brightness B of an image is defined as the average of all the pixels within the image [2,3,4,5,21]. B is given as

B

www.ijcit.com

1 M 1 N 1   x(m, n) NM m0 n0

(10)

774

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 03 – Issue 04, July 2014

D. Image Edge Enhancement Numerical Experimental Results The image edges produced by the eleven alternative combinations of filtering functions are used for image edge enhancement of the five test images with scaling constant k fixed at 0.4. The results obtained for the five test images are similar. The results for the first test image are presented as sample in Table. III. Edge enhanced images based on image edges produced by hL1, hL2, hL3, hmhL1, hmhL2, hmhL3, hghL1, hghL2 and hghL3 are characterised by poorer appearance and lower Contrast compared with the original test image. Laplacian Filtering functions are not suitable for image edge enhancement. Edge enhanced images based on image edges produced by hm and hg are characterised by better appearance, higher Frequency Estimate, Brightness and Contrast compared with

Figure 5. Frequency Estimate,

www.ijcit.com

the original test image. Low pass filtering functions are most suitable for image edge enhancement. The image edges produced hm and hg are used for image edge enhancement of five test images with different values of scaling constant k. The results are presented Figs. 6 and 7 for hm and hg respectively. For each test image, as the scaling constant k increases, Frequency Estimate and Brightness increase while the Contrast remains constant. As k increases from k = 0, the degree of enhancement increases. As k increases beyond klimit, there is diminishing return as more false edges (noise) are amplified leading to degradation in the image quality as illustrated in Table. IV. Different test image has different value of klimit. A value of 0.8 for klimit is satisfactory for most test images. The results obtained by Mean filter function hm and Gaussian filter function hg with k = 0.8 are very close as compared in Fig. 8.

Brightness and Contrast of input image and corresponding image edge obtained by eleven combinations of filtering functions for five test images

775

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 03 – Issue 04, July 2014 TABLE II.

IMAGE EDGE DETECTION NUMERICAL EXPERIMENTAL RESULTS FOR FIRST AND SECOND TEST IMAGES

Original 1st Test Image [16] F = 2.94; B = 40.06; C = 0.97

Image Edge by hL2 F = 9.54; B = 8.40; C = 1

Image Edge by hL1 F = 4.13; B = 3.35; C = 1

Image Edge by hL3 F = 3.49; B = 2.19; C = 1

Image Edge by hmhL2 F = 2.72; B = 3.20; C = 1

Image Edge by hghL2 F = 2.09; B = 2.62; C = 1

Image Edge by hm F = 1.09; B = 1.01; C = 1

Image Edge by hg F = 1.10; B = 1.09 C = 1

Image Edge by hmhL1

Image Edge by hghL1

Image Edge by hmhL3

Image Edge by hghL3

F = 1.05; B = 1.15; C = 1

F = 0.81; B = 0.93; C = 1

F = 0.63; B = 0.42; C = 1

F = 0.55; B = 0.34; C = 1

Original 2nd Test Image [17] F = 6.18; B = 140.48; C = 0.82

Image Edge by hL2 F = 22.70; B = 18.72; C = 1

Image Edge by hL1 F = 10.18; B = 7.54; C = 1

Image Edge by hL3 F = 10.20; B = 5.83; C = 1

Image Edge by hmhL2 F = 5.70; B = 6.23; C = 1

Image Edge by hghL2 F = 3.73; B = 5.02; C = 1

Image Edge by hm F = 2.93; B = 2.91; C = 1

Image Edge by hg F = 2.72; B = 2.97; C = 1

Image Edge by hmhL1 F = 2.21; B = 2.23; C = 1

Image Edge by hghL1 F = 1.50; B = 1.79; C = 1

Image Edge by hmhL3 F = 1.52; B = 0.91; C = 1

Image Edge by hghL3 F = 1.25; B = 0.73; C = 1

www.ijcit.com

776

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 03 – Issue 04, July 2014

IMAGE EDGE ENHANCEMENT NUMERICAL E XPERIMENTAL RESULTS FOR FIRST TEST IMAGE WITH K = 0. 4.

TABLE III.

Original 2nd Test Image [17] F = 6.18; B = 140.48; C = 0.82

Edge Enhanced Image based on Image Edge by hm with k = 0.4 F = 7.16; B = 141.61; C = 0.83

Edge Enhanced Image based on Image Edge by hm with k = 0.4 F = 7.11; B = 141.64; C = 0.83

Edge Enhanced Image based on Image Edge by hL1 with k = 0.4 F = 4.53; B = 143.49; C = 0.79

Edge Enhanced Image based on Image Edge by hL2 with k = 0.4 F = 7.15; B = 147.96; C = 0.79

Edge Enhanced Image based on Image Edge by hL3 with k = 0.4 F = 6.07; B = 142.80; C = 0.81

Edge Enhanced Image based on Image Edge by hmhL1 with k = 0.4 F = 6.18; B = 142.47; C = 0.80

Edge Enhanced Image based on Image Edge by hghL2 with k = 0.4 F = 5.53; B = 142.47; C = 0.78

Edge Enhanced Image based on Image Edge by hmhL3 with k = 0.4 F = 6.24; B = 140.80; C = 0.82

www.ijcit.com

777

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 03 – Issue 04, July 2014

Figure 6. Image edge enhancement based on edges produced by Mean filter function hm: effect of scaling constant k

Figure 7. Image edge enhancement based on edges produced by Gaussian filter function hg: effect of scaling constant k

www.ijcit.com

778

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 03 – Issue 04, July 2014 TABLE IV.

IMAGE EDGE ENHANCEMENT NUMERICAL EXPERIMENTAL RESULTS FOR THIRD, FOURTH AND FIFTH TEST IMAGES WITH THREE DIFFERENT VALUES OF SCALING CONSTANT

Original 3rd Test Image [13] F = 6.79; B = 164.92; C = 0.95

Original 4th Test Image [18] F = 11.54; B = 68.16; C = 0.98

Original 5th Test Image [19] F = 19.77; B = 141.18; C = 1.00

Edge Enhanced Image based on Image Edge by hmwith k = 0.5 F = 7.98; B = 166.34; C = 0.95

Edge Enhanced Image based on Image Edge by hm with k = 0.5 F = 14.55; B = 70.43; C = 0.98

Edge Enhanced Image based on Image Edge by hm with k = 0.5 F = 23.32; B = 144.70; C = 1.00

Edge Enhanced Image based on Image Edge by hm with k = 0.8 F = 8.55; B = 166.93; C = 0.95

Edge Enhanced Image based on Image Edge by hm with k = 0.8 F = 16.20; B =71.61; C = 0.98

Edge Enhanced Image based on Image Edge by hm with k = 0.8 F = 25.13; B = 146.36; C = 1.00

Edge Enhanced Image based on Image Edge by hm with k = 10 F = 18.48; B = 178.04; C = 0.95 (Noisy as k is beyond klimit)

Edge Enhanced Image based on Image Edge by hm with k = 5 F = 40.32; B = 88.66; C = 0.98 (Noisy as k is beyond klimit)

Edge Enhanced Image based on Image Edge by hm with k = 5 F = 39.52; B = 160.01; C = 1.00 (Noisy as k is beyond klimit)

www.ijcit.com

779

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 03 – Issue 04, July 2014

Figure 8.

Comparison of results of image edge enhancement based on edges produced by Mean filter function hm and Gaussian filter function hg.

IV. CONCLUSION Image edge detection and image edge enhancement schemes and their effects on test images have been studied. Results demonstrated that Laplacian filters are high pass filters where as Mean and Gaussian filters are low pass filters. The output of hL2 has highest Frequency Estimate and Brightness compared with hL1 and hL3; hL2 is therefore considered to be the best among the three versions of Laplacian filtering functions. Among the eleven alternative combinations of filtering functions, hmhL2 is the best choice for image edge detection as it produced image edge of moderate Frequency Estimate and Brightness which is free of false edges (noise). hmhL2 is closely followed by hghL2. Edge enhanced images based on image edges produced by Laplacian filtering functions are characterised by poorer appearance and lower Contrast compared with the original test image. Laplacian Filtering functions are not suitable for image edge enhancement. On the other hand, Edge enhanced images based on image edges produced by Mean filtering function hm and Gaussian filtering function hg are characterised by better appearance, higher Frequency Estimate, Brightness and Contrast compared with the original test image. Low pass filtering functions are

www.ijcit.com

suitable for image edge enhancement. As the scaling constant k increases from from k = 0 to k = klimit, the degree of image edge enhancement increases. There is diminishing return with regard to image quality as k increases beyond klimit which is about 0.8 for most test images. REFERENCES [1]

[2] [3] [4] [5] [6]

[7]

D.R. Waghule and R.S. Ochawar, ‘‘Overview on Edge Detection Methods,’’ Int. Conf. on Electronic Systems, Signal Processing and Computing Technologies, pp. 151-155, 2014. F. C. Tony and S. Jianhong, Image Processing and Analysis: Variational, PDE, Wavelet, and Stochastic Methods. Philadelphia: SIAM, 2005. A.K. Jain, Fundamentals of Digital Image Processing, tenth edition. India: Prentice-Hall, 2003. B. Chanda and D.D. Majumer, Digital Image Processing and Analysis. India: Prentice-Hall, 2000. R. C. Gonzalez and R. E. Woods, Digital Image Processing. Massachusetts: Addison-Wesley, 2002. J. Li and X. Jing, ‘‘Edge Detection Based on Decision-Level Information Fusion and its Application in Hybrid Image Filtering,’’ Int. Conf. on Image Processing (ICIP), pp. 251-254, 2004. S.J.H. Pirzada and A. Siddiqui, ‘‘Analysis of Edge Detection Algorithms for Feature Extraction in Satellite Images,’’ Proceeding of the 2013 IEEE Int. Conf. on Space Science and Communication (IconSpace), 1-3 July 2013, Melaka, Malaysia, pp. 238-242, 2013.

780

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 03 – Issue 04, July 2014 [8]

[9]

[10] [11]

[12]

[13]

[14]

M. Tabb and N. Ahuja, ‘‘Multiscale Image Segmentation by Integrated Edge and Region Detection,’’ IEEE Trans. on Image Processing, vol. 6, no. 5, pp. 642-655, 1997. S. S. Yasiran et al, ‘‘Microcalcifications Segmentation using Three Edge Detection Techniques,’’ IEEE Int. Conf. on Electronics Design, Systems and Applications (ICEDSA), pp. 207-211, 2012. R. Maini and J. Sohal, ‘‘Performance evaluation of Prewitt edge detector for noisy images,’’ GVIP Journal, vol. 6, pp. 39-46, 2006. L. Wan-she and Z. Jin, ‘‘Application of Wavelet Transform in Edge Detection,’’ 4th Int. Congress on Image and Signal Processing, pp. 2173-2176, 2011. C. Boncelet, R. Hardie and G. Arce, ‘‘Filters for Smoothing and Sharpening,’’ Nonlinear Image Processing II, SPIE, vol. 1451, pp. 70-73, 1991. A. R. Zubair and O. A. Fakolujo, ‘‘Development of Statistics and Convolution as Tools for Image Noise Suppression: Statistical Performance Analysis of Spatial Filters,’’ Afr J. of Comp & ICTs., vol. 6, no. 5, pp. 95-108, 2013. J. Flusser, J. Boldys and B. Zitova, ‘‘Invariants to Convolution in Arbitrary Dimensions,’’ J. of Mathematical Imaging and Vision 13 (Netherlands: Kluwer Academic Publishers), pp. 101–113, 2000.

www.ijcit.com

[15] MathWorks (Matlab), Documentation for MathWorks products retrieved on January 1, 2009 from http://www.mathworks.com/access/helpdesk/help/helpdesk.shtml [16] Lodox, First Test Image retrieved on February 26, 2014 from http://lodox.com/trauma/ [17] USC-SIPI Image Database , Second Test Image retrieved on October 5, 2006 from the database of Signal and Image Processing Institute of the University of Southern California, USA: http://sipi.usc.edu/database/index.html [18] Green Leaf, Fourth Test Image retrieved on February 26, 2014 from the database http://www.123rf.com/photo_10510540_summer-green-leafmacro-close-up.html [19] HealthCentral, Fifth Test Image retrieved on February 26, 2014 from the database http://www.healthcentral.com/copd/copd-000070_1-145.html [20] A. R. Zubair, O.A. Fakolujo and P.K. Rajan, ‘‘Digital Watermarking of Still Images with Colour Digital Watermarks,’’ Journal of Science Research, vol. 9, pp. 33-41, 2010. [21] A. R. Zubair, ‘‘Comparison of Image Enhancement Techniques,’’ International Journal of Research in Commerce, IT & Management, vol. 2, no. 5, pp. 44-52, 2012.

781