# Patent

## Title
Bi-affinity filter: a bilateral type filter for color images

## Abstract

An edge preserving filter that works on the principle of matting affinity allows a better representation of the range filter term in bilateral class filters. The definition of the affinity term can be relaxed to suit different applications. An approximate bi-affinity filter whose output is shown to be very similar to the traditional bilateral filter is defined. The present technique has the added advantage that no color space changes are required and hence an input image can be handled in its original color space. This is a big benefit over the traditional bilateral filter, which needs conversion to perception based spaces, such as CIELAB, to generate results close to the present invention. The full bi-affinity filter preserves very minute details of the input image, and thus permits an enhanced zooming functionality.

## Background
BACKGROUND
1. Field of Invention
The present invention pertains to the field of image processing. More specifically, it pertains to the field of image smoothing by bilateral filtering.
2. Description of Related Art
The bilateral filter was originally proposed by Tomasi and Manduchi in Bilateral Filtering for Gray and Color Images, ICCV: Proceedings of the Sixth International Conference on Computer Vision, page 839, 1998, IEEE Computer Society, herein incorporated in its entirety by reference. Basically, the bilateral filter smooths an image while preserving edges by means of a nonlinear combination of nearby image values. The principle idea behind such a filtering operation is to combine information from the spatial domain as well as from a feature domain. It can be represented as




  
    
      
        
          h
          ⁡
          
            (
            x
            )
          
        
        =
        
          
            1
            
              k
              ⁡
              
                (
                x
                )
              
            
          
          ⁢
          
            
              ∑
              
                y
                ∈
                
                  Ω
                  x
                
              
            
            ⁢
            
              
                
                  f
                  s
                
                ⁡
                
                  (
                  
                    x
                    ,
                    y
                  
                  )
                
              
              ⁢
              
                
                  g
                  r
                
                ⁡
                
                  (
                  
                    
                      I
                      ⁡
                      
                        (
                        x
                        )
                      
                    
                    ,
                    
                      I
                      ⁡
                      
                        (
                        y
                        )
                      
                    
                  
                  )
                
              
              ⁢
              
                I
                ⁡
                
                  (
                  y
                  )
                
              
            
          
        
      
    
    
      
        (
        1
        )
      
    
  




where I and h are the input and output images respectively, x and y are pixel locations over an image grid, Ωx is the neighborhood induced around the central pixel x, fs(x,y) measures the spatial affinity between pixels at x and y (i.e. the spatial domain, and may be thought of as a spatial filter) and gr(I(x),I(y)) denotes the feature/measurement/photometric affinity (i.e. the feature domain, and may be thought of as a range filter). Parameter k(x) is the normalization term given by





  
    
      
        
          k
          ⁡
          
            (
            x
            )
          
        
        =
        
          
            ∑
            
              y
              ∈
              
                Ω
                x
              
            
          
          ⁢
          
            
              
                f
                s
              
              ⁡
              
                (
                
                  x
                  ,
                  y
                
                )
              
            
            ⁢
            
              
                g
                r
              
              ⁡
              
                (
                
                  
                    I
                    ⁡
                    
                      (
                      x
                      )
                    
                  
                  ,
                  
                    I
                    ⁡
                    
                      (
                      y
                      )
                    
                  
                
                )
              
            
          
        
      
    
    
      
        (
        2
        )
      
    
  




The spatial and range filters (f and g, respectively), are commonly set to be Gaussian filters, as follows:





  
    
      
        
          
            f
            s
          
          ⁡
          
            (
            
              x
              ,
              y
            
            )
          
        
        =
        
          exp
          (
          
            
              -
              
                
                  
                  
                    x
                    -
                    y
                  
                  
                
                2
                2
              
            
            
              2
              ⁢
              
                
              
              ⁢
              
                σ
                s
                2
              
            
          
          )
        
      
    
    
      
        (
        3
        )
      
    
  
  
    
      
        
          
            g
            r
          
          ⁡
          
            (
            
              u
              ,
              v
            
            )
          
        
        =
        
          exp
          (
          
            
              -
              
                
                  
                  
                    u
                    -
                    v
                  
                  
                
                2
                2
              
            
            
              2
              ⁢
              
                
              
              ⁢
              
                σ
                r
                2
              
            
          
          )
        
      
    
    
      
        (
        4
        )
      
    
  




parameterized by the variances σs and σr. The range filter, g, penalizes distance in the feature space and hence the filter has an inherent edge preserving property. Due to this property, the bilateral filter, as an edge-preserving filter, has been one of the most widely used filtering techniques within computer vision community.

The bilateral filter is a non-linear filter (making it a computationally intensive operation) and, as such, many researchers have proposed techniques to decompose the non-linear, bilateral filter into a sum of separate one-dimensional filters or similar cascaded representations. Singular value decomposition of the 2D kernel is one such technique. Another proposed technique is an approximation of the bilateral filter by filtering sub-sampled copies of an image with discrete intensity kernels, and recombining the results using linear interpolation.
Recently the run-time of the bilateral filter has been identified as a critical bottleneck, and a few techniques have been proposed that render the filtering operation at an almost constant time, albeit with larger space requirements and behavioral approximations.
The research into improving the performance of the bilateral filter heavily relies on the form of the filter, which is applied in a range domain as well as the spatial domain. One method can be entirely broken down to an approximation of a product of a box filter for smoothing and a polynomial or fourth order Taylor series approximation of a Gaussian kernel. However, when the form of the filter is changed, such methods cannot be applied for the promised increased in speed.
It is an object of the present invention to provide a filter that provides similar image smoothing and edge preserving properties as a bilateral filter, but which is less constrained by nonlinear combination of image values.
It is a further object to provide of the present invention to provide a filter that provides similar image smoothing and edge preserving properties as a bilateral filter, but which lends itself to increased implementation optimizations.
It is a further object of the present invention to provide a filter that not only provides similar image smoothing and edge preserving properties as a bilateral filter, but also provides additional image optimization properties.
SUMMARY OF INVENTION
The above objects are met in method of smoothing and enhancing an input image by using color line techniques to determine the color affinity of pixels within their native color space.
More specifically, the above objects are met in a method of processing a digital input image, comprising: providing the digital input image, I, in physical memory, the input image having color information in a native color space for each image pixel; providing a processing device coupled to the physical memory to access the input image I and create an output image, h, by implementing the following steps:
(a) applying the following sequence to the input image I,




  
    
      h
      
        σ
        ,
        
          
        
        ⁢
        ɛ
      
    
    ⁡
    
      (
      x
      )
    
  
  =
  
    
      
        ∑
        
          y
          ∈
          
            Ω
            x
          
        
      
      ⁢
      
        (
        
          
            
              f
              s
              σ
            
            ⁡
            
              (
              
                x
                ,
                y
              
              )
            
          
          ⁢
          
            L
            xy
            ɛ
          
          ⁢
          
            I
            ⁡
            
              (
              y
              )
            
          
        
        )
      
    
    
      
        ∑
        
          y
          ∈
          
            Ω
            x
          
        
      
      ⁢
      
        (
        
          
            
              f
              s
              σ
            
            ⁡
            
              (
              
                x
                ,
                y
              
              )
            
          
          ⁢
          
            L
            xy
            ɛ
          
        
        )
      
    
  




where x and y are pixel locations over an image grid, and Ωx (or equivalently window w) is the neighborhood induced around the central pixel x; fs(x,y) measures the spatial affinity between pixels at x and y; parameter σ controls an amount of spatial blurring; Lxyε is a laplacian matrix that provides positive color affinity value for two examined pixels, x and y, that have the same color and provides a zero color affinity value for pixels with different color; parameter ε is a regularization term whose relative weight determines the smoothness of output image h.
In this method, step (a) is applied to the input image I in its native color space, which is preferably the RGB color space.
The laplacian matrix Lxyε follows a 2 color model specifying that pixel color Ii in an input image I can be represented as a linear combination of two colors P and S as follows: Ii=αiP+(1−αi)S, ∀iεw, 0≦αi≦1, where the two colors are piecewise smooth and can be derived from local properties within neighborhood Ωx containing the pixel i, and wherein piecewise smooth means smooth over a small region, i.e. a region similar in size as window w. It is noted that parameter ε determines the smoothness of the decomposition into the two color modes as represented by the smoothness of α estimates. In this approach, αi is defined as:




  
    
      α
      i
    
    =
    
      
        
          ∑
          c
        
        ⁢
        
          
            a
            c
          
          ⁢
          
            I
            i
            c
          
        
      
      +
      b
    
  
  ,
  
    ∀
    
      i
      ⁢
      
        
      
      ∈
      
        
      
      ⁢
      w
    
  
  ,
  
    c
    ∈
    
      {
      
        1
        ,
        2
        ,
        3
      
      }
    
  




where a are weights for each color channel, which is constant for the window w, b is a model parameter, and c is an index that is unique for each window over the color channels. Preferably, the α values are determined according to quadratic cost function J(α)=αTLα.

In this case, the laplacian matrix L is an n×n matrix, where n is the total number of pixels in input image I whose (ij)th element is given by




  
    ∑
    
      k
      |
      
        
          (
          
            i
            ,
            j
          
          )
        
        ∈
        
          w
          k
        
      
    
  
  ⁢
  
    (
    
      
        δ
        ij
      
      -
      
        
          1
          
            |
            
              w
              k
            
            |
          
        
        ⁢
        
          (
          
            1
            +
            
              
                (
                
                  
                    I
                    i
                  
                  -
                  
                    μ
                    k
                  
                
                )
              
              ⁢
              
                
                  (
                  
                    
                      σ
                      k
                    
                    +
                    
                      
                        ɛ
                        
                          |
                          
                            w
                            k
                          
                          |
                        
                      
                      ⁢
                      
                        I
                        3
                      
                    
                  
                  )
                
                
                  -
                  1
                
              
              ⁢
              
                (
                
                  
                    I
                    j
                  
                  -
                  
                    μ
                    k
                  
                
                )
              
            
          
          )
        
      
    
    )
  




where δij is the Kronecker delta, μk is a 3×1 mean vector of colors inside the kth window with both i and j as members, σk is the 3×3 covariance matrix, |wk| is the cardinality of the window and I3 is the identity matrix of size 3×3.

The laplacian matrix L may be further decomposed into a diagonal matrix D and a weight matrix W with the formulation L=D−W, wherein: diagonal matrix D is defined with terms Dii=#[k|iεwk] at its diagonal and represents the cardinality of the number of windows of which the pixel i is a member; individual terms of weight matrix W are given by




  
    W
    ij
  
  =
  
    
      ∑
      
        k
        |
        
          
            (
            
              i
              ,
              j
            
            )
          
          ∈
          
            w
            k
          
        
      
    
    ⁢
    
      
        1
        
          |
          
            w
            k
          
          |
        
      
      ⁢
      
        (
        
          1
          +
          
            
              (
              
                
                  I
                  i
                
                -
                
                  μ
                  k
                
              
              )
            
            ⁢
            
              
                (
                
                  
                    σ
                    k
                  
                  +
                  
                    
                      ɛ
                      
                        |
                        
                          w
                          k
                        
                        |
                      
                    
                    ⁢
                    
                      I
                      3
                    
                  
                
                )
              
              
                -
                1
              
            
            ⁢
            
              (
              
                
                  I
                  j
                
                -
                
                  μ
                  k
                
              
              )
            
          
        
        )
      
    
  




