Patent Publication Number: US-7916944-B2

Title: System and method for feature level foreground segmentation

Description:
BACKGROUND 
     1. Field of the Invention 
     The subject invention relates to video imaging and, more specifically, to automatic detection and segmentation of foreground in video streams. 
     2. Description of the Related Art 
     Automatic understanding of events happening at a site is the ultimate goal for intelligent visual surveillance systems. Higher-level understanding of events requires that certain lower level computer vision tasks be performed. These may include identification and classification of moving objects, tracking of moving objects, such as people, and understanding of people interaction. To achieve many of these tasks, it is necessary to develop a fast and reliable moving object segmentation method in dynamic video scenes. 
     Background subtraction is a conventional and effective approach to detect moving objects. Many researchers have proposed methods to address issues regarding the background subtraction. One prior art method proposes a three-frame differencing operation to determine regions of legitimate motion, followed by adaptive background subtraction to extract the moving region. According to another prior art method, each pixel is modeled as a mixture of Gaussians, and an on-line approximation is used to update the model. Yet another prior art method uses nonparametric kernel density estimation to model the intensity distribution of each pixel, and another calculates the normalized cross-correlation on the foreground region for shadow removal, and uses a threshold to avoid detecting shadow in dark areas. The last method is based on an assumption that the image produced by the pixel level background subtraction contains all possible foreground regions; however, this assumption isn&#39;t valid when the pixel level background subtraction fails due to, e.g., similar color between the foreground and background. Moreover, the threshold in the last method is sensitive to various scene changes. Consequently, misclassified pixels are ignored and are not used in the normalized cross correlation calculation. Further information about these methods can be found in:
     [1] R. Collins, et al., A system for video surveillance and monitoring: VSAM final report, Carnegie Mellon University, Technical Report: CMU-RI-TR-00-12, 2000.   [2] C. Stauffer, W. Eric L. Grimson, Learning Patterns of Activity Using Real-Time Tracking, IEEE Transactions on Pattern Analysis and Machine Intelligence, Volume 22, Issue 8, August 2000, 747˜757.   [3] A. Elgammal, et al., Background and Foreground Modeling using Non-parametric Kernel Density Estimation for Video Surveillance, Proceedings of the IEEE, 2002, 90(7):1151˜1163.   [4] Ying-li Tian, Max Lu, and Arun Hampapur, Robust and Efficient Foreground Analysis for Real-time Video Surveillance, IEEE Computer Vision and Pattern Recognition, San Diego, June, 2005.   [5] Michael Harville, A Framework for High-Level Feedback to Adaptive, Per-Pixel, Mixture-of-Gaussian Background Models, ECCV 2002: 543-560.   [6] Dengsheng Zhang, Guojun Lu, Segmentation of moving objects in image sequence: A review, Circuits, Systems, and Signal Processing, Volume 20, Number 2 2001.3.   [7] Philippe Noriega, Olivier Bernier, Real Time Illumination Invariant Background Subtraction Using Local Kernel Histograms, BMVC 2006.   [8] Toufiq Parag, Ahmed Elgammal, and Anurag Mittal; A Framework for Feature Selection for Background Subtraction, Proceedings of the 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition—Volume 2 table of contents, Pages: 1916-1923.   [9] J. P. Lewis, Fast normalized cross-correlation;  In Vision Interface,  1995.
 
