FAST DYNAMIC RANGE COMPRESSION FOR GRAYSCALE IMAGES
Vasilios Vonikakis
1
 , Ioannis Andreadis
1
and Antonios Gasteratos
2
 
1
Laboratory of Electronics, Section of Electronics and Information Systems Technology,Department of Electrical and Computer Engineering,Democritus University of Thrace, GR-671 00 Xanthi, GreeceE-mail: {bbonik, iandread}@ee.duth.gr 
2
Laboratory of Robotics and Automation, Section of Production Systems,Department of Production and Management EngineeringDemocritus University of Thrace, GR-671 00 Xanthi, GreeceE-mail: agaster@pme.duth.gr 
ABSTRACT
This paper presents a new center-surround network for thedynamic range compression of grayscale images. The proposed method exploits some of the shuntingcharacteristics of biological center-surround networks, inorder to reduce the effects of uneven illumination andimprove the dynamic range of images. The main advantageof the proposed method is its low computational burden,which allows the rendition of high-resolution 5-MPixelimages in approximately 1.3 seconds, when executed by aconventional personal computer. The method is comparedto the latest commercial version of the Retinex algorithm,and exhibits promising results for a wide variety of realimages and lighting conditions.
1. INTRODUCTION
The dynamic range of natural scenes, that is, the ratio between the maximum and minimum tonal values found inthe scene, can reach up to great proportions [1].Conventional 8-bit cameras have a dynamic range of just256:1, while 14-bit high-end cameras can reach up to16,384:1. This introduces an important problem to artificialvision systems, especially when the dynamic range of thescene exceeds the dynamic range of the camera. In thesecases, certain parts of the image can become either underexposured or overexposured, reducing the compoundvisual information. Contrary to cameras, the human visualsystem (HVS) can accommodate a dynamic range of approximately 10,000:1 [1]. This usually results intosignificant differences between the image perceived by theHVS and the one captured by the camera.Many algorithms have been presented in the past decadethat attempt to solve this problem. The most important of all is the Retinex family of algorithms. Retinex was first presented by Edwin Land in 1972 [2] and was inspired bysome attributes of the HVS, which also defined its name(Retina & Cortex). The initial algorithm inspired manyothers, the latest of which can be found in [3], while anextensive analysis of the algorithm can be found in [4,5].The main idea of Retinex is the calculation of ratios between the original image and a gaussian-filtered versionof the original image, by computing their differences in alogarithmic space. These ratios are used for the extractionof a lightness map which is independent from the sceneillumination and depends only on the reflectances of objects in the scene. The algorithm is appliedindependently to each chromatic channel and in threedifferent spatial scales. The final output is the weightedsum of the three scales. The main advantage of Retinex isthe good dynamic range compression that achieves for avariety of different lighting conditions and the color constancy attributes that exhibits. It has been successfullyused in many applications, such as shadow removal [6],color correction [7] and gamut mapping [8]. The mainweakness of Retinex is its computational burden, whichderives from the convolution of the image with Gaussianfilters of radiuses up to 240 pixels. Additionally, haloeffects tend to appear in regions where strong intensitytransitions exist, degrading the final output of the algorithm.Other approaches to the dynamic range compression problem include the modeling of brightness perception [9],the manipulation of gradient in the luminance component[10] and the combination of images captured with differentexposures [11, 12]. A detailed overview of dynamic rangecompression techniques can be found in [13].The proposed method is partially inspired by the HVS. It particularly adopts some of the shunting characteristics of the on-center off-surround networks, in order to define theresponse function for a new artificial center-surroundnetwork. This network compares every pixel to its localaverage and assigns a new value in order to light the dark image regions, while minimally affecting the light ones.Histogram stretching is applied before the center-surroundnetwork, ensuring that the final output occupies the fulldynamic range of the medium. The proposed algorithmallows the rendition of high resolution 5-MPixel images inapproximately 1 second, even when executed by aconventional personal computer. Additionally, no multiplescales are needed and no halo effects are introduced in thestrong transitions between light and dark regions. Thealgorithm exhibits good results for a wide variety of images and lighting conditions without requiring additionalmanual tuning. The evaluation of the proposed method is
 
carried out by comparing its outputs with the commercialsoftware PhotoFlair, which utilizes the Multi-Scale Retinex(MSR) algorithm, as presented in [3]. The results of thecomparison show that the proposed method exhibitscomparable and many times superior results to the Retinexalgorithm, in significantly lower execution times.The rest of the paper is organized as follows: Section 2 presents some of the attributes of the ganglion cells of theHVS upon which the proposed method is based and adetailed description of the algorithm. Section 3demonstrates the experimental results. Finally, concludingremarks are made in section 4.
2. DESCRIPTION OF THE METHOD
It is long known that a shunting on-center off-surroundnetwork of cells can reduce the effects of illumination(discount the illuminant) and extract the scene reflectances by adapting to a wide range of inputs [14, 15]. Theseattributes are the result of a biological adaptationmechanism known as ‘shunting inhibition’. The steadystate solution of the shunting differential equation, thatshows the output of an on-center off-surround cell, when t
 
