Patent Publication Number: US-11663707-B2

Title: Method and system for image enhancement

Description:
CROSS-REFERENCE TO RELATED APPLICATIONS 
     This application is a continuation application of U.S. patent application Ser. No. 16/796,998, filed on Feb. 21, 2020, which is a continuation of U.S. patent application Ser. No. 15/566,222, filed on Oct. 13, 2017, which is U.S. national stage entry under 35 U.S.C. § 371 of International Application No. PCT/CN2015/076567, filed on Apr. 14, 2015. The contents of above applications are hereby incorporated by reference. 
    
    
     FIELD OF THE INVENTION 
     The invention relates to an image processing method and system, particularly relates to an image enhancement method and system, more particularly to a contrast enhancement method and system. 
     BACKGROUND OF THE INVENTION 
     Image enhancement is a subfield in digital image processing which aims to improve the interpretability or perception of information in images for human viewers, or to provide better input for other automated image processing techniques. 
     Generally speaking, image enhancement approaches fall into two broad categories: spatial domain methods and frequency domain methods. While frequency domain methods are carried out on the frequency domain of an image, spatial domain methods operate directly on pixels of an image. Among all the methods, histogram equalization and histogram specification both belong to the category of spatial domain techniques and offer effective approaches in image enhancement. 
     To adjust the contrast of an image, histogram equalization is often implemented. Roughly speaking, an image histogram is a type of histogram that acts as a graphical representation of the tonal distribution in a digital image. The histogram plots the number of pixels in the image (vertical axis) with a particular brightness value (horizontal axis). Histogram equalization spreads out the most frequent intensity values. After equalization, the gray level in object image is set to be uniformly distributed. 
     Different from histogram equalization which makes the gray level in the object image uniform, histogram specification (or histogram matching) offers another flexible and efficient way of image enhancement. The process of histogram specification takes in an input image and produces an output image that is based upon a particular histogram that can be pre-defined. The histogram specification can be degraded into histogram equalization if the gray level in the object image is set to be uniformly distributed. 
     Since the process of histogram specification depends on the histogram that is specifically defined, it is essential for histogram specification to choose a suitable shape of the histogram, i.e., to choose a density function of the histogram. Several methods of histogram specification so far have been used to improve the performance of histogram specification. For example, some proposals are formulated utilizing a single Gaussian function having the average grey level value of the input image as the expectation and the contrast value as the standard deviation to specify a histogram. Unfortunately, those proposals utilizing a single Gaussian function suffer from loss of image details. 
     It would therefore be desirable to have systems and methods that implement a histogram specification to improve the reproduction of image detail while enhancing the quality of an image effectively. 
     SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide an image processing method utilizing a statistical distribution to enhance a digital image. 
     It is an object of the present invention to provide an image processing method capable of enhancing the clarity or contrast of an image without losing its detail. 
     It is an object of the present invention to provide an image processing method capable of enhancing the visual effect of a digital image. 
     According to another aspect of the present invention, the contrast of the image is utilized as an input value to generate the statistical distribution model. 
     In one embodiment of the present invention, an image processing method comprises of, first, reading an image and generate a histogram thereof; then, calculating a parameter profile from the image; adjusting the parameter profile to get a new parameter profile; using the new parameter profile as input to a cloud generator to generate a statistical distribution; using the distribution function to perform histogram specification to the said histogram; and lastly, generating a new image and a corresponding histogram thereof. 
     Further features and aspects of the present invention will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG.  1    is a sketch illustrating an image processing device for image enhancement. 
         FIG.  2    is a flowchart illustrating operation of an image enhancement method for unclear image. 
         FIG.  3    is a diagram illustrating input and output of a cloud generator. 
         FIG.  4    is a diagram illustrating input and output of an inverse cloud generator. 
         FIG.  5    is a flowchart illustrating operation of an image enhancement method for a foggy grayscale image according to one embodiment. 
         FIG.  6    is a flowchart illustrating operation of an image enhancement method for a foggy color image according to one embodiment. 
         FIG.  7    is an example illustrating an original grayscale image and its defogged version after the defogging processing according to one embodiment. 
         FIG.  8    is an example illustrating an original color image and its defogged version after the defogging processing according to one embodiment. 
     
    
    
     DETAILED DESCRIPTION 
     The invention will now be described by way of example with reference to the accompanying drawings. 
     [Optional Preprocessing] 
     To process an image, especially when the image is a color image, several preprocessing steps may be carried out. 
     The color conversion, or sometimes called color transformation, is usually included in the preprocessing steps. Conventional image capturing or acquisition devices often utilize one specific kind of various RGB color spaces (Adobe RGB, sRGB, ProPhoto RGB, etc.) to acquire a color image. Similarly, images are usually stored in the same RGB color space. The RGB format labels the different colors according to the human vision system and expresses a color image in terms of Red (R), Green (G) and Blue (B) components. On the other hand, the luminance information, rather than the color information, is paid more attention in many applications. Therefore, alternative color spaces including YUV color spaces (YUV PAL, YDbDr SECAM, YCbCr, YPbPr, xvYCC, etc.) and YIQ color space are proposed. Since human vision is more sensitive to brightness than to color, those color spaces explicitly address the luminance information of an image. For example, YUV color spaces express a color image with one luminance component Y and two chrominance components U and V. 
     Accordingly, it is convenient to convert the RGB color space of an image to a different color space, such as a YUV color space, or a grayscale color space. The way of converting a color image to YUV or grayscale color space is not unique; depending on different weighting of the color channels. It can be conducted in various ways, e.g. colorimetric (luminance-preserving) conversion, which are known by a person skilled in the art. 
     The steps of image preprocessing are not restricted to color conversion exclusively. Other techniques in image processing such as image cropping, white-balance calibration, noise reduction, shake reduction or any other operations, as known by a person skilled in the art, may also be included. The preprocessing techniques aiming at different purposes may be executed individually or in combination. 
     [General Procedure] 
     To implement the image processing operations, an image processing device is described in the following to handle the relevant steps and procedures. The device may comprise a computing unit, an input unit, an image enhancement module to carry out enhancement operations, several memories to store data and buffers to store intermediate data stream, etc. 
     Referring to  FIG.  1   , a system  120  for image enhancement is illustrated with its upstream device, say an image acquisition device  110 , and the downstream device such as an image display device  180 . The system comprises several modules for execution of the following functions. As an example, the image enhancement system  120  is connected to the image acquisition device  110  including but not limiting to a camera, a scanner or a mobile device with a build-in camera, and the image display device, such as a desktop display or a display of mobile phones. The manner of connection may be physical, such as via universal serial bus (USB) or an ultra-high speed (UHS) bus, or nonphysical, such as a wireless connection via wireless local area network (WLAN) or near field communication (NFC) or Bluetooth. The connection would enable data transfer between the image enhancement system and its upstream or downstream partner. Inside the system  120 , an input unit  130  is deployed for reception and storage of an image file from the acquisition device  110 . A computing unit  140 , which receives the image data (pixel values of the image) from the input unit, calculates a histogram and a parameter profile which is used to generate a statistic distribution via a profile generator (PG)  142 . The profile is then stored in a profile buffer  144 , conventionally a high speed cache. Image information, such as the pixel values for a YUV image, is used by a cloud generator  146  to generate a statistical distribution. The detailed description of the generation of the statistical distribution via the cloud generator  146  is given in the following embodiment. An adjustment unit  150  is used by the system  120  to adjust the parameter profile and feed it back to the profile buffer  144  in the computing unit for updating of the parameter profile and subsequent calculation of a new statistical distribution. The adjustment unit may be tuned manually or automatically. Further, the system  120  includes a specification unit  160 , which performs histogram specification according to the statistical distribution fed by the cloud generator  146 . Specifically, the histogram specification maps a histogram of the original image to a new histogram using a mapping rule. With the mapping rule chosen, an enhancement unit  170  reads the original image from the input unit  130  and carries out the operation of image enhancement through the process of pixel manipulation according to the mapping rule defined by the histogram specification unit  160 . The operation ends with a resulting enhanced image. Optionally, the newly generated image is outputted, for example, to a display device  180 , e.g., a desktop display. 
     Referring to  FIG.  2   , a general workflow of image enhancement system  120  is illustrated. In step  210 , initially a digital image is transferred into the image enhancement system  120 , via the Internet or other physical connection such as a universal serial bus (USB) or an ultra-high speed (UHS) bus. The image enhancement system  120  has an input  130  which plays the role of both interface of the transfer and memory which stores the image. After reading the image, intensity information (RGB values in a RGB format image, Y-component values in a YUV format image, or grey level values in a grayscale image, etc.) for each pixel is stored by the input unit  130 , allowing its computing unit  140  to generate a histogram which is subsequently stored in the main memory. 
     Going to step  220 , a profile generator  142  in the system  120  calculates a parameter profile according to the stored intensity information. The parameter profile may vary according to the way of encoding, data format or type of image. Preferably, a parameter which indicates the average luminance or brightness may be included. It may be calculated as: 
     
       
         
           
             A 
             = 
             
               
                 
                   ∑ 
                   
                     r 
                     = 
                     0 
                   
                   
                     L 
                     - 
                     1 
                   
                 
                 ⁢ 
                 
                   r 
                   ⁢ 
                   
                     
                       p 
                       r 
                     
                     ⁡ 
                     
                       ( 
                       r 
                       ) 
                     
                   
                 
               
               = 
               
                 
                   ∑ 
                   
                     r 
                     = 
                     0 
                   
                   
                     L 
                     - 
                     1 
                   
                 
                 ⁢ 
                 
                   r 
                   ⁢ 
                   
                     
                       n 
                       r 
                     
                     n 
                   
                 
               
             
           
         
       
     
     Where L represents the total number of gray levels in the image (typically 256); r represents the discrete intensity level, e.g., r is an integer between 0 and 255 in a grayscale image; n r  represents the occurrence of intensity level r; and n represents the total number of pixels in the image. 
     The contrast of the image may also be included in the parameter profile. According to a definition, the contrast of an image may be defined as 
     
       
         
           
             B 
             = 
             
               
                 ∑ 
                 
                   
                       
                   
                   
                     δ 
                     = 
                     0 
                   
                 
                 L 
               
               ⁢ 
               
                 
                   δ 
                   2 
                 
                 ⁢ 
                 
                   p 
                   δ 
                 
               
             
           
         
       
     
     Where δ is the difference in the intensity level between neighboring pixels, and p δ  is the probability distribution of the intensity difference δ among neighboring pixels in the image. 
     It should be noted that several definitions of contrast are currently in use, for example, luminance contrast, Weber contrast, Michelson contrast, or root mean square (RMS) contrast. It would be customary for a person of ordinary skill in the art to adopt a different definition of contrast in the parameter profile without much creative work of him/herself. 
     Other parameters such as the standard deviation of the intensity values may also be included in the profile. 
     Going to step  230 , the parameter profile obtained in step  220  is transferred to a distribution generator named a cloud generator. The cloud generator may comprise several random number generators (RNGs) that generate random variables with Gaussian distribution and multiple buffers to store the intermediate random values generated by the RNGs. 
     Generally speaking, a Gaussian distribution, or a normal distribution, is a mapping of two parameters, i.e., expectation and standard deviation to a normal distribution, which may agree well with the behavior of real-valued random variables whose distributions are not known. However, some random variables do not follow the Gaussian pattern, and treating them as Gaussian random variables causes systematic errors in some cases. In a cloud generator, it is possible to measure the deviation of a random phenomenon from a normal distribution when the random phenomenon does not satisfy strictly a normal distribution. Different from the Gaussian model, the cloud generator contains a random variable that describes a normally distributed standard deviation, which adds a third parameter named “hyper entropy” other than expectation and standard deviation. Thus, cloud generators use three numerical characteristics, namely Ex (expectation), En (entropy) and He (hyper entropy), wherein, Ex is most representative of a set of data; En is used to figure out the granularity scale of the set; He is used to depict the uncertainty of the granularity of the data set. The addition of additional parameters contributes to a better depiction of the data set. 
     Referring to  FIG.  3   , a cloud generator  340  maps three parameters, namely, expectation Ex, entropy E n  and hyper entropy H e , to a statistical distribution, as follows: 
     A normally distributed random number y i  with expectation E n  and variance H E  is generated by a Gaussian random number generator, then y i  is stored in a buffer; 
     
       
         
           
             
               y 
               i 
             
             = 
             
               
                 R 
                 N 
               
               ⁡ 
               
                 ( 
                 
                   
                     E 
                     n 
                   
                   , 
                   
                     H 
                     E 
                   
                 
                 ) 
               
             
           
         
       
     
     A normally distributed random number x i  with expectation E x  and variance y i  is generated by the Gaussian random number generator; 
     
       
         
           
             
               x 
               i 
             
             = 
             
               
                 R 
                 N 
               
               ⁡ 
               
                 ( 
                 
                   
                     E 
                     x 
                   
                   , 
                   
                     y 
                     i 
                   
                 
                 ) 
               
             
           
         
       
     
     Wherein i is the index of repetition. Then the cloud generator produces plural samples, herein denoted as drop  350 . The three parameters may be selected from the above parameter profile, which comprises the expectation of the grey levels (average grey level) in the grayscale version of an image, the contrast of the image, or other available information relating to the image. 
     Referring back to  FIG.  2   . In Step  240 , a histogram equalization operation is carried out on the image and the histogram equalization mapping is obtained. For each intensity level k, there is an accumulative probability s k  which indicates the probability of the intensity level no greater than k. 
     
       
         
           
             
               
                 
                   
                     s 
                     k 
                   
                   = 
                   
                     
                       T 
                       ⁡ 
                       
                         ( 
                         
                           r 
                           k 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         ∑ 
                         
                           i 
                           = 
                           0 
                         
                         k 
                       
                       ⁢ 
                       
                         
                           
                             p 
                             x 
                           
                           ⁡ 
                           
                             ( 
                             i 
                             ) 
                           
                         
                         ⁢ 
                         
                           ( 
                           
                             k 
                             = 
                             
                               0 
                               ∼ 
                               
                                 L 
                                 - 
                                 1 
                               
                             
                           
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
           
         
       
     
     Then, in Step  250 , the parameter profile is adjusted by an adjustment unit in connection with the profile generator. It&#39;s noteworthy that at least one parameter in the profile may be changed, in a manual or automatic way. The adjustment may be carried out once, if the resulting image is satisfactory, or conducted multiply. When the adjustment is multiply conducted, it&#39;s possible to implement an iterative algorithm based on some standard iteration method, including but not limited to Newton&#39;s method, or a conjugate gradient method or a gradient descent method, or any other optimization methods known by person skilled in the art. After the adjustment a newly updated parameter profile is fed to the cloud generator to generate a new distribution function. Its probability density function can also be found, thus the probability p z (i) for each individual grey level i can be determined along with the accumulative probability v l . 
     
       
         
           
             
               
                 
                   
                     v 
                     l 
                   
                   = 
                   
                     
                       G 
                       ⁡ 
                       
                         ( 
                         
                           z 
                           l 
                         
                         ) 
                       
                     
                     = 
                     
                       
                         ∑ 
                         
                           i 
                           = 
                           0 
                         
                         l 
                       
                       ⁢ 
                       
                         
                           p 
                           z 
                         
                         ⁡ 
                         
                           ( 
                           i 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
           
         
       
     
     Different ways to adjust the profile may be used, e.g., adjust only one parameter while fixing other parameters, or adjust several parameters at the same time. In a real-life scenario, it is customary to adjust the contrast of the image to enhance the perception while keeping other parameters such as the average luminance or the hyper entropy constant. It should be recognized that this step may be carried out before the step in which the histogram equalization is executed. Certain codes or algorithms may be embedded into the adjustment unit. 
     After the new distribution function is generated, the computing device uses this distribution function to specify the histogram of the desired image. To specify the histogram, a correlation of the source histogram and the resulting histogram is in need. Every intensity level in the source histogram is mapped to its corresponding intensity level in the resulting histogram. Said mapping may be carried out by computers or other computing devices iteratively. For each intensity level k in the original histogram, a lookup table is built to map that level to an intensity level l in the desired histogram that best matches the following equation. 
     
       
         
           
             
               
                 
                   
                     | 
                     
                       
                         s 
                         k 
                       
                       - 
                       
                         v 
                         l 
                       
                     
                     | 
                   
                   = 
                   
                     
                       min 
                       l 
                     
                     | 
                     
                       
                         
                           ∑ 
                           
                             i 
                             = 
                             0 
                           
                           k 
                         
                         ⁢ 
                         
                           
                             p 
                             x 
                           
                           ⁡ 
                           
                             ( 
                             i 
                             ) 
                           
                         
                       
                       - 
                       
                         
                           ∑ 
                           
                             j 
                             = 
                             0 
                           
                           l 
                         
                         ⁢ 
                         
                           
                             p 
                             z 
                           
                           ⁡ 
                           
                             ( 
                             j 
                             ) 
                           
                         
                       
                     
                     | 
                     
                       ( 
                       
                         k 
                         , 
                         
                           l 
                           = 
                           
                             0 
                             ∼ 
                             
                               L 
                               - 
                               1 
                             
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                     
                 
               
             
           
         
       
     
     After finding the intensity level l for every given intensity level k in the original histogram, a correlation which maps k to l is derived. It may be stored in a specific or standalone memory to facilitate the succeeding operations. The image processing device uses the correlation to process the histogram of the original image to get a new histogram. 
     In Step  260 , as the result of the newly generated histogram, an enhanced image is obtained based on the original image and the new histogram by a separate module called image enhancement unit. In an iterative manner, by a computing component in the image enhancement unit, the pixels having intensity level k are mapped to new pixels having intensity l accordingly, wherein the rule of mapping is described in the preceding paragraph. After each pixel of the image is processed, an enhanced image is generated and may be stored in the main memory for storage and potential operation in the future. Therefore, the whole image is transformed and the enhancement is completed. 
     Exemplary Embodiment 1 
     In this embodiment, an original grayscale image is subject to image enhancement. Herein, the image enhancement is operated on the grey level. Refer to  FIG.  5   . A general process in this embodiment of the invention is shown as following:
     1. As  510  indicates, an original foggy image is inputted into an image processing device, the grey level value for each pixel is stored in an input unit, allowing a histogram of the original image being generated;   2. In Step  520 , A parameter profile comprising three initial parameters, A, B, C, is calculated, according to the following equations:   

     
       
         
           
             
               A 
               = 
               
                 
                   
                     ∑ 
                     
                       r 
                       = 
                       0 
                     
                     
                       L 
                       - 
                       1 
                     
                   
                   ⁢ 
                   
                     r 
                     ⁢ 
                     
                       
                         p 
                         r 
                       
                       ⁡ 
                       
                         ( 
                         r 
                         ) 
                       
                     
                   
                 
                 = 
                 
                   
                     ∑ 
                     
                       r 
                       = 
                       0 
                     
                     
                       L 
                       - 
                       1 
                     
                   
                   ⁢ 
                   
                     r 
                     ⁢ 
                     
                       
                         n 
                         r 
                       
                       n 
                     
                   
                 
               
             
             ⁢ 
             
               
 
             
             ⁢ 
             
               B 
               = 
               
                 
                   ∑ 
                   
                     δ 
                     = 
                     0 
                   
                   L 
                 
                 ⁢ 
                 
                   
                     δ 
                     2 
                   
                   ⁢ 
                   
                     
                       p 
                       δ 
                     
                     ⁡ 
                     
                       ( 
                       
                         x 
                         , 
                         y 
                       
                       ) 
                     
                   
                 
               
             
           
         
       
       
         
           
             C 
             = 
             
               
                 
                   A 
                   2 
                 
                 - 
                 
                   B 
                   2 
                 
               
             
           
         
       
         
         
           
             Where δ is the difference in the intensity level between neighboring pixels, and p δ  is the probability distribution of the intensity difference δ. 
           
         
         3. In Step  530 , the three parameters A, B, C, as the expectation (E x ), entropy (E n ), hyper entropy (H E ), respectively, is used by the image processing device to generate a distribution function;
       a. A normally distributed random number y i  with expectation E n  and variance H E  is generated by a random number generator, then y i  is stored in a buffer;   
     
       
    
     
       
         
           
             
               y 
               i 
             
             = 
             
               
                 R 
                 N 
               
               ⁡ 
               
                 ( 
                 
                   
                     E 
                     n 
                   
                   , 
                   
                     H 
                     E 
                   
                 
                 ) 
               
             
           
         
       
         
         
           
             b. A normally distributed random number x i  with expectation E x  and variance y i  stored in the buffer is generated by the random number generator; 
           
         
       
    
     
       
         
           
             
               x 
               i 
             
             = 
             
               
                 R 
                 N 
               
               ⁡ 
               
                 ( 
                 
                   
                     E 
                     x 
                   
                   , 
                   
                     y 
                     i 
                   
                 
                 ) 
               
             
           
         
       
         
         
           
             c. Repeat Steps a and b until n cloud drops are generated. 
           
         
         4. The histogram of the original image is equalized using the following equation and the correlation between s k  and r k  is derived in Step  540 : 
       
    
     
       
         
           
             
               s 
               k 
             
             = 
             
               
                 T 
                 ⁡ 
                 
                   ( 
                   
                     r 
                     k 
                   
                   ) 
                 
               
               = 
               
                 
                   
                     ∑ 
                     
                       r 
                       = 
                       0 
                     
                     k 
                   
                   ⁢ 
                   
                     
                       p 
                       r 
                     
                     ⁡ 
                     
                       ( 
                       r 
                       ) 
                     
                   
                 
                 = 
                 
                   
                     ∑ 
                     
                       r 
                       = 
                       0 
                     
                     k 
                   
                   ⁢ 
                   
                     
                       
                         n 
                         r 
                       
                       n 
                     
                     ⁢ 
                     
                       ( 
                       
                         r 
                         , 
                         
                           k 
                           = 
                           
                             0 
                             ∼ 
                             
                               L 
                               - 
                               1 
                             
                           
                         
                       
                       ) 
                     
                   
                 
               
             
           
         
       
         
         5. The values of the three parameter A, B and C, is changed, automatically or manually, and a new cloud, i.e., a new probability distribution function (PDF) is generated in Step  550 ; 
         6. In Step  560 , the new PDF is used by the computing unit to specify the histogram of the original image and a new histogram is generated. Then at last, a second image is produced according to the original image and the new histogram.
       a. The cumulative probability of the new PDF is calculated by the computing unit   
     
       
    
     
       
         
           
             
               v 
               l 
             
             = 
             
               
                 G 
                 ⁡ 
                 
                   ( 
                   
                     z 
                     l 
                   
                   ) 
                 
               
               = 
               
                 
                   ∑ 
                   
                     i 
                     = 
                     0 
                   
                   l 
                 
                 ⁢ 
                 
                   
                     
                       p 
                       z 
                     
                     ⁡ 
                     
                       ( 
                       
                         z 
                         i 
                       
                       ) 
                     
                   
                   ⁢ 
                   
                     ( 
                     
                       l 
                       = 
                       
                         0 
                         ∼ 
                         
                           L 
                           - 
                           1 
                         
                       
                     
                     ) 
                   
                 
               
             
           
         
       
         
         
           
             b. For each given s k , the value of l being iteratively increased, in each step by one (1), the v l  which makes the absolute value of the difference between v l  and s k  reaches its minimum is calculated and its value with the values of the corresponding k and l is stored: 
           
         
       
    
     
       
         
           
             | 
             
               
                 v 
                 l 
               
               - 
               
                 s 
                 k 
               
             
             ⁢ 
             
               | 
               min 
             
           
         
       
         
         
           
             c. The values of the corresponding z l  and r k  is calculated: 
           
         
       
    
     
       
         
           
             
               
                 
                   
                     
                       z 
                       l 
                     
                     = 
                     
                       
                         G 
                         
                           - 
                           1 
                         
                       
                       ⁡ 
                       
                         ( 
                         
                           v 
                           l 
                         
                         ) 
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     
                       r 
                       k 
                     
                     = 
                     
                       
                         T 
                         
                           - 
                           1 
                         
                       
                       ⁡ 
                       
                         ( 
                         
                           s 
                           k 
                         
                         ) 
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
           
         
       
         
         
           
             d. r is mapped to z and the correlation is stored in a specific memory: 
           
         
       
    
     
       
         
           
             
               z 
               l 
             
             = 
             
               z 
               ⁡ 
               
                 ( 
                 
                   r 
                   k 
                 
                 ) 
               
             
           
         
       
         
         
           
             e. The above correlation stored in the specific memory is used by the computing device to process the histogram of the original image. 
           
         
       
    
     Exemplary Embodiment 2 
     In this embodiment of the invention, an image processing workflow for a color image is shown. A color image contains color information, besides its luminance information. When dealing with a color image, it is convenient to process the luminance component, say Y in the YUV format, while keeping the other components fixed. Referring to  FIG.  6   , detailed steps are listed as follows:
     1. An original image which is in an RGB color space is loaded into and then stored in an input unit in an image processing device, the original image is subsequently converted from the RGB color space to a first YUV image with a first Y fraction, a first U fraction and a first V fraction in a YUV color space by a conversion unit, the first Y fraction is treated as a first grayscale image, the first grey level value profile for the first grayscale image is read using scanning or other techniques, and hence a first histogram of the first grayscale image is generated;   2. A parameter set comprising three initial parameters, A, B, C, is generated according to the following equations:   

     
       
         
           
             
               A 
               = 
               
                 
                   
                     ∑ 
                     
                       r 
                       = 
                       0 
                     
                     
                       L 
                       - 
                       1 
                     
                   
                   ⁢ 
                   
                     r 
                     ⁢ 
                     
                       
                         p 
                         r 
                       
                       ⁡ 
                       
                         ( 
                         r 
                         ) 
                       
                     
                   
                 
                 = 
                 
                   
                     ∑ 
                     
                       r 
                       = 
                       0 
                     
                     
                       L 
                       - 
                       1 
                     
                   
                   ⁢ 
                   
                     r 
                     ⁢ 
                     
                       
                         n 
                         r 
                       
                       n 
                     
                   
                 
               
             
             ⁢ 
             
               
 
             
             ⁢ 
             
               B 
               = 
               
                 
                   ∑ 
                   
                     δ 
                     = 
                     0 
                   
                   L 
                 
                 ⁢ 
                 
                   
                     δ 
                     2 
                   
                   ⁢ 
                   
                     p 
                     δ 
                   
                 
               
             
             ⁢ 
             
               
 
             
             ⁢ 
             
               C 
               = 
               
                 
                   
                     A 
                     2 
                   
                   - 
                   
                     B 
                     2 
                   
                 
               
             
           
         
       
         
         
           
             Where δ is the difference in the intensity level between neighboring pixels, and p δ  is the probability distribution of the intensity difference δ. 
           
         
         3. The three parameters A, B, C, as the expectation (E x ), entropy (E n ), hyper entropy (H E ), respectively, is used by a computing unit in the image processing device to generate a distribution function;
       a. A normally distributed random number y i  with expectation E n  and variance H E  is generated by a random number generator which may comprise of a buffer for storage of intermediate values;   
     
       
    
     
       
         
           
             
               y 
               i 
             
             = 
             
               
                 R 
                 N 
               
               ⁡ 
               
                 ( 
                 
                   
                     E 
                     n 
                   
                   , 
                   
                     H 
                     E 
                   
                 
                 ) 
               
             
           
         
       
         
         
           
             b. A normally distributed random number x i  with expectation E x  and variance y i  is generated by a random number generator; 
           
         
       
    
     
       
         
           
             
               x 
               i 
             
             = 
             
               
                 R 
                 N 
               
               ⁡ 
               
                 ( 
                 
                   
                     E 
                     x 
                   
                   , 
                   
                     y 
                     i 
                   
                 
                 ) 
               
             
           
         
       
         
         
           
             c. Steps a and b are repeated until n cloud drops are generated. 
           
         
         4. The following equation is used to equalize the histogram of the first grayscale image and the correlation between s k  and r k  is derived: 
       
    
     
       
         
           
             
               s 
               k 
             
             = 
             
               
                 T 
                 ⁡ 
                 
                   ( 
                   
                     r 
                     k 
                   
                   ) 
                 
               
               = 
               
                 
                   
                     ∑ 
                     
                       r 
                       = 
                       0 
                     
                     k 
                   
                   ⁢ 
                   
                     
                       p 
                       r 
                     
                     ⁡ 
                     
                       ( 
                       r 
                       ) 
                     
                   
                 
                 = 
                 
                   
                     ∑ 
                     
                       r 
                       = 
                       0 
                     
                     k 
                   
                   ⁢ 
                   
                     
                       
                         n 
                         r 
                       
                       n 
                     
                     ⁢ 
                     
                       ( 
                       
                         r 
                         , 
                         
                           k 
                           = 
                           
                             0 
                             ∼ 
                             
                               L 
                               - 
                               1 
                             
                           
                         
                       
                       ) 
                     
                   
                 
               
             
           
         
       
         
         5. The values of the three parameter A, B and C are changed, thereafter a new cloud, i.e., a new probability distribution function (PDF) is generated; 
         6. The new PDF is used to specify the first histogram of the first grayscale image, then a second histogram is generated and, as a consequence, a second grayscale image according to the first grayscale image and the second histogram is generated.
       a. The cumulative probability is calculated by the computing unit   
     
       
    
     
       
         
           
             
               v 
               l 
             
             = 
             
               
                 G 
                 ⁡ 
                 
                   ( 
                   
                     z 
                     l 
                   
                   ) 
                 
               
               = 
               
                 
                   ∑ 
                   
                     i 
                     = 
                     0 
                   
                   l 
                 
                 ⁢ 
                 
                   
                     
                       p 
                       z 
                     
                     ⁡ 
                     
                       ( 
                       
                         z 
                         i 
                       
                       ) 
                     
                   
                   ⁢ 
                   
                     ( 
                     
                       l 
                       = 
                       
                         0 
                         ∼ 
                         
                           L 
                           - 
                           1 
                         
                       
                     
                     ) 
                   
                 
               
             
           
         
       
         
         
           
             b. For each given s k , the value of l being iteratively increased, in each step by one (1), the minimal v l  satisfying the following inequality is calculated and its value with the values of the corresponding k and l is stored: 
           
         
       
    
     
       
         
           
             
               
                 v 
                 l 
               
               - 
               
                 s 
                 k 
               
             
             ≥ 
             
               0 
               ⁢ 
               
                 ( 
                 
                   l 
                   , 
                   
                       
                   
                   ⁢ 
                   
                     k 
                     = 
                     
                       0 
                       ∼ 
                       
                         L 
                         - 
                         1 
                       
                     
                   
                 
                 ) 
               
             
           
         
       
         
         
           
             c. The values of the corresponding z l  and r k  are calculated as: 
           
         
       
    
     
       
         
           
             
               
                 
                   
                     
                       z 
                       l 
                     
                     = 
                     
                       
                         G 
                         
                           - 
                           1 
                         
                       
                       ⁡ 
                       
                         ( 
                         
                           v 
                           l 
                         
                         ) 
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   
                     
                       r 
                       k 
                     
                     = 
                     
                       
                         T 
                         
                           - 
                           1 
                         
                       
                       ⁡ 
                       
                         ( 
                         
                           s 
                           k 
                         
                         ) 
                       
                     
                   
                 
               
               
                 
                     
                 
               
             
           
         
       
         
         
           
             d. r is mapped to z and the correlation is stored in a memory: 
           
         
       
    
     
       
         
           
             
               z 
               l 
             
             = 
             
               z 
               ⁡ 
               
                 ( 
                 
                   r 
                   k 
                 
                 ) 
               
             
           
         
       
         
         
           
             e. The above correlation is stored in the memory to process the histogram of the first grayscale image to generate the second histogram and the second grayscale image. 
           
         
         7. The second grayscale image is used as a second Y fraction and combined with the first U fraction and the first V fraction to generate a second YUV image. The second YUV image in the YUV color space is converted by the conversion unit to an enhanced image in the RGB color space.
 
The image processing device may further comprise a display unit such as a LCD display or LED display to display the original and processed image for the sake of comparison.
 
       
    
     Herein the image processing device, along with the detailed steps of the image processing is presented. Alternatively, a suitably programmed digital signal processor for image processing or general purpose computer processor equipped with some essential components such as several kinds of processors (CPUs or GPUs) or several buffer storages can be used to implement the method given a specific software to execute image enhancement. Such a software implementation of the invention may be appropriate for image enhancement software in a personal computer, or embedded in the image processing module in a digital camera or a mobile phone. It may also be suitable for embedded implementation in image capturing devices such as compact digital cameras, digital single reflex cameras (dSLRs), or camera-phones such as feature phones or smart phones with imaging components, which generally include a general purpose microprocessor or a digital signal processor. 
     The steps of the method described herein can be implemented in any suitable order or simultaneously in appropriate circumstances. In addition, individual steps can be deleted from any method without departing from the spirit and scope of the subject matter described herein. Various aspects of any example described above can be combined with various aspects of any example in other examples described, so as to constitute a further example without losing the effect sought. 
     The foregoing descriptions are merely particular examples of the present invention, and should not be regarded as the only embodiments. Apparently, one skilled in the art, after reading and understanding the content and principles of the present invention, may make various modifications and variations to forms and details without departing from the principles and structure of the present invention, while the modifications and variations still fall within the scope of the claims of the present invention.