You are on page 1of 10

Contrast Limited Adaptive Histogram Equalization for Image Enhancement - OpenCV

Pi19404
February 2, 2013

. . . . . .2 Histogram Equalization . . . . . . . References . 3 3 5 6 8 8 9 9 9 2 | 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Contents Contents Contrast Limited Adaptive Histogram Equalization for Image Enhancement 3 0. . . . .6 Application 2 . . . . . . . . . . . . . . . . . . . . 0. . . . . . . . . .1 Introduction . . . . . . . . . . . . . . . . . . . . . 0. . . . 0. . . . . . . . 0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 Adaptive Histogram Equalization . . . . . . .7 Application 2 . . . . . . . . . . . . . . . . . . . . . . . . .4 Control Limited Adaptive Histogram Equalization 0. . . . . . .5 Application 1 . . . 0. . .8 Code . . . . . . . . . . . . . . . . 0. . . .

First we look at global histogram equalization.Most of pixels in image lie in narrow range . A Image Histogram is simply the count of pixel intensities organized into set of predefined bins A image with low contrast has histogram concenterated about some pixels while a image with high contrast has histogram that is equally spread over range of pixels.Contrast Limited Adaptive Histogram Equalization for Image Enhancement Contrast Limited Adaptive Histogram Equalization for Image Enhancement 0.adaptive histogram equalization and variance of adaptive histogram equalization called Contrast Limited Adaptive Histogram Equalization.2 Histogram Equalization A Image is said to have good contrast if it has good color variance.hence there is a low variance in pixel intensities . A Image histogram is a good tool to analyze the contrast of the image. 0. (a) Low contrast Image (b) Histogram 3 | 10 . Below are histogram of low high contrast image.1 Introduction Contrast Limited Adaptive Histogram Equalization is technique to enhance the images by improving the contrast of image.It can be observed that histogram is concenterated about few pixel values. local histogram equalization.

Contrast Limited Adaptive Histogram Equalization for Image Enhancement To produce a high contrast version of the image .the task is to process the image such that histogram is more evenly distributed across all the pixel values. The main reason for these effects may be attributed to the fact that image transformation is performed considering the global histogram of image and the same transformation many not necessarily be suitable in local context .indicating the image contains a large variation of pixels indicating a high contrast image.equalization will not transform the histogram to great extent by may lead in increasing the noise in the image The aim of histogram equalization tecnhiques is to apply some transformation of the image so that output image has increased contrast and histogram that is well distributed over the all range of pixels (c) Low contrast Image (d) Histogram (e) High contrast Image (f) Histogram However this method has many disadvantages and produces artificial images under certain scenarois. Below are samples images for which histogram equalization produces image that introduces artifacts or leads to less visually appealing images.It may lead to enhancing the unwanted noise and supressing desired information in image. These effects can be observed for images with very poor contrast such that histogram is very narrow. The histogram equalization also tends to produce visible gradients when applied to low contrast 4 | 10 .

5 | 10 . The interpolated pixel is computed by using bi-linear interpolation of vaue of pixel in 3 neighboring blocks.regions with high frequency or noise The boundary between adjacent blocks are also clearly visible due to variation in local transformation function.Too small a size will make will make it too sensitive to local variations and image noise and this will lead to artifacts .For each block histogram is computed and equalization if performed over the neighborhood. (g) Low contrast Image (h) Histogram (i) High contrast Image (j) Histogram Figure 1: Disadvantages of Equalization 0.To improve the image by providing a smooth variation of pixel values across adjacent blocks interpolation technique is used. The parameter to control is the local neighborhood size. These effects are pronounced in regions which are homogenous .3 Adaptive Histogram Equalization Adaptive histogram equalization divides the image into several blocks . Generally neighborhood is choosen about a point and operation is performed for all points in the image.Contrast Limited Adaptive Histogram Equalization for Image Enhancement images.