, is shown in equation 1.(1)where C is the value of the center, S is the value of thesurround and g
leak 
is the decay constant. When used inimage processing applications, g
leak 
usually is themaximum value that a pixel may take, which in our case is255. The 3-dimensional representation of equation (1) for an on-center off-surround cell with 0
C
255 and 0
S
 255 is depicted in Fig. 1.Figure 1: The 3-dimensional representation of equation (1).The reason for which a center-surround cell with equation(1) as an activation function can discount the illuminant isevident in Fig. 1. In fact, equation (1) performs acomparison of the contrast between the center and thesurround and adequately adjusts the output. For lowsurround values, which means that the cell is located indark image regions, the non-linearity ‘a*’ acts as a localnonlinear correction: it gives a high output even when thecenter has low values. This practically means that in dark image regions, where illumination is not adequate, the cellincreases its response to the contrast between center andsurround, compensating for the low illumination. On thecontrary, for high surround values, which means that thecell is located in a light image region, the non-linearity ‘a*’gradually vanishes to the almost-linearity ‘a’. As a result,the output of the cell is linearly associated with the contrast between the center and the surround.Equation (1) possesses several characteristics, which makeit inappropriate for direct use in dynamic rangecompression. First, it produces a bipolar output, since it isessentially an edge detector. For this reason, it is usuallyfollowed by half-way rectification and a filling-in procedure [16] which is time consuming. Second, theoutput range is reduced to half ‘b’, as the surround values progress from low to high. In order to overcome thesedrawbacks, equation (2) is used as a basis, which describesthe total activity of a shunting center-surround network [14]. It is then modified in order to eliminate the unwantedoutput reduction ‘b’. The resulted function is equation (3).The graphical representations of both equations (2) and (3)are depicted in Fig. 2.(2)
 
(3)
 
Figure 2: Graphical representation of equations (2) and (3).In equations (2) and (3), B is the maximum value thefunction can take and A is a constant that determines thedegree of non-linearity. Equation (3) transitions from asharp non-linearity (A=1) to a linearity (A
1000), whilemaintaining the same output range 0
G(x)
B for all the
( )
leak 
C-SoutC,SgCS
=+ +
( )
BAxG(x)Ax
+ =+
BxF(x)Ax
=+
 
 possible values of A. If x is substituted by the center C of acenter-surround cell and the surround S is correlated withthe non-linearity factor A, a new, improved responsefunction is formed. Since the maximum response of thecell must be equal to the maximum value of a pixel, B=255.The following equations describe the activation function of the center-surround cell of the proposed method.(4)
 
(5)(6)
 
(7)Where, (i, j) denote the coordinates of a pixel in the imageand p is its value. In the proposed method, the surround S
i,j
 is the average of a 3×3 pixel region while the center C
i,j
isthe central pixel of this region. Equation (5) describes thenon-linearity factor A, as a function of the surround. Theminimum value obtained by A(S), when S=0, is denoted by‘m’. This non-linearity affects the overall result of thealgorithm and its value is determined by the statistics of theimage. Equation (6) describes the transition between thenon-linearity ‘a*’ and the linearity ‘a’, as the surroundvalues increase. Fig. 3 shows the 3-dimensionalrepresentation of equation (4).Figure 3: The 3-dimensional representation of equation (4).The new activation function maintains the transition fromthe non-linearity ‘a*’ to the linearity ‘a’ correlated with thevalue of the surround. This means that when the surroundhas low values, something occurring in dark image regions,the non-linearity ‘a*’ increases the value of the center inorder to increase the local contrast. On the contrary, whenthe surround comprises high values, something thathappens in light image regions, the linearity ‘a’ does notalter the value of the center. For all the intermediatesurround values, equation (6) determines the degree of non-linearity.The calculation of ‘m’ in equation (5) is as follows:(8)(9)
 
Where u(x) is the unit step function (is 1 if x
0 and 0 if x<0), px, py are the dimensions of image and p
i,j
the pixelvalue at position (i, j). The main idea is to calculate the percentage of pixels in the image that have values below85. This is a rough estimation of the darkness in the imageand therefore it is used to adjust the minimum value ‘m’that the non-linear factor A can obtain. Equation (9)linearly regulates the value of ‘m’, between 10, when100% of the image pixels are below 85 and 200, when 0%of the image pixels are below 85. Constant 85 was selectedas it is the 1/3 of 255 and can be thought of as the first binof a 3-bin histogram that divides the 255 intensities into 3sets: dark, medium and light.In order to achieve better results, a histogram clipping andstretching technique is required, prior to processing withthe center-surround network. The technique is the one thathas been extensively discussed in [4] and for this reason itis not described here.
3. EXPERIMENTAL RESULTS
The proposed method is compared to the MSR algorithm,extensively described in [3]. The MSR algorithm isgenerally used for color constancy applications. However,in the present study only its dynamic range compressioncharacteristics are compared, by applying it only ongrayscale images. The implementation of the MSR algorithm that was used for the tests was the commercialsoftware PhotoFlair that features the MSR algorithm. The parameters of the MSR were the default that the authorshave mentioned (3 scales with radiuses 5, 20 and 240 pixels and equal weights for every scale). The proposedmethod was implemented in C code. Both algorithms wereexecuted on an Intel Pentium 4 processor, running at 3GHz,with 512 MB RAM and Windows XP.
3.1 Results with Real Images
This subsection presents the results of the comparison between the MSR and the proposed algorithm, in a set of real high-resolution grayscale images. Most of the imagesrepresent scenes that were captured with different digitalcameras under different lighting conditions where dynamicrange correction is required. Table 1 exhibits some of theresults that were obtained by the proposed method andMSR. For every image, its size and the execution times of the two methods are included. It is important to mentionthat the PhotoFlair software that was used to obtain theMSR outputs has 3 different versions of the Retinexalgorithm: Scenic Retinex, Portrait Retinex and PortraitRetinex followed by ‘auto levels’, which is a form of 
( )
( )
( )
i,ji,j,ti,j,t1i,ji,j,t
255ASCC(C,S)ASC
+
+ =+
( )
i,ji,ji,j
A(S)SmqS
= + +
i,ji,ji,j
255Sq(S)255-S
=
 j1i1i,jy,xyi-1 xj-1
1Sp9
++= =
=
( )
190m100r10100
= +
( )
 pypxi,ji=1j=1
u85-pr =×100 px×py
Sign up to vote on this title
UsefulNot useful