Patent Publication Number: US-7899267-B2

Title: Dynamic range compensation by filter cascade

Description:
BACKGROUND 
     This application relates to image processing in digital camera, video, and other electronic digital image acquisition and or display devices, and particularly to techniques of improving the apparent dynamic range of such images. 
     Most digital images encode only a small fraction of the intensities a human observer can see in a real scene. Detail visible to the human eye is lost in dim and bright portions of the image due to the limited dynamic range of the image sensor and/or display device. For example, current image sensors provide contrast ratios in the range of 200:1 (a dynamic range of about 46 dB). Even if the raw dynamic range of the image-sensing device were to improve by a factor of 5, to 60 dB, further improvements would still be required in order to approach the performance of the human visual cortex, having a dynamic range approaching 80 dB. 
     Various methods have been suggested over the past decades for input-output intensity mapping of digital image data, in order to enhance the perception of image details at the extreme ends of a system&#39;s dynamic range. Methods fall into two broad classes, iterative solutions and non-linear filtering. Iterative solutions gradually, and repeatedly, modify an initial image towards infinite exposure time by employing a discretized partial differential equation (PDE), such as used to emulate heat transfer (see, for example, Choudhury and Tumblin, “The Trilateral Filter for High Contrast Images and Meshes”,  Eurographics Symposium on Rendering  2003, pp. 1-11, 2003). These methods combine smoothing and edge sharpening into a single iterative process. Anisotropic diffusion (see, for example, Perona and Malik, “Scale space and edge detection using anisotropic diffusion”,  IEEE Transaction Pattern Analysis and Machine Intelligence , vol. 12(7), pp. 629-639, 1990) and gradient (see, for example, Fattal et at., “Gradient domain high dynamic range compensation”,  ACM Transactions on Graphics, special issue on Proc. Of ACM SIG - GRAPH  2002 , San Antonio, Tex ., vol, 21(3), pp. 257-266, 2002) approaches are among these methods. Nonlinear filter methods compute each output pixel separately as a position-dependent function of input pixels in a local neighborhood. Non-Linear filters obtain good-quality edge preserving smoothing in a single pass. They can produce PDE like results without a time-consuming iterative solution or possible risks of instability (e.g., Choudhury and Tumblin, 2003, cited above). This class starts with Edwin H. Land&#39;s classic Retinex work and continued by others, which led to Bilateral-filtering (see, for example, Tomasi and Manduchi, “Bilateral filtering of gray and colored images”,  Proc. IEEE Intl. Conference on Computer Vision, pp.  836-846, 1998, or Duran and Dorsey, “Fast bilateral filtering for the display of high-dynamic range images”,  ACM Transactions on Graphics, special issue on Proc. Of ACM SIG - GRAPH  2002 , San Antonio, Tex ., vol. 21(3), pp. 249-256, 2000). 
     These various prior art methods tend to have a number of shortcoming when it come to implementation in digital cameras and video, such as the amount of processing power needed for setting or predetermining the coefficients which weight scaled filtered images. Consequently, given the difference in dynamic range between digital image systems and the human visual system, there is substantial room for improvements in digital imaging systems. 
     SUMMARY 
     The described methods and corresponding apparatus provide ways to achieve superior image quality as compared to previous image dynamic range compensation approaches. A cascade of filters of ascending scale is used to obtain the desired dynamic range enhancement, while preserving edge detail, as needed, by optionally specifying the number of filters in the cascade. Additionally, the automatic extraction of the filter weighting coefficients can be incorporated. 
     A local method uses a cascade of nonlinear edge preserving filters, and pixel point operations, to calculate the pixel gain or other pixel characteristics that can be employed to make image detail more visible. An exemplary embodiment uses a non-linear combination of a gray level image, L, extracted from the input image and two or more gray images obtained by applying 2-dimensional low-pass filters to ascending scale regions of the image. In an exemplary implementation, a pair of low-pass filters is used, being applied to surrounding neighborhoods of the current pixel of narrow and of wide extent. Alternatively, many low-pass filters can be employed in order to obtain finer edge preserving transitions. The coefficients used to combine L with the ascending scale regions can be automatically extracted from high-pass filtered images of the ascending scale regions. Multiplying each color component of the input image by one or more pixel dependent gain or attenuation factors, using a nonlinear mapping function that can lighten shadow regions, darken highlight regions or change the chromaticity of pixels in either of these regions, generates the output image. Altering input image pixel chromaticity (color balance) can be used separately, or in combination with, overall pixel gain adjustment to further enhance the appearance of image details in regions of the image close to positive (the highlight regions) or negative (the shadow regions) saturation. 
     Various aspects, advantages, features and embodiments of the present invention are included in the following description of exemplary examples thereof, which description should be taken in conjunction with the accompanying drawings. All patents, patent applications, articles, other publications, documents and things referenced herein are hereby incorporated herein by this reference in their entirety for all purposes. To the extent of any inconsistency or conflict in the definition or use of terms between any of the incorporated publications, documents or things and the present application, those of the present application shall prevail. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  illustrates an example of an Image Processing Unit (IPU) of a camera or other video acquisition device in which the exposure control techniques of the present invention may be implemented; 
         FIG. 2  is a block diagram of a basic dynamic range compensation embodiment; 
         FIG. 3  illustrates a basic embodiment of the filtering and non-linear combination operation; and 
         FIG. 4  shows a more general embodiment. 
     
    
    
     DETAILED DESCRIPTION OF EXEMPLARY EMBODIMENTS 
     The methods presented below use a cascade of nonlinear edge preserving filters, and nonlinear pixel point operations, to calculate the pixel gain or other pixel characteristics, such as chromaticity, that can be employed to make image detail more visible. It suggests a new non-linear combination of a plurality of gray level images, L, of L n  through L w , where L is a gray image extracted from the input image, L=log(max(R,G,B), and L n  through L w  are gray images obtained by applying 2-dimensional low-pass filters to ascending scale regions from the narrow (L n ) to the wide (L w ) of the image. In one exemplary implementation, two low-pass filters are applied to surrounding neighborhoods of the current pixel of narrow and of wide extent. In other cases, the filter sections could be used individually. Alternatively, many low-pass filters can be employed in order to obtain finer edge preserving transitions. The coefficients used to combine L with its neighbors L n  through L w  are automatically extracted from high-pass filtered images H n =L−L n , through H w =L−L w . Multiplying each color component of the input image by one or more pixel dependent gain or attenuation factors, using a nonlinear mapping function that may either lighten shadow regions or darken highlights or change the chromaticity of pixels in either of these regions, generates the output image. Altering input image pixel chromaticity (color balance) can be used separately, or in combination with, overall pixel gain adjustment to further enhance the appearance of image details in regions of the image close to positive (the highlight regions) or negative (the shadow regions) saturation. 
     Overview 
     The following section presents an overview of some of the various aspects of the dynamic range compensation method, flow, and apparatus. Although the implementation discussed here is presented in terms of hardware for expository purposes, implementations based on firmware, software, or various combinations can be used for the concepts discussed. Furthermore, the first implementation described is a basic configuration, using just two low pass filters for the calculation cascade; more refined implementations using additional filter sections are discussed further down. 
     The various embodiments presented below use the current pixel in conjunction with a plurality of signals derived from one or more successively widening neighborhoods to refine the estimate of the enhancement gain for the current pixel. The process is preferably performed after color interpolation, that is, demosaicing of Bayer grid sensor image data when a Bayer grid format sensor is employed, so there is no need to estimate the color components of the current pixel; rather, the near neighborhood of the current pixel may be used in the tone enhancement process to determine the pixel gain, in addition to the (at least one other) wider neighborhoods. This approach differs from the prior art in the use of a cascade of widening scales, or neighborhoods, in determining the dynamic range modification to be performed, as well as, in the automatic extraction of the coefficients. Although the following discussion is given in terms of a single gain factor for each pixel, more generally this can be one or more pixel dependent gain or attenuation factors or other factors, such as changing the chromaticity of pixels in either shadow regions or highlights, that can enhance the perception of image details at the extreme ends of a system&#39;s dynamic range. 
       FIG. 1  is a block diagram of some elements of an imaging system, such as a digital still or video camera. The image is captured at block  101 , which schematically represents the various front end elements (lens, sensor array, analog to digital conversion, etc.) that precede the Image Processing Unit (IPU)  111  and supply the image to the IPU. The image data can be supplied to the IPU as raw image, RGB, YCbCr422, YCbCr444, or other format where it can be received in a SDRAM  1113 , for example. The IPU will generally contain a number of additional elements, implemented in hardware, software, or some combination of these, as is familiar in the art, but which are suppressed here for simplification of the discussion. In this embodiment, the block labeled DRC (Digital Range Compensation)  117  in the middle of the processing chain receives a 3-color×12 bit linear RGB image constructed by, in this embodiment, the Color Interpolation (CI) unit  115  if needed, The RGB output image of the DRC block, here again taken as being a 3 color×12 bit linear RGB image, is then processed by the rest of the Image Processing Unit (IPU) pipeline and, typically, eventually JPEG encoded. More generally, other formats for the image data, such as 3×8 non-linear RGB, YUV, and so on, can be used. Additionally, the DRC block  117  can be located in other locations within the image processing pipeline. 
     A basic configuration for the DRC module is schematically diagrammed in  FIG. 2 . It computes a gain (or attenuation), G(s), for each sensor pixel, s=(i,j). Each color component (C in ) of the input RGB image (R in , G in , B in ) is multiplied by G(s) to produce the output color component for that pixel C o (s):
 
 Co ( s )= G ( s )* Cin,  
 
where C=R, G or B and in the above equation, and following discussion, ‘*’ stands for multiplication. Note that the gain determined from an L(s) in one format, such as RGB, may be applied to other image data format, such as YUV HSV and so on. Although the exemplary embodiment using a single G(s) for all channels at a given pixel, more generally differing factors can be used for the different channels in image data formats that more than a single channel per pixel.
 
     As shown in  FIG. 2 , the color components of the input RGB image is received at block  201  where the gray intensity image, I(s), is determined as the maximum value of the three color components of the input image pixel (R in , G in , B in ):
 
 I ( s )=max( R   in ( s ),  G   in ( s ),  B   in ( s )).
 
This differs from other methods, which use the luminance (Y) as in YCbCr, YUV, or other combination (e.g., Y=0.3R+0.6G+0.1B), and may suffer from color saturation. Instead, the present embodiment uses the max(R,G,B), which is more suitable to prevent color saturation.
 
     In block  203 , the log of I(s) is formed by means of a look-up table, or by other computational means:
 
 L ( s )=Log( I ( s )).
 
L(s) then serves as the measure of the image strength that is input into block  205  where low pass filtering and non-linear combining are performed to produce an image, F(s), where details of this process in the basic embodiment are given with respect to  FIG. 3 . The image F(s) is applied to a gain look-up table,  207 , to determine the gain values, G(s).
 
Filtering and Non-Linear Combining
 
     The filtering and non-linear processing to determine F(s) from L(s) are schematically diagrammed in  FIG. 3 . In this basic embodiment, L(s) is applied to two cascaded 2-dimensional low-pass filters, respectively using narrow and wide neighborhoods of the pixel being treated, in order to form images L n  and L w . These images are formed from narrow (e.g., ˜5×5 pels) and wide window support, respectively. The width of the wide window can be dependent on the image width; for example, it could be set as a percentage (e.g., 2% or 10%) of the image width. Rote that although the discussion given here is for an embodiment having at least two filter stages, single stage embodiments can also be used for some embodiments to compute gain or chromaticity factors.) 
     As shown in  FIG. 3 , L(s) is received at the first stage of the filter, where it filtered by the narrow window low pass filter (LPF n )  301  to produce L n . L n  is then combined with L in adder  311  to form the linear combination L pF  as output, where the coefficients of the combination are determined at  305  from Hn, the high-pass filtered of L, at adder  303  and are applied at  307  and  309 . The second stage of the filter is constructed similarly to the first stage, except that the low-pass filter LPF w    331  now uses the wide support window and the output F(s) is now the linear combination of the low-pass filtered signal and the output of the preceding stage L pF (S) (hence, the cascading) instead of the input signal L(s). 
     More specifically, the high-pass filter images H n  and H w  are respectively formed in the adders  303  and  333  by subtracting L n  and L w  from the input signal L:
 
 H   n ( s )= L ( s )− L   n ( s );
 
 H   w ( s )= L ( s )− L   w ( s ).
 
The non-linear, pixel dependent coefficients α and β are respectively extracted from the high pass filter images at  305  and  335  using nonlinear mapping functions beta(H n ) and alpha(H w ):
 
β=beta( H   n );
 
α=alpha( H   w )
 
In a basic embodiment, the nonlinear mappings beta(H n ) and alpha(H w ) can be predetermined.
 
     Finally, the cascaded output F(s) is formed by combining L with L n  and L w  according to the following equations:
 
 F=α*L   pF +(1−α)* L   w ;
 
 L   pF   =β*L +(1−β)* L   n ;
 
where these combinations are respectively formed in adders  341  and  311 .
 
     A simple example of a possible set of non-linear functions is given below: 
               beta   ⁢           ⁢     (   s   )       =     {         0             H   n     ⁢     {   s   )       &lt;   ThrHnLow             1             H   n     ⁢     {   s   )       &gt;   ThrHnHigh               HnSlp   *     {         H   n     ⁡     (   s   )       -   ThrHnLow     }           otherwise                 
where HnSlp=1/(ThrHnHigh−ThrHnLow), and
 
               alpha   ⁢           ⁢     (   s   )       =     {         0             H   w     ⁢     {   s   )       &lt;   ThrHwLow             1             H   w     ⁢     {   s   )       &gt;   ThrHwHigh               HwSlp   *     {         H   w     ⁡     (   s   )       -   ThrHwLow     }           otherwise                 
where HwSlp=1/(ThrHwHigh−ThrHwLow). In a basic embodiments the thresholds ThrHwHigh, ThrHwLow, ThrHnHigh, ThrHnLow are predetermined constants that can be set independently for each stage of the filter; more generally, the thresholds in one stage can be dependent on other stages and these can be adaptive and responsive to image characteristics, as discussed further below.
 
     In the example above, the coefficients are piecewise linear, being 0 below the low threshold and rising linearly to unity at the high threshold. Consequently, for smaller values of H n  (below the low threshold value), β=0 and the output of the first stage will be the low-pass filtered signal L n , while for values of H n  over the high threshold β=1 and the output of the first stage is the same as the input, L(s). Similarly, F(s) will transition between the low pass filter L w  and L pF  as magnitude of the high pass filter value increases. More generally, other functions than the piecewise linear example, such as those with smoother transitions (e.g., sigmoid), may be implemented using a look up table or other means. 
     The final stage of the process ( 207 ,  FIG. 2 ) computes the desired gain G(s) for a pixel s by nonlinear mapping of F(s). Since the image F is an edge preserving low pass filter version of the image L, it carries information on the intensity of the pixels and its surrounding narrow and wide support. A gain look up table (GainLUT) can be used to implement a user predetermined non-linear function. Thus,
 
 G ( s )=GainLUT ( F ( s )).
 
The amount of gain in shadow regions as well as attenuation in highlight regions is determined by the mapping of F to the LUT content. Other compensation factors besides the exemplary case of gain, such as chromaticity (color balance), would be similarly determined. Consequently, as noted above, there may be one or more compensation factors, some of which will differ for the differing color channels. Thus, for example, pixel chromaticity adjustment can be employed to effect greater visualization of detail in the final image, in conjunction with, or separately from, pixel gain adjustment.
 
     Generalized Embodiments 
       FIG. 4  is a generalized embodiment that incorporates one or more additional cascaded stages between the initial stage with the narrowest support window and the last stage with the widest support window. The use of these successively larger neighborhoods about the pixel fills the gap between L n  and L w  with additional low-pass filter sections to obtain finer edge preserving transition by cascading additional sections. The width of these windows may be set in various ways. For example, as noted above, the narrow window could be set at, say, ˜5×5 pels, with the width of the wide window dependent upon the image width. These widow sizes may be user determined, or in a more general case, may be dependent on the content of the image. Some measures that may be used for this are discussed below. 
     Making the Selection of the Thresholds Adaptive and Responsive to Image Characteristics 
     In each section of the cascade, depicted in  FIG. 3  or  4  above, a weighting factor (for example β in the section furthest to left in  FIG. 4 ) controls the combination between the section input L and output from its low-pass filter version Ln. The weighting factor depends on its thresholds, ThrHnLow, ThrHnHigh, with ThrHnLow&lt;=ThrHnHigh. In the basic embodiment above, these thresholds were preset. More generally, these thresholds, and the determination of the weighting factors in general, can be made adaptive and responsive to the characteristics of the image. In the following description the first section (with narrow support filter) is used as an example. For sections n&gt;1, the input to the section n is the output of section n−1 and L, which is the input to the section filter. 
     When the high pass filter data (HPF), which is the difference between the input (L) and filtered data (Hn=L−Ln), is below the low threshold (beta=0), the output of the section, LpF=beta*Hn+Ln, coincides with the filtered data (LpF=Ln). While when it is above the high threshold (that means beta=1) the output coincide with the section input (LpF=L). 
     The low and the high thresholds may be related to Hn. Examples may include, but not limited to the minimum, maximum, mean, median, standard deviation or other statistical measures taken from a histogram of the whole image or within a sub-image block. For example, one embodiment can set the low and the high thresholds with respect to the minimum and the maximum of Hn, respectively, mathematically represented as:
 
ThrHnLow=k1*min( Hn ), and
 
ThrHnHigh=k2*max( Hn ),
 
with, for example, k1=k2=0.5, so that the dynamic range of the blending process may be adapted to the image characteristics.
 
     In another set of embodiments, the image statistics may be better expressed by moments of distribution. For example, in a normal distribution the statistics may be sufficiently expressed by the first two moments, namely the mean and the standard deviation (std). Using this approach, the thresholds may be set as:
 
ThrHnLow=mean( Hn )− k 1*std( Hn ), and
 
ThrHnHigh=mean( Hn )+ k 2*std( Hn ).
 
     In addition, the thresholds may be used to adaptively control the contribution of each section. For example, by setting ThrHnLow&lt;=ThrHnHigh=min(Hn), the section is adaptively bypassed (LpF=L), since Hn&gt;=ThrHnHigh. Similarly, when ThrHnLow=max(Hn), the section uses the filtered data (LpF=Ln). 
     The mean and standard deviation of Hn may be extracted for the whole image, such as from a result of a preprocessing stage. In another embodiment, an estimate of these values may be taken either from a preview image (at a smaller scale), or a previous image in a sequence of images. Another alternative is to use local mean and standard deviation extracted from a sub-image block of pixels in the neighborhood of the current pixel. 
     Adaptively Selecting the Number of Stages Cascaded Dependent on Image Content 
     The general embodiment of  FIGS. 3 and 4  can include 2 or more cascaded stages. The particular number of active sections in the cascade can be adaptively selected using measurements from the whole image or from sub image block, so that a number sections ranging from one to all of the available sections are applied to the image. In the exemplary embodiments, each section contains a linear filter whose window support length increases with the section number; that is, again referring to  FIG. 4 , the LPF of section n+1 has larger support than LPF of section n. Since a narrow support filter can track changes more locally then a filter with wider support, the local contrast may be controlled by selectively using various sections in cascade. 
     Various spatial measurements may be used to characterize the image content. These measurements, which can be taken together with user preference for the amount of local contrast needed, can be used to adaptively determine which and how many sections will be used. Examples of such measurements may include, but are not limited to:
         (1) The local magnitude of one or more of the high-pass filters (e.g. Hn) and its sign may help to measure local edges and their direction (rising or falling edge) within the image or some sub-image block. In this case measurements are taken locality with relation to the support of the section filter.   (2) Spatial frequencies as obtained from the image or sub image block, by frequency domain tools such as Discrete Cosine Transforms (DCT). A spatial frequency is detected in the image or sub image block when its coefficient is above a given threshold.       

     CONCLUSION 
     Although the various aspects of the present invention have been described with respect to exemplary embodiments thereof, it will be understood that the present invention is entitled to protection within the full scope of the appended claims.