where δij is the Kronecker delta, μk is a 3×1 mean vector of colors inside the kth window with both i and j as members, σk is the 3×3 covariance matrix, |wk| is the cardinality of the window and I3 is the identity matrix of size 3×3; and color affinity Wij for two pixels with the same color is a positive quantity varying with the homogeneity of the local windows containing the pixels i and j, and color affinity for pixels with different color is zero.

Additionally at the local minima, the solution α* satisfies a first order optimality condition LTα*=0, and the optimal condition is defined as LTα*=(D−W)Tα*.
The terms of Wi,j may be evaluated by counting the contribution of only the center pixel's local window defined as the window centered about it. Preferably, the local window w is a 3×3 pixel window requiring O(w2) computations.
In another embodiment of the present invention, the method further includes steps of: (b) interpolating the input image I to a resolution higher than its native resolution; and (c) combining the results of step (a) with the interpolated, higher resolution image of step (b). In this approach, step (a) generates detail line information of the input image I, and step (c) adds this line information to the interpolated, higher resolution image.
In the above examples, the laplacian matrix L acts like a zero-sum filter kernel.
The present invention may further be applied to a method for enlarging an input image I. This method preferably includes: providing the digital input image, I, in physical memory, the input image having color information in a native color space for each image pixel; providing a processing device coupled to the physical memory to access the input image I and create an output image, h, by implementing the following steps: (a) applying the following sequence to the input image I,




  
    
      h
      
        σ
        ,
        ɛ
      
    
    ⁡
    
      (
      x
      )
    
  
  =
  
    
      
        ∑
        
          y
          ⁢
          
            
          
          ∈
          
            Ω
            x
          
        
      
      ⁢
      
        (
        
          
            
              f
              s
              σ
            
            ⁡
            
              (
              
                x
                ,
                y
              
              )
            
          
          ⁢
          
            L
            xy
            ɛ
          
          ⁢
          
            I
            ⁡
            
              (
              y
              )
            
          
        
        )
      
    
    
      
        ∑
        
          y
          ⁢
          
            
          
          ∈
          
            Ω
            x
          
        
      
      ⁢
      
        (
        
          
            
              f
              s
              σ
            
            ⁡
            
              (
              
                x
                ,
                y
              
              )
            
          
          ⁢
          
            L
            xy
            ɛ
          
        
        )
      
    
  




where: (i) x and y are pixel locations over an image grid; (ii) Ωx is the neighborhood induced around the central pixel x; (iii) fs(x,y) measures the spatial affinity between pixels at x and y; (iv) parameter σ controls an amount of spatial blurring; (v) Lxyε is a laplacian matrix that provides positive color affinity value for two examined pixels, x and y, that have the same color and provides a zero color affinity value for pixels with different color; (vi) parameter ε is a regularization term whose relative weight determines the smoothness of output image h; (vii) laplacian matrix L is defined as a diagonal matrix, D, and a weight matrix, W, with the formulation L=D−W, where diagonal matrix D is further defined as Dii=#[k|iεwk] at its diagonal, which represents the cardinality of the number of windows of which the pixel i is a member, individual terms of the weight matrix W are given by





  
    W
    ij
  
  =
  
    
      ∑
      
        k
        |
        
          
            (
            
              i
              ,
              j
            
            )
          
          ∈
          
            
          
          ⁢
          
            w
            k
          
        
      
    
    ⁢
    
      
        1
        
          
          
            w
            k
          
          
        
      
      ⁢
      
        (
        
          1
          +
          
            
              (
              
                
                  I
                  i
                
                -
                
                  μ
                  k
                
              
              )
            
            ⁢
            
              
                (
                
                  
                    σ
                    k
                  
                  +
                  
                    
                      ɛ
                      
                        
                        
                          w
                          k
                        
                        
                      
                    
                    ⁢
                    
                      I
                      3
                    
                  
                
                )
              
              
                -
                1
              
            
            ⁢
            
              (
              
                
                  I
                  j
                
                -
                
                  μ
                  k
                
              
              )
            
          
        
        )
      
    
  




and weight matrix Wij is evaluated over all possible overlapping windows that contain the center pixel; and (b) interpolating the input image I to a resolution higher than its native resolution; (c) combining the results of step (a) with the interpolated, higher resolution image of step (b).

In this approach, step (b) generates detail line information of the input image I, and step (c) adds this line information to the interpolated, higher resolution image.
Preferably, step (a) is applied to the input image I in its native color space, which is the RGB color space.
The present invention may further be applied in a method of smoothing an input image I, having: providing the digital input image, I, in physical memory, the input image having color information in a native color space for each image pixel; providing a processing device coupled to the physical memory to access the input image I and create an output image, h, by implementing the following steps: (a) applying the following sequence to the input image I,




  
    
      h
      
        σ
        ,
        ɛ
      
    
    ⁡
    
      (
      x
      )
    
  
  =
  
    
      
        ∑
        
          y
          ⁢
          
            
          
          ∈
          
            Ω
            x
          
        
      
      ⁢
      
        (
        
          
            
              f
              s
              σ
            
            ⁡
            
              (
              
                x
                ,
                y
              
              )
            
          
          ⁢
          
            L
            xy
            ɛ
          
          ⁢
          
            I
            ⁡
            
              (
              y
              )
            
          
        
        )
      
    
    
      
        ∑
        
          y
          ∈
          
            Ω
            x
          
        
      
      ⁢
      
        (
        
          
            
              f
              s
              σ
            
            ⁡
            
              (
              
                x
                ,
                y
              
              )
            
          
          ⁢
          
            L
            xy
            ɛ
          
        
        )
      
    
  




where: (i) x and y are pixel locations over an image grid; (ii) Ωx is the neighborhood induced around the central pixel x; (iii) fs(x,y) measures the spatial affinity between pixels at x and y; (iv) parameter σ controls an amount of spatial blurring; (v) Lxyε is a laplacian matrix that provides positive color affinity value for two examined pixels, x and y, that have the same color and provides a zero color affinity value for pixels with different color; (vi) parameter ε is a regularization term whose relative weight determines the smoothness of output image h; (vii) laplacian matrix L is defined as a diagonal matrix, D, and a weight matrix, W, with the formulation L=D−W, where diagonal matrix D is further defined as Dii=#[k|iεwk] at its diagonal, which represents the cardinality of the number of windows of which the pixel i is a member, individual terms of the weight matrix W are given by





  
    W
    ij
  
  =
  
    
      ∑
      
        k
        |
        
          
            (
            
              i
              ,
              j
            
            )
          
          ∈
          
            
          
          ⁢
          
            w
            k
          
        
      
    
    ⁢
    
      
        1
        
          
          
            w
            k
          
          
        
      
      ⁢
      
        (
        
          1
          +
          
            
              (
              
                
                  I
                  i
                
                -
                
                  μ
                  k
                
              
              )
            
            ⁢
            
              
                (
                
                  
                    σ
                    k
                  
                  +
                  
                    
                      ɛ
                      
                        
                        
                          w
                          k
                        
                        
                      
                    
                    ⁢
                    
                      I
                      3
                    
                  
                
                )
              
              
                -
                1
              
            
            ⁢
            
              (
              
                
                  I
                  j
                
                -
                
                  μ
                  k
                
              
              )
            
          
        
        )
      
    
  




and terms of Wi,j are evaluated by counting the contribution of only the center pixel's local window defined as the window centered about it.

Preferably, the local window w is a 3×3 pixel window. Further preferably, regularization factor of ε is at last 0.1.
Like before, the present method may be applied directly to the input image I in its native color space, which typically is the RGB color space.
Other objects and attainments together with a fuller understanding of the invention will become apparent and appreciated by referring to the following description and claims taken in conjunction with the accompanying drawings.



BRIEF DESCRIPTION OF THE DRAWINGS
In the drawings wherein like reference symbols refer to like parts.
FIG. 1 is an RGB color histogram of real world, natural, color images.
FIG. 2 illustrates a sample setup for implementing the present Bi-affinity filter.
FIG. 3a illustrates an original image with sharp edges.
FIG. 3b illustrates an edge-rounding effect of applying the bilateral filter on the original image of FIG. 3a. 
FIG. 3c illustrates an edge-preserving effect of applying the Bi-affinity filter on the original image of FIG. 3a. 
FIG. 4a shows a center pixel C1 and nine overlapping 3×3 pixel windows that include center pixel C1.
FIG. 4b the only four overlapping windows that encompass both center pixel C1 and target neighbor pixel N1.
FIG. 4c shows only the center pixel's local window, which is the window centered about C1.
FIG. 5 illustrates the affect of varying regularization term ε pixel windows of varying pixel size.
FIG. 6 shows the effect of regularization term ε for a fixed window size, as regularization term ε assigned values of 0.0005, 0.005, 0.05, and 0.5.
FIGS. 7a and 7b show comparisons of the PSNR of the present Bi-affinity filter applied in an image's native RGB color space versus the bilateral filter applied in both the image's native RGB color space and converted CIELAB color space are shown for a fixed range filter variance and a varied window size.
FIG. 8 shows compares the results of applying the present Bi-affinity filter to an input image with the results of applying a bilateral filter to the input image in its native RGB color domain and after being converted to the CIELAB color space.
FIG. 9 shows an additional set of experimental results similar to those of FIG. 8 for comparing the Bi-affinity filter to the bilateral filter in both the native RGB color space and in the CIELAB color space.
FIG. 10 shows an additional set of experimental results similar to those of FIG. 8 for comparing the Bi-affinity filter to the bilateral filter in both the native RGB color space and in the CIELAB color space.
FIGS. 11a, 11b, and 11c show the application of the present Bi-affinity filter to enhance a low resolution image.
FIG. 12a shows an image zoomed-in by a factor of 2× by bi-cubic interpolation.
FIG. 12b shows the same zoomed-in image of FIG. 12a additionally enhanced by the present Bi-affinity filter.
FIG. 13a shows an image zoomed-in by a factor of 2× by bi-cubic interpolation.
FIG. 13b shows the zoomed-in image of FIG. 13a additionally enhanced by the present Bi-affinity filter.
FIG. 14a shows an image zoomed-in by a factor of 2× by bi-cubic interpolation.
FIG. 14b shows the zoomed-in image of FIG. 14a additionally enhanced by the present Bi-affinity filter.
FIGS. 15a and 15b show a graphical model for image enhancement.