The entire disclosure of all of which is incorporated herein by reference.
   

     The prior art methods discussed above are all based on pixel level subtraction. A natural downside is that those methods only compare the difference of each pixel during foreground subtraction, so as to ignore the local region information. As a result, the methods often fail in situations such as: 
     (1) Similar color between input image and background; 
     (2) Shadows; 
     (3) Sudden illumination changes; 
     (4) Random motion (e.g., shaking leaves in the wind). 
     That is, even when region information was used in the comparison, the choice of region for the comparison was based on the pixel level comparison. Consequently, the regional information was not used for any of the pixels that were erroneously classified as equivalent to the background. 
     Accordingly, there is a need in the art for a more reliable and robust method for accurately deciphering foreground pixels in an input video stream. 
     SUMMARY 
     The subject invention provides fast and robust foreground segmentation in real world dynamic scenes, including under various lighting and shadow conditions. Various embodiments of the invention may be used with one or multiple cameras for various automated tasks, such as classification of moving objects, tracking of moving objects (including people), and event detection in various indoor or outdoor environments. 
     According to embodiments of the invention, after the pixel to pixel subtraction, a novel feature-level based foreground segmentation method is used to properly validate the foreground pixels. In this step, for each pixel in the image, a neighborhood of pixels is selected, and the aggregate change in the neighborhood image is used to classify foreground and background pixels. In one embodiment, the aggregate change is the number of pixels that were classified as foreground during the pixel-to-pixel subtraction step. According to another embodiment, the aggregate change is the percentage of pixels that were classified as foreground during the pixel-to-pixel subtraction step. According to yet another embodiment, the aggregate change is the difference in total intensity of the neighborhood of pixels as compared with the total intensity of the corresponding background pixels. Once the foreground segmentation has been completed, normalized cross correlation is applied to the validated foreground pixels and the corresponding background pixels to identify confirmed foreground pixels. 
     According to a feature of the invention, a method for performing feature level segmentation is provided, the method comprising: 
     a. selecting a background image; 
     b. selecting an input image; 
     c. for each input pixel of the input image:
         c.i. classifying the pixel as a candidate foreground pixel or candidate background pixel;   c.ii. selecting a neighborhood image about the pixel;   c.iii. determining the aggregate change in the neighborhood image;   c.iv. depending upon the aggregate change, reclassifying the pixel as a foreground or a background pixel;       

     d. outputting an indication of all of the image pixels reclassified as foreground pixels. 
     The method may further comprise the steps: 
     e. for each pixel reclassified as foreground pixel:
         e.i. computing a difference of the neighborhood image of the reclassified foreground pixel and the corresponding background neighborhood image; and,   e.ii. when the difference passes a set threshold, outputting an indication that the pixel is a confirmed foreground pixel.       

     The method may further comprise the step:
         e.iii. generating a feature extracted image from all of the confirmed foreground pixels.       

     The method may further comprise the step:
         e.iii. generating a feature extracted image from all of the input pixels that were reclassified as foreground pixels.       

     In the method the determining the aggregate change in step c.iii. may comprise counting the total number of pixels in the neighborhood image that were classified as candidate foreground pixels in step c.i. The determining the aggregate change in step c.iii. may further comprise comparing the total number to a threshold. The determining the aggregate change in step c.iii. may also comprise calculating the percentage of pixels in the neighborhood image that were classified as candidate foreground pixels in step c.i. The determining the aggregate change in step c.iii. may further comprise comparing the percentage to a threshold. The determining the aggregate change in step c.iii. may alternatively comprise calculating the total intensity of pixels that were classified as candidate foreground pixels in step c.i. The determining the aggregate change in step c.iii. may further comprise subtracting the total intensity from a total background intensity of corresponding background neighborhood pixels to generate intensity difference, and comparing an absolute of the intensity difference to a threshold. The computing a difference of step e.i. may comprise computing normalized cross correlation for the neighborhood image and the background neighborhood image. The cross-correlation may be computed using an integral image. The computing a difference of step e.i. may comprise constructing neighborhood image intensity matrix and background neighborhood image intensity matrix and performing a dot product of the neighborhood image intensity matrix and the background neighborhood image intensity matrix. The computing a difference of step e.i. may comprise constructing neighborhood image gradient distribution and background neighborhood gradient distribution and computing the similarities of the neighborhood image gradient distribution and the background neighborhood image gradient distribution. Step c.i. may comprise comparing the input pixel to corresponding background pixel in the background image to classify the pixel as a candidate foreground pixel or candidate background pixel. Step c.ii. may comprise selecting a plurality of pixels about the pixel to define the neighborhood. The method may further comprise step b.i. of updating the background image using the input image. Step c.iv. may comprise comparing the aggregate change to a threshold. 
     According to other aspects of the invention, a system for performing feature level segmentation is provided, comprising: 
     a video storage module receiving at least one stream of video from at least one video camera; 
     a feature segmented storage module storing feature segmented images; 
     a feature extraction module, said feature extraction module comprising:
         a background image storage module storing a background image;   a pixel level subtraction module receiving images of the video stream and for each image classifying each pixel of the image as background or foreground pixel;   a foreground density estimation module receiving the background and foreground pixels from the pixel level subtraction module and for each pixel selecting a plurality of neighboring pixels to define a neighborhood image and calculating a total change of the neighborhood, based upon the total change said foreground density estimation module reclassifies each pixel as reclassified-background or reclassified-foreground pixel;   a feature extraction module receiving the reclassified-foreground pixels and generating feature segmented images and output the feature segmented images to be stored in the feature extraction module.       

     The feature extraction module may comprise a feature level subtraction module receiving the reclassified-foreground pixels and performing a normalized cross correlation on a neighborhood of each the reclassified-foreground pixel to select pixels for generating the feature extracted images. The system may further comprise pixel level background modeling module receiving the video stream and updating the background image. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The accompanying drawings, which are incorporated in and constitute a part of this specification exemplify the embodiments of the present invention and, together with the description, serve to explain and illustrate principles of the inventive technique. Specifically: 
         FIG. 1  illustrates a framework of feature level foreground segmentation method according to an embodiment of the invention. 
       FIGS.  2 (A)-(E) illustrate some examples of using the method according to the embodiment described for foreground segmentation under various illumination conditions, in comparison with results of the prior art. 
         FIG. 3  depicts images captured and processed to obtain a foreground image. 
         FIG. 4  depicts an embodiment of a system according to the subject invention. 
     
    
    
     The aforementioned accompanying drawings show by way of illustration, and not by way of limitation, specific embodiments and implementations consistent with principles of the present invention. These implementations are described in sufficient detail to enable those skilled in the art to practice the invention and it is to be understood that other implementations may be utilized and that structural changes and/or substitutions of various elements may be made without departing from the scope and spirit of present invention. The following detailed description is, therefore, not to be construed in a limited sense. Additionally, the various embodiments of the invention as described may be implemented in the form of software running on a general purpose computer, in the form of a specialized hardware, or combination of software and hardware. 
     DETAILED DESCRIPTION 
     Various embodiments of the subject invention present novel methods for foreground segmentation in complex real world scenes. A unique characteristic of the method is its ability to achieve precise segmentation results even under challenging indoor environments with cast shadows and changing illumination. According to exemplary embodiments of the invention, instead of classifying foreground pixels based only on the pixel level subtraction, a feature level subtraction is performed so as to take into account the neighborhood of the pixel. That is, according to an embodiment of the invention, a feature level subtraction module uses local region information for a more robust foreground subtraction. For each pixel of the image, a neighborhood about that pixel is selected and the aggregate change of the neighborhood pixels is determined. The aggregate change indicates the number of pixels in the neighborhood that were classified as foreground pixels during the pixel level subtraction. When the aggregate change is above a set threshold, the pixel is selected as foreground pixel. Then, for each foreground pixel, the neighborhood and the corresponding background neighborhood are correlated to provide the feature segmentation. This can be done for all foreground pixels, or for only selected pixels. For example, in certain applications one may not need the resolution of each pixel, but rather select every n-number of foreground pixels to calculate the correlation. 
     Thus, according to embodiments of the invention, general metrics that can measure the similarity between two vectors or arrays can be used. That is, the selected pixels of the foreground and background neighborhoods can be represented by vectors or matrices, and then measures are used to determine the similarities of the vectors or matrices. The representation can be, for example, using intensity of each pixel, using gradient, etc. Finding similarities can be performed by, for example, computing the cosine similarity or normalized cross correlation, etc. 
     According to an embodiment of the invention, the Gaussian mixture model is utilized for pixel level background modeling. This can be done using similar methods as described in the work of Stauffer [2] and Tian et al. [4] cited above, although any method for pixel level background subtraction may be used. In this example we only compute the Gaussian model in grayscale images. For each pixel X at time t, the probability of the pixel can be written as (1): 
                       P   ⁡     (     X   t     )       =       ∑     i   =   1     K     ⁢       ϖ     i   ,   t       *     η   (       X   t     ,     μ     i   ,   t       ,     ∑     i   ,   t         )           ⁢     
     ⁢   where           (   1   )                     η   (       X   t     ,     μ     i   ,   t       ,     ∑     i   ,   t         )     =       1         (     2   ⁢           ⁢   π     )       n   2       ⁢            ∑     i   ,   t              1   /   2           ⁢     ⅇ       -     1   2       ⁢       (       X   t     -     μ     i   ,   t         )     T     ⁢       ∑     i   ,   t       -   1       ⁢     (       X   t     -     μ     i   ,   t         )               ,     
     ⁢     i   =   1     ,   …   ⁢           ,   K     ⁢     
     ⁢   and           (   2   )                 ϖ     i   ,   t       =         (     1   -   α     )     ⁢     ϖ     it   -   1         +     α   ⁡     (     M     k   ,   t       )                 (   3   )               
