# Patent

## Title
Method for image processing by unsharp masking

## Abstract

A method for adjusting an image signal by a processor includes providing a first low pass filter and a second low pass filter, generating an energy ratio of a band-pass image signal and the image signal according to the standard deviation of a first low pass signal of the first low pass filter and a second low pass signal of the second low pass filter, providing an image adjustment parameter and generating a weighting coefficient of the image signal according to the energy ratio and the image adjustment parameter, generating a third low pass filter according to the weighting coefficient of the image signal, the image adjustment parameter, the first low pass signal of the first low pass filter and the second low pass signal of the second low pass filter, and adjusting the image signal according to the image signal and the third low pass filter.

## Background
BACKGROUND OF INVENTION
1. Field of the Invention
The present invention relates to a method for adjusting an image signal by a processor, and more specifically, to a method for image processing by unsharp masking.
2. Description of the Prior Art
Please refer to FIG. 1 and FIG. 2. FIG. 1 is a block diagram illustrating a conventional image processing system 10 and FIG. 2 illustrates an image 14 of the image processing system 10 in FIG. 1. The image processing system 10 includes a memory 12 for storing programs and the image 14 to be processed, and a processor 16 for executing the programs stored in the memory 12. The image 14 includes a plurality of pixels 18 arranged in matrix form. The image 14 is composed of an image area 20 with specific features and a boundary area 22 around the image area 20.
A goal of image processing is to have the features of the image area 20 stand out while keeping the image area 20 and the surrounding edge area 22 in harmony. An adjustment of the image parameters of the whole image 14 will sacrifice some features that are not within the image area 20 or cause distortion of the image area 20. For this reason, some image processing methods adjust only the image parameters of the surrounding edge area 22 in order to emphasize the high frequency characteristic of the edge of the image.
The unsharp mask method is a method based on the concept mentioned above. According to the method, first unsharpen an image to obtain a low frequency element of the image, then subtract the unsharpened image from the original image to obtain a high frequency element of the original image. Apply a convolution operation to the remaining high frequency image and eventually add the subtracted low frequency image to the remaining high frequency image to complete the process. Although the unsharp mask method can sharpen the edge of the image, it also increases the high frequency element of the image and raises the luminance of the whole image, making it lighter. In addition, according to the conventional unsharp mask method, while applying the convolution operation to the high frequency image and adding back the subtracted low frequency image, because two operation intensive calculations are required to be processed simultaneously, processing time and image processing cost are increased.
SUMMARY OF INVENTION
It is therefore a primary object of the present invention to provide a method for adjusting an image signal by a processor to solve the problem mentioned above.
Briefly summarized, a method for adjusting an image signal by a processor includes providing a first low pass filter and a second low pass filter; generating an energy ratio of a band-pass image signal and the image signal according to the standard deviation of the low pass signal of the first low pass filter and the low pass signal of the second low pass filter; providing an image adjustment parameter and generating a weighting coefficient of the image signal according to the energy ratio and the image adjustment parameter; generating a third low pass filter according to the weighting coefficient of the image signal, the image adjustment parameter, the low pass signal of the first low pass filter, and the low pass signal of the second low pass filter; and adjusting the image signal according to the image signal and the third low pass filter.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.



BRIEF DESCRIPTION OF DRAWINGS
FIG. 1 is a block diagram illustrating a conventional image processing system.
FIG. 2 illustrates an image of the image processing system in FIG. 1.
FIG. 3 is a block diagram illustrating an image processing system according to the present invention.
FIG. 4 illustrates a flowchart of image processing by the image processing system according to the present invention.
FIG. 5 illustrates a subtraction between a low pass filter signal h1(x, y) of the first low pass filter and a low pass filter signal h2(x, y) of the second low pass filter in frequency domain.
FIG. 6 illustrates a flowchart for image processing by an image processing system according to the second embodiment of the present invention.
FIG. 7 illustrates a subtraction between the unit pulse signal δ(x, y) and a low pass filter signal h2(x, y) of the second low pass filter in frequency domain.