DESCRIPTION OF THE PREFERRED EMBODIMENTS
It is presently proposed that the true power of the bilateral filter is yet to be realized owing to the fact that very few family of kernels have been tried with the bilateral paradigm.
Traditionally, research has overlooked one of the most important shortfalls of the bilateral filter, which is a unified handling of multi-channel color images. This is due to the fact that color channels are traditionally assumed to be independent of each other, and the filter therefore processes each color channel independently. For example, an RGB color space, which has three color channels (red, green, and blue), requires separate application of the bilateral filter to each of three color channels. As a direct consequence of this, the bilateral filter produces color artifacts at sharp color edges in the RGB color space. This poses a problem since the RGB color space is typically the native color space of color digital images, i.e. images obtained through various digital imaging techniques, such as digital photography or image scanning operations.
One remedy previously proposed is to convert from the native RGB color space to the CIELAB color space, which attempts to approximate human vision (or perception). Like the RGB color space, the CIELAB color space also has three color channels, and thus still requires that the bilateral filter be applied independently to each of three color channels, but the CIELAB is noted for avoiding color artifacts. That is, according to this approach, once the native RGB color image is converted to the CIELAB color space, then channel wise bilateral filter processing does not produce the artifacts apparent from processing in the RGB color space.
The present discussion further investigates this weakness and proposes a new technique that works at par with the transformed domain techniques (i.e. converting from a native RGB color space to an alternate color space) that have been the standard practices within the digital imaging community, thus far.
A new filter, hereafter called a “Bi-affinity filter”, for color images is presently proposed. This filter is similar in structure to a bilateral filter, but the proposed Bi-affinity filter is based on a color line model. As will be shown, this approach permits the elimination of the explicit conversion from the RGB color space to perception based color spaces, such as CIELAB.
The present Bi-affinity filter measures the color affinity of a pixel to a small neighborhood around it and weighs the filter term accordingly. It is put forth that this method can perform at par with standard bilateral filters for color images. An added benefit of the present Bi-affinity filter is that not only does it preserve big edges of an input image (a desired characteristic of the bilateral filter), but also preserves and enhances small edges of the input image, which leads to additional applications as an image enhancement filter.
As is explained above, the principle objective of the bilateral filter is to combine information from the spatial domain with a feature domain, and this feature domain is generally the color domain. Determining color affinity between pixels in color images in the RGB domain is complicated by differences in light intensity causing pixels that are close in color to appear quite different and thus have markedly different RGB values. It is therefore generally preferred to convert from the RGB color space to an alterante color space better capable to filtering out difference in light intensity, and apply the bilateral filter in the alternate color space.
Many alternative color spaces have been suggested to separate color from light intensity and create methods for determining whether two pixels share the same color, or not. These color spaces can be divided into two groups, namely linear and non-linear. Among the linear color spaces, the most widely used are the YCrCb, YUV, and YIQ color spaces. Among the non-linear color spaces, two sub-groups are popular: a first sub-group that separates color into hue (i.e. color), saturation (i.e. purity), and value (i.e. light intensity), and a second sub-group that separates color into luminance plus two color coordinates. The first group may further include the HSV, HSI, HSB, HSL, etc. color spaces. The second group are the CIELAB and CIE-LUV color spaces that separate color into luminance (i.e. light intensity) and two color coordinates in an effort to create a color space that is perceptually uniform (i.e. close to how the human eye perceives color variations).
To determine whether two pixels have the same real world color, or not, the color coordinates of a generic color model are used. These color models assume either that there is no color distortion or that there is an identical color distortion for all imaging conditions. In practice, when dealing with real world images of an unknown source, these assumptions are rarely true as scene surface color is distorted differently in different images as well as different image regions, depending on the scene and camera settings.
This leads to the topic of the color line model. The introduction of color lines has been attributed to Omer et al. in Color lines: Image Specific Color Representation, CVPR, 2004, herein incorporated in its entirety by reference. Omer et al. proposed that color natural images form clusters of pixel colors in the RGB color space. These clusters of pixels appear to form mostly tubular regions, due to the fact that most small regions in natural images can be decomposed into a linear combination of 2 colors. This lead to the two-color model, described below.
With reference to FIG. 1, when looking at the RGB color histogram 10 of real world, natural images, it can be clearly observed that the histogram is very sparse and structured. The color line model exploits these two properties of RGB color histograms by describing the elongated color clusters, or tubular regions, 11-15. Since the structure and arrangement of the color clusters 11-15 are specific to an image, this results in an image-specific color representation that has two important properties: robustness to color distortion and a compact description of colors in an image. This idea has been used for image matting (i.e. separation of a foreground subject from its surrounding background), Bayer demosaicing (i.e. reconstruction of a color image from incomplete color samples output from an image sensor overlaid with a Bayer color filter array), and more recently for image de-noising and de-blurring.
The two-color model states that any pixel color Ii in an image I can be represented as a linear combination of two colors P and S, where these colors are piecewise smooth and can be derived from local properties within a small neighborhood containing the pixel i.

Ii=αiP+(1−αi)S, ∀iεw, 0≦αi≦1  (5)

where w is a small patch, or window, and α is the matting coefficient. The patch size is a key parameter in this two-color model, as it is true for only small neighborhoods, relative to the resolution and size of the image. These “small” neighborhoods are typically defined as 3×3 pixel neighborhoods. As the resolution and the size of the images grow, so should the window size as well, to capture a valid neighborhood.

As Levin et al. show in A Closed Form Solution to Natural Image Matting, CVPR, 2006 (herein incorporated in its entirety by reference), a similar line of reasoning may be used for color images. For color images, if the color line property is obeyed, then the 4D linear model satisfied by the matting coefficient, within a small window, at each pixel can be written as




  
    
      
        
          
            α
            i
          
          =
          
            
              
                ∑
                c
              
              ⁢
              
                
                  a
                  c
                
                ⁢
                
                  I
                  i
                  c
                
              
            
            +
            b
          
        
        ,
        
          ∀
          
            
          
          ⁢
          
            i
            ∈
            w
          
        
        ,
        
          c
          ∈
          
            {
            
              1
              ,
              2
              ,
              3
            
            }
          
        
      
    
    
      
        (
        6
        )
      
    
  




Where α are weights for each color channel, which is constant for the window w, b is a model parameter, and c is an index that is unique for each window over the color channels.

A cost function for evaluating the matting coefficient α can be formulated from this model. For an image with N pixels, the cost is defined as




  
    
      
        
          J
          ⁡
          
            (
            
              α
              ,
              a
              ,
              b
            
            )
          
        
        =
        
          
            ∑
            
              k
              ∈
              N
            
          
          ⁢
          
            (
            
              
                
                  ∑
                  
                    i
                    ∈
                    
                      w
                      k
                    
                  
                
                ⁢
                
                  
                    (
                    
                      
                        α
                        i
                      
                      -
                      
                        
                          ∑
                          c
                        
                        ⁢
                        
                          
                            a
                            k
                            c
                          
                          ⁢
                          
                            I
                            i
                            c
                          
                        
                      
                      -
                      
                        b
                        k
                      
                    
                    )
                  
                  2
                
              
              +
              
                ɛ
                ⁢
                
                  
                    ∑
                    c
                  
                  ⁢
                  
                    a
                    k
                    
                      c
                      2
                    
                  
                
              
            
            )
          
        
      
    
    
      
        (
        7
        )
      
    
  




where wk is a small window around pixel k and a={αic}, for all i=[1,N]. ε is a regularization weight for uniqueness as well as smoothness of the solution.