where K is the number of mixture of Gaussians, μ is the mean, variances Σ i,t =σ k   2 I, α is the learning rate, M k,t  is 1 for the model which matched and 0 for the remaining models. During the online detection, the Gaussians are ordered by the value of  ω /α. The first N distributions are selected for pixel level background subtraction,
 
                   N   =     arg   ⁢           ⁢       max   n     ⁢     (         ∑     k   =   1     n     ⁢     ϖ   k       &gt;   T     )                 (   4   )               
where T is the portion of the background model. The mixture of Gaussian method is robust to slow illumination changes, and random motion in cluttered environments, but as in other pixel level based methods, it only considers the difference of each pixel in foreground subtraction, so as to ignore the local region information.
 
     In the prior art, it was suggested to next compute the cross-correlation in a neighborhood around each foreground pixel in the image and based on whether the cross-correlation is similar enough, classify the foreground pixel as shadow or true foreground. This procedure will not create new foreground pixels; but rather the initial set of foreground pixels may be reduced by labeling some of them as shadow. Notably, the decision of which pixels to choose for the cross correlation calculation was based on the pixel level identification of the foreground pixels. Thus, erroneous pixel level identification will lead to missing foreground pixels because the cross correlation calculation was not performed on all of the relevant pixels. 
     A feature of the embodiment according to this invention is that the pixels selected for cross correlation calculation are determined by taking into account the neighborhood of the pixel in question. That is, we first compute a more lenient foreground mask, essentially “smoothing” the foreground mask, and then use the cross-correlation to compute a revised foreground estimate for selected pixels in the new foreground mask. This procedure tends to produce more foreground pixels than there were in the original foreground mask in cases when there is moving background or the foreground color is similar to the background color. This is performed as follows. First define: 
     R x,y   C     i   ={x,y,w,h} is the position and size of local rectangle region of pixel (x,y) at camera C i . 
     Next identify a subset of pixels to use in the cross-correlation computation. This is based on the foreground classification in a local neighborhood of the pixel as follows: 
     given F p (t), the output foreground image of pixel level background subtraction at time t; 
     compute D x,y   C     i   (t), the foreground ratio inside the region R x,y   C     i    located at pixel (x,y) at time t, as: 
                       D     x   ,   y       C   i       ⁡     (   t   )       =       1     w   ·   h       ⁢       ∑       (     x   ,   y     )     ∈     R     x   ,   y       C   i           ⁢       F     x   ,   y     p     ⁡     (   t   )                   (   5   )               
