Abstract:
An image correction method and an image correction device are provided. The image correction method includes the following steps: obtaining a gray level value of a pixel in an image and a frequency domain value of the gray level value; determining whether the frequency domain value is smaller than a first threshold; performing an adaptive gamma correction procedure on the gray level value according to the frequency domain value and outputting the result if the frequency domain value is smaller than the first threshold; outputting the gray level value directly if the frequency domain value is not smaller than the first threshold.

Description:
CROSS-REFERENCE TO RELATED APPLICATIONS 
       [0001]    This non-provisional application claims priority under 35 U.S.C. §119(a) on Patent Application No(s). 104108679 filed in Taiwan, R.O.C. on Mar. 18, 2015, the entire contents of which are hereby incorporated by reference. 
       TECHNICAL FIELD 
       [0002]    The disclosure relates to an image correction method and an image correction device, more particularly to an image correction method and an image correction device both using an adaptive gamma correction procedure. 
       BACKGROUND 
       [0003]    A variety of image devices, such as scanners, digital cameras, digital video cameras and a variety of display panels are popularized more and more with the popularity of the Internet and the enhancement of computer hardware. 
         [0004]    Most display systems have a nonlinear display property, known as the gamma effect, which makes the brightness provided by a display system absolutely and directly proportioned to an output voltage. Because of this gamma effect, an image signal is usually corrected with a gamma curve before being displayed. Therefore, the nonlinear property of the display system can reversely be compensated in order to obtain a more real and colorful images display. 
         [0005]    However, when the modern gamma correction is performed on the detailed image contents (i.e. high-frequency signals), such as the edge of a region or the lines of words, broken lines or color washout may easily occur on the words. 
       SUMMARY 
       [0006]    In order to solve problems about the distortion of high-frequency signals or detailed content in image documents, the disclosure provides an adaptive gamma correction procedure to process a gray level value of a different pixel having a different frequency. 
         [0007]    In an embodiment, the disclosure provides an image correction method including the following steps. Extract a gray level value of one of pixels of an image and a frequency domain value of the extracted gray level value. Determine whether the frequency domain value is less than a first threshold. Perform an adaptive gamma correction procedure on the gray level value according to the frequency domain value and then output a corrected gray level value when the frequency domain value is less than the first threshold. Directly output the gray level value when the frequency domain value is not less than the first threshold. 
         [0008]    In another embodiment, the above image correction method further includes performing a gamma correction procedure on the gray level value to obtain a corrected value; determining whether the frequency domain value is less than a second threshold; and directly outputting the corrected value as the corrected gray level value when the frequency domain value is less than the second threshold. 
         [0009]    In yet another embodiment, the above image correction method further includes obtaining a first proportion according to the frequency domain value and calculating a product of the corrected value and the first proportion to obtain a first transformed value when the frequency domain value is not less than the second threshold; calculating a product of the gray level value and a second proportion to obtain a second transformed value; and outputting a sum of the first transformed value and the second transformed value. A sum of the first proportion and the second proportion is 1. 
         [0010]    In yet another embodiment, when the frequency domain value is equal to the first threshold, the first proportion is 0; and when the frequency domain value is equal to the second threshold, the first proportion is 1. 
         [0011]    In yet another embodiment, the above image correction method further includes calculating a gray difference between one of the pixels and each of the neighboring pixels of the pixels; and calculating an average of the gray differences and setting the average of the gray differences to be the frequency domain value of the gray level value. 
         [0012]    In yet another embodiment, the above image correction method further includes calculating absolute row gray differences between one of the pixels and its neighboring row pixels and calculating an average of the absolute row gray differences. 
         [0013]    In yet another embodiment, the above image correction method further includes calculating absolute column gray differences between one of the pixels and its neighboring column pixels and calculating an average of the absolute column gray differences. 
         [0014]    In yet another embodiment, the above image correction method further includes selecting larger one of the average of the absolute row gray differences and the average of the absolute column gray differences to be the frequency domain value of the pixel. 
         [0015]    In an embodiment, the disclosure provides an image correction device including an image capturing unit, a frequency-domain analyzer, and an adaptive corrector. The image capturing unit extracts a gray level value of one of pixels of an image. The frequency-domain analyzer is coupled to the image capturing unit, calculates a frequency domain value of the gray level value, and determines whether the frequency domain value is less than a first threshold. The adaptive corrector is coupled to the image capturing unit and the frequency-domain analyzer. The adaptive corrector performs an adaptive gamma correction procedure on the gray level value according to the frequency domain value and outputs a corrected gray level value when the frequency domain value is less than the first threshold. The adaptive corrector directly outputs the gray level value when the frequency domain value is not less than the first threshold. 
         [0016]    As described above, the disclosure extracts a gray level value of one of pixels of an image and a frequency domain value of the extracted gray level value and then determines whether the frequency domain value is less than a first threshold. When the frequency domain value is less than the first threshold, an adaptive gamma correction procedure is performed on the gray level value according to the frequency domain value and then a corrected gray level value is outputted. When the frequency domain value is not less than the first threshold, the gray level value is directly outputted. During the adaptive gamma correction procedure, a gamma correction procedure is performed to obtain a corrected value and a decision whether the frequency domain value is less than a second threshold is made. When the frequency domain value is less than the second threshold, the corrected value is directly outputted as the corrected gray level value. When the frequency domain value is less than the first threshold but is not less than second threshold, a first proportion, a first transformed value corresponding to the first proportion, a second proportion, and a second transformed value corresponding to the second proportion are obtained according to the frequency domain value, and the sum of the first transformed value and the second transformed value is outputted in order to carry out the adaptive gamma correction. Therefore, the disclosure may avoid the distortion of high-frequency signals of images data, the discoloration of the image content or the production of broken edges in the image content caused by a conventional gamma correction. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0017]    The present disclosure will become more fully understood from the detailed description given hereinbelow and the accompanying drawings which are given by way of illustration only and thus are not limitative of the present disclosure and wherein: 
           [0018]      FIG. 1  is block diagram of an image correction device in an embodiment; 
           [0019]      FIG. 2  is a schematic diagram of the variation of a first proportion with respect to the frequency domain value of a pixel in an embodiment; 
           [0020]      FIG. 3  is a schematic diagram of the variation of a first proportion with respect to the frequency domain value of a pixel in another embodiment; 
           [0021]      FIG. 4  is a flow chart of the calculation of the first proportion for a pixel performed by the frequency-domain analyzer in an embodiment; 
           [0022]      FIG. 5  is a schematic diagram of a space distribution of primary and secondary pixels in an embodiment; 
           [0023]      FIG. 6  is a flow chart of an adaptive gamma correction procedure in an embodiment; 
           [0024]      FIG. 7  is a flow chart of an adaptive gamma correction procedure in another embodiment; 
           [0025]      FIG. 8  is a flow chart of an adaptive gamma correction procedure in another embodiment; 
           [0026]      FIG. 9  is a flow chart of an image correction method with respect to  FIG. 2  in an embodiment; and 
           [0027]      FIG. 10  is a flow chart of an image correction method with respect to  FIG. 3  in an embodiment. 
       
    
    
     DETAILED DESCRIPTION 
       [0028]    In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the disclosed embodiments. It will be apparent, however, that one or more embodiments may be practiced without these specific details. In other instances, well-known structures and devices are schematically shown in order to simplify the drawings. 
         [0029]      FIG. 1  is block diagram of an image correction device  10  in an embodiment. The image correction device  10  includes an image capturing unit  110 , a frequency-domain analyzer  120 , and an adaptive corrector  130 . The frequency-domain analyzer  120  is coupled to the image capturing unit  110 . The adaptive corrector  130  is coupled to the image capturing unit  110  and the frequency-domain analyzer  120 . The image capturing unit  110 , the frequency-domain analyzer  120  and the adaptive corrector  130  can be fulfilled by, for example, but not limited to, a variety of microprocessors or chips.  FIG. 2  is a schematic diagram of the variation of a first proportion R 1  with respect to the frequency domain value x of a pixel in an embodiment, where the first proportion R 1  is expressed by the variation distribution f 1 (x).  FIG. 3  is a schematic diagram of the variation of a first proportion R 1  with respect to the frequency domain value x of a pixel in another embodiment, where the first proportion R 1  is expressed by the variation distribution f 2 (x). Please refer to  FIG. 1  to  FIG. 3 . 
         [0030]    The image capturing unit  110  extracts a gray level value of one of pixels of an image. This image can have any amount of pixels. 
         [0031]    The frequency-domain analyzer  120  extracts a frequency domain value of the gray level value of the pixel. The frequency-domain analyzer  120  obtains the frequency domain value by, for example, the frequency analysis performed on a region in which a respective pixel exists. For example, in an embodiment, the frequency-domain analyzer  120  calculates gray differences between a pixel and its neighboring pixels, calculates an average of the gray differences, and sets the average of the gray differences to be the frequency domain value of the pixel. Assume a pixel p(i,j) is selected, wherein i represents a row coordinate, j represents a column coordinate. Then, the frequency-domain analyzer  120  calculates an absolute difference between the gray level value of the pixel p(i,j) and each of the gray level values of its neighboring row pixels p(i+1,j) and p(i−1,j) on the same row (referred to as absolute row gray difference hereinafter) and calculates an average of the absolute row gray differences. This average of the absolute row gray differences is considered a row frequency domain value of the pixel p(i,j). Also, the frequency-domain analyzer  120  calculates an absolute difference between the gray level value of the pixel p(i,j) and each of the gray level values of its neighboring column pixels p(i,j+1) and p(i,j−1) on the same column (referred to as absolute column gray difference hereinafter) and calculates an average of the absolute column gray differences. This average of the absolute column gray differences is considered a column frequency domain value of the pixel p(i,j). 
         [0032]    Then, the frequency-domain analyzer  120  selects the larger between the average of the absolute row gray differences and the average of the absolute column gray differences and sets the selected one to be the frequency domain value of the pixel p(i,j). 
         [0033]    In this or some embodiments, other algorithms may be contemplated for the frequency-domain analyzer  120  to calculate the frequency domain value, such as the Fourier Transform. 
         [0034]    Moreover, the frequency-domain analyzer  120  decides the first proportion R 1  and a second proportion R 2  according to the region that the frequency domain value is located in. The first proportion R 1  represents the effect of the follow-up gamma correction procedure to the correction of the original gray level value, that is, the first proportion R 1  is a percentage of an output value occupied by the corrected value obtained by the gamma correction procedure. The second proportion R 2  is a percentage of the output value occupied by the original gray level value. The sum of the first proportion R 1  and the second proportion R 2  is 1. Each region is defined using the first threshold T 1  and the second threshold T 2 . The details will be described below. 
         [0035]    In an embodiment, the first threshold T 1  is equal to the second threshold T 2 . As shown in  FIG. 2 , when the frequency domain value is less than the first threshold T 1 , the frequency-domain analyzer  120  sets the first proportion R 1  to be 1 and the second proportion R 2  to be 0. When the frequency domain value is not less than the first threshold T 1 , the frequency-domain analyzer  120  sets the first proportion R 1  to be 0 and the second proportion R 2  to be 1. 
         [0036]    In another embodiment, the first threshold T 1  is larger than the second threshold T 2 . As shown in  FIG. 3 , when the frequency domain value is less than the second threshold T 2 , the frequency-domain analyzer  120  sets the first proportion R 1  to be 1 and the second proportion R 2  to be 0. When the frequency domain value is less than the first threshold T 1  but is not less than second threshold T 2 , the frequency-domain analyzer  120  sets the first proportion R 1  and the second proportion R 2  to be less than 1 and more than 0. When the frequency domain value is not less than the first threshold T 1 , the frequency-domain analyzer  120  sets the first proportion R 1  to be 0 and the second proportion R 2  to be 1. When the frequency domain value is equal to the first threshold T 1 , the frequency-domain analyzer  120  sets the first proportion R 1  to be 0, and when the frequency domain value is equal to the second threshold T 2 , the frequency-domain analyzer  120  sets the first proportion R 1  to be 1. The decision of the first proportion R 1  and the second proportion R 2  can be made by the frequency-domain analyzer  120  according to a lookup table or other algorithms. 
         [0037]      FIG. 4  is a flow chart of the calculation of the first proportion R 1  for a pixel p(i,j) performed by the frequency-domain analyzer  120  in an embodiment. In this embodiment, the frequency-domain analyzer  120  first calculates an absolute gray difference (i.e. the frequency domain value x) between the pixel p(i,j) and each of its neighboring pixels p(i+1,j), p(i−1,j), p(i,j+1) and p(i,j−1) and calculates the first proportion R 1  corresponding to the absolute gray differences between the pixel p(i,j) and these neighboring pixels. For example, the frequency-domain analyzer  120  uses the variation distribution f 2 (x) to calculate the first proportion R 1  according to the frequency domain value x. Then, the frequency-domain analyzer  120  calculates a row average (which is obtained by dividing the sum of the first proportions R 1  by 2) of the first proportions R 1  of the neighboring row pixels p(i+1,j) and p(i−1,j), calculates a column average (which is obtained by dividing the sum of the first proportions R 1  by 2) of the first proportions R 1  of the neighboring column pixels p(i,j+1) and p(i,j−1), and selects the little one between the row average and column average of the first proportion R 1  to be the first proportion R 1  of the pixel p(i,j). Likewise, the second proportion R 2  of the pixel p(i,j) can be deduced by analogy. 
         [0038]    The adaptive corrector  130  decides a voltage difference between the primary and secondary pixels among the pixels of the image during an AB decision in order to reduce the color washout in the spatial domain caused by different viewing angles. After the AB decision, the adaptive corrector  130  performs the adaptive correction according to the frequency domain value of the gray level value of the pixel in order to reduce the distortion of high-frequency signals or detailed contents in the image. 
         [0039]      FIG. 5  is a schematic diagram of a space distribution of primary and secondary pixels in an embodiment. During the AB decision, the primary pixel (i.e. A) neighbors with the secondary pixels (i.e. B). For example, the four upper, lower, left and right pixels neighboring with the primary pixel are called secondary pixels. Similarly, the four upper, lower, left and right pixels neighboring with a secondary pixel are called primary pixels. 
         [0040]    After the AB decision, the primary pixel and the secondary pixel are applied to their respective adaptive corrections. For example, the variation distribution of the frequency domain value x corresponding to the first proportion R 1  of the primary pixel is different from the variation distribution for the secondary pixel. Specifically, during a respective adaptive correction, the adaptive corrector  130  performs the gamma correction procedure on the gray level value to obtain a corrected value and determines the influence of the gamma correction procedure on the correction of the gray level value by the first proportion R 1  decided by the frequency-domain analyzer  120 . This will be described in detail below. 
         [0041]    In an embodiment with respect to  FIG. 2 , when the first threshold T 1  is equal to the second threshold T 2 , the adaptive corrector  130  can perform different level gamma corrections according to the frequency domain value in the two regions shown in  FIG. 2 . 
         [0042]    For example, when the frequency-domain analyzer  120  determines that the frequency domain value of the pixel p(i,j) is less than the first threshold T 1 , the first proportion R 1  of the pixel p(i,j) is 1 and the second proportion R 2  of the pixel p(i,j) is 0. In other words, the adaptive corrector  130  can directly output the corrected value obtained by the gamma correction procedure performed on the gray level value of the pixel p(i,j). When the frequency-domain analyzer  120  determines that the frequency domain value of the pixel p(i,j) is not less than the first threshold T 1 , the first proportion R 1  is 0 and the second proportion R 2  is 1. That is, the adaptive corrector  130  directly outputs this gray level value of the pixel p(i,j). 
         [0043]    In an embodiment with respect to  FIG. 3 , when the first threshold T 1  is larger than the second threshold T 2 , the adaptive corrector  130  performs different level gamma corrections according to the frequency domain value in the three regions shown in  FIG. 3 . 
         [0044]    For example, when the frequency-domain analyzer  120  determines that the frequency domain value of the pixel p(i,j) is less than the second threshold T 2 , the first proportion R 1  is 1 and the second proportion R 2  is 0. That is, the adaptive corrector  130  outputs the corrected value obtained by the gamma correction procedure performed on the gray level value of the pixel p(i,j). When the frequency-domain analyzer  120  determines that the frequency domain value of the pixel p(i,j) is not less than the first threshold T 1 , the first proportion R 1  is 0 and the second proportion R 2  is 1. Herein, the adaptive corrector  130  directly outputs the gray level value of the pixel p(i,j). When the frequency domain value of the pixel p(i,j) is not less than second threshold T 2  but is less than the first threshold T 1 , the first proportion R 1  and the second proportion R 2  are less than 1 and more than 0. 
         [0045]    Such an adaptive gamma correction will be described in detail by referring to  FIG. 3  and  FIG. 6 , which is a flow chart of an adaptive gamma correction procedure in an embodiment. 
         [0046]    When the frequency-domain analyzer  120  determines that the frequency domain value of the pixel p(i,j) is not less than second threshold T 2  but is less than the first threshold T 1 , after the AB decision is performed, the adaptive corrector  130  calculates the product of the corrected value, obtained by the gamma correction procedure performed on the gray level value of the pixel p(i,j), and the first proportion R 1  to obtain a first transformed value C 1 , calculates the product of the gray level value of the pixel p(i,j) and the second proportion R 2  to obtain a second transformed value C 2 , calculates the sum of the first transformed value C 1  and the second transformed value C 2 , and outputs the sum, so as to carry out the adaptive gamma correction procedure. 
         [0047]    In this or some embodiments, the variation distribution f 2 (x) of the first proportion R 1  between the first threshold T 1  and the second threshold T 2  as shown in  FIG. 3  is a straight line or other curve. 
         [0048]    Moreover, since the frequency domain value with a higher frequency may indicate the detailed image content, a line of a word, or a region edge, the conventional gamma correction may distort it. In the disclosure, in view of  FIG. 3 , the frequency domain value with a higher frequency has more chances that the gamma correction will not be performed thereon (when the frequency domain value is not less than the first threshold T 1 ), or that the first proportion R 1  of the output value occupied by the corrected value is smaller (when the frequency domain value is not less than second threshold T 2  but is less than the first threshold T 1 ). 
         [0049]      FIG. 7  is a flow chart of an adaptive gamma correction procedure in another embodiment. After the AB decision is performed and the gamma correction procedure is performed on the gray level value to obtain the corrected value, the adaptive corrector  130  will perform a pre-gamma process (e.g. converting the gray level value into a brightness signal) on the gray level value and the corrected value to obtain a pre-gamma gray level value and a pre-gamma corrected value, respectively, calculate the product of the pre-gamma corrected value and the first proportion R 1  to obtain a first pre-gamma transformed value, calculate the product of the pre-gamma gray level value and the second proportion R 2  to obtain a second pre-gamma transformed value, perform a post-gamma process (e.g. converting the brightness signal into a grayscale signal) on the sum of the first pre-gamma transformed value and the second pre-gamma transformed value, and output the result of the post-gamma process, so as to carry out the adaptive gamma correction procedure. 
         [0050]      FIG. 8  is a flow chart of an adaptive gamma correction procedure in another embodiment. After the AB decision is performed, the adaptive corrector  130  can use multiple built-in gamma lookup tables (e.g. a first gamma lookup table, a second gamma lookup table, a third gamma lookup table and a fourth gamma lookup table) to perform the adaptive gamma correction on the frequency domain value. The frequency-domain analyzer  120  provides a control signal according to a different frequency domain value so that a selector can select the look-up result from one of the gamma lookup tables. 
         [0051]      FIG. 9  is a flow chart of an image correction method with respect to  FIG. 2  in an embodiment. The image correction method includes the following steps S 410 ˜S 450 . Please refer to  FIG. 1 ,  FIG. 2  and  FIG. 9 . 
         [0052]    In step S 410 , the image capturing unit  110  extracts a gray level value of one of pixels of an image. In step S 420 , the frequency-domain analyzer  120  calculates the frequency domain value of the gray level value. In step S 430 , the frequency-domain analyzer  120  determines whether the frequency domain value is less than the first threshold T 1 . In step S 440 , when the frequency domain value is not less than the first threshold T 1 , the adaptive corrector  130  directly outputs the gray level value of the pixel. In step S 450 , when the frequency domain value is less than the first threshold T 1 , the adaptive corrector  130  performs the gamma correction procedure on the gray level value to obtain a corrected value. In step S 460 , the adaptive corrector  130  directly outputs the corrected value. The details of these steps have been described above and thus, will not be repeated hereinafter. 
         [0053]      FIG. 10  is a flow chart of an image correction method with respect to  FIG. 3  in an embodiment. The image correction method includes the steps S 510 ˜S 550 , as shown in  FIG. 5 , and the step S 550  includes steps S 551 ˜S 556 . Please refer to  FIGS. 1, 3 and 10 . 
         [0054]    In step S 510 , the image capturing unit  110  extracts a gray level value of one of pixels of an image. In step S 520 , the frequency-domain analyzer  120  calculates the frequency domain value of the gray level value. In step S 530 , the frequency-domain analyzer  120  determines whether the frequency domain value is less than the first threshold T 1 . In step S 540 , when the frequency domain value is not less than the first threshold T 1 , the adaptive corrector  130  directly outputs the gray level value of the pixel. 
         [0055]    In step S 550 , when the frequency domain value is less than the first threshold T 1 , the adaptive corrector  130  performs the adaptive gamma correction procedure on the gray level value. In step S 551 , the adaptive corrector  130  performs the gamma correction procedure on the gray level value to obtain a corrected value. In step S 552 , the frequency-domain analyzer  120  determines whether the frequency domain value is less than the first threshold T 1  and is less than the second threshold T 2 . In step S 553 , when the frequency domain value is less than the first threshold T 1  but is less than the second threshold T 2 , the adaptive corrector  130  directly outputs the corrected value. In step S 554 , when the frequency domain value is less than the first threshold T 1  but is not less than the second threshold T 2 , the adaptive corrector  130  obtains the first proportion R 1  and the second proportion R 2  according to the frequency domain value. In step S 555 , the adaptive corrector  130  calculates the product of the corrected value and the first proportion R 1  to obtain the first transformed value C 1  and calculates the product of the gray level value and the second proportion R 2  to obtain the second transformed value C 2 . In step S 556 , the adaptive corrector  130  sums up the first transformed value C 1  and the second transformed value C 2  and outputs the sum. The details of these steps have been described above and thus, will not be repeated hereinafter. 
         [0056]    As set forth above, the disclosure employs the frequency-domain analyzer  120  to calculate gray differences between one of the pixels and its neighboring pixels, calculate an average of the gray differences, and set the average as a frequency domain value of the gray level value after employing the image capturing unit  110  to extract a gray level value of any one of an image. According to the analysis result, the frequency-domain analyzer  120  analyzes the frequency domain value, and the adaptive corrector  130  determines to directly output the gray level value or further perform an adaptive gamma correction procedure. 
         [0057]    In one accept, the frequency-domain analyzer  120  may set the first proportion R 1 , which the corrected value obtained by the gamma correction procedure occupies an output value, and the second proportion R 2 , which the original gray level value occupies the output value, and the adaptive corrector  130  may further perform the gamma correction procedure, calculate the first transformed value C 1  corresponding to the first proportion R 1  and the second transformed value C 2  corresponding to the second proportion R 2 , and output the sum of the first transformed value C 1  and the second transformed value C 2 . In another aspect, the adaptive corrector  130  may further perform the pre-gamma process and the post-gamma process. In yet another aspect, the adaptive corrector  130  may use multiple built-in gamma lookup tables to perform the adaptive gamma correction on the frequency domain value. 
         [0058]    Therefore, the disclosure may avoid the distortion of high-frequency signals in an image document or the color washout or broken edges in the detailed image content occurring in the conventional gamma correction.