A first theorem is herein proposed, as follow.
Theorem 1: Let J(α)=mina,bJ(α,a, b), then J(α)=αTLα, where L is a laplacian matrix. As it is known in the art, and in particular in the mathematical field of graph theory, a laplacian matrix (also called an admittance matrix or Kirchhoff matrix, is a matrix representation of a graph. Together with Kirchhoff's theorem, it can be used to calculate the number of spanning trees for a given graph. In the present case, L is an n×n matrix, whose ijth element is given by




  
    
      
        
          ∑
          
            k
            |
            
              
                (
                
                  i
                  ,
                  j
                
                )
              
              ∈
              
                
              
              ⁢
              
                w
                k
              
            
          
        
        ⁢
        
          (
          
            
              δ
              ij
            
            -
            
              
                1
                
                  
                  
                    w
                    k
                  
                  
                
              
              ⁢
              
                (
                
                  1
                  +
                  
                    
                      
                        (
                        
                          
                            I
                            i
                          
                          -
                          
                            μ
                            k
                          
                        
                        )
                      
                      T
                    
                    ⁢
                    
                      
                        
                          Σ
                          ~
                        
                        k
                        
                          -
                          1
                        
                      
                      ⁢
                      
                        (
                        
                          
                            I
                            j
                          
                          -
                          
                            μ
                            k
                          
                        
                        )
                      
                    
                  
                
                )
              
            
          
          )
        
      
    
    
      
        (
        8
        )
      
    
  




where δij is the Kronecker delta, μk is a 3×1 mean vector of colors inside the kth window with both i and j as members, Ii and Ij are the color vectors at location i and j,





  
    
      
        Σ
        ~
      
      k
    
    =
    
      
        Σ
        k
      
      +
      
        
          ɛ
          
            
            
              w
              k
            
            
          
        
        ⁢
        
          I
          3
        
      
    
  
  ,




where Σk is the 3×3 covariance matrix, |wk| is the cardinality of the window and I3 is the 3×3 identity matrix.

Proof: Levin et. al. provide a limited proof based on an extension from a gray scale case. Below is presented a full 3-channel proof that can be readily extended to more channels, if necessary. Rewriting Eq. 7 in a matrix notation, where ∥•∥ denotes the 2-norm,





  
    
      
        
          
            J
            ⁡
            
              (
              
                α
                ,
                a
                ,
                b
              
              )
            
          
          =
          
            
              ∑
              k
            
            ⁢
            
              
              
                
                  
                    G
                    k
                  
                  ·
                  
                    
                      a
                      _
                    
                    k
                  
                
                -
                
                  α
                  k
                
              
              
            
          
        
        ⁢
        
          

        
        ⁢
        where
      
    
    
      
        (
        9
        )
      
    
  
  
    
      
        
          
            G
            k
          
          =
          
            [
            
              
                
                  
                    I
                    1
                    R
                  
                
                
                  
                    I
                    1
                    G
                  
                
                
                  
                    I
                    1
                    B
                  
                
                
                  1
                
              
              
                
                  ⋮
                
                
                  ⋮
                
                
                  ⋮
                
                
                  ⋮
                
              
              
                
                  
                    I
                    
                      w
                      k
                    
                    R
                  
                
                
                  
                    I
                    
                      w
                      k
                    
                    G
                  
                
                
                  
                    I
                    
                      w
                      k
                    
                    B
                  
                
                
                  1
                
              
              
                
                  
                    ɛ
                  
                
                
                  0
                
                
                  0
                
                
                  0
                
              
              
                
                  0
                
                
                  
                    ɛ
                  
                
                
                  0
                
                
                  0
                
              
              
                
                  0
                
                
                  0
                
                
                  
                    ɛ
                  
                
                
                  0
                
              
            
            ]
          
        
        ,
        
          
            
              a
              _
            
            k
          
          =
          
            [
            
              
                
                  
                    a
                    k
                    R
                  
                
              
              
                
                  
                    a
                    k
                    G
                  
                
              
              
                
                  
                    a
                    k
                    B
                  
                
              
              
                
                  b
                
              
            
            ]
          
        
        ,
        
          
            α
            k
          
          =
          
            [
            
              
                
                  
                    α
                    1
                  
                
              
              
                
                  ⋮
                
              
              
                
                  
                    α
                    
                      w
                      k
                    
                  
                
              
              
                
                  0
                
              
              
                
                  0
                
              
              
                
                  0
                
              
            
            ]
          
        
      
    
    
      
        (
        10
        )
      
    
  




Note that another representation of Gk is possible where the last 3 rows are combined to a single row of the form [√{square root over (ε)}√{square root over (ε)}√{square root over (ε)}0], but this form leads to an unstable covariance matrix. For known αk, the least square problem can be solved

āk=argmin∥Gk·āk−αk∥  (11)

=(GkTGk)−1GkTαk  (12)

Substituting this solution in Eq. 9, and denoting Lk=I|wk|+3−Gk(GkTGk)−1GkT, where I|wk|+3 is the identity matrix of size (|wk|+3), one obtains,





  
    
      
        
          
            
              
                J
                ⁡
                
                  (
                  α
                  )
                
              
              =
              
              ⁢
              
                
                  ∑
                  k
                
                ⁢
                
                  
                  
                    
                      L
                      k
                    
                    ⁢
                    
                      α
                      k
                    
                  
                  
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  ∑
                  k
                
                ⁢
                
                  (
                  
                    
                      α
                      k
                      T
                    
                    ⁢
                    
                      L
                      k
                      T
                    
                    ⁢
                    
                      L
                      k
                    
                    ⁢
                    
                      α
                      k
                    
                  
                  )
                
              
            
          
        
      
    
    
      
        (
        13
        )
      
    
  




Making the additional observation that





  
    
      
        
          
            L
            k
            T
          
          ⁢
          
            L
            k
          
        
        =
        
        ⁢
        
          
            
              (
              
                
                  I
                  
                    
                      
                      
                        w
                        k
                      
                      
                    
                    +
                    3
                  
                
                -
                
                  
                    
                      
                        G
                        k
                      
                      ⁡
                      
                        (
                        
                          
                            G
                            k
                            T
                          
                          ⁢
                          
                            G
                            k
                          
                        
                        )
                      
                    
                    
                      -
                      1
                    
                  
                  ⁢
                  
                    G
                    k
                    T
                  
                
              
              )
            
            T
          
          ⁢
          
            (
            
              
                I
                
                  
                    
                    
                      w
                      k
                    
                    
                  
                  +
                  3
                
              
              -
              
                
                  
                    
                      G
                      k
                    
                    ⁡
                    
                      (
                      
                        
                          G
                          k
                          T
                        
                        ⁢
                        
                          G
                          k
                        
                      
                      )
                    
                  
                  
                    -
                    1
                  
                
                ⁢
                
                  G
                  k
                  T
                
              
            
            )
          
        
      
    
  
  
    
      
        =
        
        ⁢
        
          
            I
            
              
                
                
                  w
                  k
                
                
              
              +
              3
            
          
          +
          
            
              
                
                  G
                  k
                
                ⁡
                
                  (
                  
                    
                      G
                      k
                      T
                    
                    ⁢
                    
                      G
                      k
                    
                  
                  )
                
              
              
                -
                1
              
            
            ⁢
            
              G
              k
              T
            
            ⁢
            
              
                
                  G
                  k
                
                ⁡
                
                  (
                  
                    
                      G
                      k
                      T
                    
                    ⁢
                    
                      G
                      k
                    
                  
                  )
                
              
              
                -
                1
              
            
            ⁢
            
              G
              k
              T
            
          
          -
          
            2
            ⁢
            
              
                
                  G
                  k
                
                ⁡
                
                  (
                  
                    
                      G
                      k
                      T
                    
                    ⁢
                    
                      G
                      k
                    
                  
                  )
                
              
              
                -
                1
              
            
            ⁢
            
              G
              k
              T
            
          
        
      
    
  
  
    
      
        =
        
        ⁢
        
          
            I
            
              
                
                
                  w
                  k
                
                
              
              +
              3
            
          
          -
          
            
              
                
                  G
                  k
                
                ⁡
                
                  (
                  
                    
                      G
                      k
                      T
                    
                    ⁢
                    
                      G
                      k
                    
                  
                  )
                
              
              
                -
                1
              
            
            ⁢
            
              G
              k
              T
            
          
        
      
    
  
  
    
      
        =
        
        ⁢
        
          L
          k
        
      
    
  




one can write equation (13) as J(α)=Σk(αkTLkαk). To complete the proof one needs to find the expression for Lk|i,j.

Noting the identity E[X2]=σXX2+E[X]2, denoting the individual channel means E[R] as R, one can write




  
    
      
        
          
            G
            k
            T
          
          ⁢
          
            G
            k
          
        
        =
        
          
        
        ⁢
        
          (
          14
          )
        
      
    
  
  
    
      
        
          
        
        ⁢
        
          
            
            w
            
          
          ⁡
          
            [
            
              
                
                  
                    
                      (
                      
                        
                          
                            
                              
                                
                                  
                                    
                                      
                                        
                                          
                                            σ
                                            RR
                                            2
                                          
                                          +
                                          
                                            R
                                            2
                                          
                                          +
                                          
                                            ɛ
                                            
                                              
                                              
                                                w
                                                k
                                              
                                              
                                            
                                          
                                        
                                      
                                    
                                    
                                      
                                        
                                          
                                            σ
                                            GR
                                            2
                                          
                                          +
                                          GR
                                        
                                      
                                    
                                  
                                
                              
                              
                                
                                  
                                    
                                      σ
                                      BR
                                      2
                                    
                                    +
                                    BR
                                  
                                
                              
                            
                          
                          
                            
                              
                                
                                  
                                    
                                      
                                        
                                          
                                            σ
                                            RG
                                            2
                                          
                                          +
                                          RG
                                        
                                      
                                    
                                    
                                      
                                        
                                          
                                            σ
                                            GG
                                            2
                                          
                                          +
                                          
                                            G
                                            2
                                          
                                          +
                                          
                                            ɛ
                                            
                                              
                                              
                                                w
                                                k
                                              
                                              
                                            
                                          
                                        
                                      
                                    
                                  
                                
                              
                              
                                
                                  
                                    
                                      σ
                                      BG
                                      2
                                    
                                    +
                                    BG
                                  
                                
                              
                            
                          
                          
                            
                              
                                
                                  
                                    
                                      
                                        
                                          
                                            
                                              σ
                                              RB
                                              2
                                            
                                            +
                                            RB
                                          
                                        
                                      
                                      
                                        
                                          
                                            
                                              σ
                                              GB
                                              2
                                            
                                            +
                                            GB
                                          
                                        
                                      
                                    
                                  
                                
                                
                                  
                                    
                                      
                                        σ
                                        BB
                                        2
                                      
                                      +
                                      
                                        B
                                        2
                                      
                                      +
                                      
                                        ɛ
                                        
                                          
                                          
                                            w
                                            k
                                          
                                          
                                        
                                      
                                    
                                  
                                
                              
                              )
                            
                          
                        
                      
                    
                    
                      {
                      A
                    
                  
                
                
                  
                    
                      (
                      
                        
                          
                            
                              
                                
                                  
                                    R
                                    
                                      
                                    
                                  
                                
                              
                              
                                
                                  
                                    G
                                    
                                      
                                    
                                    
                                      
                                    
                                  
                                
                              
                            
                          
                        
                        
                          
                            
                              B
                              
                                
                              
                            
                          
                        
                      
                      )
                    
                    
                      {
                      D
                    
                  
                
              
              
                
                  
                    
                      
                        
                          
                            
                              
                                
                                  (
                                  R
                                
                              
                              
                                
                                  
                                
                              
                              
                                
                                  
                                
                              
                              
                                
                                  
                                
                              
                              
                                
                                  
                                
                              
                              
                                
                                  
                                
                              
                              
                                
                                  
                                
                              
                              
                                
                                  
                                
                              
                              
                                
                                  
                                
                              
                              
                                
                                  
                                
                              
                              
                                G
                              
                            
                          
                        
                        
                          
                            
                          
                        
                        
                          
                            
                          
                        
                        
                          
                            
                          
                        
                        
                          
                            
                          
                        
                        
                          
                            
                          
                        
                        
                          
                            
                          
                        
                        
                          
                            
                          
                        
                        
                          
                            
                          
                        
                        
                          
                            
                          
                        
                        
                          
                            B
                            )
                          
                        
                      
                    
                    
                      }
                      
                        D
                        T
                      
                    
                  
                
                
                  
                    
                      1
                      
                        
                      
                    
                    
                      }
                      C
                    
                  
                
              
            
            ]
          
        
      
    
  




where the matrix has been divided into 4 components. Note that D=μk for the kth window. The inverse of the above system can now be written as:




  
    
      
        (
        
          
            G
            k
            T
          
          ⁢
          
            G
            k
          
        
        )
      
      
        -
        1
      
    
    =
    
      
        1
        
          
          
            w
            k
          
          
        
      
      ⁡
      
        [
        
          
            
              P
            
            
              Q
            
          
          
            
              R
            
            
              S
            
          
        
        ]
      
    
  




  
    
      
        
          P
          =
          
          ⁢
          
            
              (
              
                A
                -
                
                  
                    DC
                    
                      -
                      1
                    
                  
                  ⁢
                  
                    D
                    T
                  
                
              
              )
            
            
              -
              1
            
          
        
      
    
    
      
        
          =
          
          ⁢
          
            
              (
              
                A
                -
                
                  DD
                  T
                
              
              )
            
            
              -
              1
            
          
        
      
    
    
      
        
          =
          
          ⁢
          
            
              [
              
                
                  
                    
                      
                        σ
                        RR
                        2
                      
                      +
                      
                        ɛ
                        
                          
                          
                            w
                            k
                          
                          
                        
                      
                    
                  
                  
                    
                      σ
                      RG
                      2
                    
                  
                  
                    
                      σ
                      RB
                      2
                    
                  
                
                
                  
                    
                      σ
                      GR
                      2
                    
                  
                  
                    
                      
                        σ
                        GG
                        2
                      
                      +
                      
                        ɛ
                        
                          
                          
                            w
                            k
                          
                          
                        
                      
                    
                  
                  
                    
                      σ
                      GB
                      2
                    
                  
                
                
                  
                    
                      σ
                      BR
                      2
                    
                  
                  
                    
                      σ
                      BG
                      2
                    
                  
                  
                    
                      
                        σ
                        BB
                        2
                      
                      +
                      
                        ɛ
                        
                          
                          
                            w
                            k
                          
                          
                        
                      
                    
                  
                
              
              ]
            
            
              -
              1
            
          
        
      
    
    
      
        
          =
          
          ⁢
          
            
              Σ
              ~
            
            k
            
              -
              1
            
          
        
      
    
  




  
    Q
    =
    
      
        -
        
          P
          ⁡
          
            (
            
              DC
              
                -
                1
              
            
            )
          
        
      
      =
      
        
          -
          PD
        
        =
        
          
            -
            
              
                Σ
                ~
              
              k
              
                -
                1
              
            
          
          ⁢
          
            μ
            k
          
        
      
    
  




  
    R
    =
    
      
        
          -
          
            (
            
              
                C
                
                  -
                  1
                
              
              ⁢
              
                D
                T
              
            
            )
          
        
        ⁢
        P
      
      =
      
        
          
            -
            
              D
              T
            
          
          ⁢
          P
        
        =
        
          
            -
            
              μ
              k
              T
            
          
          ⁢
          
            
              Σ
              ~
            
            k
            
              -
              1
            
          
        
      
    
  




  
    S
    =
    
      
        
          C
          
            -
            1
          
        
        -
        
          R
          ⁡
          
            (
            
              DC
              
                -
                1
              
            
            )
          
        
      
      =
      
        
          1
          -
          RD
        
        =
        
          1
          +
          
            
              μ
              k
              T
            
            ⁢
            
              
                Σ
                ~
              
              k
              
                -
                1
              
            
            ⁢
            
              μ
              k
            
          
        
      
    
  



Putting all the terms together, one can write





  
    
      
        
          
            (
            
              
                G
                k
                T
              
              ⁢
              
                G
                k
              
            
            )
          
          
            -
            1
          
        
        =
        
          
            1
            
              
              
                w
                k
              
              
            
          
          ⁡
          
            [
            
              
                
                  
                    
                      Σ
                      ~
                    
                    k
                    
                      -
                      1
                    
                  
                
                
                  
                    
                      -
                      
                        
                          Σ
                          ~
                        
                        k
                        
                          -
                          1
                        
                      
                    
                    ⁢
                    
                      μ
                      k
                    
                  
                
              
              
                
                  
                    
                      -
                      
                        μ
                        k
                        T
                      
                    
                    ⁢
                    
                      
                        Σ
                        ~
                      
                      k
                      
                        -
                        1
                      
                    
                  
                
                
                  
                    1
                    +
                    
                      
                        μ
                        k
                        T
                      
                      ⁢
                      
                        
                          Σ
                          ~
                        
                        k
                        
                          -
                          1
                        
                      
                      ⁢
                      
                        μ
                        k
                      
                    
                  
                
              
            
            ]
          
        
      
    
    
      
        (
        15
        )
      
    
  
  
    
      
        
          
            
              G
              k
            
            ⁡
            
              (
              
                
                  G
                  k
                  T
                
                ⁢
                
                  G
                  k
                
              
              )
            
          
          
            -
            1
          
        
        =
        
          
            1
            
              
              
                w
                k
              
              
            
          
          ⁡
          
            [
            
              
                
                  
                    
                      
                        (
                        
                          
                            I
                            1
                          
                          -
                          
                            μ
                            k
                          
                        
                        )
                      
                      T
                    
                    ⁢
                    
                      
                        Σ
                        ~
                      
                      k
                      
                        -
                        1
                      
                    
                  
                
                
                  
                    1
                    -
                    
                      
                        
                          (
                          
                            
                              I
                              1
                            
                            -
                            
                              μ
                              k
                            
                          
                          )
                        
                        T
                      
                      ⁢
                      
                        
                          Σ
                          ~
                        
                        k
                        
                          -
                          1
                        
                      
                      ⁢
                      
                        μ
                        k
                      
                    
                  
                
              
              
                
                  
                    
                      
                        (
                        
                          
                            I
                            2
                          
                          -
                          
                            μ
                            k
                          
                        
                        )
                      
                      T
                    
                    ⁢
                    
                      
                        Σ
                        ~
                      
                      k
                      
                        -
                        1
                      
                    
                  
                
                
                  
                    1
                    -
                    
                      
                        
                          (
                          
                            
                              I
                              2
                            
                            -
                            
                              μ
                              k
                            
                          
                          )
                        
                        T
                      
                      ⁢
                      
                        
                          Σ
                          ~
                        
                        k
                        
                          -
                          1
                        
                      
                      ⁢
                      
                        μ
                        k
                      
                    
                  
                
              
              
                
                  ⋮
                
                
                  ⋮
                
              
              
                
                  
                    
                      
                        (
                        
                          
                            I
                            
                              w
                              k
                            
                          
                          -
                          
                            μ
                            k
                          
                        
                        )
                      
                      T
                    
                    ⁢
                    
                      
                        Σ
                        ~
                      
                      k
                      
                        -
                        1
                      
                    
                  
                
                
                  
                    1
                    -
                    
                      
                        
                          (
                          
                            
                              I
                              
                                w
                                k
                              
                            
                            -
                            
                              μ
                              k
                            
                          
                          )
                        
                        T
                      
                      ⁢
                      
                        
                          Σ
                          ~
                        
                        k
                        
                          -
                          1
                        
                      
                      ⁢
                      
                        μ
                        k
                      
                    
                  
                
              
              
                
                  
                    
                      ɛ
                    
                    ⁢
                    
                      
                        Σ
                        ~
                      
                      k
                      
                        -
                        1
                      
                    
                  
                
                
                  
                    
                      ɛ
                    
                    ⁢
                    
                      
                        Σ
                        ~
                      
                      k
                      
                        -
                        1
                      
                    
                    ⁢
                    
                      μ
                      k
                    
                  
                
              
            
            ]
          
        
      
    
    
      
        (
        16
        )
      
    
  




Right multiplication by GkT yields the final symmetric form, where only the ith column is shown for conciseness and ease of understanding





  
    
      
        
          G
          k
        
        ⁡
        
          (
          
            
              G
              k
              T
            
            ⁢
            
              G
              k
            
          
          )
        
      
      
        -
        1
      
    
    ⁢
    
      
        G
        k
        T
      
      ⁡
      
        [
        
          :
          
            ,
            i
          
        
        ]
      
    
  
  =
  
    
      1
      
        
        
          w
          k
        
        
      
    
    ⁡
    
      [
      
        
          
            
              1
              +
              
                
                  
                    (
                    
                      
                        I
                        1
                      
                      -
                      
                        μ
                        k
                      
                    
                    )
                  
                  T
                
                ⁢
                
                  
                    
                      Σ
                      ~
                    
                    k
                    
                      -
                      1
                    
                  
                  ⁡
                  
                    (
                    
                      
                        I
                        i
                      
                      -
                      
                        μ
                        k
                      
                    
                    )
                  
                
              
            
          
        
        
          
            
              1
              +
              
                
                  
                    (
                    
                      
                        I
                        2
                      
                      -
                      
                        μ
                        k
                      
                    
                    )
                  
                  T
                
                ⁢
                
                  
                    
                      Σ
                      ~
                    
                    k
                    
                      -
                      1
                    
                  
                  ⁡
                  
                    (
                    
                      
                        I
                        i
                      
                      -
                      
                        μ
                        k
                      
                    
                    )
                  
                
              
            
          
        
        
          
            
              1
              +
              
                
                  
                    (
                    
                      
                        I
                        3
                      
                      -
                      
                        μ
                        k
                      
                    
                    )
                  
                  T
                
                ⁢
                
                  
                    
                      Σ
                      ~
                    
                    k
                    
                      -
                      1
                    
                  
                  ⁡
                  
                    (
                    
                      
                        I
                        i
                      
                      -
                      
                        μ
                        k
                      
                    
                    )
                  
                
              
            
          
        
        
          
            ⋮
          
        
        
          
            
              1
              +
              
                
                  
                    (
                    
                      
                        I
                        
                          w
                          k
                        
                      
                      -
                      
                        μ
                        k
                      
                    
                    )
                  
                  T
                
                ⁢
                
                  
                    
                      Σ
                      ~
                    
                    k
                    
                      -
                      1
                    
                  
                  ⁡
                  
                    (
                    
                      
                        I
                        i
                      
                      -
                      
                        μ
                        k
                      
                    
                    )
                  
                
              
            
          
        
        
          
            
              ɛ
              ⁢
              
                
                  
                    Σ
                    ~
                  
                  k
                  
                    -
                    1
                  
                
                ⁡
                
                  (
                  
                    
                      I
                      i
                    
                    -
                    
                      μ
                      k
                    
                  
                  )
                
              
            
          
        
      
      ]
    
  




Subtracting from I|wk|+3 and summing over k concludes the proof. Note that Gk has 3 extra rows (or C extra rows for general case) for the regularization ε. These can be neglected in the final expression since they do not explicitly effect the other computations.

As is stated above, laplacian matrix L, is an n×n matrix. It is note that in L, n may also be understood to be the total number of pixels in the image, whose (ij)th element is given by




  
    
      
        
          ∑
          
            k
            ❘
            
              
                (
                
                  i
                  ,
                  j
                
                )
              
              ∈
              
                w
                k
              
            
          
        
        ⁢
        
          
        
        ⁢
        
          (
          
            
              δ
              ij
            
            -
            
              
                1
                
                  
                  
                    w
                    k
                  
                  
                
              
              ⁢
              
                (
                
                  1
                  +
                  
                    
                      (
                      
                        
                          I
                          i
                        
                        -
                        
                          μ
                          k
                        
                      
                      )
                    
                    ⁢
                    
                      
                        (
                        
                          
                            σ
                            k
                          
                          +
                          
                            
                              ɛ
                              
                                
                                
                                  w
                                  k
                                
                                
                              
                            
                            ⁢
                            
                              I
                              3
                            
                          
                        
                        )
                      
                      
                        -
                        1
                      
                    
                    ⁢
                    
                      (
                      
                        
                          I
                          j
                        
                        -
                        
                          μ
                          k
                        
                      
                      )
                    
                  
                
                )
              
            
          
          )
        
      
    
    
      
        (
        17
        )
      
    
  




where δij is the Kronecker delta, μk is a 3×1 mean vector of colors inside the kth window with both i and j as members, σk is the 3×3 covariance matrix, |wk| is the cardinality of the window and I3 is the identity matrix of size 3×3. Note that the term ε is a regularization term and determines the smoothness of the decomposition into two dominant color modes (i.e. two colors P and S). The laplacian matrix defined by L has been termed the matting laplacian.

The usual decomposition of the laplacian matrix L into a diagonal matrix, D, and a weight matrix, W, leads to the formulation L=D−W. Here D is a diagonal matrix with the terms Dii=#[k|iεwk] at its diagonal, which represents the cardinality of the number of windows of which the pixel i is a member. The individual terms of the weight matrix W are given by




  
    
      
        
          W
          ij
        
        =
        
          
            ∑
            
              k
              ❘
              
                
                  (
                  
                    i
                    ,
                    j
                  
                  )
                
                ∈
                
                  w
                  k
                
              
            
          
          ⁢
          
            
              1
              
                
                
                  w
                  k
                
                
              
            
            ⁢
            
              (
              
                1
                +
                
                  
                    (
                    
                      
                        I
                        i
                      
                      -
                      
                        μ
                        k
                      
                    
                    )
                  
                  ⁢
                  
                    
                      (
                      
                        
                          σ
                          k
                        
                        +
                        
                          
                            ɛ
                            
                              
                              
                                w
                                k
                              
                              
                            
                          
                          ⁢
                          
                            I
                            3
                          
                        
                      
                      )
                    
                    
                      -
                      1
                    
                  
                  ⁢
                  
                    (
                    
                      
                        I
                        j
                      
                      -
                      
                        μ
                        k
                      
                    
                    )
                  
                
              
              )
            
          
        
      
    
    
      
        (
        18
        )
      
    
  




This brings the present discussion to the subject of the Bi-affinity filter. It is first noted that by the definition of the laplacian matrix, all its rows sum to zero, which leads to Dii=ΣjWij. At the local minima, the solution α* satisfies the first order optimality condition LTα*=0. So the optimal condition can be written as




  
    
      
        
          
            L
            T
          
          ⁢
          
            α
            *
          
        
        =
        
          
            
              (
              
                D
                -
                W
              
              )
            
            T
          
          ⁢
          
            α
            *
          
        
      
    
    
      
        (
        19
        )
      
    
  
  
    
      
        
          
            L
            T
          
          ⁢
          
            α
            *
          
        
        =
        
          (
          
            
              
                
                  
                    D
                    11
                  
                  ⁢
                  
                    α
                    1
                    *
                  
                
              
              
                
                  -
                  
                    
                      ∑
                      j
                    
                    ⁢
                    
                      
                    
                    ⁢
                    
                      
                        W
                        
                          1
                          ⁢
                          
                            
                          
                          ⁢
                          j
                        
                      
                      ⁢
                      
                        α
                        j
                        *
                      
                    
                  
                
              
            
            
              
                
                  
                    D
                    22
                  
                  ⁢
                  
                    α
                    2
                    *
                  
                
              
              
                
                  -
                  
                    
                      ∑
                      j
                    
                    ⁢
                    
                      
                    
                    ⁢
                    
                      
                        W
                        
                          2
                          ⁢
                          
                            
                          
                          ⁢
                          j
                        
                      
                      ⁢
                      
                        α
                        j
                        *
                      
                    
                  
                
              
            
            
              
                ⋮
              
              
                ⋮
              
            
            
              
                
                  
                    D
                    nn
                  
                  ⁢
                  
                    α
                    n
                    *
                  
                
              
              
                
                  -
                  
                    
                      ∑
                      j
                    
                    ⁢
                    
                      
                    
                    ⁢
                    
                      
                        W
                        Nj
                      
                      ⁢
                      
                        α
                        j
                        *
                      
                    
                  
                
              
            
          
          )
        
      
    
    
      
        (
        20
        )
      
    
  




Substituting Dii=ΣjWij into the above system of equations and invoking the first order optimality condition leads to





  
    
      
        
          (
          
            
              
                
                  
                    ∑
                    j
                  
                  ⁢
                  
                    
                  
                  ⁢
                  
                    
                      (
                      
                        
                          α
                          1
                          *
                        
                        -
                        
                          α
                          j
                          *
                        
                      
                      )
                    
                    ⁢
                    
                      W
                      
                        1
                        ⁢
                        
                          
                        
                        ⁢
                        j
                      
                    
                  
                
              
            
            
              
                
                  
                    ∑
                    j
                  
                  ⁢
                  
                    
                  
                  ⁢
                  
                    
                      (
                      
                        
                          α
                          2
                          *
                        
                        -
                        
                          α
                          j
                          *
                        
                      
                      )
                    
                    ⁢
                    
                      W
                      
                        2
                        ⁢
                        
                          
                        
                        ⁢
                        j
                      
                    
                  
                
              
            
            
              
                ⋮
              
            
            
              
                
                  
                    ∑
                    j
                  
                  ⁢
                  
                    
                  
                  ⁢
                  
                    
                      (
                      
                        
                          α
                          n
                          *
                        
                        -
                        
                          α
                          j
                          *
                        
                      
                      )
                    
                    ⁢
                    
                      W
                      nj
                    
                  
                
              
            
          
          )
        
        =
        0
      
    
    
      
        (
        21
        )
      
    
  




The effect of this equation is that the color affinity Wij for two pixels with the same color (same α*), is a positive quantity varying with the homogeneity of the local windows containing the pixels i and j as governed by Eqn. 18. But for pixels with different color (different α*) the color affinity is zero. In essence the rows of the laplacian matrix L work as a zero-sum filter kernel, after appropriate resizing of the window.

This leads to the formulation of the Bi-affinity filter as:




  
    
      
        
          
            h
            
              σ
              ,
              ɛ
            
          
          ⁡
          
            (
            x
            )
          
        
        =
        
          
            
              ∑
              
                y
                ∈
                
                  Ω
                  x
                
              
            
            ⁢
            
              
            
            ⁢
            
              (
              
                
                  
                    f
                    s
                    σ
                  
                  ⁡
                  
                    (
                    
                      x
                      ,
                      y
                    
                    )
                  
                
                ⁢
                
                  L
                  xy
                  ɛ
                
                ⁢
                
                  I
                  ⁡
                  
                    (
                    y
                    )
                  
                
              
              )
            
          
          
            
              ∑
              
                y
                ∈
                
                  Ω
                  x
                
              
            
            ⁢
            
              
            
            ⁢
            
              (
              
                
                  
                    f
                    s
                    σ
                  
                  ⁡
                  
                    (
                    
                      x
                      ,
                      y
                    
                    )
                  
                
                ⁢
                
                  L
                  xy
                  ɛ
                
              
              )
            
          
        
      
    
    
      
        (
        22
        )
      
    
  




FIG. 2 illustrates a sample setup for implementing the present Bi-affinity filter. The input image may be provided in a digital memory 110 that is in communication with a data processing device 112, such as a CPU, ASIC, PLD, CPLD, or other type of data processing or computing device. In the present case, the data processing device processing the input image in memory 110 according to processing steps defined by equation 22, where the dependence on user specified parameters σ,ε on the filter output are denoted. I and h are the input and output images respectively, x and y are pixel locations over an image grid, and Ωx is the neighborhood induced around the central pixel x. In the present case, fs(x,y) measures the spatial affinity between pixels at x and y, where parameter σ controls the amount of spatial blurring and serves a similar purpose as the spatial filter variance (i.e. σs in eqn. 3) in a traditional bilateral filter. Lxyε is the laplacian matrix (or matting laplacian) that provides positive color affinity value for two examined pixels, x and y, that have the same color and provides a zero color affinity value for pixels with different color. The parameter ε, a regularization term, works analogous to the range variance parameter (i.e. σr in eqn. 4) in a traditional bilateral filter. Note that the relative weight attributed to regularization term ε, determines the smoothness of the α estimates (i.e. the smoothness of color blending from pixel to pixel), which in the present work translates to the smoothness of the filtered image. The output image h may be saved back to memory 110 or may be stored in another memory device, not shown.

However, the Bi-affinity filter does not smooth the edge, due to the affinity formulation which is zero across the edge. This is in direct contrast to the Bilateral filter, which has an inherent bending effect at the edges. This image distortion can be observed in FIGS. 3a-3c. FIG. 3a is an example of an original image with a sharp image. FIG. 3b shows the result of applying bilateral filtering. As is shown, bilateral filtering results in rounding of the edges. By contrast, applying Bi-affinity filtering preserves edge sharpness, as is shown in FIG. 3c. 
The calculation of the exact weight matrix Wij (hereafter called the “affinity matrix”) as mentioned in Eqn. 18, involves evaluations over all possible overlapping windows that contain the center pixel. This involves O(w3) computations, where w is the size of the window. For example, if the window size is 3 (i.e. three pixels by three pixels), then nine computations would be required per center pixel, which is more than typically required in a traditional bilateral filter.
For example FIG. 4a shows a center pixel C1 and nine overlapping 3×3 pixel windows 21-29 that include center pixel C1. Neighbor pixels N1-N8 are also noted. In the present example, the color affinity between center pixel C1 and target neighbor pixel N1 is desired.
The overall complexity can be reduced by evaluating the color affinity over a smaller set of possible windows. For example in FIG. 4b, only the four overlapping windows, 22, 23, 24, and 29, that encompass both center pixel C1 and target neighbor pixel N1 may be evaluated.
In the simplest case, shown in FIG. 4c, the terms of Wi,j can be evaluated locally, i.e. counting the contribution of only the center pixel's local window, 29, which is the window centered about C1. In this case, the complexity is similar to the typical bilateral range filter, which involves O(w2) computations. This simplest case of only evaluating terms of Wi,j local to a center pixel (i.e. only evaluating the center pixel's local window) is the basis of an approximate Bi-affinity filter.
To keep fair the following comparisons of the Bi-affinity filter with the bilateral filter (i.e. to assure that both have a similar level of complexity), the bilateral filter will instead be compared to the approximate Bi-lateral filter denoted by hl(x) and herein defined as:




  
    
      
        
          
            h
            l
          
          ⁡
          
            (
            x
            )
          
        
        =
        
          
            
              ∑
              
                y
                ∈
                
                  Ω
                  x
                
              
            
            ⁢
            
              
            
            ⁢
            
              
                
                  f
                  s
                  σ
                
                ⁡
                
                  (
                  
                    x
                    ,
                    y
                  
                  )
                
              
              ⁢
              
                L
                xy
                
                  x
                  ⁢
                  
                    
                  
                  ⁢
                  ɛ
                
              
              ⁢
              
                I
                ⁡
                
                  (
                  y
                  )
                
              
            
          
          
            
              ∑
              
                y
                ∈
                
                  Ω
                  x
                
              
            
            ⁢
            
              
            
            ⁢
            
              
                
                  f
                  s
                  σ
                
                ⁡
                
                  (
                  
                    x
                    ,
                    y
                  
                  )
                
              
              ⁢
              
                L
                xy
                
                  x
                  ⁢
                  
                    
                  
                  ⁢
                  ɛ
                
              
            
          
        
      
    
    
      
        (
        23
        )
      
    
  