select pixels where the foreground ratio D x,y   C     i   (t) is higher than a ratio T P  as the pixels for which the normalized cross-correlation will be computed.
 
This subset of pixels can be thought of as a smoothed version of the original foreground mask, and are “candidate foreground” pixels. During the normalized cross-correlation computation, we determine a subset of mixture component(s) to use:
 
determine P, the component in the Gaussian mixture model with the greatest weight:
 
                   P   =     arg   ⁢           ⁢       max   k     ⁢     (     ϖ   k     )                 (   6   )               
P is usually a single component, but more than one component may be used.
 
identify B(t), the mean value of the Gaussian distribution P in the Mixture of Gaussians Model at time t. If more than one mixture component is identified, then B(t) contains the corresponding number of Gaussian means.
 
1. One Dimension Representation and Metric
 
     A vector, such as a histogram-based descriptor, can be used to represent the pixels in a block of an image. Let&#39;s denote the one dimension histogram of the region on input image and background image as vector I and B respectively. Various descriptors can be used to compute the histogram. For instance, the color histogram or the gradient orientation histogram can be computed. A gradient orientation histogram is a representation of an image derived by counting the ‘gradient orientation’ of each pixel. 
     To compare the similarity M t (x,y) of two vectors of length m centered at (x,y), the standard normalized cross correlation (7) is an example of a metric that can be used. 
                       M   t     ⁡     (     x   ,   y     )       =           ∑     k   =   1     m     ⁢         I   t     ⁡     (   k   )       ·       B   t     ⁡     (   k   )           -       1   m     ⁢       ∑     k   =   1     m     ⁢         I   t     ⁡     (   k   )       ·       ∑     k   =   1     m     ⁢       B   t     ⁡     (   k   )                           (         ∑     k   =   1     m     ⁢       I   t   2     ⁡     (   k   )         -         1   m     ⁡     [       ∑     k   =   1     m     ⁢       I   t     ⁡     (   k   )         ]       2       )                 (         ∑     k   =   1     m     ⁢       B   t   2     ⁡     (   k   )         -         1   m     ⁡     [       ∑     k   =   1     m     ⁢       B   t     ⁡     (   k   )         ]       2       )     )                       (   7   )               
