# Patent

## Title
Image processing method and apparatus

## Abstract

A method of processing an image includes traversing pixels of an image in a single pass over the image. An inverting function is applied to the pixels. A recursive filter is applied to the inverted pixel values. The filter has parameters which are derived from previously traversed pixel values of the image. A pixel value is combined with a filter parameter for the pixel to provide a processed pixel value for a processed image.

## Background
PRIORITY
This application is a Continuation of U.S. patent application Ser. No. 12/116,140, filed May 6, 2008, which claims priority to PCT application number PCT/EP2008/000378, filed Jan. 18, 2008, published as WO 2009/089847 A1, which is incorporated by reference.


FIELD OF THE INVENTION
The present invention relates to an image processing method and apparatus for improving the quality of an acquired image.
BACKGROUND
It is well known to apply filters to images to improve their characteristics.
U.S. Pat. No. 7,072,525, Covell discloses an adaptive filter for filtering a target version of a visual image that is produced by processing an original version of the visual image, the characteristics of the adaptive filter being determined in accordance with one or more characteristics of the original version of the visual image. The orientation and/or strength of filtering of the adaptive filter are adjusted based on local properties of the original image, which can enable the adaptive filter to avoid introducing blurring across true edges in the image.
U.S. Pat. No. 6,823,086, Dolazza discloses a system for adaptively filtering an image so as to reduce a noise component associated with the image. The system includes an image analyzer for determining image parameters related to the image. The system also includes a spatial filter, having an adjustable kernel responsive to the image parameters, for filtering the image sequence. The image analyzer manipulates the filter kernel as a function of the image parameters so that the system produces a filtered image, adaptable in real time, as a function of the unfiltered image, external rules, predetermined constraints, or combinations thereof. The spatial filter includes a time-invariant section and an adaptable section. The time-invariant section applies a plurality of filters to the image, each of the filters having a distinct frequency response, so as to produce a plurality of distinct filtered outputs. The adaptable section scales each of the plurality of distinct filtered outputs with a corresponding distinct weighting value to produce a plurality of scaled filtered outputs, and combines the plurality of scaled filtered outputs to produce a composite filtered output.
In Covell and Dolazza, several 2-D low pass filters, each with a distinct frequency response, are applied to the image and the outputs are weighted in order to produce a composite filtered output.
As such, the complexity of U.S. Pat. Nos. 7,072,525 and 6,823,086 is high. Also, these patents require an image analyzer or another image in order to decide on the behavior of the adaptive filters, i.e. at least one pass over the original image and the target image is necessary.
U.S. Pat. No. 6,335,990, Chen et al, discloses filtering in the spatial and temporal domain in a single step with filtering coefficients that can be varied depending upon the complexity of the video and the motion between the adjacent frames. The filter comprises: an IIR filter, a threshold unit, and a coefficient register. The IIR filter and threshold unit are coupled to receive video data. The IIR filter is also coupled to the coefficient register and the threshold unit. The IIR filter receives coefficients, a, from the coefficient register and uses them to filter the video data received. The IIR filter filters the data in the vertical, horizontal and temporal dimensions in a single step. The filtered data output by the IIR filter is sent to the threshold unit. The threshold unit compares the absolute value of the difference between the filtered data and the raw video data to a threshold value from the coefficient register, and then outputs either the raw video data or the filtered data.
Chen uses an IIR filter and a threshold unit and output the raw video data or filtered data. As such, the IIR filter operates on its previous outputs and the pixel values.
Referring to FIG. 1, US 2004/0213478, Chesnokov, discloses an image processing method comprising the step of processing an input signal to generate an adjusted output signal, wherein the intensity values I(x,y) for different positions (x,y) of an image are adjusted to generate an adjusted intensity value I′(x,y) in accordance with:




  
    
      I
      out
    
    =
    
      
        
          ∑
          
            i
            =
            0
          
          N
        
        ⁢
        
          
            
              α
              i
            
            ⁡
            
              (
              I
              )
            
          
          ⁢
          LPF
          ⁢
          
            
          
          ⁢
          
            
              
                Ω
                i
              
              ⁡
              
                [
                
                  
                    P
                    i
                  
                  ⁡
                  
                    (
                    
                      F
                      ⁡
                      
                        (
                        I
                        )
                      
                    
                    )
                  
                
                ]
              
            
            ·
            
              
                Q
                i
              
              ⁡
              
                (
                
                  F
                  ⁡
                  
                    (
                    I
                    )
                  
                
                )
              
            
          
        
      
      +
      
        
          (
          
            1
            -
            
              α
              i
            
          
          )
        
        ⁢
        I
      
    
  
  ,