which considers only the local window centered around pixel x, denoted by Lx.

The operations involved in computing the Lij terms as mentioned in Eqn. 6 (or Eqn. 17), can be decomposed as summation of Gaussian likelihoods over window dependent parameters μw, Σw. These parameters can be computed by accumulating first and second order sufficient statistics over windows. If memory complexity is not an issue then pre-computing 9 integral images can be an option. These 9 integral images correspond to 3 integral images for each of the R, G and B color channels, 3 integral images for RR, GG and BB channels, and 3 integral images for RG, GB and RB channels. For 3 channel color images, this is equivalent to storing 3 more images into the memory. For really large images (HDTV etc.) this option might not be the most optimal due to the large memory overhead.
Another method of computing the Lij terms is to collect sufficient statistics for the current window and then update the statistics for each unit move from top to bottom and left to right, as proposed by the median filtering approach in Two-Dimensional Digital Signal Processing II, Transforms and Median Filters (by T. S. Huang, pages 209-211, 1981, Springer-Verlag, which is herein incorporated in its entirety by reference) and in Fast Median and Bilateral Filtering (ACM Trans. Graph., 25(3):519-526, 2006, by Weiss), which is also herein incorporated in its entirety by reference. Both of these methods can now be used to implement both the full and the approximate bi-affinity filter.
The above approximate Bi-affinity filter (as described in eqn. 23) was tested.
With reference to FIG. 5, the regularization term ε in the affinity formulation works as an edge smoothness term. For understanding the effect of this term, the amount of regularization ε used for the process was varied for each of nine square windows, W5, W7, W9, W11, W13, W15, W17, W19, and W21, with each window having a size of 5, 7, 9, 11, 13, 15, 17, 19, and 21 pixels per side, respectively. The power-to-signal noise ratio, PSNR, for each window with respect to the original image was recorded. As shown, the PSNR degrades for larger window sizes. This is in keeping with the two color model, which is valid only for small windows. However, the regularization term ε neutralizes the effect of window size to a certain degree, as is evident by the band of values collecting near the PSNR value of 96 dB. This suggests a possible tradeoff between PSNR and edge smoothness. For very small regularization values, the noise across the edge can contribute to the jaggedness of the reconstruction. This effect can be countered by increasing regularization term ε, but the increased regularization comes at the cost of increased smoothness of the overall image.
Empirically, good results have been obtained for larger window sizes by keeping values of regularization term ε relatively larger than those proposed in the matting literature mentioned above (i.e. preferably at least 1.5 times larger).
With reference to FIG. 6, the effect of regularization term ε for a fixed window size are illustrated by showing the results assigning values 0.0005, 0.005, 0.05, and 0.5 to regularization term ε. The edge reconstruction becomes increasingly jagged as the amount of regularization is decreased, as is more clearly seen in the closeup view at the upper-right corner of each sample image.
With reference to FIGS. 7a and 14b, comparisons of the PSNR of the present Bi-affinity filter applied in an image's native RGB color space versus the bilateral filter applied in both an image's native RGB color space and converted CIELAB color space are shown. For quantitative comparisons against the traditional bilateral filter, the window size is varied for a fixed range filter variance of 0.1 in FIG. 7a, and for a fixed range filter variance of 1.0 in FIG. 7b. 
With ε=σr=0.1 in FIG. 7a, the PSNR values of the present Bi-affinity filter 100 is better than that of the RGB bilateral filter 102, but is lower than the CIELAB bilateral filter 104. Nonetheless, the present Bi-affinity filter 100 is still within acceptable deviations from the CIELAB bilateral filter 104.
However, as is shown in FIG. 7b, when the range filter variance is increased to 1.0 (i.e. ε=1), the preference of the present Bi-affinity filter 100 can surpass that of the CIELAB bilateral filter 104. More specifically, when the window is increase to at least 5×5 pixels (i.e. w=5), the performance of the present Bi-affinity filter in the image's native RGB color spaces surpasses that of the bilateral filter even in the converted CIELAB color space.
As is mentioned earlier in reference to Eqn. 23, the approximate Bi-affinity filter, which is evaluated over one centered local window, closely emulates the traditional bilateral filter. The following, next experimental results compare the present approximate Bi-affinity filter to the traditional bilateral filter. These results are illustrated in FIG. 8.
With reference to FIG. 8, the upper-left corner image shows the original input image, to which the bilateral filter and the present approximate Bi-affinity filter will be applied. The results of applying the bilateral filter in the input image's native RGB color space (with the bilateral filter individually applied to each of the Red color channel, Green color channel, and Blue color channel) is shown in the upper-right corner. As shown, the resultant soften image suffers from color artifacts at sharp color edges that may be perceived as a loss in image definition.
However, if the input image is first converted from the RGB color space to the CIELAB color space, and the bilateral filter is then individually applied to each of the three CIELAB color channels, then the resultant soften image is more clearly defined, as is shown in the lower-left corner of FIG. 8.
Nonetheless, as is shown in the lower-right corner of FIG. 8, similar results are obtained by applying the present Bi-affinity filter to the original input image in its native RGB color space, with a regularization factor of ε=0.1. Thus, the response of the bilateral filter in the CIELAB color space and the Bi-affinity filter in the native RGB color space is very similar, even though the Bi-affinity filter does not need, or use, any color conversions, resulting in a reduction in filter processing steps.
Two additional sets of experimental results similar to those of FIG. 8 for comparing the Bi-affinity filter to the bilateral filter in both the native RGB color space and in the CIELAB color space are shown in FIGS. 9 and 10.
The present Bi-affinity filter also has applications in enhanced image zooming. The original Bi-affinity filter of Eqn. 22 (i.e. the version not limited to evaluation over only one centered local window), has been shown to preserve very minute details. In other words, the present bi-affinity formulation preserves very intricate details of an image as compared to the traditional bilateral filter, which preserves only dominant edges of an image. In this regard, the present Bi-affinity filter can be understood to preserve all edges, whereas the bilateral filter preserves only strong edges. This important feature of the Bi-affinity filter leads to one of the most interesting applications of the Bi-affinity filter: image enhancement and zooming.
Image enhancement techniques attempt to convert a low-resolution image to a high-resolution image. In effect, image enhancement techniques try to generate high-resolution data from available low-resolution data by estimating missing information. This leads to numerous formulations, some learning based and some interpolation based. Basically, if one can infer the missing high-resolution data, then one can add the missing high-resolution data to an interpolation of the low-resolution data (i.e. an enlarged or zoomed-in version of the input image) that satisfies data fidelity constraints. The result is an estimated (i.e. generated) high-resolution image.
For example with reference to FIG. 11a, given a low-resolution input image, as shown, one can interpolate it to a desired higher-resolution, and then add the missing high-resolution information to generate a final high-resolution result. The mean affinity at each pixel, which is the row wise normalized summation of W, appears to contain this missing detail. This missing detail is shown in FIG. 11b. The Bi-affinity filter further places a smoothed affinity weighted kernel at each pixel, and the combined effect is the enhanced image shown in FIG. 11c. This enhancement effect is a bi-product of the filtering formulation of the Bi-affinity filter.
A second example of the enhancement feature of the present Bi-affinity filter is shown FIGS. 12a and 12b. FIG. 12a shows an image zoomed-in by a factor of 2× by bi-cubic interpolation. FIG. 12b shows the same zoomed-in image additionally enhanced by the present Bi-affinity filter. Note the preservation of small image details.
A third example of the enhancement feature of the present Bi-affinity filter is shown FIGS. 13a and 13b. FIG. 13a shows an image zoomed-in by a factor of 2× by bi-cubic interpolation. FIG. 13b shows the same zoomed-in image additionally enhanced by the present Bi-affinity filter.
A fourth example of the enhancement feature of the present Bi-affinity filter is shown FIGS. 14a and 14b. FIG. 14a shows an image zoomed-in by a factor of 2× by bi-cubic interpolation. FIG. 14b shows the same zoomed-in image additionally enhanced by the present Bi-affinity filter.
A graphical model for image enhancement is shown in FIGS. 15a and 15b. FIG. 15a illustrates a passive filtering technique and FIG. 15b illustrates an active filtering technique. In both FIGS. 15a and 15b, the circles represent observed nodes, the squares represent function nodes, and the triangles represent hidden nodes to be estimated.
The method of the present invention is a passive filtering technique, and is best described by FIG. 15a. Like other passive filtering techniques, e.g. bilateral, bicubic, etc., the present method only looks at the low-resolution observation layer (i.e. layer having lower circles LC along the dashed grid pattern) to generate the values of the high-resolution scene (i.e. the upper layer having upper triangles UT). In the present case, the filter kernel is applied to the observed node to generate the scene.
By comparison, active methods such as Markov random field (MRF) based models, shown in FIG. 15b, impose neighborhood continuity constraints in the inferred layer as well. That is, scene nodes are also influenced by the neighbors in the hidden scene field. This is typically done through interaction potential within the scene nodes. It is presently put forth that the principles of the present invention may be applied to a such model, as well.
In summary, a new edge preserving filter, which works on the principle of matting affinity, is proposed. The formulation of matting affinity allows a better representation of the range filter term in bilateral filter class. The definition of the affinity term can be relaxed to suit different applications.
An approximate Bi-affinity filter whose output is shown to be very similar to the traditional bilateral filter is defined. The present technique has the added advantage that no color space changes are required and hence an input images can be handled in its original color space, i.e. its native color space. This is a big benefit over traditional bilateral filter, which needs a conversion from its native color space to a perception based color spaces, such as CIELAB, to generate results close to the present invention.
Furthermore, the full Bi-affinity filter preserves very minute details of the input image, and can easily be extended to an image enhancement application to permit an enhanced zooming function.
While the invention has been described in conjunction with several specific embodiments, it is evident to those skilled in the art that many further alternatives, modifications, and variations will be apparent in light of the foregoing description. Thus, the invention described herein is intended to embrace all such alternatives, modifications, applications and variations as may fall within the spirit and scope of the appended claims.