Other examples of metrics that can be used include the Hellinger metric, the symmetric KL divergence, cosine similarity, etc.
 
2. Two Dimension Representation and Metric
 
     For the two dimension we compute the normalized cross-correlation, M(x,y) for only the selected pixels and selected mixture components: 
                       M   t     ⁡     (     x   ,   y     )       =                 ∑       (     x   ,   y     )     ∈     R     x   ,   y       C   i           ⁢         I   t     ⁡     (     x   ,   y     )       ·       B   t     ⁡     (     x   ,   y     )           -     1     w   ·   h                     ∑       (     x   ,   y     )     ∈     R     x   ,   y       C   i           ⁢         I   t     ⁡     (     x   ,   y     )       ·       ∑       (     x   ,   y     )     ∈     R     x   ,   y       C   i           ⁢       B   t     ⁡     (     x   ,   y     )                             (         ∑       (     x   ,   y     )     ∈     R     x   ,   y       C   i           ⁢       I   t   2     ⁡     (     x   ,   y     )         -         1     w   ·   h       [       ∑       (     x   ,   y     )     ∈     R     x   ,   y       C   i           ⁢       I   t     ⁡     (     x   ,   y     )         ]     2       )                 (         ∑       (     x   ,   y     )     ∈     R     x   ,   y       C   i           ⁢       B   t   2     ⁡     (     x   ,   y     )         -         1     w   ·   h       [       ∑       (     x   ,   y     )     ∈     R     x   ,   y       C   i           ⁢       B   t     ⁡     (     x   ,   y     )         ]     2       )     )                       (   8   )               