where Pi(γ) is an orthogonal basis of functions of γ defined in the range 0<γ<1; Qi(.) are anti-derivatives of Pi(.):





  
    
      Q
      i
    
    ⁡
    
      (
      
        F
        ⁡
        
          (
          I
          )
        
      
      )
    
  
  =
  
    
      ∫
      0
      
        F
        ⁡
        
          (
          I
          )
        
      
    
    ⁢
    
      
        
          P
          i
        
        ⁡
        
          (
          η
          )
        
      
      ⁢
      
        d
        
          
        
        ⁢
        η
      
    
  




or an approximation thereto; LPFΩis an operator of low-pass spatial filtering; Ωi is a cut-off frequency of the low-pass filter; F(.) is a weighting function; and where 0<α<1.

The output of the weighting function F(.) is monotonically decreasing with higher values of the pixels. There is a feedback from the output of the filtered sequence and the method can receive information other than from the image. For example, an amplification factor can be added to the linear or the logarithmic multiplication block and can be computed from a preview using an integral image. As such, in Chesnokov, significant processing steps are applied to the input signal, making the method quite complex and the output image is a weighted sum of the original and the processed image.
SUMMARY OF THE INVENTION
A technique is provided of processing an image. Multiple pixels are traversed in a single pass over the image. An inverting function is applied to the pixels. A recursive filter is applied to one or more inverted pixel values. The filter has one or more parameters derived from previously traversed pixel values of the image. The one or more pixel values are combined with the one or more parameters to provide processed pixel values for a processed image.
The image may include one or a combination of YCC or RGB format. For example, the image may include RGB format and the inverting function may invert a combination of one or more color plane values for a pixel. The image may include YCC format and the inverting function may invert an intensity value for a pixel.
The traversing may include one or a combination of: row wise; column wise; or traversing a path across the image.
The method may include providing an estimate of the average of the red, green and blue planes from previously traversed pixel values of the image, providing correction terms for one or more of the planes, where the correction terms are dependent on color channel average estimates, and where the combining includes multiplying a pixel value with a correction term. The correction terms may be limited by respective upper and lower thresholds.
The combining may include a linear or a logarithmic combination. The combining may include multiplying a pixel value, a correction term and a filter parameter for the pixel to provide a processed pixel value for a processed image.
The method may include providing an estimate of the average of red, green and blue channels as follows:

 R=β· R+(1−β)·G(i,j,1)

 G=β· G+(1−β)·G(i,j,2)

 B=β· B+(1−β)−G(i,j,3),

where:

G(i,j,k) includes the pixel value for the respective red (R), green (G) or blue (B) color plane; and β is a coefficient between 0 and 1.
The correction terms γR,γB for the red and blue color planes may include:



  
    
      γ
      R
    
    =
    
      
        
          
            G
            _
          
          
            R
            _
          
        
        ·
        
          
            [
            
              
                
                  (
                  
                    1
                    -
                    a
                  
                  )
                
                ·
                
                  R
                  _
                
              
              +
              
                255
                ·
                a
              
            
            ]
          
          
            [
            
              
                
                  (
                  
                    1
                    -
                    a
                  
                  )
                
                ·
                
                  G
                  _
                
              
              +
              
                255
                ·
                a
              
            
            ]
          
        
      
      ⁢
      
        
      
      ⁢
      and
    
  




  
    
      γ
      B
    
    =
    
      
        
          G
          _
        
        
          B
          _
        
      
      ·
      
        
          [
          
            
              
                (
                
                  1
                  -
                  a
                
                )
              
              ·
              
                B
                _
              
            
            +
            
              255
              ·
              a
            
          
          ]
        
        
          [
          
            
              
                (
                
                  1
                  -
                  a
                
                )
              
              ·
              
                G
                _
              
            
            +
            
              255
              ·
              a
            
          
          ]
        
      
    
  



where:

 R, G, B comprise said color channel average estimates; and a is a positive value less than 1.
The values of γR and γB may be limited to between 0.95 and 1.05
The recursive filter parameters H(i,j) may include:

H(i,j)=αH(i,j−1)+(1−α)(f(G(i,j,k)))

where:

α is the pole of the filter; G(i,j,k) is the pixel value for the respective red (R), green (G) or blue (B) color plane, or combinations thereof; and f(G(i,j,k)) is the inverting function. The value of α may be between 0.05 and 0.8.
The inverting function may include the following:




  
    f
    ⁡
    
      (
      
        
          G
          ⁡
          
            (
            
              i
              ,
              j
              ,
              k
            
            )
          
        
        ,
        a
        ,
        δ
      
      )
    
  
  =
  
    (
    
      1
      -
      a
      +
      
        
          255
          ·
          a
        
        
          max
          ⁡
          
            (
            
              δ
              ,
              
                
                  (
                  
                    
                      G
                      ⁡
                      
                        (
                        
                          i
                          ,
                          j
                          ,
                          1
                        
                        )
                      
                    
                    +
                    
                      G
                      ⁡
                      
                        (
                        
                          i
                          ,
                          j
                          ,
                          2
                        
                        )
                      
                    
                    +
                    
                      G
                      ⁡
                      
                        (
                        
                          i
                          ,
                          j
                          ,
                          3
                        
                        )
                      
                    
                  
                  )
                
                /
                3
              
            
            )
          
        
      
    
    )
  