## Claims

1. A method of processing a digital, input image, comprising:
providing said digital input image, I, in physical memory, said input image having color information in a native color space for each image pixel;
providing a processing device coupled to said physical memory to access said input image I and create an output image, h, by implementing the following steps:
(a) applying the following sequence to said input image I,





  
    
      h
      
        σ
        ,
        ɛ
      
    
    ⁡
    
      (
      x
      )
    
  
  =
  
    
      
        ∑
        
          y
          ∈
          
            Ω
            x
          
        
      
      ⁢
      
        
      
      ⁢
      
        (
        
          
            
              f
              s
              σ
            
            ⁡
            
              (
              
                x
                ,
                y
              
              )
            
          
          ⁢
          
            L
            xy
            ɛ
          
          ⁢
          
            I
            ⁡
            
              (
              y
              )
            
          
        
        )
      
    
    
      
        ∑
        
          y
          ∈
          
            Ω
            x
          
        
      
      ⁢
      
        
      
      ⁢
      
        (
        
          
            
              f
              s
              σ
            
            ⁡
            
              (
              
                x
                ,
                y
              
              )
            
          
          ⁢
          
            L
            xy
            ɛ
          
        
        )
      
    
  




where x and y are pixel locations over an image grid, and Ωx is the neighborhood induced around the central pixel x; fs(x,y) measures the spatial affinity between pixels at x and y; parameter σ controls an amount of spatial blurring; Lxyε is a laplacian matrix that provides positive color affinity value for two examined pixels, x and y, that have the same color and provides a zero color affinity value for pixels with different color; parameter ε is a regularization term whose relative weight determines the smoothness of output image h.