DETAILED DESCRIPTION
Please refer to FIG. 3. FIG. 3 is a block diagram illustrating an image processing system 30 according to the present invention. The image processing system 30 includes a memory 32 for storing an image processing program 34 and an image 36 to be processed. The image processing program 34 includes a first low pass filter 38 and a second low pass filter 40 implemented using software. The first low pass filter 38 and the second low pass filter 40 can also be hardware circuits. The image processing system 30 further includes an image processor 42 for executing the image processing program 34 stored in the memory 32, and an input device 44 for image parameter settings.
Please refer to FIG. 4 showing a flowchart for image processing by the image processing system 30 according to the present invention. The flowchart in FIG. 4 includes following steps:

    Step 100: Please refer to FIG. 5 showing a subtraction between a low pass filter signal h1(x, y) of the first low pass filter 38 and a low pass filter signal h2(x, y) of the second low pass filter 40, shown in frequency domain. Obtain a band-pass filter signal h(x, y) by subtracting the low pass filter signal h2(x, y) of the second low pass filter 40 from the low pass filter signal h1(x, y) of the first low pass filter 38. Define the signal resulting from convoluting the band-pass filter signal h(x, y) and an image signal I(x, y) as a band-pass image signal h(x, y){circle around (x)}I(x, y), wherein {circle around (x)} means convolution.
    Step 102: Generate an energy ratio






  
    E
    
      h
      ⁢
      
        
      
      ⊗
      
        
      
      ⁢
      I
    
  
  
    E
    I
  




     of the band-pass image signal and the image signal according to the standard deviation of the low pass filter signal h1(x, y) of the first low pass filter 38 and the low pass filter signal h2(x, y) of the second low pass filter 40. The energy ratio






  
    E
    
      h
      ⁢
      
        
      
      ⊗
      
        
      
      ⁢
      I
    
  
  
    E
    I
  




     of the band-pass image signal h(x, y){circle around (x)}I(x, y) and the image signal I(x, y) is equivalent to






  
    1
    
      4
      ⁢
      π
      ⁢
      
        
      
      ⁢
      
        σ
        1
        2
      
    
  
  -
  
    2
    
      2
      ⁢
      
        π
        ⁡
        
          (
          
            
              σ
              1
              2
            
            +
            
              σ
              2
              2
            
          
          )
        
      
    
  
  +
  
    1
    
      4
      ⁢
      π
      ⁢
      
        
      
      ⁢
      
        σ
        2
        2
      
    
  




     wherein σ1 is not equivalent to σ2.
    Step 104: Provide a maximum image distortion ratio and divide it with the energy ratio






  
    E
    
      h
      ⁢
      
        
      
      ⁢
      Θ
      ⁢
      
        
      
      ⁢
      I
    
  
  
    E
    I
  




     to obtain a maximum image adjustment weighting coefficient C2|max. Further provide an image adjustment normalized value between 0 and 1 so that an image adjustment parameter C2 can be obtained by multiplying the maximum image adjustment weighting coefficient C2|max with the image adjustment normalized value. A user can input the image adjustment normalized value by the input device 44 of the image processing system 30 to obtain the image adjustment parameter C2.
    Step 106: Generate a weighting coefficient C1 of the image signal according to the energy ratio






  
    E
    
      h
      ⁢
      
        
      
      ⁢
      Θ
      ⁢
      
        
      
      ⁢
      I
    
  
  
    E
    I
  




     and the image adjustment parameter C2, wherein






  
    C
    1
  
  =
  
    1
    -
    
      
        C
        2
      
      ⁢
      
        
          
            E
            
              h
              ⁢
              
                
              
              ⁢
              Θ
              ⁢
              
                
              
              ⁢
              I
            
          
          
            E
            I
          
        
        .
      
    
  




    Step 108: Obtain a third low pass filter 41 h2(x, y) according to the weighting coefficient C1 of the image signal, the image adjustment parameter C2, the low pass filter signal h1(x, y) of the first low pass filter 38, and the low pass filter signal h2(x, y) of the second low pass filter 40, wherein h2(x, y)=C1δ(x, y)+C2[h1(x, y)−h2(x, y)], and δ(x, y) is a delta function.
    Step 110: Finally, convolute the third low pass filter 41 h1(x, y) with the image signal I(x, y) to obtain an adjusted image signal f1(x, y)=h3(x, y){circle around (x)}I(x, y), wherein {circle around (x)} means convolution.


