[IEEE 2014 Recent Advances and Innovations in Engineering (ICRAIE) - Jaipur, India...

6
IEEE International Conference on Recent Advances and Innovations in Engineering (ICRAIE-2014), May 09-11, 2014, Jaipur, India A Hybrid Approach to Image Enhancement using Contrast Stretching on Image Shaening and the analysis of various cases arising using Histogram Shailendra Singh Negi Department of Computer Science and Engineering G, B, Pant Engineering College (GBPEC) Pauri Garhwal, Uttarakhand, India shailendra 14negi@gmaiLcom Abstract- Image Enhancement is one of the first steps in Image processing. In this technique, the original image is processed so that the resultant image is more suitable than the original for specific applications. Preprocessing an image include removal of noise, edge or boundary enhancement, automatic edge detection, automatic contrast adjustment and segmentation. Image enhancement is a purely subjective processing technique. An image enhancement technique used to process images might be excellent for a person but the same result might not be good enough for another. Image enhancement is a cosmetic procedure i.e. it does not add any extra information to the original image. It merely improves the subjective quality of the images by working with the existing data. This Research paper focuses on Contrast Stretching and Image Sharpening techniques. In this paper, an approach that simultaneously adjusts contrast and enhances boundaries is presented. Histogram has been plotted to verify the result of various cases arising due to implementation of contrast stretching on image sharpening. The edges of the objects in the image are also enhanced by this methodology. Various other edge enhancement techniques are also available like Contrast Stretching on Adaptive Thresholding for enhancing edges of MRI knee images. The proposed methodology shows much better result than the one said above. Keywords- Contrast Stretching; Image Sharpening; Histogram Processing; Laplacian mask L INTRODUCTION Image enhancement as a field is basically used for improving the interpretability or perception of information in images for human viewers and providing 'better' and 'enhanced' input for other automated image processing techniques, Digital image enhancement techniques provide a range of choices for improving the visual quality of images. Appropriate choice of such techniques is greatly influenced by the imaging modality, task to achieve and viewing conditions. In this research paper we are combining and applying Point Processing technique (Conast Stretching) and Neighborhood Processing technique (Image Shaening) on an image and their analysis is done using histogram plotting. Let f(x, y ) be the original input image where f is the gray level value or intensity value and (x, y) are the image co- [978-1-4799-4040-0/14/$31.00 ©2014 IEEE] Yatendra Singh Bhandari Department of Computer Science and Engineering G. B. Pant Engineering College (GBPEC) Pauri Garhwal, Uttarakhand, India [email protected] ordinates. For an 8-bit image, 'f' can take values om 0-255, where ° represents black, 255 represents white and all the intermediate values represent shades of gray. Image enhancement simply means, transforming an image 'f' into image ' g , using 'T' . The modified image can be expressed as: g (x, y ) = T[f( x , y )] (1). For all spatial domain techniques it is simply T that changes. The above equation can also be written as: s = T (r) (2). Where 'T' is the transformation that maps a pixel value ' r ' into a pixel value 'S' . The results of this ansformation are mapped back into the gray scale range as we are dealing here only with gray scale digital images. So, the results are mapped back into the range [0, L-l], where L=2\ k being the number of bits in the image being considered. In this research paper we have only considered gray level images for processing. II. IMPLEMENTAnON TECHNIQUES A. Contrast Stretching Low conast images are the result of insufficient illumination, lack of dynamic range in the image sensor or even the wrong setting of a lens aperture during image acquisition phase. Conast stretching is a process that expands the range of intensity levels in an image so that it spans the ll intensity range of the recording medium or display device. The idea behind this is to increase the conast of the images by making the dark portions darker and the bright portions brighter. The equation and figure below shows the transformation nction used to achieve conast setching on an image. j l*r Or<a s= m*(r-a)+v ar<b n*(r-b)+w br<L-l (3). Where I, m and n are the slopes. as is evident om the graph of Fig. 1 below and equation (3) above, we make the dark gray levels darker by assigning a slope of less than one (between (0, 0) and (rJ, Sl) and between (r2' S2) and (L-l, L-l))