2. The method of claim 1, wherein step (a) is applied to said input image I in its native color space.

3. The method of claim 2, wherein said native color space is the RGB color space.

4. The method of claim 1, wherein said laplacian matrix Lxyε follows a 2 color model specifying that pixel color Ii in an input image I can be represented as a linear combination of two colors P and S as follows:


Ii=αiP+(1−αi)S, ∀iεw, 0≦αi≦1

where the two colors are piecewise smooth and can be derived from local properties within neighborhood Ωx containing the pixel i, and wherein piecewise smooth means smooth within a region of similar in size as window w.

5. The method of claim 4, wherein parameter ε determines the smoothness of the decomposition into said two color modes as represented by the smoothness of α estimates.

6. The method of claim 4, wherein αi is defined as:




  
    
      α
      i
    
    =
    
      
        
          ∑
          c
        
        ⁢
        
          
        
        ⁢
        
          
            a
            c
          
          ⁢
          
            I
            i
            c
          
        
      
      +
      b
    
  
  ,
  
    ∀
    
      i
      ∈
      w
    
  



where α are weights for each color channel and is constant for the window w, b is a model parameter, and c is an index over the color channels.

7. The method of claim 6, wherein the α values are determined according to quadratic cost function J(α)=αTLα.

8. The method of claim 7, wherein laplacian matrix L is an n×n matrix, where n is the total number of pixels in input image I whose (ij)th element is given by




  
    ∑
    
      k
      ❘
      
        
          (
          
            i
            ,
            j
          
          )
        
        ∈
        
          w
          k
        
      
    
  
  ⁢
  
    
  
  ⁢
  
    (
    
      
        δ
        ij
      
      -
      
        
          1
          
            
            
              w
              k
            
            
          
        
        ⁢
        
          (
          
            1
            +
            
              
                (
                
                  
                    I
                    i
                  
                  -
                  
                    μ
                    k
                  
                
                )
              
              ⁢
              
                
                  (
                  
                    
                      σ
                      k
                    
                    +
                    
                      
                        ɛ
                        
                          
                          
                            w
                            k
                          
                          
                        
                      
                      ⁢
                      
                        I
                        3
                      
                    
                  
                  )
                
                
                  -
                  1
                
              
              ⁢
              
                (
                
                  
                    I
                    j
                  
                  -
                  
                    μ
                    k
                  
                
                )
              
            
          
          )
        
      
    
    )
  