The image processing method according to the first embodiment of the present invention includes capturing the high frequency portion of the image 36 and applying a convolution operation, i.e. C2[h(x, y){circle around (x)}I(x, y)]. Then adding the weighting coefficient of the original signal, i.e. C1I(x, y), so that the high frequency portion can be emphasized. Further imposing a restriction according to conservation of energy, i.e. (Ef1=C1EI+C2Eh{circle around (x)}1)^(Ef1=EI), and calculating an adjusted image signal f1(x, y) under the condition that the energy of the adjusted image signal f1(x, y) is equivalent to the energy of the original image signal I(x, y).
More specifically, under the condition that a limited signal has the same energy in either time domain and space domain according to the Rayleigh's theorem, calculate the energy ratio




  
    E
    
      h
      ⁢
      
        
      
      ⁢
      Θ
      ⁢
      
        
      
      ⁢
      I
    
  
  
    E
    I
  




of the band-pass image signal h(x, y){circle around (x)}I(x, y) and the image signal I(x, y), wherein





  
    
      
        E
        
          h
          ⁢
          
            
          
          ⁢
          Θ
          ⁢
          
            
          
          ⁢
          I
        
      
      
        E
        I
      
    
    =
    
      
        1
        
          4
          ⁢
          π
          ⁢
          
            
          
          ⁢
          
            σ
            1
            2
          
        
      
      -
      
        2
        
          2
          ⁢
          
            π
            ⁡
            
              (
              
                
                  σ
                  1
                  2
                
                +
                
                  σ
                  2
                  2
                
              
              )
            
          
        
      
      +
      
        1
        
          4
          ⁢
          π
          ⁢
          
            
          
          ⁢
          
            σ
            2
            2
          
        
      
    
  
  ,




σ1 and σ2 represent respectively the standard deviations of the low pass filter signal h1(x, y) of the first low pass filter 38 and the low pass filter signal h2(x, y) of the second low pass filter 40, and σ1 is not equivalent to σ2 so that





  
    E
    
      h
      ⁢
      
        
      
      ⁢
      Θ
      ⁢
      
        
      
      ⁢
      I
    
  
  
    E
    I
  




will not be zero and the band-pass filter signal h(x, y) can capture the high frequency portion of the image 36. Then obtain





  
    C
    1
  
  =
  
    1
    -
    
      
        C
        2
      
      ⁢
      
        
          E
          
            h
            ⊗
            l
          
        
        
          E
          l
        
      
    
  




on the bases that EI=C1EI+C2Eh{circle around (x)}1.

Subsequently, while determining the image adjustment parameter C2 and the weighting coefficient C1 of the image signal in Step 104 and Step 106, a maximum image distortion ratio must first be determined, that is the maximum acceptable energy decay of the unprocessed low frequency portion such as the image area 20 in FIG. 2. For instance, if the energy decay of the image area of the image 36 is to be limited to 5%, the minimum weighting coefficient of the image signal can be determined as C1|min=1−0.05=0.95 and the maximum image adjustment weighting coefficient can be determined as




  
    C
    2
  
  ⁢
  
    
      
      max
    
    ⁢
    
      =
      
        
          0.05
          
            
              E
              
                h
                ⁢
                
                  
                
                ⁢
                Θ
                ⁢
                
                  
                
                ⁢
                I
              
            
            
              E
              I
            
          
        
        .
      
    
  




For the user's convenience, it is possible to provide the image adjustment normalized value between 0 and 1 normalized from the image adjustment parameter C2 by the input device 44 of the image processing system 30 so that the image adjustment parameter C2 can be obtained by multiplying the maximum image adjustment weighting coefficient C2|max with the image adjustment normalized value. That is, when a user inputs 1 as the normalized value by the input device 44, the image adjustment parameter C2 is





  
    0.05
    
      
        E
        
          h
          ⊗
          l
        
      
      /
      
        E
        l
      
    
  
  ,




