USE OF HISTOGRAM EQUALIZATION IN IMAGE PROCESSING FOR IMAGE ENHANCEMENT Sapana S. Bagade M.E,Computer Engineering, Sipna s C.O.E.T,Amravati, Amravati,India sapana.bagade@gmail.com Vijaya K. Shandilya Assistant Proffessor,Computer Science & Engg Dept, Sipna s C.O.E.T,Amravati, Amravati,India vkshandilya@rediffmail.com Abstract Digital Image Processing is a rapidly evolving field with the growing applications in science & engineering. Image Processing holds the possibility of developing an ultimate machine that could perform visual functions of all living beings. The image processing is a visual task, the foremost step is to obtain an image i.e. image acquisition then enhancement and finally to process. In this paper there are details for image enhancement for the purpose of image processing. Image enhancement is basically improving the digital image quality. Image histogram is helpful in image enhancement. The histogram in the context of image processing is the operation by which the occurrences of each intensity value in the image is shown and Histogram equalization is the technique by which the dynamic range of the histogram of an image is increased. Keywords- Image processing, image enhancement, image histogram, Histogram equalization 1. Introduction Image processing is in many cases concerned with taking one array of pixels as input and producing another array of pixels as output which in some way represents an improvement to the original array. The term Digital Image Processing generally refers to the processing of a two-dimensional picture by a digital computer i.e. altering an existing image in the desired manner. For example, this processing may remove noise, improve the contrast of the image, remove blurring caused by movement of the camera during image acquisition, it may correct for geometrical distortions caused by the lens. Before going for image processing image enhancement is necessary. We will not be considering every image processing and enhancement technique in this section but we will see the enhancement of image through image histogram or better way histogram equalization. If an image is low contrast and dark, we wish to improve its contrast and brightness. The histogram equalization improve all parts of the image when the original image is irregularly illuminated. The enhancement techniques are employed in order to increase the contrast of an image. Therefore, the distinction of features in the scene can be easily performed by visualization. This will augment the efficiency of image classification and interpretation. Generally, an image can be enhanced by spreading out the range of scene illumination. This procedure is called contrast stretch. If the ranges of gray values are uniformly prolonged, the process will be called linear contrast stretch. The disadvantage of the linear contrast stretch is that a number of gray levels are equally assigned to the unusually appeared gray levels as to the often appeared gray levels. This effect still causes the ambiguous distinction of the similar features. To overcome the mention defect, the process of histogram equalization is applied. The process tries to assigned more number of gray levels to the frequency appeared gray levels. The enhanced image obtained from the global area histogram equalization will cause an effect of intensity saturation in darkness area and whiteness areas. The color image enhancement will be obtained by encoding the color of red, green and blue to three different spectral images. 2. Image Processing Technique As has just been established, a number of factors can adversely affect image quality. With the use of image enhancement techniques, the difference in sensitivity between image can be decreased. A number of image processing techniques, in addition to enhancement techniques, can be applied to improve the data usefulness. Techniques include convolution edge detection, mathematics, filters, trend removal, and image analysis. The various image enhancements and image processing techniques will be introduced in this section. Computer software programs are available, including some or all of the following programs: Enhancement programs make information more visible. Histogram equalization-redistributes the intensities of the image of the entire range of possible intensities (usually 256 gray-scale levels). 6
Unsharp masking-subtracts smoothed image from the original image to emphasize intensity changes. Convolution programs are 3-by-3 masks operating on pixel neighborhoods. Highpass filter-emphasizes regions with rapid intensity changes. Lowpass filter-smoothes images, blurs regions with rapid changes 2.1 Image Enhancement Technique Image enhancement techniques improve the quality of an image a perceived by a human. These techniques are most useful because many images when examined on a color display give inadequate information for image interpretation. There is no conscious effort to improve the fidelity of the image with regard to some ideal form of the image. There exists a wide variety of techniques for improving image quality. The contrast stretch, density slicing, edge enhancement, and spatial filtering are the more commonly used techniques. Image enhancement is attempted after the image is corrected for geometric and radiometric distortions. Image enhancement methods are applied separately to each band of a multispectral image. Digital techniques have been found to be most satisfactory than the photographic technique for image enhancement, because of the precision and wide variety of digital processes. Contrast Contrast generally refers to the difference in luminance or grey level values in an image and is an important characteristic. It can be defined as the ratio of the maximum intensity to the minimum intensity over an image. Contrast ratio has a strong bearing on the resolving power and detects ability of an image. Larger this ratio, more easy it is to interpret the image. Contrast Enhancement Contrast enhancement techniques expand the range of brightness values in an image so that the image can be efficiently displayed in a manner desired by the analyst. The density values in a scene are literally pulled farther apart, that is, expanded over a greater range. The effect is to increase the visual contrast between two areas of different uniform densities. This enables the analyst to discriminate easily between areas initially having a small difference in density. Non-Linear Contrast Enhancement In these methods, the input and output data values follow a non-linear transformation. The general form of the non-linear contrast enhancement is defined by y = f (x), where x is the input data value and y is the output data value. The non-linear contrast enhancement techniques have been found to be useful for enhancing the color contrast between the nearly classes and subclasses of a main class. A type of non linear contrast stretch involves scaling the input data logarithmically. This enhancement has greatest impact on the brightness values found in the darker part of histogram. It could be reversed to enhance values in brighter part of histogram by scaling the input data using an inverse log function. Histogram equalization is another non-linear contrast enhancement technique. In this technique, histogram of the original image is redistributed to produce a uniform population density. This is obtained by grouping certain adjacent grey values. Thus the number of grey levels in the enhanced image is less than the number of grey levels in the original image 3. Histogram Histogram equalization is a widely used scheme for contrast enhancement in a variety of applications due to its simple function and effectiveness. One possible drawback of the histogram equalization is that it can change the mean brightness of an image significantly as a consequence of histogram flattening. Clearly, this is not a desirable property when preserving the original mean brightness of a given image is necessary. As an effort to overcome such drawback for extending the applications of the histogram equalization in consumer electronic products, bi-histogram equalization has been proposed by the author which is capable of preserving the mean brightness of an image while it performs contrast enhancement. The essence of the bi-histogram equalization is to utilize independent histogram equalizations separately over two subimages obtained by decomposing the input image based on its mean. A simplified version of the bi-histogram equalization is proposed, which is referred to as the quantized bi-histogram equalization. The proposed algorithm provides a much simpler hardware (H/W) structure than the bi-histogram equalization since it is based on the cumulative density function of a quantized image. Thus, the realization of bihistogram equalization in H/W is feasible, which leads to versatile applications in the field of consumer electronics 3.1 What is Histogram The histogram in the context of image processing is the operation by which the occurrences of each intensity value in the image is shown. Normally, the histogram is a graph showing the number of pixels in an image at each different intensity value found in that image. For an 8-bit grayscale image there are 256 different possible intensities, and so the histogram will graphically display 256 numbers showing the distribution of pixels amongst those grayscale values. Histogram modification is a classical method for 7
image enhancement, especially histogram equalization. Histogram equalization method is a self-acting process since it does not request any information, just only the probability of each intensity level of image. However, the enhanced image is obtained by the global area histogram equalization will cause an effect of intensity saturation in some areas. 3.2 What is Histogram Equalization Histogram equalization is the technique by which the dynamic range of the histogram of an image is increased. Histogram equalization assigns the intensity values of pixels in the input image such that the output image contains a uniform distribution of intensities. It improves contrast and the goal of histogram equalization is to obtain a uniform histogram. This technique can be used on a whole image or just on a part of an image. means 0, 1, 2, 3,..., 255. That is how new intensity levels are calculated for the previous intensity levels. The next step is to replace the previous intensity level with the new intensity level. This is accomplished by putting the value of Oi in the image for all the pixels, where Oi represents the new intensity value, whereas i represents the previous intensity level. To understand the working of the histogram equalization, take the example of the following image: the dynamic range of image intensities is shown by the following histogram: Histogram equalization redistributes intensity distributions. If the histogram of any image has many peaks and valleys, it will still have peaks and valley after equalization, but peaks and valley will be shifted. Because of this, "spreading" is a better term than "flattening" to describe histogram equalization. In histogram equalization, each pixel is assigned a new intensity value based on its previous intensity level. 3.3 General Working The histogram equalization is operated on an image in three step: 1). Histogram Formation 2). New Intensity Values calculation for each Intensity Levels 3). Replace the previous Intensity values with the new intensity values For the first step see the article on histogram. In step 2, new intensity values are calculated for each intensity level by applying the following equation: Fig1: Dark image The meaning of Max. Intensity Levels maximum intensity level which a pixel can get. For example, if the image is in the grayscale domain, then the count is 255. And if the image is of size 256x256 then, the No. of pixels is 65536. And the expression is the bracket means that the no. of pixels having the intensity below the output intensity level or equal to it. For example, if we are calculating the output intensity level for 1 input intensity level, then it means that the no. of pixels in the image having the intensity below or equal to 1 means 0 and 1. If we are calculating the output intensity level for 5 input intensity level, then the it means that the no. of pixels in the image having the intensity below or equal to 5 means 0, 1, 2, 3, 4, 5. Thus, if we are calculating the output intensity level for 255 input intensity level, then the it means that the no. of pixels in the image having the intensity below or equal to 255 Fig4: High contrast image 8
3.4 Histogram Equalization: Regional Adaptive The Histogram Equalization: Regional Adaptive algorithm, a high-pass filter, enhances the contrast in an image by reevaluating the gray-scale, or intensity, value of each pixel based on the values of nearby pixels in the same region. Background Features in some images require a larger range of intensity values than are displayed. Histogram equalization is a method to improve the contrast of an area in an image by distributing an equal number of pixels across the range of intensities in the image. This algorithm tabulates the histogram for each region, then assigns the pixel to the new histogram level. This algorithm acts in regions of an image, dividing the image into m rows and n columns. Each region is the source when remapping the histogram, adapting the value of the pixel to its location in the histogram of the region. Although, depending on image type, there are some minor variations in how this algorithm proceeds, generally the algorithm first calculates the bin width of each region. It then processes each region by judging each pixel's location within this new histogram. Regardless of pixel value, the algorithm remaps the brightest pixel in each region to the brightest value in the histogram (i.e., 256) and remaps the darkest pixel to the lowest value in the histogram (i.e., 0) of the pixels' neighboring region, recording the new values as pixelintensity values. The algorithm then processes each of the remaining regions in the original, or source, image in the same way and builds a new, or reference, image using the new pixel-intensity values. Performing histogram equalization makes it possible to see minor variations within portions of the reference image that appeared nearly uniform in the source image. Arithmetically, the process in a region is rather simple: where N i is the intensity of the ith pixel, and T is the total number of pixels in the region. The reference image using the new histogram is similar to the source image; however, in areas where the source image had similar values, the reference image is enhanced. The reference histogram now stretches over a greater proportion of the possible image intensities The histogram for the source image is very compact in structure; that is, it has a great number of darker pixels, but very few brighter pixels. In fact, the bottom-most intensity values make up almost all of the pixels' values in the image. Note, however, in the histogram of the reference image, the look-up table is more evenly spread than that of the histogram for the source image. Also, areas of low intensity and low contrast in the source image were correspondingly remapped in the reference image to areas of higher contrast and generally overall brighter values. Notice that different low areas of the reference image are more distinguishable depending on the number of rows and columns that divide the image. The contrast changes are due to which pixel is considered the brightest and which the darkest in a particular region. The brightest pixel in a 1 x 1 separated image is the brightest of the image. However, when the image is divided into more regions, the brightest pixel in the region gets remapped as one of the brightest pixels in the image regardless of its absolute intensity in the image. Likewise, the darkest pixel in the region is remapped as one of the darkest in the image regardless of its absolute intensity. The histogram equalization process can enforce certain characteristics about the image called clipping. As the algorithm processes the image, it counts out the number of pixels of certain intensity. Clipping cuts that counting short; it stores the excess pixels of a particular intensity and redistributes that number equally among all intensities. For instance, if a particular intensity must be clipped at 100 and the count is 145, the algorithm redistributes 45 pixels to other brightness. It adds to the count of each intensity level an equal number of pixels if there are enough excess, but it attempts to spread the excess over as many pixels as possible. Gamma correction Gamma correction operation performs nonlinear brightness adjustment. Brightness for darker pixels is increased, but it is almost the same for bright pixels. As result more details are visible. 4. Conclusion Histogram equalization is powerful method for image enhancement and it will increase the contrast of image. The enhanced image will give the full dynamic range of histogram. However, histogram equalization process tries to merge the adjacent gray levels together in order to force the uniformity of number of pixels in each appeared gray levels. Consequently, the intensity saturation will be presented in darkness regions and whiteness region. Histogram equalization assigns the intensity values of pixels in the input image such that the output image contains a uniform distribution of intensities. It improves contrast and obtain a uniform histogram. This technique can be used on a whole image or just on a part of an image. 5. References [1]. Bob Cromwell, "Localized Contrast Enhancement: Histogram Equalization," paper on his web site at http://www.cromwellintl.com/3d/histogram/index.html. 9
[2]. John Russ, The Image Processing Handbook (Boca Raton, Florida: CRC Press LLC, 2003). [3]. J. Alex Stark, "Adaptive Image Contrast Enhancement Using Generalizations of Histogram Equalization," in IEEE Transactions on Image Processing (May 2000). [4]. http//www.codersource.net/microsoftnet/cimageprocessing/histo gramandnormalizedhistograminc.aspx [5]. Dr A D Marshall, Vision Systems, Vision_lecture_caller.tex. [6]. ROHAN KAR IMAGE PROCESSING OPTICAL CHARACTER RECOGNITION Seminar Report 2004 Monsoon [7]. http//www.ndt ed.org/educationresources/communitycollege/radiography/adv ancedtechniques/real_time_radiography/imageprocessingtechn iques.htm [8]. Minakshi Kumar DIGITAL IMAGE PROCESSING, Photogrammetry and Remote Sensing Division Indian Institute of Remote Sensing, Dehra Dun [9]. V.V. Starovoitov, D.I Samal, D.V. Briliuk Image Enhancement for Face Recognition,Submitted to International Conference on Iconics, 2003, St.Petersburg, Russia. [10]. YuWang; QianChen; BaeominZhang; Image enhancement based on equal area dualistic sub-image histogram equalization method 06 August 2002 IEEE Consumer Electronics Society 10