Transcript of [IEEE 2014 Recent Advances and Innovations in Engineering (ICRAIE) - Jaipur, India...

Page 1: [IEEE 2014 Recent Advances and Innovations in Engineering (ICRAIE) - Jaipur, India (2014.5.9-2014.5.11)] International Conference on Recent Advances and Innovations in Engineering

IEEE International Conference on Recent Advances and Innovations in Engineering (ICRAIE-2014), May 09-11, 2014, Jaipur, India

A Hybrid Approach to Image Enhancement using Contrast Stretching on Image Sharpening and the

analysis of various cases arising using Histogram

Shailendra Singh Negi Department of Computer Science and Engineering

G, B, Pant Engineering College (GBPEC) Pauri Garhwal, Uttarakhand, India

shailendra 14negi@gmaiLcom

Abstract- Image Enhancement is one of the first steps in Image

processing. In this technique, the original image is processed so

that the resultant image is more suitable than the original for

specific applications. Preprocessing an image include removal of

noise, edge or boundary enhancement, automatic edge detection,

automatic contrast adjustment and segmentation. Image

enhancement is a purely subjective processing technique. An

image enhancement technique used to process images might be

excellent for a person but the same result might not be good

enough for another. Image enhancement is a cosmetic procedure

i.e. it does not add any extra information to the original image. It

merely improves the subjective quality of the images by working

with the existing data. This Research paper focuses on Contrast

Stretching and Image Sharpening techniques. In this paper, an

approach that simultaneously adjusts contrast and enhances

boundaries is presented. Histogram has been plotted to verify the

result of various cases arising due to implementation of contrast

stretching on image sharpening. The edges of the objects in the

image are also enhanced by this methodology. Various other edge

enhancement techniques are also available like Contrast

Stretching on Adaptive Thresholding for enhancing edges of

MRI knee images. The proposed methodology shows much better

result than the one said above.

Keywords- Contrast Stretching; Image Sharpening; Histogram Processing; Laplacian mask

L INTRODUCTION

Image enhancement as a field is basically used for improving the interpretability or perception of information in images for human viewers and providing 'better' and 'enhanced' input for other automated image processing techniques, Digital image enhancement techniques provide a range of choices for improving the visual quality of images. Appropriate choice of such techniques is greatly influenced by the imaging modality, task to achieve and viewing conditions. In this research paper we are combining and applying Point Processing technique (Contrast Stretching) and Neighborhood Processing technique (Image Sharpening) on an image and their analysis is done using histogram plotting.

Let f(x, y) be the original input image where f is the gray

level value or intensity value and (x, y) are the image co-

[978-1-4799-4040-0/14/$31.00 ©2014 IEEE]

Yatendra Singh Bhandari Department of Computer Science and Engineering

G. B. Pant Engineering College (GBPEC) Pauri Garhwal, Uttarakhand, India

[email protected]

ordinates. For an 8-bit image, 'f' can take values from 0-255, where ° represents black, 255 represents white and all the intermediate values represent shades of gray. Image enhancement simply means, transforming an image 'f' into image ' g , using 'T' . The modified image can be expressed

as:

g(x, y) = T[f(x, y)] (1).

For all spatial domain techniques it is simply T that changes. The above equation can also be written as:

s = T (r) (2).

Where 'T' is the transformation that maps a pixel value ' r ' into a pixel value 'S' . The results of this transformation are mapped back into the gray scale range as we are dealing here only with gray scale digital images. So, the results are mapped back into the range [0, L-l], where L=2\ k being the number of bits in the image being considered. In this research paper we have only considered gray level images for processing.

II. IMPLEMENT A nON TECHNIQUES

A. Contrast Stretching Low contrast images are the result of insufficient

illumination, lack of dynamic range in the image sensor or even the wrong setting of a lens aperture during image acquisition phase. Contrast stretching is a process that expands the range of intensity levels in an image so that it spans the full intensity range of the recording medium or display device. The idea behind this is to increase the contrast of the images by making the dark portions darker and the bright portions brighter. The equation and figure below shows the transformation function used to achieve contrast stretching on an image.

j l*r O:S:r<a s= m*(r-a)+v a:S:r<b

n*(r-b)+w b:S:r<L-l

(3).

Where I, m and n are the slopes. as is evident from the graph of Fig. 1 below and equation (3) above, we make the dark gray levels darker by assigning a slope of less than one (between (0, 0) and (rJ, Sl) and between (r2' S2) and (L-l, L-l))

Page 2: [IEEE 2014 Recent Advances and Innovations in Engineering (ICRAIE) - Jaipur, India (2014.5.9-2014.5.11)] International Conference on Recent Advances and Innovations in Engineering

IEEE International Conference on Recent Advances and Innovations in Engineering (ICRAIE-2014), May 09-11, 2014, Jaipur, India

and make the bright gray levels brighter by assigning a slope greater than one (between (rJ, Sl) and (r2' S2)) i,e, the slopes '1' and 'n' are less than one while 'm' is greater than one. The contrast stretching transformation increases the dynamic range of the modified image. In the following implementations we have used 1, n=0.5 and m=2. The lower threshold and upper threshold value is taken as 50 and 200 respectively.

1.-1

(n,s::!)

3U4 Output

Gray

Level U2 T(I') S

U4 (n,sl) 0

0 U4 U2 3U4 1.-1

Input Gray Level r

Fig. l. Graph of Contrast Stretching

Fig. 2(a). Original Image Fig. 2(b). Contrast Stretched Image

Different slopes can be applied depending on the input image and the application for which it is going to be used. Since we know that image enhancement is a subjective processing technique and hence there is no set of slope values that would yield the desired result. The contrast stretching transformation increases the dynamic range of the modified image. From the above graph we can see that the location of points (rJ, s1) and (rb S2) control the shape of the transformation function. If (rl=sl) and (r2=s2), the transformation is a linear function that produces no changes in intensity levels. If (r1=r2), SI=O and s2=L-l, the transformation becomes a threshold function that creates a binary image as shown below. The general equation for threshold image is given below. {o

s -L -1

if r:S; a

if r > a (4).

The graph and output image of thresholding function is shown below in fig. 3(a) and 3(b) respectively. The result of thresholding function is always a binary image with only two colors, black i.e. pixel value 0 and white i.e. pixel value 255.

S I �r)

L------..I-k------'---- r Dn'k � LiThl

Fig. 3(a): Graph of Thresholding Figure 3(b): Output of image 2(a) using Thresholding function

B. Image Sharpening spatial filters The main objective and purpose of sharpening spatial filters

is to highlight transitions in intensity. Sharpening can be accomplished by spatial differentiation. The derivatives of a digital function are defined in terms of differences. We require that any definition we use for a first derivative must be:

(1) Zero in area of constant intensity.

(2) Non zero at the onset of an intensity step or ramp and

(3) Non zero along ramps.

Similarly, any defmition of a second derivative must be:

(I) Zero in areas of constant intensity.

(2) Non zero at the onset and end of an intensity step or ramp and

(3) Zero along ramps of constant slope.

The Laplacian: This is the simplest isotropic filter, whose response is independent of the direction of the discontinuities

in the image. It is defined for a function (image) f(x, y) of

two variables as:

112f=d2f+d2f dX2 dy2

(5).

Because derivatives of any order are linear operations, the laplacian is a linear operator. To express this equation in discrete form, we have:

d 2 f dX' = f(x+l,y)+f(x-l,y)-2f(x,y) (6).

And

CJ 2 { = f (x, y + I) + f ( x , y - I) -2 f ( x , y ) (7). CJy

Therefore, discrete laplacian of two variables is given as:

This equation can be implemented using the filter mask (a) shown below with centre coefficient as -4. It gives an isotropic result for rotations in increments of 90 degree. Filter mask (b) with centre coefficient as -8 is used to implement isotropic results in increments of 45 degree. Their implementation on input images 'Penguin.jpg' and 'Sachin.jpg' is shown below.

Page 3: [IEEE 2014 Recent Advances and Innovations in Engineering (ICRAIE) - Jaipur, India (2014.5.9-2014.5.11)] International Conference on Recent Advances and Innovations in Engineering

IEEE International Conference on Recent Advances and Innovations in Engineering (ICRAIE-2014), May 09-11, 2014, Jaipur, India

0 1 0 1 1 1

1 -4 1 1 -8 1

0 1 0 1 1 1

Fig. 4: Laplacian masks with center coefficient as -4 and -8

Fig. 5: Orginal Images as input to laplacian mask

Fig. 6: Output images from laplacian mask with center coefficient as -4

Fig. 7: Output images from laplacian mask with center coefficient as -8

Since the laplacian is a derivative operator, its use highlights intensity discontinuities in an image and deemphasizes regions with slowly varying intensity levels. This will produce images that have grayish edge lines and other discontinuities producing featureless background. Background features can be recovered while still preserving the sharpening effect of the laplacian simply by adding the laplacian image to the original image. The basic way in which we use the laplacian for image sharpening is given by this equation below.

g(x, y) = I(x, y) + c[V' 2 I(x, y)] (9).

Where I(x, y) and g(x. y) are the input and sharpened images respectively. The constant c=-I, if the above two laplacian filters are used and c=1 if the above laplacian filters coefficient are multiplied by - 1. The demonstration is shown below:

Fig. 8: Original gray scale images as input

Fig. 9: Output images from laplacian mask with center coefficient as -8

Fig. 10: Final sharpened images using images from Fig. 8 and Fig. 9

III. METHODOLOGYG

The proposed methodology applies Contrast Stretching on Image Sharpening. Contrast Stretching on Image Sharpening can be performed on various stages. In this paper, an approach that simultaneously adjusts contrast and enhances boundaries is presented. The process flowchart below shows the various stages of image sharpening process and these stages are the phases where contrast stretching can be applied. The flow of process is same as that of image sharpening using laplacian mask. We have only incorporated contrast stretching into it. There are three stages where contrast stretching can be applied as can be seen from the block diagram below of fig. 11. Hence a total of three cases arise for us to perform study in the proposed methodology. The analysis of these three cases can be accomplished by various methods but we are using histogram as a means to validate our results. The final output image from the three cases which is having a flat histogram is considered best. A flat histogram means that all the gray levels in an image are equal in number.

Page 4: [IEEE 2014 Recent Advances and Innovations in Engineering (ICRAIE) - Jaipur, India (2014.5.9-2014.5.11)] International Conference on Recent Advances and Innovations in Engineering

IEEE International Conference on Recent Advances and Innovations in Engineering (ICRAIE-2014), May 09-11, 2014, Jaipur, India

[

Original Wey scale Unage as

inxIut

D Apply � Mask wi1h center coefficient as -8

n

� Oulputof

!���Mask

Add Original bnagewilh Output of

� Ma.sk

Stag" 1

-]1 S"tage .2

SlCage 3

Fig. II: Flowchart of Image Sharpening process and stages where Contrast Stretching is applied

Case 1:- In this case we are applying contrast stretching technique on the final sharpened output image from image sharpening process. For the image sharpening process we are using the Laplacian mask with centre coefficient as -8. The histogram of this final contrast stretched image has been plotted to verify the result. It can be seen from the plotted histogram that majority of its pixels lie towards the darker side. Moreover it does not provide us a flat histogram. Thus it can be seen that the sharpened image is not clear and majority of its pixels are dark. Hence it is not useful for other applications as input image. As can be seen clearly the laplacian image is also not having enhanced boundaries or edges in fig. 12(b). The demonstration is shown below:

Fig. 12(a): Original gray scale image Figure 12(b): Laplacian image or image output from laplacian mask with center coefficient as -8

Figure 13(a): Sharpened image Figure 13 (b): image after applying contrast stretching on image of Fig. 13(a)

8000,------.----,---...,.--.----.-------,--....:::;

7000

6000

4000

3000

300 350

Fig. 14: Histogram of final image from case 1

Case 2:- In this case we are applying contrast stretching technique on the image which is output from laplacian mask i.e. laplacian image. For the image sharpening process we are using the Laplacian mask with centre coefficient as -8. Then this image is added to the original image for the purpose of getting sharpened image. The histogram of the final image has been plotted to understand and verity the result. The histogram is not a flat one, so it did not provide us best result and it cannot be used for other application purpose also. There are negligible pixels at the darker portion of the image as can be seen from the histogram. As can be seen clearly from fig. 16(a), the edges are enhanced a little bit as compared to the case 1 due to application of contrast stretching on laplacian image. The demonstration is shown below.

Fig. 15(a): Original gray scale image Figure 15(b): Laplacian image or image output from laplacian mask with center coefficient as -8

Page 5: [IEEE 2014 Recent Advances and Innovations in Engineering (ICRAIE) - Jaipur, India (2014.5.9-2014.5.11)] International Conference on Recent Advances and Innovations in Engineering

IEEE International Conference on Recent Advances and Innovations in Engineering (ICRAIE-2014), May 09-11, 2014, Jaipur, India

Fig. 16(a): image after applying contrast stretching on previous image Figure 16 (b): final sharpened image

6QOO,--�--�--�--�--�--�--,

5000

4000

3000

2000

Fig. 17: Histogram of final image from case 2

Case 3:- In this case we are applying contrast stretching technique on the original input gray scale image 'Sachin.jpg'. Then, this image is passed through the laplacian mask to get the laplacian image. For the image sharpening process we are using the Laplacian mask with centre coefficient as -8. Laplacian image is finally added to the original gray scale image to get the final sharpened image. The histogram is plotted of this fmal sharpened image. It can be seen from the histogram that all of the image pixels are equal in number and it is a flat histogram. Thus the fmal sharpened image is very clear and it is useful and can be used for other application purpose also. As can be seen clearly from fig. 19(a) the edges of the image are enhanced much greater than the previous cases on application of contrast stretching on the original gray scale image. The demonstration is shown below:

Fig. IS(a): Original gray scale image Figure IS(b): Contrast stretching on previous image

Fig. 19(a): Image after applying laplacian mask with center coefticient as -S Figure 19(b): final sharpened image

2.5

2

1.5

0.5

..... .... °O .... �50 .... ·1·00 .... ·1 �5 0 .. --�20�O----��O -�3�OO�-�S50

Fig. 20: Histogram of final image from case 3 showing best result

IV. EXPERIMENTAL RESULTS AND DISCUSSIONS

To evaluate the performance of the proposed methodology, the experiments are done on images taken by handheld camera and images taken from the internet in different situations. The three cases which are implemented above are studied and analyzed by the help of histogram. Histogram is plotted for the final output image from the above discussed three cases. Thus from the histograms plotted we can see and identify the case which is having a flat histogram and it is the best result. Case 3 is having best result due to the outcome of a flat histogram. From the above discussion it is clear that applying contrast stretching on the original gray scale image always shows good result after image sharpening is done on it. The result of case 3 can be made as a base for our conclusion.

V. CONCLUSION

Contrast stretching and image sharpening is an important area of digital image enhancement. These both topics come under the category of image enhancement in spatial domain. Many researchers have proposed many hybrid image enhancement techniques but in this work, we are combining contrast stretching with image sharpening. Preprocessing an image include removal of noise, edge or boundary enhancement, automatic edge detection, automatic contrast adjustment and segmentation. In this paper, an approach that simultaneously adjusts contrast and enhances boundaries is

Page 6: [IEEE 2014 Recent Advances and Innovations in Engineering (ICRAIE) - Jaipur, India (2014.5.9-2014.5.11)] International Conference on Recent Advances and Innovations in Engineering

IEEE International Conference on Recent Advances and Innovations in Engineering (ICRAIE-2014), May 09-11, 2014, Jaipur, India

presented. The three cases which arise are studied and analyzed using histogram. By viewing the histogram we can conclude that case three is showing best results. In case three we are applying contrast stretching on the original gray scale image and then it is input or passed to the laplacian mask. The output of the laplacian mask i.e. laplacian image is added to the original gray scale image to get the fmal sharpened image. This final output image is having a flat histogram which is enough to support our conclusion. It also proves the concept that a good quality original image before any operation provides a good quality image as the final output.

VI. FUTURE WORK

The future work in this paper can be done on increasing the height of flat histogram which is the result of case three. Contrast stretching is used to enhance the image for sharpening purpose; instead of this we can use histogram equalization or histogram stretching or histogram matching technique to enhance the image. Various other hybrid image enhancement models can be developed by using other techniques or combining various other techniques. As image enhancement is a subjective process, the result of enhancement models varies from person to person. Superior techniques like histogram equalization, histogram stretching or histogram matching can be used in place of contrast stretching for enhancing edges of the objects in the image.

REFERENCES

[I] A. K. Jain, "Fundamentals of Digital Image Processing", Prentice Hall of India (PHI), 2003.

[2] Rafael C. Gonzalez and Richard E. woods, "Digital Image Processing", Pearson Education, Third Edition, 2009.

[3] W. K. Pratt, "Digital image processing", Prentice Hall of India, 2007.

[4] Chris Solomon, "Fundamentals of Digital Image Processing", John Wiley & Sons Ltd.

[5] R. Jain, R. Kasturi and B. G. Schunck, "Image Processing Fundamentals", Tata McGraw-Hili International Edition, 2005.

[6] Raman Maini and Himanshu Aggarwal "A Comprehensive Review of Image Enhancement Techniques", Journal of Computing, Volume 2, Issue 3, March 2010, ISSN 2151-9617, pp.8-13.

[7] Sunita Dhariwal, "Comparative Analysis of Various Image Enhancement Techniques", International Journal of Electronics & Communication Technology (!JECT), Vol. 2, Issue 3, Sept. 2011, pp. 91-95.

[8] B. Chanda and D. Dutta Majumder, "Digital Image Processing and Analysis", Prentice Hall of India (PHI), 2005.

[9] R. W. Jr. Weeks. 2002, "Fundamental of Electronic Image Processing". Bellingham: SPIE Press.

[10] Dhananjay K. Theckedath, 2008. "Digital Image Processing". Tech -Max publication, Pune, India.

[11] Manpreet Kaur, Jasdeep Kaur, Jappreet Kaur, "Survey of Contrast Enhancement Techniques based on Histogram Equalization", (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 2, No. 7, 2011, pp.138-141.

[12] R. Shannila, R. Uma, "A New Approach To Image Contrast Enhancement using Weighted Threshold Histogram Equalization with Improved Switching Median Filter", International Journal Of Advanced Engineering Sciences and Technologies, Vol-7, No. 2, 2011, pp. 206 -211.

[13] Sonia Goyal, Seema, "Region Based Contrast Limited Adaptive HE with Additive Gradient for Contrast Enhancement of Medical Images (MRI)", International Journal of Soft Computing and Engineering (IJSCE), Vol. I, No.4, 2011, pp.154-157.

[14] Mehmet Sezgin, Bulent Sankur, "Survey over image thresholding techniques and quantitative performance evaluation", Journal of Electronic Imaging, Vo1.l3, No.1, 2004, pp.146-165.

[15] Shailendra Singh Negi, Bhumika Gupta, "Survey of various image enhancement techniques in spatial domain using matlab", International conference on advances in computer engineering and applications-20 14 (ICACEA-2014), special proceedings of International journal of computer applications (IJCA), 2014, pp.8-18.

[16] Balvant Singh, Ravi Shankar Mishra, Puran Gour, "Analysis of Contrast Enhancement Techniques for underwater image", International Journal of Computer Technology and Electronics Engineering (!JCTEE) ISSN: 2249-6343, Vol. 1, Issue 2, pp. 190-194.

[17] Asst. Prof. Dr. Umut Arioz, Lecture notes on Digital Image processing, Lecture 3: Image enhancement in Spatial Domain.

[18] R Hummel, "Histogram modification techniques", Computer graphics and Image Processing, Vol. 4, pp. 209-224,1975.

[19] U. Pavan Kumar, P. Padmaja, "A Hybrid method for enhancement of MRI Knee images", International journal of engineering trends and technology (IJETT), Vol. 4, issue 10, October 2013.

[20] Naglaa Yehya Hassan and Norio Aakamatsu ,"Contrast Enhancement Technique of Dark Blurred Image", IJCSNS International Journal of Computer Science and Network Security, VOL.6 No.2A, pp. 223-226, February 2006.

[21] Jayaraman, S. Esakkirajan and T. Veerakumar," Digital Image Processing",Tata Mc-Graw Hill Education,2009.

[22] Saruchi, "Adaptive Sigmoid function to enhance low contrast images", IJCA International journal of computer applications, Vol-55, No.-4, October 2012.

[23] Dileep. MD and A. Sreenivasa Murthy, "A Comparison between different Colour Image Contrast Enhancement Algorithms", IEEE, Proceedings oflCETECT 2011, pp. 708-712.