the weighting coefficient C1 of the image signal is 0.95, and the adjusted energy amplitude will be 5% in maximum. Alternatively, when the user inputs 0 as a corresponding weighting coefficient by the input device 44, the image adjustment parameter C2 is 0, the weighting coefficient C1 of the image signal is 1, and the adjusted energy amplitude will be 0% in minimum, which means not to adjust the image 36.

Consequently evaluate the third low pass filter 41 h3(x, y) using the first filter 38, the second filter 40, the above-mentioned C1 and C2, and the equation h3(x, y)=C1δ(x, y)+C2[h1(x, y)−h2(x, y)], wherein δ(x, y) is a unit pulse signal. Convolute the third low pass filter 41 and the image signal to obtain the adjusted image signal f1(x, y)=h3(x, y){circle around (x)}I(x, y). In such a way the luminance change in the prior art can be improved.
Please refer to FIG. 6 showing a flowchart for image processing by an image processing system 30 according to the second embodiment of the present invention. The difference between the two embodiments is that in the second embodiment, to simplify the calculation, a second low pass filter 40 and a unit pulse signal are used instead of the first low pass filter 38. However, when inputting an image adjustment value, the second embodiment will not show a linear transition as in the first embodiment. The flowchart in FIG. 6 includes following steps:

    Step 112: Please refer to FIG. 7 showing a subtraction between the unit pulse signal δ(x, y) and a low pass filter signal h2(x, y) of the second low pass filter 40 in frequency domain. Determine a high pass filter signal h′(x, y) obtained by subtracting the low pass filter signal h2(x, y) of the second low pass filter 40 from the low pass filter signal h1(x, y) of the first low pass filter 38. Define the signal resulted by convoluting h′(x, y) and an image signal I(x, y) as a high pass image signal h′(x, y){circle around (x)}I(x, y).
    Step 114: Generate an energy ratio






  
    E
    
      h
      ⁢
      
        
      
      ⁢
      Θ
      ⁢
      
        
      
      ⁢
      I
    
  
  
    E
    I
  




     of the high pass image signal and the image signal according to the standard deviation of the low pass filter signal h2(x, y) of the second low pass filter 40. The energy ratio






  
    E
    
      h
      ⁢
      
        
      
      ⁢
      Θ
      ⁢
      
        
      
      ⁢
      I
    
  
  
    E
    I
  




     of the high pass image signal h′(x, y){circle around (x)}I(x, y) and the image signal I(x, y) is equivalent to






  
    1
    -
    
      3
      
        4
        ⁢
        
          πσ
          2
          2
        
      
    
  
  ,




     wherein σ2 is larger than






  
    
      3
      
        4
        ⁢
        π
      
    
  
  .




    Step 116: Provide a maximum image distortion ratio and divide it with the energy ratio






  
    E
    
      h
      ⁢
      
        
      
      ⁢
      Θ
      ⁢
      
        
      
      ⁢
      I
    
  
  
    E
    I
  




     to obtain a maximum image adjustment weighting coefficient C4|max. Further provide an image adjustment normalized value between 0 and 1 so that an image adjustment parameter C4 can be obtained by multiplying the maximum image adjustment weighting coefficient C4|max with the image adjustment normalized value. A user can input the image adjustment normalized value using an input device 44 of the image processing system 30 to obtain the image adjustment parameter C4.
    Step 118: Generate a weighting coefficient C3 of the image signal according to the energy ratio






  
    E
    
      h
      ⁢
      
        
      
      ⁢
      Θ
      ⁢
      
        
      
      ⁢
      I
    
  
  
    E
    I
  




     and the image adjustment parameter C4, wherein






  
    C
    3
  
  =
  
    1
    -
    
      
        C
        4
      
      ⁢
      
        
          
            E
            
              h
              ⁢
              
                
              
              ⁢
              Θ
              ⁢
              
                
              
              ⁢
              I
            
          
          
            E
            I
          
        
        .
      
    
  




    Step 120: Obtain a fourth low pass filter 46, h4(x, y) according to the weighting coefficient C3 of the image signal, the image adjustment parameter C4, and the low pass filter signal h2(x, y) of the second low pass filter 40, wherein h4(x, y)=C3δ(x, y)+C4[δ(x, y)−h2(x, y)] and δ(x, y) is the unit pulse signal.
    Step 122: Convolute the third low pass filter 46 h4(x, y) and the image signal I(x, y) to obtain an adjusted image signal f2(x, y)=h4(x, y){circle around (x)}I(x, y).


