Abstract:
A local enhancement method is provided, including: dividing an image into a plurality of blocks, which include a first block and a second block adjacent to the first block; generating histograms of the blocks respectively; generating enhancement functions of the blocks respectively based on the corresponding histograms, wherein the enhancement functions include at least a first contrast enhancement function of the first block and a second contrast enhancement function of the second block; and for each pixel in the blocks: generating a first enhanced pixel value for a current pixel of the first block based on the first contrast enhancement; generating a second enhanced pixel value for the current pixel of the first block based on the second contrast function of the second block; and generating a final enhanced pixel value for the current pixel based on the first and second enhanced pixel values.

Description:
BACKGROUND OF THE INVENTION 
       [0001]    1. Field of the Invention 
         [0002]    The present invention relates to image processing technology, and in particular relates to local contrast enhancement technology. 
         [0003]    2. Description of the Related Art 
         [0004]    Various image enhancement approaches are used to improve image quality. One of the image enhancement approaches is contrast enhancement. Contrast enhancement is a procedure used to improve contrast in images. Compared with global contrast enhancement, local contrast enhancement can bring out more detail in an image. For local contrast enhancement, an image is first divided into several blocks, and then a procedure called histogram equalization is performed to each of the blocks so that the brightness values of pixels in a block are transformed based on a transformation function (contrast enhancement function) of the block. The image after histogram equalization looks inconsistent due to different average brightness from block to block. 
       BRIEF SUMMARY OF THE INVENTION 
       [0005]    The present invention provides a local contrast enhancement method, in which an image is divided into a plurality of blocks, which include first and second blocks; generating histograms of the blocks respectively. Enhancement functions of the blocks are generated respectively based on the corresponding histograms, wherein the enhancement functions include at least a first contrast enhancement function of the first block and a second contrast enhancement function of the second block which is adjacent to the first block. For each pixel in the blocks, a first enhanced pixel value for a current pixel of the first block is generated based on the first contrast enhancement; a second enhanced pixel value for the current pixel of the first block is generated based on the second contrast function of the second block; and a final enhanced pixel value for the current pixel is generated based on the first and second enhanced pixel values. 
         [0006]    The present invention also provides a local enhancement apparatus, comprising: a block divider for dividing an image into a plurality of blocks, which include at least a first block, a second block horizontally adjacent to the first block, a third block vertically adjacent to the first block, and a fourth block horizontally adjacent to the third block; a block histogram generator for generating histograms of the blocks respectively; a block enhancement function generator for generating enhancement functions of the blocks respectively based on the corresponding histograms, wherein the enhancement functions include at least a first enhancement function of the first block, a second enhancement function of the second block, a third enhancement function of the third block, and a fourth enhancement function of the fourth block; a vertical interpolator for processing each pixel in the blocks by generating an first vertically interpolated pixel value for a current pixel of the first block based on the first enhancement function and the third enhancement function, and generating a second vertically interpolated pixel value for the current pixel of the first block based on the second enhancement function and the fourth enhancement function; and a horizontal interpolator for generating an enhanced pixel value for the current pixel based on horizontally interpolating the first vertically interpolated pixel value and the second vertically interpolated pixel value. 
         [0007]    The present invention also provides another local enhancement apparatus, comprising an enhancement module for dividing an image into a plurality of blocks, and generating histograms on each of the blocks to generate corresponding enhancement functions, wherein the blocks at least include at least a first block and a second block adjacent to the first block, and the enhancement functions include at least a first enhancement function of the first block and a second enhancement function of the second block; an interpolation module for generating an interpolated enhancement function for a current pixel of the first block, by interpolating coefficients of the first enhancement function and the second enhancement function; and a mapping unit for generating an enhanced pixel value by applying the current pixel to the interpolated enhancement function. 
         [0008]    A detailed description is given in the following embodiments with reference to the accompanying drawings. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0009]    The present invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein: 
           [0010]      FIG. 1  is a flow chart of the local contrast enhancement method according to the preferred embodiment of the present invention; 
           [0011]      FIG. 2  is the image on which the local contrast enhancement of the present invention is performed; 
           [0012]      FIG. 3  shows an exemplary curve of a contrast enhancement function for one of the blocks; 
           [0013]      FIG. 4  is a block diagram of a local enhancement apparatus according to a second embodiment of the present invention; and 
           [0014]      FIG. 5  is a schematic diagram of the local enhancement apparatus of a third embodiment of the present invention. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       [0015]    The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims. 
         [0016]    The present invention provides a local contrast enhancement method to overcome the deficiencies in the prior art. A preferred embodiment will be discussed in accordance with  FIGS. 1 and 2 . 
         [0017]      FIG. 1  is a flow chart of the local contrast enhancement method according to the preferred embodiment of the present invention, and  FIG. 2  is the image on which the local contrast enhancement of the present invention is performed. 
         [0018]    At first in step S 102 , the image is divided into a plurality of blocks. As shown in  FIG. 2 , the image  200  is divided into 25 squares W 0 ˜W 24 , wherein each has a height BH and a width WH. Then in step S 104 , histograms of the blocks are generated respectively. In step S 106 , contrast enhancement functions he 0 ˜he 24  are generated respectively for the blocks W 0 ˜W 24  based on the corresponding histograms. For illustration,  FIG. 3  shows an exemplary curve of a contrast enhancement function for one of the blocks, where each of the original brightness value in an X-axis is mapped to a new brightness value in a Y-axis. In one embodiment, the contrast enhancement functions he 0 ˜he 24  are polynomial functions, this step S 106  is to obtain coefficients of each term of the polynomial functions he 0 ˜he 24 . 
         [0019]    However, due to different contrast enhancement functions, the edges between two of the blocks may have different brightness and make the whole image  200  inconsistent. Therefore, the embodiment of the present invention uses a specific procedure in the following the steps to deal with this problem. Different from the interpolation in the prior art which is performed pixel by pixel, the embodiment of the present invention performs the horizontal interpolation and the vertical interpolation for each pixel. Take a current pixel P, marked as a star sign of the block W 11  in  FIG. 2 , as an example. In step  108 , a first horizontally interpolated pixel value P 1  for the current pixel P of the block W 11  is generated based on the contrast enhancement functions of the blocks W 11  and W 12 . In step  110 , a second horizontally interpolated pixel value P 2  for the current pixel P of the block W 11  is generated based on the contrast enhancement functions of the blocks W 16  and W 17 . There are various ways to do the interpolation in steps S 108  and S 110 . In this embodiment, a bi-linear interpolation is illustrated as an example, but not limited to. The weightings of the bi-linear interpolation are determined based on distances between the current pixel P and the corresponding adjacent blocks. The first horizontally interpolated pixel P 1  is generated by the following equation: 
         [0000]    
       
         
           
             
               P 
                
               
                   
               
                
               1 
             
             = 
             
               
                 
                   
                     ( 
                     
                       BW 
                       - 
                       w 
                     
                     ) 
                   
                   BW 
                 
                  
                 h 
                  
                 
                     
                 
                  
                 e 
                  
                 
                     
                 
                  
                 11 
               
               + 
               
                 
                   w 
                   BW 
                 
                  
                 h 
                  
                 
                     
                 
                  
                 e 
                  
                 
                     
                 
                  
                 12 
               
             
           
         
       
     
         [0000]    The second horizontally interpolated pixel P 2  is generated by the following equation: 
         [0000]    
       
         
           
             
               P 
                
               
                   
               
                
               2 
             
             = 
             
               
                 
                   
                     ( 
                     
                       BW 
                       - 
                       w 
                     
                     ) 
                   
                   BW 
                 
                  
                 h 
                  
                 
                     
                 
                  
                 e 
                  
                 
                     
                 
                  
                 16 
               
               + 
               
                 
                   w 
                   BW 
                 
                  
                 h 
                  
                 
                     
                 
                  
                 e 
                  
                 
                     
                 
                  
                 17 
               
             
           
         
       
     
         [0020]    Finally in step S 112 , a contrast enhanced pixel value P′ is generated for the current pixel P based on vertically interpolating the first horizontally interpolated pixel value P 1  and the second horizontally interpolated pixel value P 2 . The weightings of the bi-linear interpolation in step S 112  are determined based on distances between the current pixel P and the corresponding adjacent blocks. The contrast enhanced pixel value P′ is thus generated based on the following equation: 
         [0000]    
       
         
           
             
               P 
               ′ 
             
             = 
             
               
                 
                   
                     ( 
                     
                       BH 
                       - 
                       h 
                     
                     ) 
                   
                   BH 
                 
                  
                 P 
                  
                 
                     
                 
                  
                 1 
               
               + 
               
                 
                   w 
                   BW 
                 
                  
                 P 
                  
                 
                     
                 
                  
                 2. 
               
             
           
         
       
     
         [0000]    The steps S 108 -S 112  are repeated for each pixel in the image, so as to obtain a contrast enhanced image. 
         [0021]    It is noted that this embodiment performs horizontal interpolations (S 108 , S 110 ) and then vertical interpolation (S 112 ), but the sequence may be altered. In another embodiment, vertical interpolations maybe performed first. That is, a first vertically interpolated pixel value P 1 ′ for the current pixel P of the block W 11  is generated based on the contrast enhancement functions of the blocks W 11  and W 16 . Then a second vertically interpolated pixel value P 2 ′ for the current pixel P of the block W 11  is generated based on the contrast enhancement functions of the blocks W 12  and W 17 . Finally, a contrast enhanced pixel value P′ is generated for the current pixel P based on horizontally interpolating the first vertically interpolated pixel value P 1 ′ and the second vertically interpolated pixel value P 2 ′. 
         [0022]    From the steps described above, it can be found that each of the pixels on the scan line L has the same vertical distance h to the neighborhood squares W 10 ˜W 14  so that the steps S 108  and S 110  can be easily and quickly completed, thus making the present procedure more efficient than that of the prior art. 
         [0023]      FIG. 4  is a block diagram of a local enhancement apparatus according to the second embodiment of the present invention. The local enhancement apparatus  300  includes a block divider  310 , a block histogram generator  320 , a block enhancement function generator  330 , a vertical interpolator  340  and a horizontal interpolator  350 . At first, the block divider  310  divides the input image into a plurality of blocks. As shown in  FIG. 2 , the image  200  is divided into 25 squares W 0 ˜W 24 , wherein each has a height BH and a width WH. Then the block histogram generator  320  generates histograms of the blocks respectively. Next, the block enhancement function generator  330  generates enhancement functions he 0 -he 24  respectively for the blocks W 0 ˜W 24  based on the corresponding histograms. In this embodiment, the enhancement function is a contrast enhancement function, but other enhancement functions such as sharpness or color calibration are also possible. For illustration,  FIG. 3  shows an exemplary curve of a contrast enhancement function for one of the blocks, where each of the original brightness value in an X-axis is mapped to a new brightness value in a Y-axis. In one embodiment, the contrast enhancement functions he 0 ˜he 24  are polynomial functions, the step S 106  is to obtain coefficients of each term of the polynomial functions he 0 ˜he 24 . 
         [0024]    However, due to different contrast enhancement functions of different blocks, the edges between two of the blocks may have different brightness and make the whole image  200  inconsistent. The embodiment of the present invention performs the horizontal interpolation and the vertical interpolation for each pixel to achieve image consistency. Take a current pixel P, marked as a star sign of the block W 11  in  FIG. 2 , as an example. The vertical interpolator  340  first generates a first vertically interpolated pixel value Pv 1  for the current pixel P of the block W 11  based on the contrast enhancement functions of the blocks W 11  and W 16 . Then the vertical interpolator  340  generates a second vertically interpolated pixel value Pv 2  for the current pixel P of the block W 11  based on the contrast enhancement functions of the blocks W 12  and W 17 . There are various ways to do the interpolation in the vertical interpolator  340 . In this embodiment, a bi-linear interpolation is illustrated as an example, but not limited to. The weightings of the bi-linear interpolation are determined based on distances between the current pixel P and the corresponding adjacent blocks. The first vertically interpolated pixel Pv 1  is generated by the following equation: 
         [0000]    
       
         
           
             
               Pv 
                
               
                   
               
                
               1 
             
             = 
             
               
                 
                   h 
                   BH 
                 
                  
                 h 
                  
                 
                     
                 
                  
                 e 
                  
                 
                     
                 
                  
                 16 
                  
                 
                   ( 
                   P 
                   ) 
                 
               
               + 
               
                 
                   
                     ( 
                     
                       BH 
                       - 
                       h 
                     
                     ) 
                   
                   BH 
                 
                  
                 h 
                  
                 
                     
                 
                  
                 e 
                  
                 
                     
                 
                  
                 11 
                  
                 
                   ( 
                   P 
                   ) 
                 
               
             
           
         
       
     
         [0000]    The second horizontally interpolated pixel Pv 2  is generated by the following equation: 
         [0000]    
       
         
           
             
               Pv 
                
               
                   
               
                
               2 
             
             = 
             
               
                 
                   h 
                   BH 
                 
                  
                 h 
                  
                 
                     
                 
                  
                 e 
                  
                 
                     
                 
                  
                 17 
                  
                 
                   ( 
                   P 
                   ) 
                 
               
               + 
               
                 
                   
                     ( 
                     
                       BH 
                       - 
                       h 
                     
                     ) 
                   
                   BH 
                 
                  
                 h 
                  
                 
                     
                 
                  
                 e 
                  
                 
                     
                 
                  
                 12 
                  
                 
                   ( 
                   P 
                   ) 
                 
               
             
           
         
       
     
         [0025]    Finally the horizontal interpolator  350  generates a contrast enhanced pixel value P″ is generated for the current pixel P based on horizontally interpolating the first vertically interpolated pixel value Pv 1  and the second vertically interpolated pixel value Pv 2 . The weightings of the bi-linear interpolation used by the horizontal interpolator  350  are determined based on distances between the current pixel P and the corresponding adjacent blocks. The contrast enhanced pixel value P″ is thus generated based on the following equation: 
         [0000]    
       
         
           
             
               P 
               ″ 
             
             = 
             
               
                 
                   
                     ( 
                     
                       BH 
                       - 
                       h 
                     
                     ) 
                   
                   BH 
                 
                  
                 Pv 
                  
                 
                     
                 
                  
                 1 
               
               + 
               
                 
                   w 
                   BW 
                 
                  
                 Pv 
                  
                 
                     
                 
                  
                 2. 
               
             
           
         
       
     
         [0000]    The vertical interpolator  340  and the horizontal interpolator  350  process each pixel in the image, so as to obtain a contrast enhanced image. It is noted that, in this embodiment, the vertical interpolator  340  is placed before the horizontal interpolator  350 , but the sequence may be altered. In another embodiment, the horizontal interpolator  350  may be placed before the vertical interpolator  340 . 
         [0026]      FIG. 5  is a schematic diagram of the local enhancement apparatus of a third embodiment of the present invention. The above method  100  and the local enhancement apparatus  300  apply the current pixel to different enhancement functions of different blocks and then do the interpolation. The local enhancement apparatus  400  interpolates the enhancement functions and then applies the current pixel to the interpolated enhancement function to generate an enhanced pixel value. The local enhancement apparatus  400  comprises an enhancement module  410  and an interpolation module  420 . The enhancement module  410  divides an image (for example, image  200  in  FIG. 2 ) into a plurality of blocks (for example, squares W 0 ˜W 24  in  FIG. 2 ), generates histograms on each of the blocks, and generates corresponding enhancement functions (for example, contrast enhancement function he 0 ˜he 24  in the embodiment of  FIG. 2 ). The interpolation module  420  is coupled to the enhancement module  410 , and is used for obtaining all of the interpolated enhancement functions of the blocks. Given that the enhancement functions can be expressed by N-order polynomial functions, the interpolation module interpolates the coefficients of corresponding enhancement functions of corresponding blocks for each pixel. For example, the current pixel P in image  200  in  FIG. 2  has four corresponding enhancement functions he 11 , he 12 , hel 6  and he 17 . The interpolation module  420  generates an interpolated enhancement function ihe 11  for the block W 11  based on the corresponding enhancement functions he 11 , he 12 , hel 6  and he 17 . The weightings of the interpolation by the interpolation module  420  may be related to the distances between the current pixel P and the corresponding blocks W 11 , W 12 , W 16  and W 17 . Then the mapping unit  430  applies the pixels of block W 11  to the interpolated enhancement function ihe 11  to generate enhanced pixel values. 
         [0027]    For an image sensor with rolling shutter, the image is captured line by line. The following example illustrates the detail of the interpolation module  420  for this type of the image sensor. The interpolation module  420  includes multiplexers MUX- 0  to MUX-N, a vertical interpolation unit  422 , a storage unit  4224  and a horizontal interpolation unit  426 . For illustration, enhancement functions of 1-order polynomial function are taken as example: 
         [0000]    
       
         
           
             
               he 
                
               
                   
               
                
               01 
                
               
                 ( 
                 P 
                 ) 
               
             
             = 
             
               
                 
                   A 
                   0 
                 
                  
                 P 
               
               + 
               
                 
                   B 
                   0 
                 
                  
                 
                   
                       
                   
                    
                   
                       
                   
                 
                  
                 for 
                  
                 
                     
                 
                  
                 block 
                  
                 
                   
                       
                   
                    
                   
                       
                   
                 
                  
                 
                   W 
                   0 
                 
               
             
           
         
       
       
         
           
             
               he 
                
               
                   
               
                
               02 
                
               
                 ( 
                 P 
                 ) 
               
             
             = 
             
               
                 
                   A 
                   1 
                 
                  
                 P 
               
               + 
               
                 
                   B 
                   1 
                 
                  
                 
                     
                 
                  
                 for 
                  
                 
                     
                 
                  
                 block 
                  
                 
                     
                 
                  
                 
                   W 
                   1 
                 
               
             
           
         
       
       
         
           ⋮ 
         
       
       
         
           
             
               he 
                
               
                   
               
                
               24 
                
               
                 ( 
                 P 
                 ) 
               
             
             = 
             
               
                 
                   A 
                   24 
                 
                  
                 P 
               
               + 
               
                 
                   B 
                   24 
                 
                  
                 
                     
                 
                  
                 for 
                  
                 
                     
                 
                  
                 block 
                  
                 
                     
                 
                  
                 
                   W 
                   24 
                 
               
             
           
         
       
     
         [0000]    For the pixels in the block W 11 , The multiplexer MUX- 0  receives the first set of coefficients A 0 -A 24  and outputs corresponding coefficients A 11 , A 12 , A 16  and A 17 . The multiplexer MUX- 2  receives the second set of coefficients B 0 -B 24  and outputs corresponding coefficients B 11 , B 12 , B 16  and B 17 . The vertical interpolation unit  422  performs vertical interpolation in the column direction (i.e., y direction) on the enhancement functions of the blocks for each pixel on a line (for example, the scan line L in  FIG. 2 ). Take the current pixel P in  FIG. 2  as an example, the vertical interpolation unit  422  generates a coefficient Ai based on the first set of coefficients A 16  and A 11  according to the weightings based on the distances between the current pixel P and the corresponding blocks W 11  and W 16 . The vertical interpolation unit  422  generates a coefficient Bi based on the second set of coefficients B 16  and B 11  according to the weightings based on the distances between the current pixel P and the corresponding blocks W 11  and W 16 . The vertical interpolation unit  422  generates a coefficient Aj based on the first set of coefficients A 16  and A 11  according to the weightings based on the distances between the current pixel P and the corresponding blocks W 11  and W 16 . The vertical interpolation unit  422  generates a coefficient Bj based on the second set of coefficients B 16  and B 11  according to the weightings based on the distances between the current pixel P and the corresponding blocks W 11  and W 16 . The calculated coefficients Ai, Bi, Aj, Bj can be applied to the pixels on the line L. 
         [0000]    
       
         
           
             
               A 
                
               
                   
               
                
               i 
             
             = 
             
               ( 
               
                 
                   
                     h 
                     BH 
                   
                    
                   
                     A 
                     16 
                   
                 
                 + 
                 
                   
                     
                       BH 
                       - 
                       h 
                     
                     BH 
                   
                    
                   
                     A 
                     11 
                   
                 
               
               ) 
             
           
         
       
       
         
           
             
               B 
                
               
                   
               
                
               i 
             
             = 
             
               ( 
               
                 
                   
                     h 
                     BH 
                   
                    
                   
                     B 
                     16 
                   
                 
                 + 
                 
                   
                     
                       BH 
                       - 
                       h 
                     
                     BH 
                   
                    
                   
                     B 
                     11 
                   
                 
               
               ) 
             
           
         
       
       
         
           
             
               A 
                
               
                   
               
                
               j 
             
             = 
             
               ( 
               
                 
                   
                     h 
                     BH 
                   
                    
                   
                     A 
                     17 
                   
                 
                 + 
                 
                   
                     
                       BH 
                       - 
                       h 
                     
                     BH 
                   
                    
                   
                     A 
                     12 
                   
                 
               
               ) 
             
           
         
       
       
         
           
             
               B 
               j 
             
             = 
             
               ( 
               
                 
                   
                     h 
                     BH 
                   
                    
                   
                     B 
                     17 
                   
                 
                 + 
                 
                   
                     
                       BH 
                       - 
                       h 
                     
                     BH 
                   
                    
                   
                     B 
                     12 
                   
                 
               
               ) 
             
           
         
       
     
         [0028]    The storage unit  424  is coupled to the vertical interpolation unit  422 , and is used for storing the coefficients from the vertical interpolation unit  422 . The horizontal linear interpolation unit  426  is coupled to the storage unit  424 , and is used for performing horizontal interpolation in the line direction (i.e., x direction) on the stored coefficients of the vertical interpolation unit  422  for each pixel (for example, pixel P in  FIG. 2 ) of the line L to obtain an interpolated enhancement function Y out  of the pixel. 
         [0000]    
       
         
           
             
               Y 
               out 
             
             = 
             
               
                 
                   ( 
                   
                     
                       
                         w 
                         BW 
                       
                        
                       A 
                        
                       
                           
                       
                        
                       i 
                     
                     + 
                     
                       
                         
                           ( 
                           
                             BW 
                             - 
                             w 
                           
                           ) 
                         
                         BW 
                       
                        
                       A 
                        
                       
                           
                       
                        
                       j 
                     
                   
                   ) 
                 
                  
                 P 
               
               + 
               
                 ( 
                 
                   
                     
                       w 
                       BW 
                     
                      
                     B 
                      
                     
                         
                     
                      
                     i 
                   
                   + 
                   
                     
                       
                         ( 
                         
                           BW 
                           - 
                           w 
                         
                         ) 
                       
                       BW 
                     
                      
                     B 
                      
                     
                         
                     
                      
                     j 
                   
                 
                 ) 
               
             
           
         
       
     
         [0029]    The enhancement apparatus  400  further comprises a mapping unit  430  applying a pixel to the interpolated enhancement function Y out  to generate an enhanced pixel value for the pixel. 
         [0030]    While the invention has been described by way of example and in terms of the preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments. To the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements.