Patent Document

FIELD OF THE INVENTION 
       [0001]    The invention relates to a method and apparatus for filtering an image, in particular to reduce noise. 
       BACKGROUND TO THE INVENTION 
       [0002]    When an image is captured electronically, it tends to be affected by noise. In particular, most image sensors introduce photon shot noise and dark current noise into images that they capture. Noise can also be introduced by operations in the image formation processing chain (for example demosaicing). 
         [0003]    Filtering is commonly used to remove noise from images. This invention concerns vectorial image neighbour filtering. A local neighbour filter calculates the output value of a subject pixel using statistics concerning neighbour pixels found in a window around the subject pixel. The subject pixel is typically at the centre of the window. As the subject pixel changes to allow filtering of the whole image, the window is moved and new neighbour pixels are identified. The window is therefore often referred to as a sliding window. 
         [0004]    The pixels of the image may each be represented by a colour vector. The colour vector is made up of a value in each one of several different dimensions or channels. For an image coded using an RGB standard, the colour vector has three dimensions or channels; red, green and blue. The value in each channel can take one of a given number of levels. Coding images with 255 levels in each channel is common. 
         [0005]    One particular local neighbour vector filter, referred to as a vector sigma filter, is described in the paper “Vector Sigma Filters For Noise Detection And Removal In Colour Images”, Lukac et al, J. Vis. Commun. Image R. 17 (2006) 1-26. The principle of this filter is to replace the colour vector of the subject pixel by the average of the colour vectors of only the neighbour pixels that respect a fixed criterion. More specifically, the new colour vector {right arrow over (g)}(i,j) of the subject pixel at coordinates i,j in the filtered image is defined by 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       g 
                       → 
                     
                      
                     
                       ( 
                       
                         i 
                         , 
                         j 
                       
                       ) 
                     
                   
                   = 
                   
                     
                       
                         ∑ 
                         
                           s 
                           = 
                           
                             ( 
                             
                               i 
                               - 
                               m 
                             
                             ) 
                           
                         
                         
                           m 
                           + 
                           i 
                         
                       
                        
                       
                         
                           ∑ 
                           
                             t 
                             = 
                             
                               ( 
                               
                                 j 
                                 - 
                                 m 
                               
                               ) 
                             
                           
                           
                             m 
                             + 
                             j 
                           
                         
                          
                         
                           
                             δ 
                             
                               s 
                               , 
                               t 
                             
                           
                            
                           
                             
                               f 
                               → 
                             
                              
                             
                               ( 
                               
                                 s 
                                 , 
                                 t 
                               
                               ) 
                             
                           
                         
                       
                     
                     
                       
                         ∑ 
                         
                           s 
                           = 
                           
                             ( 
                             
                               i 
                               - 
                               m 
                             
                             ) 
                           
                         
                         
                           m 
                           + 
                           i 
                         
                       
                        
                       
                         
                           ∑ 
                           
                             t 
                             = 
                             
                               ( 
                               
                                 j 
                                 - 
                                 m 
                               
                               ) 
                             
                           
                           
                             m 
                             + 
                             j 
                           
                         
                          
                         
                           δ 
                           
                             s 
                             , 
                             t 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   1 
                   ) 
                 
               
             
           
         
       
     
         [0006]    where {right arrow over (f)}(s,t) is the colour vector of a neighbour pixel at coordinates s,t, the sliding window has dimensions (2m+1)×(2m+1) and δ s,t  is a Dirac function defined by 
         [0000]    
       
         
           
             
               
                 
                   
                     δ 
                     
                       s 
                       , 
                       t 
                     
                   
                   = 
                   
                     { 
                     
                       
                         
                           
                             
                               1 
                                
                               
                                   
                               
                                
                               if 
                                
                               
                                   
                               
                                
                               
                                  
                                 
                                   
                                     
                                       f 
                                       → 
                                     
                                      
                                     
                                       ( 
                                       
                                         s 
                                         , 
                                         t 
                                       
                                       ) 
                                     
                                   
                                   - 
                                   
                                     
                                       f 
                                       → 
                                     
                                      
                                     
                                       ( 
                                       
                                         i 
                                         , 
                                         j 
                                       
                                       ) 
                                     
                                   
                                 
                                  
                               
                             
                             ≤ 
                             
                               ( 
                               
                                 k 
                                 × 
                                 Δ 
                               
                               ) 
                             
                           
                         
                       
                       
                         
                           
                             0 
                              
                             
                                 
                             
                              
                             otherwise 
                           
                         
                       
                     
                      
                     
                         
                     
                   
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
           
         
       
     
         [0007]    where |{right arrow over (f)}(s,t)−{right arrow over (f)}(i,j)| is the difference between the colour vector {right arrow over (f)}(s,t) of a neighbour pixel and the colour vector {right arrow over (f)}(i,j) of the subject pixel, and (k×Δ) is a threshold value in which k is a variable and Δ is the standard deviation of the colour vectors of the neighbour pixels, which can be defined by 
         [0000]    
       
         
           
             
               
                 
                   Δ 
                   = 
                   
                     
                       
                         1 
                         
                           
                             ( 
                             
                               
                                 2 
                                  
                                 m 
                               
                               + 
                               1 
                             
                             ) 
                           
                           2 
                         
                       
                        
                       
                         
                           ∑ 
                           
                             i 
                             = 
                             1 
                           
                           
                             
                               ( 
                               
                                 
                                   2 
                                    
                                   m 
                                 
                                 + 
                                 1 
                               
                               ) 
                             
                             2 
                           
                         
                          
                         
                           
                             ( 
                             
                               
                                  
                                 
                                   
                                     
                                       f 
                                       → 
                                     
                                     i 
                                   
                                   - 
                                   
                                     μ 
                                     → 
                                   
                                 
                                  
                               
                               2 
                             
                             ) 
                           
                           2 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   3 
                   ) 
                 
               
             
           
         
       
     
         [0008]    where f i  is the colour vector of the ith neighbour pixel in the window and {right arrow over (μ)} is the mean colour vector of all the neighbour pixels in the window. 
         [0009]    It can be appreciated from equation (2) that the new colour vector {right arrow over (g)}(i,j) yielded from equation (1) is based on only neighbour pixels in the window having a colour vector {right arrow over (f)}(s,t) that differs from the colour vector {right arrow over (f)}(i,j) of the subject pixel by an amount less than or equal to the threshold (k×Δ). So, neighbour pixels that have a colour vector {right arrow over (f)}(s,t) that differs too much from the colour vector {right arrow over (f)}(i,j) of the subject pixel are discarded and not used in the calculation of the new colour vector {right arrow over (g)}(i,j). 
         [0010]    This filter reduces noise in images. However, it suffers from a known drawback that impulsive noise represented by clusters of one or two pixels is not always eliminated. To overcome this drawback, it has been suggested to calculate an improved new colour vector {right arrow over (ĝ)}(i,j) for the subject pixel as the average of the colour vectors {right arrow over (f)}(i,j) of just the pixels immediately adjacent to the subject pixel when the number n of neighbour pixels selected in equation (2) above is less than a given number N. This improved new colour vector {right arrow over (ĝ)}(i,j) can be defined by 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       
                         g 
                         → 
                       
                       ^ 
                     
                      
                     
                       ( 
                       
                         i 
                         , 
                         j 
                       
                       ) 
                     
                   
                   = 
                   
                     { 
                     
                       
                         
                           
                             
                               g 
                               → 
                             
                              
                             
                               ( 
                               
                                 i 
                                 , 
                                 j 
                               
                               ) 
                             
                           
                         
                         
                           
                             
                               if 
                                
                               
                                   
                               
                                
                               n 
                             
                             &gt; 
                             N 
                           
                         
                       
                       
                         
                           
                             immediate 
                              
                             
                                 
                             
                              
                             
                               neighbours 
                               &#39; 
                             
                              
                             
                                 
                             
                              
                             average 
                           
                         
                         
                           
                             
                               if 
                                
                               
                                   
                               
                                
                               n 
                             
                             ≤ 
                             N 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   4 
                   ) 
                 
               
             
           
         
       
     
         [0011]    A common value of N is 5, as recommended in the paper “Digital Image Smoothing And The Sigma Filter”, Computer graphics and Image Processing, 24, 225-269, 1983. However, optimum image filtering is still not achieved using this modified version of the vector sigma filter. In particular, this filter still does not completely remove noise from an image. It also has a tendency to blur edges and thin details. 
         [0012]    The present invention seeks to overcome these problems. 
       SUMMARY OF THE INVENTION 
       [0013]    According to a first aspect of the invention there is provided a method of filtering an image, the image having pixels and the colour of each pixel being specified by values that define a colour vector for the pixel, the method comprising: 
         [0014]    identifying neighbour pixels in a window around a subject pixel; 
         [0015]    determining, for each of the neighbour pixels in the window, a maximum difference between the values defining the colour vector for that neighbour pixel; 
         [0016]    calculating a threshold based on the maximum differences and the standard deviation of the values defining the colour vectors for the neighbour pixels in the window; 
         [0017]    selecting only those neighbour pixels in the window that have a colour vector that differs from the colour vector of the subject pixel by less than or the same as the threshold; and 
         [0018]    determining a new colour vector for the subject pixel based on the colour vectors for the selected neighbour pixels. 
         [0019]    Also, according to a second aspect of the present invention, there is provided an apparatus for filtering an image, the image having pixels and the colour of each pixel being specified by values that define a colour vector for the pixel, the apparatus comprising a processor for: 
         [0020]    identifying neighbour pixels in a window around a subject pixel; 
         [0021]    determining, for each of the neighbour pixels in the window, a maximum difference between the values defining the colour vector for that neighbour pixel; 
         [0022]    calculating a threshold based on the maximum differences and the standard deviation of the values defining the colour vectors for the neighbour pixels in the window; 
         [0023]    selecting only those neighbour pixels in the window that have a colour vector that differs from the colour vector of the subject pixel by less than or the same as the threshold; and 
         [0024]    determining a new colour vector for the subject pixel based on the colour vectors for the selected neighbour pixels. 
         [0025]    So, the invention considers the values that make up the colour vector of a neighbour pixel. The maximum difference between these values for the neighbour pixel contains information about the colour of pixel. Likewise, the standard deviation of these values for the neighbour pixels in the window contains information about the colour of the neighbour pixels in the window. So, by basing a threshold for selection of neighbour pixels in the window on the maximum differences and the standard deviation of the values, the selection can be based on this colour information. It has been found that filtering based on neighbour pixels selected in this way improves the preservation of edges and thin details in the filtered image, whilst further reducing noise. 
         [0026]    It should be noted that the neighbour pixels may not necessarily be limited to only those pixels which are immediately adjacent to the subject pixel. Rather, the neighbour pixels are usually all of the pixels inside the window except the subject pixel. So, the neighbour pixels may be adjacent to the subject pixel and/or near to the subject pixel, with the extent of the neighbour pixels being defined by the window. 
         [0027]    It is preferred that the threshold is determined based on a median of the maximum differences for the neighbour pixels in the window. Likewise, it is preferred that the threshold is a scaled product of the maximum differences and the standard deviation of the values defining the colour vectors for the neighbour pixels in the window. 
         [0028]    In a preferred example, determining the new colour vector may be based on the average of the colour vectors for the selected neighbour pixels. The method may also comprise: calculating another threshold based on the standard deviation of the colour vectors of the neighbour pixels in the window; and selecting only those neighbour pixels in the window that have a colour vector that differs from the colour vector of the subject pixel by less than or the same as the another threshold. Similarly, the processor may also calculate another threshold based on the standard deviation of the colour vectors of the neighbour pixels in the window; and select only those neighbour pixels in the window that have a colour vector that differs from the colour vector of the subject pixel by less than or the same as the another threshold. It will be appreciated that this is similar to the vector sigma filter of the prior art. Indeed, in this example, the invention is an improvement of that filter and can be referred to as a hue vector sigma filter. 
         [0029]    The colour vector of each pixel of the image is preferably defined by RGB values. In other words, RGB coding may be used. However, this is not essential. The invention is equally applicable to other types of coding for colour images. 
         [0030]    In a preferred example, the invention is implemented in a digital camera, such as a digital still camera or a digital video camera. However, it might equally be implemented in a mobile telephone, personal digital assistant (PDA), smart phone or such like. Indeed, it might be implemented in any form of image processing apparatus. 
         [0031]    Use of the term “processor” above is intended to be general rather than specific. The invention may be implemented using an individual processor, such as a digital signal processor (DSP) or central processing unit (CPU). However, the invention could equally be implemented using a hard-wired circuit or circuits, such as an application-specific integrated circuit (ASIC), or by embedded software, and it is intended that the term “processor” includes these options. 
         [0032]    It can also be appreciated that the invention can be implemented using computer program code. Indeed, according to a further aspect of the present invention, there is therefore provided computer software or computer program code adapted to carry out the method described above when processed by a processing means. The computer software or computer program code can be carried by a computer readable medium. The medium may be a physical storage medium such as a Read Only Memory (ROM) chip. Alternatively, it may be a disk such as a Digital Versatile Disk (DVD-ROM) or Compact Disk (CD-ROM). It could also be a signal such as an electronic signal over wires, an optical signal or a radio signal such as to a satellite or the like. The invention also extends to a processor running the software or code, e.g. a computer configured to carry out the method described above. 
     
    
     
       BRIEF DESCRIPTION OF DRAWINGS 
         [0033]    The invention will now be described, by way of example only, with reference to the accompanying drawings, in which: 
           [0034]      FIG. 1  is a schematic illustration of a digital camera; 
           [0035]      FIG. 2  is a schematic illustration of an image captured by the camera; 
           [0036]      FIG. 3  is a flowchart showing a method by which the digital camera filters the image; and 
           [0037]      FIG. 4  is a graphical representation of root mean square error against additive Gaussian noise in a test image for a preferred embodiment of the invention and the prior art. 
       
    
    
     DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS 
       [0038]    Referring to  FIG. 1 , a digital camera  100  has an image sensor  101 , a processor  102 , a display  103  and a memory  104 . The image sensor  101  captures an image  200 , shown schematically in  FIG. 2 , and outputs it to the processor  102 . The processor  102  filters the captured image  200  and outputs the filtered image to either or both of the display  103  and/or the memory  104 . The display  103  displays the filtered image. The memory  104  stores it. 
         [0039]    The processor  102  filters the captured image  200  using the process  300  shown in  FIG. 3 . In more detail, at step  301 , the processor  102  receives the captured image  200  from the image sensor  101 . The processor  102  filters the captured image  200  on a pixel by pixel basis. So, at step  302 , the processor chooses a subject pixel  201  to be filtered and determines the colour vector {right arrow over (f)}(s,t) of that pixel  201 , where s,t are the coordinates of the subject pixel  201  in the captured image  200 . In this embodiment, the image is coded using RGB encoding with 256 levels. This means that the colour vectors of the pixels have three dimensions or channels; red, green and blue, and that each value of each colour vector is one of 256 different values. In other embodiments, different encoding or a different number of levels can be used. 
         [0040]    At step  303 , the processor  102  locates a sliding window  202  around the subject pixel  201 . The sliding window  202  identifies neighbour pixels  203  on the basis of which the subject pixel  201  can be later filtered. In this embodiment, as can be seen in  FIG. 2 , the subject pixel  201  is at the centre of the sliding window  202  and the sliding window  202  is square, with dimensions (2m+1) pixels by (2m+1) pixels. Typically, m has value 2, with the result that the sliding window  202  has dimensions 5 pixels by 5 pixels. In other embodiments, different size or shape sliding windows can be used. 
         [0041]    At step  304 , the processor  102  determines a first threshold (k 1 ×Δ 1 ) on the basis of which the neighbour pixels  203  are later selected for use in filtering the subject pixel  201 , where k 1  is a first variable equal to 1.8 and Δ 1  is a first standard deviation defined by 
         [0000]    
       
         
           
             
               
                 
                   
                     Δ 
                     1 
                   
                   = 
                   
                     
                       
                         1 
                         
                           
                             ( 
                             
                               
                                 2 
                                  
                                 m 
                               
                               + 
                               1 
                             
                             ) 
                           
                           2 
                         
                       
                        
                       
                         
                           ∑ 
                           
                             i 
                             = 
                             1 
                           
                           
                             
                               ( 
                               
                                 
                                   2 
                                    
                                   m 
                                 
                                 + 
                                 1 
                               
                               ) 
                             
                             2 
                           
                         
                          
                         
                           
                             ( 
                             
                               
                                  
                                 
                                   
                                     
                                       f 
                                       → 
                                     
                                     i 
                                   
                                   - 
                                   
                                     μ 
                                     → 
                                   
                                 
                                  
                               
                               2 
                             
                             ) 
                           
                           2 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   5 
                   ) 
                 
               
             
           
         
       
     
         [0042]    in which {right arrow over (f)} i  is the colour vector of the ith neighbour pixel  203  in the sliding window  202  and {right arrow over (μ)} is the mean colour vector of all the neighbour pixels  203  in the window  202 . 
         [0043]    At step  305 , the processor  102  determines a second threshold (k 2 ×Δ 2 ), on the basis of which the neighbour pixels  203  are also later selected for use in filtering the subject pixel  201 . k 2  is a second variable defined by 
         [0000]    
       
         
           
             
               
                 
                   
                     k 
                     2 
                   
                   = 
                   
                     x 
                     × 
                     
                       ( 
                       
                         1 
                         + 
                         
                           y 
                           × 
                           
                             
                               ( 
                               
                                 D 
                                 - 
                                 d 
                               
                               ) 
                             
                             D 
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ( 
                   6 
                   ) 
                 
               
             
           
         
       
     
         [0044]    where x is a third variable equal to 0.85, y is a fourth variable equal to 0.2, D is the number of levels to which each dimension of the colour vectors of the pixels of the captured image  200  is encoded (equal to 256 in this embodiment) and d is a fifth variable defined by 
         [0000]    
       
         
           
             
               
                 
                   d 
                   = 
                   
                     Median 
                      
                     
                       ( 
                       
                         
                           M 
                            
                           
                             ( 
                             
                               s 
                               , 
                               t 
                             
                             ) 
                           
                         
                         | 
                         
                           
                             
                               
                                 s 
                                 = 
                                 
                                   
                                     ( 
                                     
                                       i 
                                       - 
                                       m 
                                     
                                     ) 
                                   
                                   → 
                                   
                                     ( 
                                     
                                       i 
                                       + 
                                       m 
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                           
                             
                               
                                 t 
                                 = 
                                 
                                   
                                     ( 
                                     
                                       j 
                                       - 
                                       m 
                                     
                                     ) 
                                   
                                   → 
                                   
                                     ( 
                                     
                                       j 
                                       + 
                                       m 
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ( 
                   7 
                   ) 
                 
               
             
           
         
       
     
         [0045]    where Median( ) is a median function and M(s,t) is defined by 
         [0000]    
       
         
           
             
               
                 
                   
                     M 
                      
                     
                       ( 
                       
                         s 
                         , 
                         t 
                       
                       ) 
                     
                   
                   = 
                   
                     max 
                     ( 
                     
                       
                         abs 
                          
                         
                           ( 
                           
                             
                               
                                 v 
                                 p 
                               
                                
                               
                                 ( 
                                 
                                   s 
                                   , 
                                   t 
                                 
                                 ) 
                               
                             
                             - 
                             
                               
                                 v 
                                 q 
                               
                                
                               
                                 ( 
                                 
                                   s 
                                   , 
                                   t 
                                 
                                 ) 
                               
                             
                           
                           ) 
                         
                       
                       | 
                       
                         
                           
                             
                               p 
                               = 
                               
                                 1 
                                 → 
                                 n 
                               
                             
                           
                         
                         
                           
                             
                               q 
                               = 
                               
                                 1 
                                 → 
                                 n 
                               
                             
                           
                         
                         
                           
                             
                               p 
                               ≠ 
                               q 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   8 
                   ) 
                 
               
             
           
         
       
     
         [0046]    where abs( ) is an absolute value function, v p (s,t) and v q (s,t) are the pth and qth values of the colour vector of the neighbour pixel  203  at the coordinates s,t in the sliding window  202  and n is the number of dimensions of the colour vector (equal to 3 in this embodiment). So, the function M(s,t) finds the maximum difference between the values of the colour vector of a neighbour pixel  203 . The fifth variable d is the median of these differences for all the neighbour pixels  203  in the sliding window  202 . The function M(s,t) can be written 
         [0000]        M ( s,t )=max( abs ( R ( s,t )− G ( s,t ));  abs ( R ( s,t )− B ( s,t ));  abs ( G ( s,t )− B ( s,t ))  (9) 
         [0047]    for an RGB image, where R(s,t), G(s,t) and B(s,t) are respectively the red, green and blue values of the neighbour pixel  203 . 
         [0048]    Δ 2  is a second standard deviation defined by 
         [0000]    
       
         
           
             
               
                 
                   
                     Δ 
                     2 
                   
                   = 
                   
                     
                       
                         1 
                         
                           ( 
                           
                             
                               
                                 ( 
                                 
                                   
                                     2 
                                      
                                     m 
                                   
                                   + 
                                   1 
                                 
                                 ) 
                               
                               2 
                             
                             × 
                             n 
                           
                           ) 
                         
                       
                        
                       
                         
                           ∑ 
                           
                             i 
                             = 
                             1 
                           
                           
                             
                               
                                 ( 
                                 
                                   
                                     2 
                                      
                                     m 
                                   
                                   + 
                                   1 
                                 
                                 ) 
                               
                               2 
                             
                             × 
                             n 
                           
                         
                          
                         
                           
                             ( 
                             
                               
                                 x 
                                 i 
                               
                               - 
                               
                                 x 
                                 _ 
                               
                             
                             ) 
                           
                           2 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   10 
                   ) 
                 
               
             
           
         
       
     
         [0049]    where x i  is the value in each dimension of the ith neighbour pixel  203  in the sliding window  202  and  x  is the mean value across all dimensions of all of the neighbour pixels  203  in the sliding window  202 . 
         [0050]    At step  306 , the processor  102  chooses a neighbour pixel  203  in the sliding window  202 . At step  307 , the processor  102  determines the modulus of the difference between the colour vector {right arrow over (f)}(s,t) of the subject pixel  201  and the colour vector {right arrow over (f)}(i,j) of the chosen neighbour pixel  203 , i.e. |{right arrow over (f)}(s,t)−{right arrow over (f)}(i,j)|. The processor  102  then compares the difference to the first threshold, at step  308 . If the difference is less than or equal to the first threshold, the processor  102  compares the difference to the second threshold at step  309 . If the difference is less than or equal to the second threshold, the chosen neighbour pixel  203  is selected for use in filtering the subject pixel  201  at step  310 . If the difference is greater than either the first threshold or the second threshold, the chosen neighbour pixel  203  is discarded at step  311 . This pixel selection can be defined by replacing equation (2) above with 
         [0000]    
       
         
           
             
               
                 
                   
                     δ 
                     
                       s 
                       , 
                       t 
                     
                   
                   = 
                   
                     { 
                     
                       
                         
                           1 
                         
                         
                           
                             
                               
                                 
                                   if 
                                    
                                   
                                       
                                   
                                    
                                   
                                     ( 
                                     
                                       ( 
                                       
                                         
                                            
                                           
                                             
                                               
                                                 f 
                                                 → 
                                               
                                                
                                               
                                                 ( 
                                                 
                                                   s 
                                                   , 
                                                   t 
                                                 
                                                 ) 
                                               
                                             
                                             - 
                                             
                                               
                                                 f 
                                                 → 
                                               
                                                
                                               
                                                 ( 
                                                 
                                                   i 
                                                   , 
                                                   j 
                                                 
                                                 ) 
                                               
                                             
                                           
                                            
                                         
                                         ≤ 
                                         
                                           
                                             ( 
                                             
                                               
                                                 k 
                                                 1 
                                               
                                               × 
                                               
                                                 Δ 
                                                 1 
                                               
                                             
                                             ) 
                                           
                                            
                                           
                                               
                                           
                                            
                                           and 
                                         
                                       
                                     
                                   
                                 
                               
                             
                             
                               
                                 
                                   
                                       
                                   
                                    
                                   
                                     ( 
                                     
                                       
                                          
                                         
                                           
                                             
                                               f 
                                               → 
                                             
                                              
                                             
                                               ( 
                                               
                                                 s 
                                                 , 
                                                 t 
                                               
                                               ) 
                                             
                                           
                                           - 
                                           
                                             
                                               f 
                                               → 
                                             
                                              
                                             
                                               ( 
                                               
                                                 i 
                                                 , 
                                                 j 
                                               
                                               ) 
                                             
                                           
                                         
                                          
                                       
                                       ≤ 
                                       
                                         ( 
                                         
                                           
                                             k 
                                             2 
                                           
                                           × 
                                           
                                             Δ 
                                             2 
                                           
                                         
                                         ) 
                                       
                                     
                                     ) 
                                   
                                   ) 
                                 
                               
                             
                           
                         
                       
                       
                         
                           0 
                         
                         
                           otherwise 
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   11 
                   ) 
                 
               
             
           
         
       
     
         [0051]    At step  312 , the processor  102  determines when all of the neighbour pixels  203  in the sliding window  202  have either been selected or discarded. If any of the neighbour pixels still need to be selected or discarded, the processor returns to choose another neighbour pixel  203  at step  306 , determine the difference between the colour vector for the subject pixel  201  and the colour vector of that chosen neighbour pixel  203  at step  307  and repeat the comparisons and selecting and discarding, as appropriate, at steps  308  to  311 . When all the neighbour pixels in the sliding window  202  have either been selected or discarded, the processor  102  goes on to determine a new colour vector {right arrow over (g)}(i,j) for the subject pixel  201  at step  313 . 
         [0052]    The processor  102  determines the new colour vector {right arrow over (g)}(i,j) for the identified pixel  201  using the average of the selected neighbour pixels  203 , according equation (1) above, i.e. 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       g 
                       → 
                     
                      
                     
                       ( 
                       
                         i 
                         , 
                         j 
                       
                       ) 
                     
                   
                   = 
                   
                     
                       
                         ∑ 
                         
                           s 
                           = 
                           
                             ( 
                             
                               i 
                               - 
                               m 
                             
                             ) 
                           
                         
                         
                           m 
                           + 
                           i 
                         
                       
                        
                       
                         
                           ∑ 
                           
                             t 
                             = 
                             
                               ( 
                               
                                 j 
                                 - 
                                 m 
                               
                               ) 
                             
                           
                           
                             m 
                             + 
                             j 
                           
                         
                          
                         
                           
                             δ 
                             
                               s 
                               , 
                               t 
                             
                           
                            
                           
                             
                               f 
                               → 
                             
                              
                             
                               ( 
                               
                                 s 
                                 , 
                                 t 
                               
                               ) 
                             
                           
                         
                       
                     
                     
                       
                         ∑ 
                         
                           s 
                           = 
                           
                             ( 
                             
                               i 
                               - 
                               m 
                             
                             ) 
                           
                         
                         
                           m 
                           + 
                           i 
                         
                       
                        
                       
                         
                           ∑ 
                           
                             t 
                             = 
                             
                               ( 
                               
                                 j 
                                 - 
                                 m 
                               
                               ) 
                             
                           
                           
                             m 
                             + 
                             j 
                           
                         
                          
                         
                           δ 
                           
                             s 
                             , 
                             t 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   1 
                   ) 
                 
               
             
           
         
       
     
         [0053]    The processor  102  then determines if new colour vectors have been determined for all the pixels in the captured image  200 , at step  314 . If not, the processor  102  returns to choose another subject pixel  201  at step  302  and repeats the steps  303  to  313  required to determine a new colour vector for that pixel  201 . If new colour vectors have been determined for all the pixels in the captured image  200 , the processor  102  outputs a filtered image using the new colour vectors at step  315 . 
         [0054]    A common objective in image filtering is to minimise root mean square error E RMS  of the filtered image. This has been tested for the preferred embodiment of the invention and the vector sigma filter of the prior art described above using an artificially noisy image, with E RMS  defined by 
         [0000]    
       
         
           
             
               
                 
                   
                     E 
                     rms 
                   
                   = 
                   
                     
                       [ 
                       
                         
                           1 
                           MN 
                         
                          
                         
                           
                             ∑ 
                             
                               i 
                               = 
                               0 
                             
                             
                               M 
                               - 
                               1 
                             
                           
                            
                           
                             
                               ∑ 
                               
                                 j 
                                 = 
                                 0 
                               
                               
                                 N 
                                 - 
                                 1 
                               
                             
                              
                             
                               
                                 [ 
                                 
                                   
                                     
                                       g 
                                       ^ 
                                     
                                      
                                     
                                       ( 
                                       
                                         i 
                                         , 
                                         j 
                                       
                                       ) 
                                     
                                   
                                   - 
                                   
                                     f 
                                      
                                     
                                       ( 
                                       
                                         i 
                                         , 
                                         j 
                                       
                                       ) 
                                     
                                   
                                 
                                 ] 
                               
                               2 
                             
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   12 
                   ) 
                 
               
             
           
         
       
     
         [0055]    where f(i,j) is the colour vector at coordinates i,j of an original image having dimensions M by N and ĝ(i,j) is the colour vector at coordinates i,j of an artificially noisy version of the image after filtering. The results of this testing are shown in  FIG. 4 , where it can be seen that for increasing additive Gaussian noise  400  in the artificially noisy image, the E RMS    401  after filtering according to the preferred embodiment of the invention is lower than the E RMS    402  after filtering according to the vector sigma filter of the prior art. Furthermore, human visual comparison of the filtered images showed better edge preservation, as well as better noise removal, after filtering according to the preferred embodiment of the invention in comparison to after filtering according to the vector sigma filter of the prior art. 
         [0056]    From reading the present disclosure, other variations and modifications will be apparent to the skilled person. Such variations and modifications may involve equivalent and other features which are already known in the art and which may be used instead of, or in addition to, features already described herein. 
         [0057]    Although the appended claims are directed to particular combinations of features, it should be understood that the scope of the disclosure of the present invention also includes any novel feature or any novel combination of features disclosed herein either explicitly or implicitly or any generalisation thereof, whether or not it relates to the same invention as presently claimed in any claim and whether or not it mitigates any or all of the same technical problems as does the present invention. 
         [0058]    Features which are described in the context of separate embodiments may also be provided in combination in a single embodiment. Conversely, various features which are, for brevity, described in the context of a single embodiment, may also be provided separately or in any suitable sub combination. 
         [0059]    The applicant hereby gives notice that new claims may be formulated to such features and/or combinations of such features during the prosecution of the present application or of any further application derived therefrom. 
         [0060]    For the sake of completeness it is also stated that the term “comprising” does not exclude other elements or steps, the term “a” or “an” does not exclude a plurality, a single processor or other unit may fulfil the functions of several means recited in the claims and reference signs in the claims shall not be construed as limiting the scope of the claims.

Technology Category: g