The image processing method according to the second embodiment is essentially the same to that of the first embodiment. The method is to capture the high frequency portion of the image 36 and apply a convolution operation, i.e.




  
    
      C
      4
    
    ⁡
    
      [
      
        
          
            h
            ′
          
          ⁡
          
            (
            
              x
              ,
              y
            
            )
          
        
        ⊗
        
          I
          ⁡
          
            (
            
              x
              ,
              y
            
            )
          
        
      
      ]
    
  
  ,




then add the weighting coefficient of the original signal, i.e. C3I(x, y), so that the high frequency portion is emphasized. Additionally, impose a restriction according to the conservation of energy, i.e. (Ef2=C3EI+C4Eh{circle around (x)}1)^(Ef2=EI), and calculate an adjusted image signal f2(x, y) under the condition that the energy of the adjusted image signal f2(x, y) is equivalent to the energy of the original image signal I(x, y).

In the same manner, under the condition that a limited energy signal has the same energy in either time domain or space domain according to the Rayleigh's theorem, calculate the energy ratio




  
    E
    
      h
      ⁢
      
        
      
      ⁢
      Θ
      ⁢
      
        
      
      ⁢
      I
    
  
  
    E
    I
  




of the high pass image signal h′(x, y){circle around (x)}I(x, y) and the image signal I(x, y), wherein





  
    
      
        E
        
          h
          ⁢
          
            
          
          ⁢
          Θ
          ⁢
          
            
          
          ⁢
          I
        
      
      
        E
        I
      
    
    =
    
      1
      -
      
        3
        
          4
          ⁢
          π
          ⁢
          
            
          
          ⁢
          
            σ
            2
            2
          
        
      
    
  
  ,




and σ2 is larger than





  
    3
    
      4
      ⁢
      π
    
  




so that





  
    E
    
      R
      ⊗
      I
    
  
  
    E
    I
  




will be larger than zero, in other words, the band-pass filter signal h′(x, y){circle around (x)}I(x, y) is able to capture the high frequency portion of the image 36. Since the flowchart of the second embodiment is similar to that of the first embodiment, further description is hereby omitted.

In contrast to the prior art, the present invention is capable of sharpening the edge of an image while maintaining the luminance, so that the disadvantage of the prior art which makes the image lighter due to the increased high frequency portion can be improved. Additionally, in contrast to the operation intensive calculations caused by twice adjustments on image signals required by the prior art, the method according to the present invention only calculates weighted parameters and filter signals in space domain first. In such a manner the operations are reduced and, accordingly, the cost and time of image processing is reduced at the same time.
Those skilled in the art will readily observe that numerous modifications and alterations of the device may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.

## Claims

1. A method for adjusting an image signal by a processor comprising:
(a) providing a first low pass filter and a second low pass filter;
(b) generating an energy ratio of a band-pass image signal and the image signal according to the standard deviation of a first low pass signal of the first low pass filter and a second low pass signal of the second low pass filter;
(c) providing an image adjustment parameter and generating a weighting coefficient of the image signal according to the energy ratio and the image adjustment parameter;
(d) generating a third low pass filter according to the weighting coefficient of the image signal, the image adjustment parameter, the first low pass signal of the first low pass filter, and the second low pass signal of the second low pass filter;
(e) adjusting the image signal according to the image signal and the third low pass filter; and
(f) storing the adjusted image signal in a computer-readable memory.

2. The method of claim 1 wherein in step (b), the band-pass image signal is generated by convoluting the image signal and a band-pass filter signal generated by subtracting the second low pass signal of the second low pass filter from the first low pass signal of the first low pass filter.

3. The method of claim 1 wherein in step (b), the band-pass image signal is generated by convoluting the image signal and the first low pass signal of the first low pass filter to generate a first signal, and convoluting the image signal and the second low pass signal of the second low pass filter to generate a second signal, and then subtracting the second signal from the first signal.