6 | 10 .Contrast Limited Adaptive Histogram Equalization for Image Enhancement The transformation function accepts a pixel intensity values and outputs a transformed pixel intensity value.(i   1. y ) in = (A   )£(   )£ x B y v1 + (A   )£ £ y x v2 + (A   )£ £ x y v3 +x £ £ y v4 For the block that lie along the boundary of the image linear interpolation is used Consider the block (i. For such regions a histogram clip limit can be defined. 0. 0) and (i   1. j ) and (i.4 Control Limited Adaptive Histogram Equalization It can be observed that noise in enhanced in regions of low contrast using adaptive histogram equalization. j ) and let value of pixel according to transformation function in these blocks be v1.(i. j   1) .v2. 0) if pixel corridnaties are such that x < A=2 and y < B=2 then v = (A   )£ x v1 +x £ £ v2 Similarily for blocks along boundary in y direction v (0. however we clip all the pixels so as to obtain a relatively uniform historam indicating a image with good contrast. The only different is how they handel pixels at a local level.v3.The transformation is computed using the clipped histogram. The histogram value is maintained the same if not excess pixels are not added to it.The histogram is clipped at the specified value and pixels are distributed to obtain a locally uniform histogram. Consider the block with size (A. j ) and (0.interpolated and CLAHE are almost same. B ) and co-ordinates (i   1.v4. The histogram of adaptive equalization.While interpolation provides smooth transition between adjacent blocks of pixels. The bilinear interpolation can be expressed as for pixel block 4 v (x. j   1) = (B   )£ y v1 +y v2 The interpolation will reduce the boundary effects and provide smooth transition of pixel values between adjacent blocks of image. j   1) .

The clipped level for all the blocks the transformation domain will be the same for all the blocks.Contrast Limited Adaptive Histogram Equalization for Image Enhancement The effect of clipping is to produce locally uniform histogram . (a) Low contrast Image (b) Histogram (c) Equalize (d) Histogram (e) normalized (f) Histogram (g) Local HE (h) Histogram (i) interpolated (j) Histogram (k) CLAHE (l) Histogram Figure 2: Local Histogram Equalization 7 | 10 .The locally uniform histogram will give rise to locally good contrast image and the uniform clip level will give rise to a globally consistant image.

Another approach we can take is to apply CLAHE to RGB channels on the image independently choosing the clip level for each channel independently based on the requirement.then CLAHE is applied on the illumination channel of the color image. In some situations it may be required to apply CLAHE to only one of RGB channels and Global histogram equalization is applied to other channels.applying the CLAHE algorithm to the illumination channel does not help much in improving the contrast of the image.Contrast Limited Adaptive Histogram Equalization for Image Enhancement 0.6 Application 2 If in the above approach the color cast is not removed successfully . (a) gray world (b) CLAHE (c) gray world (d) CLAHE Figure 3: Application of CLAHE to image enchancementApplication 1 0. 8 | 10 .5 Application 1 An application of CLAHE is for underwater image processing.First the color cast in under water image are removed using color constancy algorithm.In the below examples it can be seen that such processing is useful for enhancement of underwater images.

7 Code Code is available in repository http://code. 9 | 10 .com/p/m19404/source/ browse/CLAHE/HistogramEqualization the implemetation is written in opencv using C++ wrappers and is same as OpenCv Code for Clahe and Code for Clahe with few minor modifications based on the above analysis.Contrast Limited Adaptive Histogram Equalization for Image Enhancement (a) image (b) CLAHE R (c) global RGB (d) CLAHE RGB Figure 4: Application of CLAHE to image enchancementApplication 2 0.google.

. Karel Zuiderveld. San Diego. Contrast limited adaptive histogram equalization. 1994.org/citation. Karel Zuiderveld.c.cfm?id=180895.acm. Code for Clahe. url: https://github.com/joshdoe/opencv-clahe. Heckbert. Chap. In: ed. by Paul S. url: http://dl.  Graphics gems IV. pp. isbn: 0-12-336155-9. 10 | 10 . USA: Academic Press Professional.180940. Inc. 474485. url: http://tog.org/resources/ GraphicsGems/gemsiv/clahe. [3] acm. CA.Bibliography Bibliography [1] [2] OpenCv Code for Clahe.