where:

a is a positive value less than 1; and δ is used in order to avoid division by zero and to amplify dark pixels.
The inverting function may include the following:




  
    f
    ⁡
    
      (
      
        
          Y
          ⁡
          
            (
            
              i
              ,
              j
            
            )
          
        
        ,
        a
        ,
        δ
      
      )
    
  
  =
  
    (
    
      1
      -
      a
      +
      
        
          255
          ·
          a
        
        
          max
          ⁡
          
            (
            
              δ
              ,
              
                Y
                ⁡
                
                  (
                  
                    i
                    ,
                    j
                  
                  )
                
              
            
            )
          
        
      
    
    )
  




where Y(i,j) is said pixel intensity value; a is a positive value less than 1; and δ is used in order to avoid division by zero and to amplify dark pixels.

The combining may include:

G1(i,j,1)=G(i,j,1)·H(i,j)·γR 

G1(i,j,2)=G(i,j,2)·H(i,j)

G1(i,j,3)=G(i,j,3)·H(i,j)·γB 

where:

    γR,γB is the correction terms;
    H(i,j) is the filter parameter; and
    G(i,j,k) is the pixel value for the respective red (R), green (G) or blue (B) color plane, or combinations thereof.


The combining may include:




  
    
      
        G
        1
      
      ⁡
      
        (
        
          i
          ,
          j
          ,
          1
        
        )
      
    
    =
    
      D
      -
      
        
          D
          ⁡
          
            (
            
              1
              -
              
                
                  G
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                      ,
                      1
                    
                    )
                  
                
                D
              
            
            )
          
        
        
          ɛ
          ⁢
          
            
          
          ⁢
          
            H
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
          ⁢
          
            γ
            R
          
        
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        G
        1
      
      ⁡
      
        (
        
          i
          ,
          j
          ,
          2
        
        )
      
    
    =
    
      D
      -
      
        
          D
          ⁡
          
            (
            
              1
              -
              
                
                  G
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                      ,
                      2
                    
                    )
                  
                
                D
              
            
            )
          
        
        
          ɛ
          ⁢
          
            
          
          ⁢
          
            H
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
        
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        G
        1
      
      ⁡
      
        (
        
          i
          ,
          j
          ,
          3
        
        )
      
    
    =
    
      D
      -
      
        
          D
          ⁡
          
            (
            
              1
              -
              
                
                  G
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                      ,
                      3
                    
                    )
                  
                
                D
              
            
            )
          
        
        
          ɛ
          ⁢
          
            
          
          ⁢
          
            H
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
          ⁢
          
            γ
            B
          
        
      
    
  




where:

    γR,γB is the correction terms;
    H(i,j) is the filter parameter;
    G(i,j,k) is the pixel value for the respective red (R), green (G) or blue (B) color plane, or combinations thereof;
    D is the maximum permitted pixel value; and
    ε is a constant whose with a value between 1 and 3.


The image may be in YCC format and the recursive filter parameters H(i,j) may include:

H(i,j)=αH(i,j−1)+(1−α)(f(Y(i,j)))

where:

    α is the pole of the IIR filter;
    Y(i,j) is said pixel intensity value; and
    f(Y(i,j)) is said inverting function.


The inverting function may include:




  
    f
    ⁡
    
      (
      
        
          Y
          ⁡
          
            (
            
              i
              ,
              j
            
            )
          
        
        ,
        δ
      
      )
    
  
  =
  
    
      Y
      ⁡
      
        (
        
          i
          ,
          
            j
            +
            1
          
        
        )
      
    
    
      max
      ⁡
      
        (
        
          δ
          ,
          
            Y
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
        
        )
      
    
  




where:

    δ is used in order to avoid division by zero.


The combining may include:

Y1(i,j)=Y(i,j)[1+ε(i,j)·(1−H(i,j))]

where:

    H(i,j) is said filter parameter; and
    ε(i,j) is a gain factor.


The parameter ε(i,j) may be constant or varies for the image, or a combination thereof.
The steps may be iteratively applied to one or more successively processed images that are respectively adapted to improve image luminance or image sharpness or both.
A one-pass image technique is also provided that uses an IR filter to improve the quality of pictures, using only one image and with efficient use of processor resources.
In one embodiment automatic correction is provided of uneven luminance in the foreground/background of an image. This implementation improves quality especially where the background is more illuminated/or darker than the foreground.
In another embodiment, an estimate of the average of the red, green and blue channels is provided while another recursive filter filters a term that has a component inversely proportional with the values of each color plane pixel value or the intensity value. Its output is multiplied with one or more correction terms dependent on the color channel(s) and preferably limited by two thresholds. The enhanced pixel value is obtained by using a linear or logarithmic model.
Using the embodiment, as well as an automatic correction of uneven luminance in the foreground/background, color boost is also obtained.
In the first embodiment, the average values of each color channel are not used for comparison purposes and they can be replaced by sliding averaging windows ending on the pixel being processed. In any case, these average values are used to determine correction terms which in turn are used to avoid over-amplification of red or blue channels.
Coefficients of the IIR filter may be fixed, rather than employ adaptive filters. As such, the present method involves one pass through an image, while the output of one filter does not have to be used as an input to another filter.



BRIEF DESCRIPTION OF THE DRAWINGS
An embodiment of the invention will now be described by way of example, with reference to the accompanying drawings, in which:
FIG. 1 is a block diagram of a conventional image enhancement system; and
FIG. 2 is a block diagram of an image enhancement system according to an embodiment of the present invention.



DETAILED DESCRIPTION OF THE EMBODIMENTS
Referring now to FIG. 2, an acquired image G is supplied for filtering according to the present invention. While the embodiment is described in terms of processing an image in RGB space, the invention can be applied to luminance channels only or other color spaces.
Only one input image, G, is used and a running average on each color channel is computed 20 as each pixel value is read. Therefore for each pixel G(i,j,k) of each plane k=1 . . . 3, we compute:

 R=β· R+(1−β)·G(i,j,1)

 G=β· G+(1−β)·G(i,j,2)

 B=β· B+(1−β)·G(i,j,3),

where β is a coefficient between 0 and 1.

Another variant is to compute on each color channel, the sum of 2N+1 pixel values around the pixel G(i,j,k) and divide by 2N+1.
From the moving average values, R, G, B, correction terms γR,γB are calculated, step 25, as follows:




  
    γ
    R
  
  =
  
    
      
        
          
            G
            _
          
          
            R
            _
          
        
        ·
        
          
            [
            
              
                
                  (
                  
                    1
                    -
                    a
                  
                  )
                
                ·
                
                  R
                  _
                
              
              +
              
                255
                ·
                a
              
            
            ]
          
          
            [
            
              
                
                  (
                  
                    1
                    -
                    a
                  
                  )
                
                ·
                
                  G
                  _
                
              
              +
              
                255
                ·
                a
              
            
            ]
          
        
      
      ⁢
      
        
      
      ⁢
      and
      ⁢
      
        
      
      ⁢
      
        γ
        B
      
    
    =
    
      
        
          G
          _
        
        
          B
          _
        
      
      ·
      
        
          [
          
            
              
                (
                
                  1
                  -
                  a
                
                )
              
              ·
              
                B
                _
              
            
            +
            
              255
              ·
              a
            
          
          ]
        
        
          [
          
            
              
                (
                
                  1
                  -
                  a
                
                )
              
              ·
              
                G
                _
              
            
            +
            
              255
              ·
              a
            
          
          ]
        
      
    
  




Preferably, both correction terms, γR and γB values are limited within a chosen interval (e.g. between 0.95 and 1.05; if any of γR and γB values is below 0.95 their value is set to 0.95; if any of γR and γB values is above 1.05 their value is set to 1.05). This prevents over-amplification of the red and blue channels in further processing.
In parallel with generating the moving average values, the pixels are parsed on rows or columns and for each pixel of a color plane G(i,j,k), a coefficient H(i,j) is calculated as follows:




  
    H
    ⁡
    
      (
      
        i
        ,
        j
      
      )
    
  
  =
  
    
      α
      ⁢
      
        
      
      ⁢
      
        H
        ⁡
        
          (
          
            i
            ,
            
              j
              -
              1
            
          
          )
        
      
    
    +
    
      
        (
        
          1
          -
          α
        
        )
      
      ⁢
      
        (
        
          1
          -
          a
          +
          
            
              255
              ·
              a
            
            
              max
              ⁡
              
                (
                
                  δ
                  ,
                  
                    
                      (
                      
                        
                          G
                          ⁡
                          
                            (
                            
                              i
                              ,
                              j
                              ,
                              1
                            
                            )
                          
                        
                        +
                        
                          G
                          ⁡
                          
                            (
                            
                              i
                              ,
                              j
                              ,
                              2
                            
                            )
                          
                        
                        +
                        
                          G
                          ⁡
                          
                            (
                            
                              i
                              ,
                              j
                              ,
                              3
                            
                            )
                          
                        
                      
                      )
                    
                    /
                    3
                  
                
                )
              
            
          
        
        )
      
    
  




In FIG. 2, this processing is broken into step 30:




  
    f
    ⁡
    
      (
      
        
          G
          ⁡
          
            (
            
              i
              ,
              j
              ,
              k
            
            )
          
        
        ,
        a
        ,
        δ
      
      )
    
  
  =
  
    (
    
      1
      -
      a
      +
      
        
          255
          ·
          a
        
        
          max
          ⁡
          
            (
            
              δ
              ,
              
                
                  (
                  
                    
                      G
                      ⁡
                      
                        (
                        
                          i
                          ,
                          j
                          ,
                          1
                        
                        )
                      
                    
                    +
                    
                      G
                      ⁡
                      
                        (
                        
                          i
                          ,
                          j
                          ,
                          2
                        
                        )
                      
                    
                    +
                    
                      G
                      ⁡
                      
                        (
                        
                          i
                          ,
                          j
                          ,
                          3
                        
                        )
                      
                    
                  
                  )
                
                /
                3
              
            
            )
          
        
      
    
    )
  




followed by a recursive filter, step 40:

H(i,j)=αH(i,j−1)+(1−α)(f(G(i,j,k),a,δ))

where:

    a is a positive value less than 1 (e.g. a=0.125); and
    α is the pole of the corresponding recursive filtering, e.g. α can have values between 0.05 and 0.8).


The comparison with δ is used in order to avoid division by zero and to amplify dark pixels (e.g. δ=15). The initial value H(1,1) can have values between 1 and 2.
Using this filter, darker areas are amplified more than illuminated areas due to the inverse values averaging and, therefore, an automatic correction of uneven luminance in the foreground/background is obtained.
It will be seen from the above that the recursive filter, H, doesn't filter the pixel values. For example, if a=α=1⁄8 and δ=15, the filter 30/40 is filtering a sequence of numbers that varies between 1 and 3 depending on actual pixel value G(i,j,k) and the preceding values of the image. If the filter 40 simply uses as input the pixel values G(i,j,k), it generates a simple low pass filtered image, with no luminance correction.
In one implementation of the embodiment, the modified pixel values, G1(i,j,k), are given by a linear combination, step 50, of the filter parameters H and the correction terms γR,γB:

G1(i,j,1)=G(i,j,1)·H(i,j)·γR 

G1(i,j,2)=G(i,j,2)·H(i,j)

G1(i,j,3)=G(i,j,3)·H(i,j)·γB.

One more complex alternative to the linear model is a logarithmic model. In such an implementation, the output pixel Gi(i,j,k) corresponding to the enhanced color plane (R/G/B color planes), is as follows:




  
    
      
        G
        1
      
      ⁡
      
        (
        
          i
          ,
          j
          ,
          1
        
        )
      
    
    =
    
      D
      -
      
        
          D
          ⁡
          
            (
            
              1
              -
              
                
                  G
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                      ,
                      1
                    
                    )
                  
                
                D
              
            
            )
          
        
        
          ɛ
          ⁢
          
            
          
          ⁢
          
            H
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
          ⁢
          
            γ
            R
          
        
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        G
        1
      
      ⁡
      
        (
        
          i
          ,
          j
          ,
          2
        
        )
      
    
    =
    
      D
      -
      
        
          D
          ⁡
          
            (
            
              1
              -
              
                
                  G
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                      ,
                      2
                    
                    )
                  
                
                D
              
            
            )
          
        
        
          ɛ
          ⁢
          
            
          
          ⁢
          
            H
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
        
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        G
        1
      
      ⁡
      
        (
        
          i
          ,
          j
          ,
          3
        
        )
      
    
    =
    
      D
      -
      
        
          D
          ⁡
          
            (
            
              1
              -
              
                
                  G
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                      ,
                      3
                    
                    )
                  
                
                D
              
            
            )
          
        
        
          ɛ
          ⁢
          
            
          
          ⁢
          
            H
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
          ⁢
          
            γ
            B
          
        
      
    
  




where:

D is the maximum permitted value (e.g. 255 for 8 bit representation of images); and
ε is a constant whose indicated values are between 1 and 3.
Examination of the formula above shows that only values smaller than D may be obtained. In this implementation, the degree of color and brightness boost are obtained by varying the pole value (α) and the logarithmic model factor (ε).
The computations can be adapted for the YCC or other color spaces. For example, when using YCC color space in the embodiment of FIG. 2, there is no need to compute the correction terms γR, γB, and ε=1 for the Y channel if the logarithmic model is used. The inverting function for the Y channel is therefore:




  
    f
    ⁡
    
      (
      
        
          Y
          ⁡
          
            (
            
              i
              ,
              j
            
            )
          
        
        ,
        a
        ,
        δ
      
      )
    
  
  =
  
    
      (
      
        1
        -
        a
        +
        
          
            255
            ·
            a
          
          
            max
            ⁡
            
              (
              
                δ
                ,
                
                  Y
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                    
                    )
                  
                
              
              )
            
          
        
      
      )
    
    .
  




The linear model can be applied for the luminance channel and the logarithmic model can be used for the chrominance channels using the H(i,j) coefficient computed on the luminance channel.
This approach leads to computational savings and add the possibility of adjusting the color saturation by using a different positive value for ε (e.g. ε=0.9) when computing the new chrominance values. The brightness of the enhanced image can be varied by multiplying the Y channel with a positive factor, ε, whose value can be different than the value of ε used for the chrominance channels.
In a second embodiment of the invention, the processing structure of FIG. 2 can be used to sharpen an image.
In this embodiment, the image is preferably provided in YCC format and the processing is performed on the Y channel only. The ratio of the next pixel and the current pixel value is computed and filtered with a one pole IIR filter (e.g. α= 1/16), step 40. The operations can be performed on successive or individual rows or columns. The initial H coefficient is set to 1 and in case of operating on row i we have:




  
    
      H
      ⁡
      
        (
        
          i
          ,
          j
        
        )
      
    
    =
    
      
        α
        ⁢
        
          
        
        ⁢
        
          H
          ⁡
          
            (
            
              i
              ,
              
                j
                -
                1
              
            
            )
          
        
      
      +
      
        
          (
          
            1
            -
            α
          
          )
        
        ⁢
        
          
            Y
            ⁡
            
              (
              
                i
                ,
                
                  j
                  +
                  1
                
              
              )
            
          
          
            max
            ⁡
            
              (
              
                δ
                ,
                
                  Y
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                    
                    )
                  
                
              
              )
            
          
        
      
    
  
  ,




where:

    α is the pole of the IIR filter.


Again, this processing can be broken down in step 30:




  
    f
    ⁡
    
      (
      
        
          Y
          ⁡
          
            (
            
              i
              ,
              j
            
            )
          
        
        ,
        δ
      
      )
    
  
  =
  
    
      Y
      ⁡
      
        (
        
          i
          ,
          
            j
            +
            1
          
        
        )
      
    
    
      max
      ⁡
      
        (
        
          δ
          ,
          
            Y
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
        
        )
      
    
  




followed by the recursive filter, step 40:

H(i,j)=αH(i,j−1)+(1−α)(f(Y(i,j),δ))

Again, the comparison with δ is used in order to avoid division by zero (δ is usually set to 1). H(i,j) is a coefficient that corresponds to the current pixel position (i, j) of the original image. The initial coefficient can be set to 1 at the beginning of the first row or at the beginning of each row. In the first case, the coefficient computed at the end of the one row is used to compute the coefficient corresponding to the first pixel of the next row.
The enhanced pixel value Y1(i,j) is given by the following formula:

Y1(i,j)=Y(i,j)[1+ε(i,j)·(1−H(i,j))]

where ε(i,j) can be a constant gain factor or a variable gain depending on the H coefficients. Another alternative for ε(i,j) is to use the difference between consecutive pixels or the ratio of successive pixel values. For example, if the difference between successive pixels is small (or the ratio of consecutive pixel values is close to 1) the value of ε(i,j) should be lower, because the pixel might be situated in a smooth area. If the difference is big (or the ratio is much higher or much lower than 1), the pixels might be situated on an edge, therefore the value of ε(i,j) should be close to zero, in order to avoid possible over-shooting or under-shooting problems. For intermediate values, the gain function should vary between 0 and a maximum chosen gain. An example of ε(i,j) according to these requirements has a Rayleigh distribution.

In some implementations, a look up table (LUT) can be used if a variable ε(i,j) is chosen, because the absolute difference between consecutive pixels has limited integer values.
This method is highly parallelizable and its complexity is very low. The complexity can be further reduced if LUTs are used and some multiplications are replaced by shifts.
Furthermore, this second embodiment can also be applied to images in RGB space.
The second embodiment can be applied in sharpening video frames either by sharpening each individual video frame or identified slightly blurred frames.
In each embodiment, the pixels can be parsed using any space-filling curves (e.g. Hilbert curves), not only by rows or columns. The corrected image can be thought as a continuously modified image, pixel by pixel, through a path of a continuously moving point.
It will also be seen that the image sharpening image processing of the second embodiment can be applied after the luminance correction of the first embodiment to provide a filtered image with even superior characteristics to either method implemented independently.
Indeed, either method can be applied in conjunction with other image processing methods as required for example following the processing described in PCT Application No. PCT/EP2007/009939 and U.S. application Ser. No. 11/856,721, which are incorporated by reference.
While an exemplary drawings and specific embodiments of the present invention have been described and illustrated, it is to be understood that that the scope of the present invention is not to be limited to the particular embodiments discussed. Thus, the embodiments shall be regarded as illustrative rather than restrictive, and it should be understood that variations may be made in those embodiments by workers skilled in the arts without departing from the scope of the present invention.
In addition, in methods that may be performed according to preferred embodiments herein and that may have been described above, the operations have been described in selected typographical sequences. However, the sequences have been selected and so ordered for typographical convenience and are not intended to imply any particular order for performing the operations, except for those where a particular order may be expressly set forth or where those of ordinary skill in the art may deem a particular order to be necessary.
In addition, all references cited herein, as well as U.S. applications 60/945,558, Ser. Nos. 10/764,339, 12/042,335, 11/753,098, 11/752,925, 60/944,046, Ser. Nos. 11/767,412, 11/624,683, and Ser. No. 11/856,721, and US published application 2005/0041121, 2006/0204110, 2006/0120599, 2006/0098890, 2006/0039690, 2006/0285754, 2007/0189748, 2008/0037840, and 2007/0269108, and U.S. Pat. No. 7,352,394, as well as the background, invention summary, abstract and brief description of the drawings, are each incorporated by reference into the detailed description of the preferred embodiments as disclosing alternative embodiments.

