Abstract:
A method and an apparatus for bi-layer segmentation of an image or a sequence of images are described. A classifier is derived based on depth data of the image and another classifier is derived based on color data of the image. The image is then segmented by maximizing a weighted sum of matching scores derived from the classifiers based on depth data and color data of the image. The classifier based on color data of the image is derived using color sampling subsequent to generating an initial segmentation of the image.

Description:
FIELD OF THE INVENTION 
       [0001]    The invention relates to a method and an apparatus for bi-layer segmentation of an image or a sequence of images. More specifically, the invention refers to a method and an apparatus for bi-layer segmentation of an image or a sequence of images, which makes use of color information and depth information. 
       BACKGROUND OF THE INVENTION 
       [0002]    The term image segmentation denotes the art of hard-cutting important objects out of an image, in the sense that each pixel is assigned to only one object. This is in contrast to alpha matting, where a continuous blending function is estimated. The general image segmentation problem is ill-defined as the definition of what an object actually is strongly depends on the task at hand. This high-level knowledge usually needs to be provided by a human operator. 
         [0003]    A simpler scenario is given by the bi-layer segmentation, where a foreground object merely needs to be separated from the scene background. One common solution to this task is called background subtraction, where the foreground object is assumed to be moving in front of a static background. During the last years active depth sensors have become standard components of vision systems and have received much interest from the research community. For image segmentation, the scene depth represents a strong additional cue to color information as it is independent of the lighting conditions. Additionally it does not suffer from ambiguous statistical distributions between foreground objects and background scene, which are typically encountered in the color data. However, depth images captured from active sensors typically have a low resolution and are affected by parallax displacement with respect to the corresponding color images due to the physical distance of their projection centers. Therefore, depth maps and color images need to be registered, which is also a non-trivial task. In O. Wang et al.: “ Automatic Natural Video Matting with Depth”,  PG &#39;07. Proceedings of the 15th Pacific Conference on Computer Graphics and Applications (2007), pp. 469-472, a super resolution technique is used to up-sample the depth map of a time-of-flight camera to the resolution of the main color camera. Passive depth estimation like stereo matching and structure from motion do not suffer from these issues but have their own difficulties. In J. Zhu et al.: “ Joint depth and alpha matte optimization via fusion of stereo and time - of - flight sensor”,  CVPR 2009. IEEE Conference on Computer Vision and Pattern Recognition (2009), pp. 453-460, a sensor setup consisting of a time-of-flight camera in conjunction with a stereo camera is used to combine the robustness of the former with the resolution of the latter. 
         [0004]    Despite the resolution and alignment issues, depth maps can be successfully used to extract a rough initial segmentation fully automatically, without any user input. Furthermore, they allow for the construction of a rough trimap, where alpha matting techniques are directly applied. However, a precise trimap typically allows to produce much better alpha mattes and although the employed alpha matting schemes are also extended towards exploiting the available depth information, their results still suffer from the rather broad initial trimap. 
         [0005]    The research activities on binary segmentation using color and depth may be split into two camps: feature-level fusion and decision-level fusion. In all approaches based on feature-level fusion a k-means clustering is performed on feature vectors consisting of the color components and the spatial position, including the depth, for each pixel. Basically all the decision-level fusion approaches employ a graph-cuts framework, where the depth is integrated into the data term as a statistically independent additional source of information. They typically use classical Bayesian inference. However, also a voting scheme has been proposed to combine the output of three separate classifiers based on background subtraction, color statistics and depth/motion consistency. 
         [0006]    For many video and image editing applications, like clean background plate creation, background substitution, object tracking, 2D to 3D conversion, and many others, a robust segmentation of the foreground object from the background scene is required. Despite the ongoing research on automatic segmentation, currently this task is manually performed by an operator, drawing the silhouette of the segmentation target. This operation is called rotoscoping in the post-production industry. 
       SUMMARY OF THE INVENTION 
       [0007]    It is thus an object of the present invention to propose a robust solution for automatic bi-layer segmentation of an image or a sequence of images. 
         [0008]    According to one aspect of the invention, a method for bi-layer segmentation of an image comprises the steps of:
   deriving a classifier based on depth data of the image;   deriving a classifier based on color data of the image; and   segmenting the image by maximizing a weighted sum of matching scores derived from the classifiers based on depth data and color data of the image.   
 
         [0012]    Similarly, an apparatus for bi-layer segmentation of an image is adapted to perform the steps of:
   deriving a classifier based on depth data of the image;   deriving a classifier based on color data of the image; and   segmenting the image by maximizing a weighted sum of matching scores derived from the classifiers based on depth data and color data of the image.   
 
         [0016]    According to another aspect of the invention, a method for bi-layer segmentation of an image comprises the steps of:
   generating an initial segmentation of the image;   deriving a classifier based on color data of the image using color sampling; and   segmenting the image by maximizing a sum of matching scores derived from the classifier based on color data of the image.   
 
         [0020]    Similarly, an apparatus for bi-layer segmentation of an image is adapted to perform the steps of:
   generating an initial segmentation of the image;   deriving a classifier based on color data of the image using color sampling; and   segmenting the image by maximizing a sum of matching scores derived from the classifier based on color data of the image.   
 
         [0024]    Bi-layer segmentation is performed by processing simultaneously in a graph based framework both the color and depth data of an image or an image sequence. The pipeline is organized in two main steps. A rough segmentation is initially obtained from the statistical analysis of the depth distribution, then the image is segmented by maximizing a weighted sum of matching scores. 
         [0025]    Depth and color data at any pixel location and a space regularization function provide the different score contributions and the resulting optimization problem is solved using graph cut, for example. This approach is used as a safer fusion strategy for the two independent classifiers based on depth and color respectively. The first classifier is preferably constructed using the statistical distribution of the depth data across the video sequence and computing the likelihood of the depth measurements given the two segmentation labels. The color classifier is based on color sampling and the segmentation scores are given by the distance in color space between each pixel and the closest within a set of samples randomly drawn from the sampling areas identified by the initial segmentation. 
         [0026]    The invention provides an automatic tool for rotoscoping a single foreground subject from an image or an image sequence comprising color images and the corresponding depth maps. A remarkable aspect of the tool is the lack of constrains on the background scene, that is, no assumption is done regarding either its motion state or its rigid structure. Furthermore, the proposed sampling approach solves two important issues. First, it handles the case of images with similar statistical distributions of the color data in the background and foreground areas. Second, is can naturally handle small holes on the foreground and background masks, which could severally corrupt the performance of the color sampling. 
         [0027]    One advantage of the proposed solution is that it allows for an automatic segmentation. The system receives as input a color image or a sequence of color images and depth maps aligned on a common reference frame and provides as output a foreground/background bi-layer segmentation map in a fully automatic way. No human interaction is needed, nevertheless the processing pipeline is suitable to hold human hints, when these are available. Indeed, the graph framework can naturally enforce the labeling constraints on some image areas, provided by the user by mean of some scribbles. 
         [0028]    Instead of a probabilistic framework, the present invention for the first time uses color sampling in the binary segmentation pipeline. This technique has been already exploited for alpha matting as an accurate trimap is available. Indeed in color sampling for each pixel within the unknown area of the trimap a few samples are drawn from the nearby foreground and background areas and if the trimap is rather broad it may happen that sampling zones are too distant from the reference pixel and the sampled pixels becomes meaningless. This is not the case in alpha matting where a narrow trimap is available, and it is the reason why so far this technique has not been used for binary segmentation. In the present system a rough initial trimap is automatically extracted using the depth map, but due to its inaccuracy the standard color sampling cannot be successfully employed. Therefore, its basic constraint is relaxed, that is the samples are drawn from both the labeled and unlabeled areas. 
         [0029]    In any graph-based image segmentation algorithm the edge capacities are computed as a function of the local image contrast. Different approaches to measure the image contrast have been proposed in literature, nevertheless in the field of graph-based image segmentation it is always computed as the distance in color space between neighboring pixels. In case of blurred images the color intensity smoothly varies between neighboring pixels and the contrast information carried by neighboring pixel pairs may become too weak. According to the present invention, the dimension of the neighborhood used to measure the image contrast is increased up to four pixels. Considering a pixel pair (b, c), then the quadruplet of aligned pixels (a, b, c, d) is used to compute the local contrast, which is given by the highest color distance provided by the pairs (a, c) and (b, d). 
         [0030]    In line with classical Bayesian inference, the output of statistically independent classifiers is typically combined as a sum of log-likelihood ratios. For some applications (like e.g. image segmentation), it should, however, be safer to use the proposed weighted sum of matching scores as fusion strategy. This allows for a more sensible treatment of the critical case where a pixel can neither be explained well by the foreground nor the background model, i.e. both likelihoods are close to zero. In such a case, it should be safer to assume that basically no information is provided by the classifier. Even if all classifiers happen to be undecided, in case of image segmentation, the correct classification for a pixel may still be inferred from its neighbors. 
         [0031]    Bi-layer segmentation is a low level tool, which is part of many computer vision applications. Possible applications include:
   Background Modeling. This processing is aimed to the creation of a background panoramic image from a set of still images, or a video sequence captured from a moving camera. The knowledge of the foreground subject provides an important support for the estimation of the panoramic geometry.   Background Substitution. This processing is aimed to the replacement in a video sequence of the background scene behind the foreground subject with a new one. Such an application needs the knowledge of an accurate segmentation mask.   2D to 3D Conversion. The conversion of a movie from 2D to 3D needs the accurate segmentation mask of subjects located at different depth, in order to apply the correct disparity field in post processing. The proposed segmentation system can be integrated within the 2D to 3D conversion pipeline, as long as at least one color sequence has its corresponding depth map. The latter can be provided as a sequence of range scans captured by an active sensor, a sequence of disparity maps computed from a passive stereo camera, or it can be an a-dimensional 3D model also computed from a single view using Structure From Motion.   Videoconferencing and Telepresence. This application allows remotely located people to cooperate and interact within a common virtual environment. The segmentation of the foreground subject from the video-sequences minimizes the volume of transferred data between the remote sites.   Alpha Matting. Alpha matting is the soft segmentation of video objects, with the simultaneous estimation of a continuous point-wise blending function between the foreground and background colors. For this purpose an accurate binary segmentation is needed in input, in order to restrict the processing domain to the actual contour of the target objects.   
 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0037]    For a better understanding the invention shall now be explained in more detail in the following description with reference to the figures. It is understood that the invention is not limited to this exemplary embodiment and that specified features can also expediently be combined and/or modified without departing from the scope of the present invention as defined in the appended claims. In the figures: 
           [0038]      FIG. 1  shows an image to be segmented, 
           [0039]      FIG. 2  shows a depth map associated to the image of  FIG. 1 , 
           [0040]      FIG. 3  illustrates a normalized histogram computed from the depth map of  FIG. 2 , 
           [0041]      FIG. 4  depicts a trimap for the image of  FIG. 1  expanded from a segmentation contour, 
           [0042]      FIG. 5  shows a likelihood map for the image of  FIG. 1  computed using a Single Gaussian Model, 
           [0043]      FIG. 6  shows a likelihood map for the image of  FIG. 1  computed using a Single-Side Gaussian Model, 
           [0044]      FIG. 7  illustrates a conservative approach for color sampling, 
           [0045]      FIG. 8  illustrates a risky sampling scheme, 
           [0046]      FIG. 9  shows a histogram of the color distance obtained across a test video sequence using the risky sampling scheme, 
           [0047]      FIG. 10  shows a likelihood map computed using a Hierarchical Gaussian Mixture Model, 
           [0048]      FIG. 11  shows a likelihood map computed using the sampling scheme proposed in equation (6), 
           [0049]      FIGS. 12-23  illustrate segmentations results obtained for four different test video sequences, and 
           [0050]      FIG. 24  depicts a flowchart of a method according to the invention. 
       
    
    
     DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS 
       [0051]    The two main steps of the overall segmentation pipeline comprise five major sub-steps. Furthermore, two datasets           and           are stored and updated across the video sequence. They collect the history of the depth values and their corresponding segmentation labels. In the following the segmentation label for the i-th pixel will be denoted with α 1  and the notation α=0 for the background and α=1 for the foreground pixels, respectively, will be adopted.
   Source data normalization. The color image and the depth maps are normalized in the interval [0, 1]. Although this is a usual step, it is pointed out here since also afterwards, across the whole processing chain, all the involved variables will be normalized. This allows for an easy tuning of the system parameters.   Initial segmentation. The construction of the segmentation graph is not approached directly. Instead it is proposed to perform an initial rough segmentation based only on an analysis of the depth histogram. A trimap is then generated by dilating this segmentation contour. Only the pixels belonging to the unknown area           within this trimap will then be considered in constructing the segmentation graph, while the outside regions are directly labeled as foreground and background.   Statistics learning. The statistical models of the depth measurements are learned from the samples available in the sets           and          . The color data will instead be processed within a sampling scheme so that no statistical model is needed.   Graph building and cut. The segmentation labeling problem is formulated in terms of a cost function minimization. For the unknown area           of the trimap, a graph is constructed in order to refine the binary segmentation in the form of a minimum cut/maximum flow solution. The framework combines the depth with the color information.   Data set update. At the end of each segmentation cycle, the gathered information is integrated into the processing pipeline. The set           is updated with the depth dataset           of the current frame. The set update is performed by means of a memory factor μ,          ←           μ  ∪            1−μ   + , where the notation            μ  means that a fraction of μ samples are randomly extracted from the set          . In the present implementation p is set to 25%. The set           is updated accordingly.   
 
         [0057]    The initial rough segmentation is obtained using only the depth measurements. The histogram of the data available in the set           is constructed and a foreground/background segmentation threshold d th  is determined as 
         [0000]        d   th   =d   m0 +ρ·( d   m1   −d   m0 )   (1)
 
         [0000]    where d m0  and d m1  are the first two peaks in the depth histogram. Here it is assumed that there is a significant jump in depth between the foreground object and the rest of the scene. For such scenes, the depth values of this foreground object should form one well-defined first peak in the depth distribution. In the present implementation, the parameter p (ranging in the interval [0, 1]) is set to 0.5 as the initial segmentation should preferably not be biased neither towards the foreground nor the background. If the assumption is violated and only one peak is detected, d m1  is set to one. 
         [0058]    The initial segmentation is then dilated and eroded in order to construct a trimap. The dimension of the structuring elements applied by the morphological operators is empirically set to 10% of the image width. It has been observed that the resulting trimap is wide enough to cope with the inaccuracy of the depth based segmentation.  FIGS. 1 to 4  show an example of a trimap generated by this scheme.  FIG. 1  shows the original image  1  to be segmented,  FIG. 2  shows the associated depth map  2 .  FIG. 3  illustrates a normalized histogram h d  is computed from the depth map. A value illustrated by the black line between the first two peaks of the normalized histogram h d  is taken as a segmentation threshold.  FIG. 4  depicts a trimap  3  expanded from the segmentation contour. 
         [0059]    In the literature a general trend to use a Single Gaussian Model (SGM) to capture the two conditional probabilities of the depth values for the foreground and background areas can be observed. In most of the cases this is a sufficiently robust representation, but it is prone to gross errors just in those areas where the segmentation inference is most trivial. When the background contains multiple depth layers, the SGM is likely to be polarized towards one of them and it may happen that the farthest peak in the depth distribution is quite poorly represented, i.e. both the foreground and background likelihoods are very low for high depth values. Mostly this is not an issue when a log-likelihood classifier is used, because it uses the ratio of the likelihood functions. However, there is a non-negligible possibility that the estimated probability densities cross in the far depth zone, which makes the depth classifier unreliable. 
         [0060]    For the present implementation this problem is even more relevant because the probability densities will be used as match scores instead of the log-likelihoods, in order to be consistent with the choice of a cost based framework, with all the costs ranging in the interval [0, 1]. Therefore, a Single-Side Gaussian Model (SSGM) is used, which is more realistic and slightly easier to learn: 
         [0000]    
       
         
           
             
               
                 
                   
                     p 
                      
                     
                       ( 
                       
                         
                           d 
                           | 
                           α 
                         
                         = 
                         1 
                       
                       ) 
                     
                   
                   = 
                   
                     { 
                     
                       
                         
                           
                             
                               C 
                               1 
                             
                             · 
                             
                                
                               
                                 
                                   - 
                                   
                                     1 
                                     2 
                                   
                                 
                                  
                                 
                                   
                                     ( 
                                     
                                       
                                         d 
                                         - 
                                         0 
                                       
                                       
                                         σ 
                                         1 
                                       
                                     
                                     ) 
                                   
                                   2 
                                 
                               
                             
                           
                         
                         
                           
                             d 
                             ≥ 
                             0 
                           
                         
                       
                       
                         
                           0 
                         
                         
                           
                             d 
                             &lt; 
                             0 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
             
               
                 
                   
                     p 
                      
                     
                       ( 
                       
                         
                           d 
                           | 
                           α 
                         
                         = 
                         0 
                       
                       ) 
                     
                   
                   = 
                   
                     { 
                     
                       
                         
                           
                             
                               C 
                               0 
                             
                             · 
                             
                                
                               
                                 
                                   - 
                                   
                                     1 
                                     2 
                                   
                                 
                                  
                                 
                                   
                                     ( 
                                     
                                       
                                         d 
                                         - 
                                         1 
                                       
                                       
                                         σ 
                                         0 
                                       
                                     
                                     ) 
                                   
                                   2 
                                 
                               
                             
                           
                         
                         
                           
                             d 
                             ≤ 
                             1 
                           
                         
                       
                       
                         
                           0 
                         
                         
                           
                             d 
                             &gt; 
                             1 
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   3 
                   ) 
                 
               
             
           
         
       
     
         [0061]    The parameters C 0  and C 1  are estimated using the constraint that the likelihood must integrate to 1. The standard deviations σ 0  and σ 1  are learnt from variances of two subsets            o  and            1  obtained by dividing the set           according to the labels set          .  FIGS. 5 and 6  show a comparison between the background likelihood map computed using the SGM ( FIG. 5 ) and the SSGM ( FIG. 6 ) proposed in equation (3). It is apparent that the far background area is not properly captured by the SGM, due to the presence of multiples depth layers. 
         [0062]    Let          ={0, 1} denote the space of binary labels and α=[α 0 , . . . , α N−1 ] T  ∈           the N-dim vector collecting the pixel labels. Then the binary image segmentation is given by the labeling vector which minimizes the following objective function defined over            N : 
         [0000]    
       
         
           
             
               
                 
                   
                     α 
                     = 
                     
                       
                         min 
                         
                           α 
                           ∈ 
                           
                              
                             N 
                           
                         
                       
                        
                       
                         { 
                         
                           
                             
                               ∑ 
                               
                                 i 
                                 ∈ 
                                  
                               
                             
                              
                             
                               
                                 E 
                                 
                                   d 
                                   , 
                                   i 
                                 
                               
                                
                               
                                 ( 
                                 
                                   α 
                                   i 
                                 
                                 ) 
                               
                             
                           
                           + 
                           
                             
                               w 
                               s 
                             
                              
                             
                               
                                 ∑ 
                                 
                                   
                                     ( 
                                     
                                       i 
                                       , 
                                       j 
                                     
                                     ) 
                                   
                                   ∈ 
                                   ℕ 
                                 
                               
                                
                               
                                 
                                   E 
                                   
                                     s 
                                     , 
                                     i 
                                     , 
                                     j 
                                   
                                 
                                  
                                 
                                   ( 
                                   
                                     
                                       α 
                                       i 
                                     
                                     , 
                                     
                                       α 
                                       j 
                                     
                                   
                                   ) 
                                 
                               
                             
                           
                         
                         } 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   4 
                   ) 
                 
               
             
           
         
       
     
         [0000]    where           is the set of neighboring pixels belonging to          , the data term E d,i  is the contribution to the overall cost computed from the measurements provided by the pixel i, and finally the smoothness term E s,i,j  is the cost contribution, which assigns a penalty for each pair of neighbor pixels differently labeled. 
         [0063]    The solution to the problem in equation (4) is then obtained via graph cut. A graph is a collection of nodes and interconnecting edges. When it is used to model the segmentation process of an image of resolution (W,H), the graph contains a set of N n =(W·H+2) nodes, since two additional virtual nodes are required to represent the segmentation labels. The cardinality of the edge set depends on the type of neighborhood model. When the 4-connected neighborhood is adopted, the graph counts an overall number of N c =(3W·H−W−H) edges. In the present implementation only the unlabeled pixels belonging to           contribute to the graph, whose size is, therefore, considerably reduced. 
         [0064]    Ultimately, the core of each graph-based algorithm is the assignment of the capacities to each edge of the graph. The edges connecting neighboring nodes form the smoothness term in equation (4), while the edges connecting the nodes with the two virtual nodes, usually denoted as t-links, model the data term in equation (4). The latter is usually computed by means of a monotonic decreasing function of the likelihood of the pixel data, given the segmentation labeling. Since 3D color vectors and scalar depth measurements are available for each pixel, the data term is computed as a weighted sum of two independent contributions: 
         [0000]        E   d,i (α)= w   c   E   c,i (α)+ w   2   E   z,i (α),   (5)
 
         [0000]    where the indexes ( ) c  and ( ) z  identify the costs computed from the color and depth values. 
         [0065]    The overall cost function comprises by three main contributions, which are balanced by means of the corresponding weights w s , w c  and w z . 
         [0066]    The first contribution to the data term in equation (5) is computed from the 3D color vectors. Commonly this is done within a probabilistic framework. First a statistical model suitable to describe the color distribution in the foreground and background areas is learnt, then the corresponding costs are computed as the negative log-likelihood of the color data, given the labeling conditions. Learning the probabilistic models is not easy, since it is prone to numerical instability and over- or under-fitting problems. A hybrid approach aimed to match the two Gaussian Mixture Models for the background/foreground areas (HGMM), using 3D histograms in color space as intermediate representation. 
         [0067]    Mostly because of its cumulative nature, which leads to a loss of any spatial information, such a global statistical model is not the best choice in the context of image segmentation. Besides it is not unrealistic that background and foreground areas have similar color distributions. Therefore, the present implementation makes use of a more aggressive technique based on local color sampling instead. For each pixel in the set          , two sets of color samples            0  and            1  are randomly extracted from near foreground/background areas. Then the color contribution in equation (5) is computed as the Euclidean distance in color space between the reference pixel and the best sample available in each of two sample sets: 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       E 
                       
                         c 
                         , 
                         i 
                       
                     
                      
                     
                       ( 
                       α 
                       ) 
                     
                   
                   = 
                   
                     min 
                      
                     
                       
                         { 
                         
                           
                             th 
                             c 
                           
                           , 
                           
                             
                               1 
                               
                                 3 
                               
                             
                             · 
                             
                               
                                 min 
                                 
                                   s 
                                   ∈ 
                                   
                                      
                                     α 
                                   
                                 
                               
                                
                               
                                  
                                 
                                   
                                     I 
                                     i 
                                   
                                   - 
                                   
                                     I 
                                     s 
                                   
                                 
                                  
                               
                             
                           
                         
                         } 
                       
                       . 
                     
                   
                 
               
               
                 
                   ( 
                   6 
                   ) 
                 
               
             
           
         
       
     
         [0068]    The threshold th c  is used to bound the contribution of outlier samples with large errors. In the present implementation it is empirically set to 0.1. By inspection of the normalized histogram of the measure of equation 6 computed over a video sequence, as depicted in  FIG. 9 , it can be seen that this value safely includes the 75th percentile of the error distribution. Therefore, it is guaranteed to cut-off only the cost contribution of certainly wrong samples. 
         [0069]    However, the color sampling scheme has a considerable drawback. It requires a-priori knowledge of the sampling areas. For this reason it has been proposed and successfully exploited for Alpha Matting, where a quite accurate segmentation is available and the samples within the foreground/background areas can be easily extracted for each pixel of the set          . In the general context of binary segmentation this information is not available, and there has not yet been any approach using the sampling scheme. Also, in the present scenario the sampling scheme cannot be applied easily, since the unknown area U needs to be grown as a broad strip in order to cope with the inaccuracy of the initial segmentation. 
         [0070]    In the following a reliable and fast technique to set the width of the area           is described, which provides a satisfying trade-off between the sampling effectiveness and the robustness against the initialization inaccuracy. 
         [0071]    The present implementation uses a risky sampling scheme, which relaxes the assumptions on the sampling areas. Instead of performing the color sampling only inside the foreground/background areas identified by the trimap, those sampling areas identified by the initial segmentation are considered as eligible. In other words, the foreground/background samples drawn for the unknown pixels could possibly belong to the same area          . This is schematically illustrated in  FIGS. 7 and 8 , where the gray area represents the foreground area and the hashed area represents the unknown area           produced by the initial depth based segmentation.  FIG. 7  shows a conservative approach for color sampling. The foreground and background samples (represented by the gray and black circles) are drawn only in the areas outside          , as it is typically done in Alpha Matting.  FIG. 8  depicts the approach chosen for the present implementation. The samples are drawn within the initial segmentation areas and, therefore, may belong as well to          . A histogram of the color distance obtained across a test video sequence using the proposed sampling scheme is depicted in  FIG. 9 . 
         [0072]    The sampling is implemented by two steps: first a random direction toward the sampling area is chosen, then a sample is drawn on a sampling segment aligned with the selected direction. The sampling segment starts on the contour of the sampling area and has a length equal to the width of the area          . 
         [0073]    It is worth to point out that a satisfying discrimination power was achieved using only one sample for each area, as can be seen from  FIGS. 10 and 11 , which show a comparison between the background color likelihood map computed using the HGMM ( FIG. 10 ) and the pseudo-likelihood map computed using the sampling scheme proposed in equation (6) ( FIG. 11 ). The bright areas denote high likelihood. 
         [0074]    Allowing for the sampling within the unknown area implicitly enables to cope in a natural way with a certain group of circumstances. Any time the spatial extent of a foreground or background patch is smaller than the width of the domain          , it will be absorbed during the trimap expansion. This happens, for example, when a foreground has small internal holes, thin in/outward lobes, or it is too near to the image border. In all these circumstances the original sampling scheme is unfeasible. The implemented approach instead naturally solves this problem, since the trimap identifies only the set of unknown pixels for which the color samples are required. It does not identify the sampling zones, which are instead provided by the initial depth-based segmentation.  FIGS. 12 to 23  depict segmentation results on three sample frames selected from four test video sequences. 
         [0075]    In  FIG. 14  the foreground subject creates two circles with the arms and the background area inside these circles disappears during the trimap expansion. Similarly, in  FIG. 17  the subject is very close to the image border and the trimap absorbs the small residual background area. Nevertheless, in both the cases the proposed sampling scheme can still provide a quite accurate result. 
         [0076]    The second contribution to the data term in equation (5) is extracted from the depth measurement of each pixel. As previously mentioned, the general trend is to cast the overall estimation within a probabilistic framework. The underlying assumption of statistical independency between the depth and color random variables leads to sum up in the final cost function the negative log-likelihood measures. The SSG model proposed above for the depth values will, however, be used within a non statistical framework, rather to specify one of the two independent classifiers. Following this approach the classification cost for the depth measurement is defined as 
         [0000]        E=δ   α,0 +(1−2 ε α,0 ) P ( d|α ),   (7)
 
         [0000]    where P(d|α) is the distribution function given by the SSM model introduced further above and δ α     i     ,α     j    is the Kronecker Delta function. This cost measure is bounded in the interval [0, 1], in accordance with the other involved measures. 
         [0077]    The smoothness term in equation (4) provides an additional penalty to the overall cost for each pair of neighboring pixels with different segmentation labels. This penalty is preferably tightly related to the image contrast, in order to penalize a change in labeling inside homogeneous areas. However, it has been observed that the contrast measure computed from a pair of neighboring pixels is sensitive to both noise and blur. Therefore, the dimension of the neighborhood is slightly increased from two to four pixels. Let (1, i, j, k) be a quadruplet of aligned consecutive pixels, then the color contrast between the pixels i and j is computed as 
         [0000]    
       
         
           
             
               
                 
                   
                     
                       Γ 
                       
                         i 
                         , 
                         j 
                       
                     
                     = 
                     
                       
                         
                           1 
                           
                             3 
                           
                         
                         · 
                         max 
                       
                        
                       
                         { 
                         
                           
                              
                             
                               
                                 I 
                                 l 
                               
                               - 
                               
                                 I 
                                 j 
                               
                             
                              
                           
                           , 
                           
                              
                             
                               
                                 I 
                                 i 
                               
                               - 
                               
                                 I 
                                 k 
                               
                             
                              
                           
                         
                         } 
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   8 
                   ) 
                 
               
             
           
         
       
     
         [0000]    where the normalization factor is used to bound the contrast measure in the range [0, 1]. Using this contrast measure (8) the smoothness term is computed as 
         [0000]        E   s,i,j (α i , α j )=δ α     i     ,α     j   ·min{ th   c −Γ i,j },   (9)
 
         [0000]    where δ α     i     ,α     j    is the Kronecker Delta function, and th c  is the threshold used in equation (6). Compared to other tested measures based on the image gradient, on the image response to circular harmonic filters, or derived for the binary edge map, this is the one which has provided the best performance. 
         [0078]    All the cost measures proposed above range in the interval [0, 1]. Therefore, it is easy to assign meaningful weights to the different contributions. It has been observed that the depth measurement provides a reliable clue in the initialization phase and it allows for the extraction of a rough segmentation trimap. However, the low resolution of the sensor usually makes the measurements inaccurate across the foreground borders. This is also the main reason why the depth information has not been used in the computation of the smoothness term (equation (9)). On the other hand, the color sampling strategy turned out to be quite reliable and it is believed that the corresponding energy (equation (6)) should provide the main driver for the segmentation process. Finally, the smoothness term turns out to play the role of supporting the overall process rather than deciding where the segmentation should actually be, therefore it gets assigned the lowest weight within the overall cost. Following this qualitative analysis, for a set of test sequences the weights are set to w c =5, w d =1, and w s =0.5. 
         [0079]    For an evaluation test the data set available online at http://vis.uky.edu/˜gravity/Research/ToFMatting/ToFMatting.htm with the corresponding ground truth has been used. Table 1 summarizes the obtained results compared with those obtained by the provider of the dataset, see L. Wang et al.: “ TofCut: Towards robust real - time foreground extraction using a time - of - flight camera”,  3DPVT Conf. (2010).  FIGS. 12 to 23  present segmentation samples from these video sequences. 
         [0000]    
       
         
               
             
               
               
             
               
               
               
               
               
             
               
               
             
               
               
               
               
               
             
               
               
               
               
               
               
               
               
               
             
           
               
                 TABLE 1 
               
             
             
               
                   
               
               
                 Comparison between the proposed segmentation technique 
               
               
                 and TofCut obtained on four test video sequences. 
               
             
          
           
               
                   
                 Seq. ID 
               
             
          
           
               
                   
                 WL 
                 MS 
                 MC 
                 CW 
               
             
          
           
               
                   
                 Frames 
               
             
          
           
               
                   
                 200 
                 400 
                 300 
                 300 
               
               
                   
                   
               
             
          
           
               
                 Alg. 
                 TofCut 
                 Sampling 
                 TofCut 
                 Sampling 
                 TofCut 
                 Sampling 
                 TofCut 
                 Sampling 
               
               
                 % Err. 
                 1.35 
                 0.59 
                 0.51 
                 0.19 
                 0.15 
                 0.07 
                 0.38 
                 0.18 
               
               
                   
               
             
          
         
       
     
         [0080]    The mean percentage error computed over the whole image and across the whole sequence is provided. 
         [0081]    The results presented in Table 1 show that the proposed method can outperform TofCut in most of the tested sequences, although the latter is already very accurate. In the sequence CW the second subject is not correctly segmented by the implemented algorithm. The error rate provided in Table 1 for this sequence is computed without considering the misclassified pixels of the frames within the interval [60, 160], where the second subject is present. Still this result is considered relevant for three reasons. First, the moving subject is perceived by the depth sensor at the same distance as the static foreground, the misclassification is mostly due to the limitations of the sensor and it was not intended to provide a modeling for such a limitation. Many sensors are available on the market which may not suffer of this sort of limitations. On the other hand in the present implementation patches with similar depth are all considered as part of the foreground even if spatially distant. Second, it is also interesting to notice that after the disappearance of the second subject the algorithm does not suffer from any segmentation drift toward other parts of the background scene. Indeed, it is able to recover correctly the segmentation mask of the main foreground subject. Third, in the above mentioned article by L. Wang et al. an adaptive weighting scheme is introduced mostly to handle this sort of scenes, and the same approach could be integrated as well within the present system if needed. 
         [0082]      FIG. 24  depicts a flowchart of a method according to the invention. The input data, i.e. the color map  20  and the depth map  30 , are initially preprocessed in normalization steps  21 ,  21  in order to constraint the data within a unit norm interval. Then a trimap is expanded  34  from the rough segmentation  33  based on a depth histogram obtained in a histogram building step  32 . The depth data available within the background region is used to update  35  the depth statistical distribution. Finally a segmentation graph for the unlabelled area of the trimap is built  40  using the depth and color likelihood maps, which are constructed using the depth distribution and color sampling  22 . The final segmentation mask is obtained in a graph cut step  41  using the mincut/maxflow algorithm and the labeled depth data are used to update the depth histogram from the next frame.