When M(x,y) is less than a threshold M T , the pixel is labeled as foreground. According to one embodiment, three significant parameters are needed to be set. The threshold of matching ratio M T , the size of the local region R x,y   C     i    and foreground ratio threshold P T . Based on camera calibration information, the size of the region may vary due to different distance. In one example the parameters were chosen as M T =0.91, R x,y   C     i   ={x,y,15,15} and P T =10% The cross-correlation can be efficiently computed using an integral image (e.g., see, reference [9] cited above).
 
     1. Example I 
       FIG. 1  illustrates a framework of feature level foreground segmentation method and system according to an embodiment of the invention. When an input image  100  is received, the pixel level background model technique  120  is utilized to update the background image  110 . Then pixel level subtraction  140  is performed for the entire image  100  with respect to the updated background image  110 . Then the foreground density estimation  150  is performed over the entire input image  100 . The foreground density estimation  150  defines bounded regions/neighborhoods about each pixel in the input image  100 . Then it selects each pixel and checks the aggregate change for that pixel&#39;s neighborhood. In this example, the aggregate change is the percentage of the pixels in that pixel&#39;s bounded region that have been classified as foreground during the pixel level subtraction  140 . That is, a threshold is set in the foreground density estimation  150 , indicating the percentage of foreground pixels in the bounded region above which the selected pixel is defined as a foreground pixel. 
     An indication of the foreground pixels is output by the foreground density estimation  150  to the feature extraction  130 , which then provides the pixels of the bounded region of the foreground pixel and the corresponding pixels from the background image  110  to the feature level subtraction  160 . The feature level subtraction  160  performs normalized cross correlation for the pixels of each bounded region received from the feature extraction  130 . Alternatively, the indication of the foreground pixels may be output by the foreground density estimation  150  to the feature level subtraction  160 . In this case, the feature extraction  130  provides all of the pixels to the feature level subtraction  160 , which then performs the normalized cross correlation only for the pixels of each bounded region received from the foreground density estimation  150 . 
     The pixels that are confirmed as foreground pixels during the cross correlation process at the feature level subtraction  160  are used together to generate the output image forming the extracted feature image and defined as the foreground image  180 . As shown in  FIG. 1 , optionally a morphological filter  170  is applied to the output of the feature level subtraction  160 . The morphological filter  170  generally performs estimation of missing pixels so as to provide a complete and smoothed foreground image, i.e., a feature extracted image. 
     The described embodiment has been tested using multiple cameras indoor video surveillance system, and the detection results were used for object tracking and multiple camera hand off. FIGS.  2 (A)-(E) illustrate some examples of using the method according to the embodiment described for foreground segmentation under various illumination conditions, in comparison to results obtained using the prior art method. In FIGS.  2 (A)-(E), column (a) shows the input image and detected bounding box; column (b) shows the foreground regions of Mixture Gaussian Model, as obtained using the method according to the prior art; column (c) is the foreground region of the embodiment of the invention; and column (d) shows the segmented foreground image. As can be seen by comparing the asks of columns b and c, the masks of column c have more pixels relating to the feature as compared to the mask of column b. Conversely, the mask of column c contains less “noise” or “false foreground” pixels as compared to column b. 
     Using one embodiment of the invention, video taken from four cameras was processed simultaneously using the inventive method operating in a single Pentium IV computer, providing processing at 7 fps for each camera with image size of 320×240. This embodiment demonstrates that the inventive method is fast and robust for foreground segmentation even under difficult conditions, such as shadows, similar color and illumination changes. 
     2. Example II 
       FIG. 4  depicts an embodiment of a system according to the subject invention. In the system of  FIG. 4 , one or more cameras  400  are connected to a network  405 , such as a local area network (LAN). The connection may be by any conventional means, such as wired, wireless, etc., and each camera  400  may have its own identification designation, such as an IP address. The video streams from each camera  400  are stored in a digital video recorder server, DVRS  410 . The foreground image extraction module  420  receives frames from the DVRS  410 , performs foreground image extraction according to any of the novel methods described above, and outputs the extracted foreground image to the database server  430 . The foreground image extraction module  420  may be a specifically programmed general purpose PC or any specially designed processor performing the processing described herein. Alternatively, the foreground image extraction module  420  may be part of the DVRS  410  server or the database server  430 . Similarly, the DVRS  410  and the database server  430  may be the same physical machine or separate machines. Further, a human computer interface HCI  440  is provided to enable users to investigate the images on the database server  430 . The feature segmented image output by the foreground image extraction  420  may be displayed on the HCI  440 . When the foreground image extraction module  420  is implemented as part of the DVRS  410  server or the database server  430 , the HCI  440  may also be used to control the foreground image extraction module  420 . Optionally, the system also includes a trigger mechanism  450 . For example, when the system is used for security purposes, the trigger mechanism  450  may activate an alarm when the foreground image indicates a motion of a potential intruder. 
     3. Advantages and Benefits 
     As can be understood from the preceding description, most of the prior art foreground segmentation algorithms are based on pixel level analysis. These prior art methods only compare the difference between pixels, thus ignoring the local region information. That is, the basic prior art processing framework contains two step: (1) using pixel to pixel subtraction to get a rough foreground image, and (2) using a post processing model to remove false alarm pixels of detected foreground regions. Consequently, pixels that were erroneously classified as background if the first step cannot be recovered in the second step. As a result, much information may be missing from the final foreground image. This is illustrated in  FIG. 3 .  FIG. 3  depicts images captured and processed to obtain a foreground image. Image  300  is the background image, while image  310  is the input image. Image  320  results from the pixel to pixel subtraction processing according to the prior art. As can be seen, many pixels were erroneously classified as background, likely because the person&#39;s dark shirt appears as shadow or its color was similar to the background color, so that these pixels were removed. Consequently, when the cross correlation is applied based on this result, pixels can only be removed from this result as being misidentified as foreground. However, pixels that were misidentified as background cannot be recovered. Therefore, the resulting foreground image is incomplete, as shown by image  330 . 
     On the other hand, the subject invention uses the local region information, which is more stable than the intensity of a single pixel under shadow or illumination changes. That is, according to embodiments of the subject invention, a neighborhood of pixels is defined for each pixel in the input image  310 . Then for each pixel in the input image  310  it is determined what percentage of the neighborhood pixels were classified as foreground pixels. If the percentage is above a threshold, that pixel is designated as foreground pixel. In this manner, pixels that were misclassified as background pixels during the pixel to pixel subtraction can be recovered. Conversely, pixels that were misclassified as foreground pixels during the pixel to pixel subtraction may be removed. The result is a foreground mask, as shown in image  340  in  FIG. 3 . This process is superior to the prior art method in that it enables overcoming foreground detection issues associated with the prior art methods, such as shadows, lighting changes, similar colors in background and foreground, rapid motion of elements in the background (such as leaves on trees), etc. Then, when the foreground mask is completed, it is applied to the image to select the proper foreground pixels, as identified in the mask  340 , to provide the final image  350 , which is the feature segments image. 
     Various embodiments of the invention, e.g., as described with respect to  FIG. 1 , can be implemented as software executing on a programmed general purpose computer, a special purpose computer, a microprocessor or the like. It should also be understood that each element shown in  FIG. 1  may be implemented as a circuit, routine, and/or application, i.e., as a module implemented in hardware, software or combination of hardware and software, and as a portion of a suitably programmed general-purpose data processor. Alternatively, each of the circuits, routines, and/or applications shown in  FIG. 1  can be implemented as physically distinct hardware circuits within an ASIC, a digital signal processor (DSP), a FPGA, a PLD, a PLA and/or a PAL, or discrete logic elements or discrete circuit elements. In general, any device capable of implementing a finite state machine, that is in turn capable of implementing the framework shown in  FIG. 1 , can be used to implement the foreground segmentation according to the embodiments of the invention. The particular form of the circuits, routines, applications, and/or objects shown in  FIG. 1  will take is a design choice and will be obvious and predictable to those skilled in the art. It should be appreciated that the circuits, routines, applications, and/or objects shown in  FIG. 1  do not need to be of the same design. 
     While this invention has been described in conjunction with the exemplary embodiments outlined above, various alternatives, modifications, variations, improvements, and/or substantial equivalents, whether known or that are or may be presently unforeseen, may become apparent to those having at least ordinary skill in the art. Accordingly, the exemplary embodiments of the invention, as set forth above, are intended to be illustrative, not limiting. Various changes may be made without departing from the spirit and scope of the invention. Therefore, the claims as filed and as they may be amended are intended to embrace all known or later-developed alternatives, modifications, variations, improvements, and/or substantial equivalents.