## Claims

1. A method of processing an RGB format image comprising:
traversing each pixel of the image in a single pass over the image;
applying an inverting function to a combination of each color plane value for a pixel;
applying a recursive filter to each inverted pixel value, said filter having parameters which are derived from previously traversed pixel values of said image; and
combining said pixel value with said filter parameter for said pixel to provide a pixel value for a processed image
wherein said recursive filter parameters H(i,j) comprise:


H(i,j)=αH(i,j−1)+(1−α) (f(G(i,j,k)))



where:
α comprises the pole of the filter;
G(i,j,k) comprises the pixel value for the respective red (R), green (G) or blue (B) color plane k; and f(G(i,j,k)) comprises said inverting function.

2. A method of processing a YCC format image comprising:
traversing each pixel of the image in a single pass over the image;
applying an inverting function to an intensity value for each pixel;
applying a recursive filter to each inverted pixel value, said filter having parameters which are derived from previously traversed pixel values of said image; and
combining said pixel value with said filter parameter for said pixel to provide a pixel value for a processed image
wherein said recursive filter parameters H(i,j) comprise:


H(i,j)=αH(i,j−1)+(1−α)(f(Y(i,j)))



where:
α comprises the pole of the IIR filter;
Y(i,j) comprises said pixel intensity value; and
f(Y(i,j)) comprises said inverting function.

3. A method according to claim 1 or 2 wherein said traversing is one of: row wise; column wise; or traversing any path across the image.

4. A method according to claim 1 further comprising:
providing (20) an estimate of the average of the red, green and blue planes from previously traversed pixel values of said image;
providing (25) correction terms for one or more of said planes, said correction terms being dependent on said color channel average estimates; and
wherein said combining (50) includes multiplying a pixel value with a correction term.

5. A method according to claim 1 wherein said combining comprises one of a linear or a logarithmic combination.

6. A method according to claim 5 wherein said combining comprises multiplying said pixel value, a correction term and said filter parameter for said pixel to provide a pixel value for a processed image.

7. A method according to claim 4 wherein said providing an estimate of the average of said red, green and blue channels comprises:


 R=β· R+(1−β)·G(i,j,1)



 G=β· G+(1−β)·G(i,j,2)



 B=β· B+(1−β)·G(i,j,3),


where:
β comprises a coefficient between 0 and 1.

8. A method according to claim 4 wherein said correction terms γR,γB for each of said red and blue color planes comprise:




  
    γ
    R
  
  =
  
    
      
        
          
            G
            _
          
          
            R
            _
          
        
        ·
        
          
            [
            
              
                
                  (
                  
                    1
                    -
                    a
                  
                  )
                
                ·
                
                  R
                  _
                
              
              +
              
                255
                ·
                a
              
            
            ]
          
          
            [
            
              
                
                  (
                  
                    1
                    -
                    a
                  
                  )
                
                ·
                
                  G
                  _
                
              
              +
              
                255
                ·
                a
              
            
            ]
          
        
      
      ⁢
      
        
      
      ⁢
      and
      ⁢
      
        
      
      ⁢
      
        γ
        B
      
    
    =
    
      
        
          G
          _
        
        
          B
          _
        
      
      ·
      
        
          [
          
            
              
                (
                
                  1
                  -
                  a
                
                )
              
              ·
              
                B
                _
              
            
            +
            
              255
              ·
              a
            
          
          ]
        
        
          [
          
            
              
                (
                
                  1
                  -
                  a
                
                )
              
              ·
              
                G
                _
              
            
            +
            
              255
              ·
              a
            
          
          ]
        
      
    
  




where:
 R, G, B are said color channel average estimates; and
α comprises a positive value less than 1.