4. The method of claim 1 wherein in step (b), the standard deviation of the first low pass signal of the first low pass filter is not equivalent to the standard deviation of the second low pass signal of the second low pass filter.

5. The method of claim 4 wherein in step (b), the energy ratio of the band-pass image signal and the image signal is




  
    
      1
      
        4
        ⁢
        
          πσ
          1
          2
        
      
    
    -
    
      2
      
        2
        ⁢
        
          π
          ⁡
          
            (
            
              
                σ
                1
                2
              
              +
              
                σ
                2
                2
              
            
            )
          
        
      
    
    +
    
      1
      
        4
        ⁢
        
          πσ
          2
          2
        
      
    
  
  ,




wherein σ1 is the standard deviation of the first low pass signal of the first low pass filter, and σ2 is the standard deviation of the second low pass signal of the second low pass filter.

6. The method of claim 1 wherein in step (c), the weighting coefficient of the image signal is 1-(the image adjustment parameter)*(the energy ratio of the band-pass image signal and the image signal).

7. The method of claim 1 further comprising setting the range of the image adjustment parameter according to an acceptable range of the weighting coefficient of the image signal and the energy ratio of the band-pass image signal and the image signal.

8. The method of claim 1 wherein step (d) further comprises generating a third low pass filter by multiplying the weighting coefficient of the image signal with a unit pulse signal δ(x, y) plus the product of multiplying the image adjustment parameter with the remainder obtained by subtracting the second low pass signal of the second low pass filter from the first low pass signal of the first low pass filter.

9. The method of claim 1 wherein step (e) further comprises obtaining an adjusted image signal by multiplying the image signal with the third low pass filter.

10. An image processing system for implementing the method of claim 1.

11. A method for adjusting an image signal by a processor comprising:
(a) providing a first low pass filter and a unit pulse signal;
(b) generating an energy ratio of a band-pass image signal and the image signal according to the standard deviation of a first low pass signal of the first low pass filter;
(c) providing an image adjustment parameter and generating a weighting coefficient of the image signal according to the energy ratio and the image adjustment parameter;
(d) generating a third low pass filter according to the image signal, the image adjustment parameter, the first low pass signal of the first low pass filter, and the unit pulse signal;
(e) adjusting the image signal according to the image signal and the third low pass filter; and
(f) storing the adjusted image signal in a computer-readable memory.

12. The method of claim 11 wherein in step (b), the band-pass image signal is generated by convoluting the image signal and a band-pass filter signal generated by subtracting the first low pass signal of the first low pass filter from the unit pulse signal.

13. The method of claim 11 wherein in step (b), the band-pass image signal is generated by convoluting the image signal and the unit pulse signal to generate a first signal, convoluting the image signal and the first low pass signal of the first low pass filter to generate a second signal, and then subtracting the second signal from the first signal.

14. The method of claim 11 wherein in step (b), the standard deviation of the first low pass signal of the first low pass filter is larger than




  
    
      3
      
        4
        ⁢
        π
      
    
  
  .

15. The method of claim 14 wherein in step (b), the energy ratio of the band-pass image signal and the image signal is




  
    1
    -
    
      3
      
        4
        ⁢
        
          πσ
          1
          2
        
      
    
  
  ,




wherein σ1 is the standard deviation of the low pass signal of the first low pass filter.

16. The method of claim 11 wherein in step (c), the weighting coefficient of the image signal is 1-(the image adjustment parameter)*(the energy ratio of the band-pass image signal and the image signal).

17. The method of claim 11 further comprising setting the range of the image adjustment parameter according to an acceptable range of the weighting coefficient of the image signal and the energy ratio of the band-pass image signal and the image signal.

18. The method of claim 11 wherein step (d) further comprises generating a third low pass filter by multiplying the weighting coefficient of the image signal with a unit pulse signal δ(x, y) plus the product of multiplying the image adjustment parameter with the remainder obtained by subtracting the first low pass signal of the first low pass filter from the unit pulse signal.

19. The method of claim 11 wherein step (e) further comprises obtaining an adjusted image signal by multiplying the image signal with the third low pass filter.

20. An image processing system for implementing the method of claim 11.