where δij is the Kronecker delta, μk is a 3×1 mean vector of colors inside the kth window with both i and j as members, σk is the 3×3 covariance matrix, |wk| is the cardinality of the window and I3 is the identity matrix of size 3×3.

9. The method of claim 8, wherein the laplacian matrix L is further decomposed into a diagonal matrix D and a weight matrix W with the formulation L=D−W, wherein:
diagonal matrix D is defined with terms Dii=#[k|iεwk] at its diagonal and represents the cardinality of the number of windows of which the pixel i is a member;
individual terms of weight matrix W are given by





  
    W
    ij
  
  =
  
    
      ∑
      
        k
        ❘
        
          
            (
            
              i
              ,
              j
            
            )
          
          ∈
          
            w
            k
          
        
      
    
    ⁢
    
      
        1
        
          
          
            w
            k
          
          
        
      
      ⁢
      
        (
        
          1
          +
          
            
              (
              
                
                  I
                  i
                
                -
                
                  μ
                  k
                
              
              )
            
            ⁢
            
              
                (
                
                  
                    σ
                    k
                  
                  +
                  
                    
                      ɛ
                      
                        
                        
                          w
                          k
                        
                        
                      
                    
                    ⁢
                    
                      I
                      3
                    
                  
                
                )
              
              
                -
                1
              
            
            ⁢
            
              (
              
                
                  I
                  j
                
                -
                
                  μ
                  k
                
              
              )
            
          
        
        )
      
    
  




where δij is the Kronecker delta, μk is a 3×1 mean vector of colors inside the kth window with both i and j as members, σk is the 3×3 covariance matrix, |wk| is the cardinality of the window and I3 is the identity matrix of size 3×3; and
color affinity Wij for two pixels with the same color is a positive quantity varying with the homogeneity of the local windows containing the pixels i and j, and color affinity for pixels with different color is zero.

10. The method of claim 9, wherein at the local minima, the solution α* satisfies a first order optimality condition LTα*=0, and the optimal condition is defined as LTα*=(D−W)Tα*.

11. The method of claim 9, wherein terms of Wi,j are evaluated by counting the contribution of only the center pixel's local window defined as the window centered about it.

12. The method of claim 11, wherein the local window w is a 3×3 pixel window requiring O(w2) computations.

13. The method of claim 1, further including:
(b) interpolating said input image I to a resolution higher than its native resolution;
(c) combining the results of step (a) with the interpolated, higher resolution image of step (b).

14. The method of claim 13, wherein step (a) generates detail line information of said input image I, and step (c) adds this line information to the interpolated, higher resolution image.

15. The method of claim 1, wherein the laplacian matrix L is a zero-sum filter kernel.

16. A method of enlarging an input image I, comprising:
providing said digital input image, I, in physical memory, said input image having color information in a native color space for each image pixel;
providing a processing device coupled to said physical memory to access said input image I and create an output image, h, by implementing the following steps:
(a) applying the following sequence to said input image I,





  
    
      h
      
        σ
        ,
        ɛ
      
    
    ⁡
    
      (
      x
      )
    
  
  =
  
    
      
        ∑
        
          y
          ∈
          
            Ω
            x
          
        
      
      ⁢
      
        
      
      ⁢
      
        (
        
          
            
              f
              s
              σ
            
            ⁡
            
              (
              
                x
                ,
                y
              
              )
            
          
          ⁢
          
            L
            xy
            ɛ
          
          ⁢
          
            I
            ⁡
            
              (
              y
              )
            
          
        
        )
      
    
    
      
        ∑
        
          y
          ∈
          
            Ω
            x
          
        
      
      ⁢
      
        
      
      ⁢
      
        (
        
          
            
              f
              s
              σ
            
            ⁡
            
              (
              
                x
                ,
                y
              
              )
            
          
          ⁢
          
            L
            xy
            ɛ
          
        
        )
      
    
  




where:
(i) x and y are pixel locations over an image grid;
(ii) Ωx is the neighborhood induced around the central pixel x;
(iii) fs(x,y) measures the spatial affinity between pixels at x and y;
(iv) parameter σ controls an amount of spatial blurring;
(v) Lxyε a laplacian matrix that provides positive color affinity value for two examined pixels, x and y, that have the same color and provides a zero color affinity value for pixels with different color;
(vi) parameter ε is a regularization term whose relative weight determines the smoothness of output image h;
(vii) laplacian matrix L is defined as a diagonal matrix, D, and a weight matrix, W, with the formulation L=D−W, where diagonal matrix D is further defined as Dii=#[k|iεwk] at its diagonal, which represents the cardinality of the number of windows of which the pixel i is a member, individual terms of the weight matrix W are given by







  
    W
    ij
  
  =
  
    
      ∑
      
        k
        ❘
        
          
            (
            
              i
              ,
              j
            
            )
          
          ∈
          
            w
            k
          
        
      
    
    ⁢
    
      
        1
        
          
          
            w
            k
          
          
        
      
      ⁢
      
        (
        
          1
          +
          
            
              (
              
                
                  I
                  i
                
                -
                
                  μ
                  k
                
              
              )
            
            ⁢
            
              
                (
                
                  
                    σ
                    k
                  
                  +
                  
                    
                      ɛ
                      
                        
                        
                          w
                          k
                        
                        
                      
                    
                    ⁢
                    
                      I
                      3
                    
                  
                
                )
              
              
                -
                1
              
            
            ⁢
            
              (
              
                
                  I
                  j
                
                -
                
                  μ
                  k
                
              
              )
            
          
        
        )
      
    
  




and weight matrix Wij is evaluated over all possible overlapping windows that contain the center pixel; and
(b) interpolating said input image I to a resolution higher than its native resolution;
(c) combining the results of step (a) with the interpolated, higher resolution image of step (b).

17. The method of claim 16, wherein step (b) generates detail line information of said input image I, and step (c) adds this line information to the interpolated, higher resolution image.

18. The method of claim 16, wherein step (a) is applied to said input image I in its native color space.

19. The method of claim 17, wherein said native color space is the RGB color space.

20. A method of smoothing an input image I, comprising:
providing said digital input image, I, in physical memory, said input image having color information in a native color space for each image pixel;
providing a processing device coupled to said physical memory to access said input image I and create an output image, h, by implementing the following steps:
(a) applying the following sequence to said input image I,





  
    
      h
      
        σ
        ,
        ɛ
      
    
    ⁡
    
      (
      x
      )
    
  
  =
  
    
      
        ∑
        
          y
          ∈
          
            Ω
            x
          
        
      
      ⁢
      
        
      
      ⁢
      
        (
        
          
            
              f
              s
              σ
            
            ⁡
            
              (
              
                x
                ,
                y
              
              )
            
          
          ⁢
          
            L
            xy
            ɛ
          
          ⁢
          
            I
            ⁡
            
              (
              y
              )
            
          
        
        )
      
    
    
      
        ∑
        
          y
          ∈
          
            Ω
            x
          
        
      
      ⁢
      
        
      
      ⁢
      
        (
        
          
            
              f
              s
              σ
            
            ⁡
            
              (
              
                x
                ,
                y
              
              )
            
          
          ⁢
          
            L
            xy
            ɛ
          
        
        )
      
    
  




where:
(i) x and y are pixel locations over an image grid;
(ii) Ωx is the neighborhood induced around the central pixel x;
(iii) fs(x,y) measures the spatial affinity between pixels at x and y;
(iv) parameter σ controls an amount of spatial blurring;
(v) Lxyε a laplacian matrix that provides positive color affinity value for two examined pixels, x and y, that have the same color and provides a zero color affinity value for pixels with different color;
(vi) parameter ε is a regularization term whose relative weight determines the smoothness of output image h;
(vii) laplacian matrix L is defined as a diagonal matrix, D, and a weight matrix, W, with the formulation L=D−W, where diagonal matrix D is further defined as Dii=#[k|iεwk] at its diagonal, which represents the cardinality of the number of windows of which the pixel i is a member, individual terms of the weight matrix W are given by







  
    W
    ij
  
  =
  
    
      ∑
      
        k
        ❘
        
          
            (
            
              i
              ,
              j
            
            )
          
          ∈
          
            w
            k
          
        
      
    
    ⁢
    
      
        1
        
          
          
            w
            k
          
          
        
      
      ⁢
      
        (
        
          1
          +
          
            
              (
              
                
                  I
                  i
                
                -
                
                  μ
                  k
                
              
              )
            
            ⁢
            
              
                (
                
                  
                    σ
                    k
                  
                  +
                  
                    
                      ɛ
                      
                        
                        
                          w
                          k
                        
                        
                      
                    
                    ⁢
                    
                      I
                      3
                    
                  
                
                )
              
              
                -
                1
              
            
            ⁢
            
              (
              
                
                  I
                  j
                
                -
                
                  μ
                  k
                
              
              )
            
          
        
        )
      
    
  




and terms of Wi,j are evaluated by counting the contribution of only the center pixel's local window defined as the window centered about it.

21. The method of claim 20, wherein the local window w is a 3×3 pixel window.

22. The method of claim 20, wherein regularization factor of ε is at last 0.1.

23. The method of claim 20, wherein step (a) is applied to said input image I in its native color space.

24. The method of claim 23, wherein said native color space is the RGB color space.