9. A method according to claim 1 wherein said inverting function is:




  
    f
    ⁡
    
      (
      
        
          G
          ⁡
          
            (
            
              i
              ,
              j
              ,
              k
            
            )
          
        
        ,
        a
        ,
        δ
      
      )
    
  
  =
  
    (
    
      1
      -
      a
      +
      
        
          255
          ·
          a
        
        
          max
          ⁡
          
            (
            
              δ
              ,
              
                
                  (
                  
                    
                      G
                      ⁡
                      
                        (
                        
                          i
                          ,
                          j
                          ,
                          1
                        
                        )
                      
                    
                    +
                    
                      G
                      ⁡
                      
                        (
                        
                          i
                          ,
                          j
                          ,
                          2
                        
                        )
                      
                    
                    +
                    
                      G
                      ⁡
                      
                        (
                        
                          i
                          ,
                          j
                          ,
                          3
                        
                        )
                      
                    
                  
                  )
                
                /
                3
              
            
            )
          
        
      
    
    )
  




where:
α comprises a positive value less than 1; and
δ is used in order to avoid division by zero and to amplify dark pixels.

10. A method according to claim 2 wherein said inverting function is:




  
    f
    ⁡
    
      (
      
        
          Y
          ⁡
          
            (
            
              i
              ,
              j
            
            )
          
        
        ,
        a
        ,
        δ
      
      )
    
  
  =
  
    (
    
      1
      -
      a
      +
      
        
          255
          ·
          a
        
        
          max
          ⁡
          
            (
            
              δ
              ,
              
                Y
                ⁡
                
                  (
                  
                    i
                    ,
                    j
                  
                  )
                
              
            
            )
          
        
      
    
    )
  




where
α comprises a positive value less than 1; and
δ is used in order to avoid division by zero and to amplify dark pixels.

11. A method according to claim 4 wherein combining comprises:


G1(i,j,1)=G(i,j,1)·H(i,j)·γR 



G1(i,j,2)=G(i,j,2)·H(i,j)



G1(i,j,3)=G(i,j,3)·H(i,j)·γB 


where:
γR,γB comprise said correction terms.

12. A method according to claim 4 wherein combining comprises:




  
    
      
        G
        1
      
      ⁡
      
        (
        
          i
          ,
          j
          ,
          1
        
        )
      
    
    =
    
      D
      -
      
        
          D
          ⁡
          
            (
            
              1
              -
              
                
                  G
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                      ,
                      1
                    
                    )
                  
                
                D
              
            
            )
          
        
        
          ɛ
          ⁢
          
            
          
          ⁢
          
            H
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
          ⁢
          
            γ
            R
          
        
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        G
        1
      
      ⁡
      
        (
        
          i
          ,
          j
          ,
          2
        
        )
      
    
    =
    
      D
      -
      
        
          D
          ⁡
          
            (
            
              1
              -
              
                
                  G
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                      ,
                      2
                    
                    )
                  
                
                D
              
            
            )
          
        
        
          ɛ
          ⁢
          
            
          
          ⁢
          
            H
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
        
      
    
  
  ,
  
    

  
  ⁢
  
    
      
        G
        1
      
      ⁡
      
        (
        
          i
          ,
          j
          ,
          3
        
        )
      
    
    =
    
      D
      -
      
        
          D
          ⁡
          
            (
            
              1
              -
              
                
                  G
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                      ,
                      3
                    
                    )
                  
                
                D
              
            
            )
          
        
        
          ɛ
          ⁢
          
            
          
          ⁢
          
            H
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
          ⁢
          
            γ
            B
          
        
      
    
  




where:
γR,γB are said correction terms;
D comprises the maximum permitted pixel value; and
ε comprises a constant with a value between 1 and 3.

13. A method according to claim 2 wherein said inverting function is:




  
    f
    ⁡
    
      (
      
        
          Y
          ⁡
          
            (
            
              i
              ,
              j
            
            )
          
        
        ,
        δ
      
      )
    
  
  =
  
    
      Y
      ⁡
      
        (
        
          i
          ,
          
            j
            +
            1
          
        
        )
      
    
    
      max
      ⁡
      
        (
        
          δ
          ,
          
            Y
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
        
        )
      
    
  




where:
δ is used in order to avoid division by zero.

14. A method according to claim 2 wherein said combining comprises:


Y1(i,j)=Y(i,j)[1+ε(i,j)·(1−H(i,j))]


where:
ε(i,j) comprises a gain factor.

15. A method according to claim 14 wherein ε(i,j) comprises a constant or varies for said image.

16. A method according to claim 1 or claim 2, comprising iteratively applying steps a) to d) to one or more successively processed images each of steps b), c) and d) being respectively adapted to improve one of image luminance or image sharpness.

17. An image processing apparatus comprising:
one or more optics and a sensor for acquiring a digital image;
a processor; and
one or more storage media having digital code embodied therein for programming the processor to perform an image processing method comprising:
acquiring the image;
using the processor to perform the method of claim 1 or claim 2.

18. One or more computer-readable media having code embedded therein for programming a processor to perform a method of processing an image, wherein the method comprises:
acquiring the image;
using the processor to perform the method of claim 1 or claim 2.