Abstract:
A method and apparatus for segmenting an image are provided. An image acquisition and segmentation apparatus may include a sensor, a lens having a variable distance to the sensor, and a processor for acquiring an image and segmenting one or more segments from the acquired image. The lens may be moved relative to the sensor in accordance with a microelectronic machine in order to provide a shallow depth of field and a resulting blurred background, therefore easing a segmentation of one or more foreground objects in an acquired image.

Description:
BACKGROUND OF THE INVENTION 
     Systems and methods for generating depth maps for images have suffered from lack of precision and requirements for great computing resources. Additionally, specialized hardware is often required in order to generate such a depth map. Imprecision in generation of such a depth map may result in poor resolution of acquired images and difficulty in identifying precise locations of objects within those depth maps. Without such precise identification of these locations, later processing of these images and objects may result in a reduced ability to rely on these locations and objects for additional processing. 
     Therefore, it would be desirable to present a method and apparatus that overcomes the drawbacks of the prior art. 
     SUMMARY OF THE INVENTION 
     In accordance with various embodiments of the present invention, a method and apparatus is provided for stabilizing segmentation and depth calculations. The inventors of the present invention have presented, in U.S. patent application Ser. No. 13/025,038, titled “Method and Apparatus for Performing Segmentation of an Image”, filed Feb. 10, 2011 to El Dokor et al., Ser. No. 13/025,055, titled “Method and Apparatus for Disparity Computation in Stereo Images, filed February 10 to El Dokor et al., and Ser. No. 13/025,070, titled “Method and Apparatus for Determining Disparity of Texture”, filed Feb. 10, 2011 to El Dokor et al., the entire contents of each of these applications being incorporated herein by reference, a case for describing various types of segments, labeled as stable or unstable segments, used for developing a disparity map. This is described as being accomplished by matching such segments with their appropriate counterparts between the two images in a stereo image sequence. Building on the implementation described in the above-mentioned applications, in accordance with various embodiments of the present invention, a series of criteria is presented for updating the various segments, specifically with the goal of efficient and accurate depth map updating. 
     As is described in the &#39;038, &#39;055 and &#39;070 applications, it is meaningful to look only at one or more changes associated with a given stereo image sequence to produce a subsequent depth map and not the entire image. Thus, rather than recomputing an entirely new depth map for each pair of stereo images over time, only changes between consecutive frames are computed and integrated into one composite depth map. This process is not only computationally more efficient than recomputing the complete depth map for each stereo frame pair, it is also more accurate for matching, since only regions with significant changes are being matched in any given frame or sequence of frames. This is an altogether novel approach to computational stereo as previous attempts have been faced with a significant amount of computational complexity, problems with limiting a candidate space of depth calculations, and a nebulous set of features at best to extract from, without these features being robust to significant changes in the scene&#39;s quality or even overall color scheme. 
     In accordance with various embodiments of the present invention, a framework with which such an approach can be accomplished is provided, defining various types of regions and segments that are associated with such an approach. Also presented are other relevant aspects and features to develop a set of factors that can improve the accuracy of segmentation and the accuracy of the depth map itself, by presenting a shallow-depth of field concept with two different realizations. 
     Still other objects and advantages of the invention will in part be obvious and will in part be apparent from the specification and drawings. 
     The invention accordingly comprises the several steps and the relation of one or more of such steps with respect to each of the other steps, and the apparatus embodying features of construction, combinations of elements and arrangement of parts that are adapted to affect such steps, all as exemplified in the following detailed disclosure, and the scope of the invention will be indicated in the claims. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       For a more complete understanding of the invention, reference is made to the following description and accompanying drawings, in which: 
         FIG. 1  is a flowchart diagram depicting relationships between a number of segment classifications in accordance with an embodiment of the invention; 
         FIG. 2  is a flowchart diagram depicting processing for updating a depth map in accordance with a depth map in accordance with the invention; 
         FIG. 3  is a state diagram depicting a relationship for movement between different pixel segments in accordance with an embodiment of the invention; 
         FIG. 4  is a flowchart diagram depicting 3D segmentation of a depth map; 
         FIG. 5  is a flowchart diagram depicting 3D segmentation of a depth map using gray world and color world segments; 
         FIG. 6  depicts a number of steps for segmentation and depth calculation in accordance with an embodiment of the invention; and 
         FIG. 7  depicts the relationship of a MEM-mounted lens and an image sensor in accordance with an additional embodiment of the invention. 
     
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     One or more embodiments of the invention will now be described, making reference to the following drawings in which like reference numbers indicate like structure between the drawings. 
     An image scene may be organized into a series of homogenized segments, or “regions”, defined by their color, texture properties or other relevant properties. Each of these regions defines one or more segments in the image. The challenge for creating a disparity map (and hence, a depth map) from such segments lies in matching these segments against their correct counterparts in a secondary image (the other image in, for example, a stereo pair of images). To accomplish that, an even bigger challenge is associated with segmenting these images into segments of meaningful context. The above-mentioned &#39;038, &#39;055 and &#39;070 applications present a more detailed discussion of the different clustering techniques that may be associated with defining segments, and associated matching techniques. One of the most important assumptions that was made in these applications, and that carries through to the present invention, is that changes in the image, in general, are very gradual. While there are regions of abrupt changes, they are few in relationship to an entire image sequence. Most regions exhibit this well-behaved and gradual change. Such gradual transition allows exploitation of redundancy of data between frames to: 
     1) Stabilize segments, since most segments mostly do not change, i.e. no differences in their pixel values between consecutive frames, based on intra-frame metrics; and 
     2) Stabilize a subsequent depth map, in that if segments associated with a given disparity value have not changed, then the subsequent depth map also should not change. This makes perceptual sense since changes in the scene&#39;s depth should be reflected by changes in the observed field of view. 
     Given these two general observations, in accordance with embodiments of the present invention, a more coherent approach to disparity-based depth compute is provided, in which the depth map is iteratively improved through segmentation, followed by depth computation. Temporal and spatial stability criteria of various segments become crucial to determining disparity updates, and hence depth map updates, since absent of such criteria a temporal-based approach can not be implemented, and the scene&#39;s temporal redundancy can not be successfully exploited. Tracking across such a broad range of features ensures that changes in the image are correctly accounted for and integrated into the depth map. 
     This novel approach to segmentation/depth map calculation allows a highly efficient and accurate depth map to be produced and enables a real-time implementation that can be embedded on smaller platforms, including (system-on-a-chip) SoC platforms, where an existing embedded GPGPU can provide the parallel computation that is preferred to implement this approach. 
     Given the importance of stability criteria, embodiments of the present invention define various segment types that enhance scene understanding through such criteria, and exploit such criteria to understand scene changes across frames and within the same frame. Thus, as is shown in  FIG. 1 , five different segment types may be defined. These segments are preferably classified in two groups, non-residual segments  110  and residual segments  120 . Residual segments  100  further may comprise stable segments  112 , partially stable segments  114  and mesostable segments  116 . Similarly, residual segments may comprise unstable segments  122  and unsegmented background  124 . As is further shown in  FIG. 1 , pixels may move between these segments as will be described in accordance with the flowchart set forth in  FIG. 2 . Therefore, at step  210 , a previous cluster map is copied and stored in memory as a current cluster map. Next, at step  215 , all pixels that have changed in color by more than Tps (or frames) are declared residual. Then, at step  220 , one or more residual pixels may be clustered together to form one or more unstable segments (as such because they are just formed). At step  225 , depth is calculated for all partially stable and unstable segments. Then, the depth computed for the unstable segments is considered at step  230 , and if the calculated depth is determined to be valid, the corresponding unstable segment is moved to the mesostable range. Mesostable segments remaining after Tms frames are moved to the stable range at step  235 , and at step  240  mesostable segmentation is refined so that segments with the best color match between stable and mesostable ranges are merged. Finally at step  245 , non-residual segments are reevaluated for stability. 
     Table 1, below, depicts the various segment types, and a description of characteristics of that segment type. As can be seen, stable segments have little or no change, while partially stable segments have a small amount of change, but the segment is still considered generally stable. Mesostable segments are transitioning from an unstable classification to a more stable classification, while an unstable segment has enough motion that it may have to be resegmented, and may be a result of any of the other classifications. Other/background segments include all other pixels that cannot be placed into a segment with other pixels. 
     
       
         
               
             
               
               
               
               
             
           
               
                 TABLE I 
               
             
             
               
                   
               
               
                 Description of various segments and pixels. 
               
             
          
           
               
                 Pixel 
                 Segment 
                 Segment 
                   
               
               
                 Classification 
                 Classification 
                 Subcategory 
                 Description 
               
               
                   
               
               
                 Non-residual 
                 Mostly Stable 
                 Stable  
                 Segments that have  
               
               
                 Pixels 
                 Segments 
                 Segments 
                 had little or no change 
               
               
                   
                   
                 Partially Stable 
                 Segments with a small  
               
               
                   
                   
                 Segments 
                 amount of change 
               
               
                   
                 Mesostable 
                   
                 Segments that have  
               
               
                   
                 Segments 
                   
                 partially stabilized  
               
               
                   
                   
                   
                 from being unstable 
               
               
                 Residual 
                 Unstable 
                   
                 Segments with significant  
               
               
                 Pixels 
                 Segments 
                   
                 enough motion that 
               
               
                   
                   
                   
                 have to be resegmented 
               
               
                   
                 Other/ 
                   
                 Every other type of pixel, 
               
               
                   
                 Background 
                   
                 including background,  
               
               
                   
                   
                   
                 filtered out pixels,  
               
               
                   
                   
                   
                 noise, etc. 
               
               
                   
               
             
          
         
       
     
     As is noted, pixels therefore may move between classifications based upon change associated therewith. A state diagram depicting movement paths between various classifications is shown at  FIG. 3 . As can be seen in  FIG. 3  (as well as with the arrow indicators in  FIG. 1 ), a stable segment  310  can remain a stable segment, can be changed to a partially stable segment  320  if a small amount of change is determined, or can be declared an unstable segment  340  if significant change is determined. Similarly, a partially stable segment  320  can become a stable segment  310  if it remains partially stable for a predetermined period of time, can become a mesostable segment  330  if some change below a predetermined threshold is detected, and can become an unstable segment  340  if significant change greater than a predetermined threshold is determined. Similarly, a mesostable segment  330  can become a partially stable segment  320  or a stable segment  310  if no change is determined, and it can become an unstable segment  340  if a lot of change is determined. Finally, various pixels in the unstable segments may be declared “other” (or unsegmented)  350  if they do not appear to be able to be segmented. 
     Therefore, pixels may be classified into one of the two general classes: residual pixels, i.e. pixels that have changed in the image as determined in accordance with one or more intra-frame metrics, and non-residual pixels representing pixels that have not changed, also based on such metrics. Segments undertake the overall process described earlier: they may be first created, by identifying pixels that are residual. They then may migrate to states of mesostability or stability, depending on the associated criteria. A depth may be computed and associated with such segments, and then a second depth-based segmentation step may be implemented. By default, any pixel or group of pixels that have not been assigned to stable or mesostable, are assigned to unstable. 
     Organizing a scene into various segments is preferably predicated upon the concept that neighboring pixels generally exhibit similar behavior, and hence generally do belong to the same segment. This behavior may involve characteristics of motion, color changes, texture features, or any combination of features. The exception to this notion lies at object boundaries and/or at depth discontinuities. 
     Once objects, or segments, are identified as stable or unstable, the natural progression is towards cluster numbers that stabilize the process over time, so that only changes in images are accounted for. This general theoretical approach, though very different in its details, is widely exploited in video encoding (Wiegand, Sullivan, Bjøntegaard, &amp; Luthra, 2003) at a much more basic level, in which segments are considered for dominant features for texture or motion-based coding. The most substantial contribution and difference here is the explicit definition of different segment types, their lifecycle, and the associated pixel states, aspects of the work that are not present in video coding. Additionally video coding techniques do not attempt to glean or extract depth or even associated segments with various depths. The invention as set forth in one or more embodiments of the present invention also exploits advances in GPU computing to parallelize the process of clustering and scene organization. 
     The utilization of image segments for calculating depth and iteratively improving segmentation through gleaning scene queues of perceptual relevance allows disparity computation to take place in a very efficient manner. A feature, such as motion, that can be a very dominant feature in scene analysis, can be extracted from mesostable segments, i.e., segments transitioning between an unstable state and a stable one. Local changes in the image that are associated with motion may be clustered and tracked through residual segmentation first. Disparities may then be computed by only matching such segments with ones that represent similar mesostable changes and ignoring all other pixels. Hence, the search space that is associated with disparity matching is greatly reduced, and matching accuracy is enhanced. Once depth is computed, a new depth map can be re-clustered based on combining stable segments with recently depth-computed mesostable segments. 
       FIG. 4  depicts a process associated with this inventive approach. 2D Segmentation may be first attempted at step  410  on the image sequence and regions are broken into homogeneous segments of color/texture/orientation and scale. For orientation and scale, it is preferred that a variant of the complex wavelet transform be used to extract texture information. A depth map is preferably next computed in step  420 , based on the segmentation step. In real-time, unstable pixels may be clustered together to form residual regions that are segmented separately in step  415  and then have their depth computed next at step  425 . The newly computed regions&#39; residual depth map may then be combined with the stable depth map at step  430 . The overall composite map may then be reclustered by combining mesostable segments with stable segments in a step that also involves segmentation based on depth. 
     Similar to the process noted above, one or more color spaces may be combined together to produce meaningful segmentation processing. In accordance with another embodiment of the present invention, not only are residual segments computed, but a scene may be broken down into two or more orthogonal scenes: one of high Chroma (color world) and one of low Chroma (gray world). The two scenes may then be segmented, and then the steps set forth in  FIG. 4  may also be implemented for each segmentation. The result is a more complete and comprehensive depth map. In the gray world, intensity becomes a dominant feature, with extracted scale-space and frequency features being used in disparity decomposition. As a result, the task of depth map computation may be been divided into two tasks, depending on the individual pixel&#39;s (and associated regions′) dominant features: for color pixels, hue is a good representation of color. For low-Chroma pixels, intensity helps in differentiating the pixel. Gradients and structures that are associated with these features can be extracted, as well as the scales that are associated with such gradients. However, the fundamental approach described earlier remains unchanged, namely: performing segmentation and/or residual segmentation, and then computing depth on both, and combining the results in an overall composite depth map. 
     Once the gray world depth map has been created, it can be easily combined and fused with the high-Chroma depth map, presented earlier.  FIG. 5  represents the algorithm with the two processes running simultaneously,  510  representing the processing of  FIG. 4  applied to the color world data and  520  representing the processing of  FIG. 4  applied to the gray world. In the particular embodiment of  FIG. 5 , data need not be shared between the two processes, but rather, the final result is preferably combined to produce a composite depth map  530 . 
       FIG. 6  depicts a three-frame sequence in which depth computation may be performed, in two aspects: for stable segments as well as the unstable segments. After initial segmentation of unstable segments, a depth computation is performed on partially stable segments as well as mesostable segments. Therefore, as is shown in  FIG. 6 , row  610  depicts a series of source images at frames f i , f i+1 , f i+2 . In this particular example, an idealized movement of a user&#39;s arm is shown between frames in a sequence, these frames not necessarily being consecutive. Employing the residual 2D segmentation process described above, row  620  depicts such residual segmentation, and in particular depicts the positioning of the hand in the prior frame and the new position overlaid. Areas of the new position that overlap the old position are further segmented. Row  630  then shows the results of depth computation, figuring the depth of each of the segments shown in the residual segmentation process of row  620 . Row  640  depicts performance of 3D segmentation as described, and finally depth composition is shown at row  650 . Thus, in accordance with  FIG. 6 , a three-frame sequence in which depth computation is performed is shown. The depth computation may be performed in two aspects: for stable segments as well as for unstable segments. After initial segmentation of unstable segments, depth computation may be performed on partially stable segments as well as mesostable segments. 
     In accordance with another embodiment of the present invention, based upon the determination that video sequences are well behaved, then one may make the additional useful assumption that any associated segmentation map and any additional subsequently computed maps are likely also well behaved. Thus, even when confronted with a given partially stable segment whose disparity is to be recalculated, a well-behaved segment allows the assumption that a newly computed disparity for that segment is likely in the neighborhood of the old one from the previous frame, as the segment may be tracked across one or more frames. As such, it is possible to define two second level types of stability for a particular partially stable segment:
         1. Major stability, indicating that very few pixels have changed. Thus, it may be determined that there has not been enough change to warrant a reevaluation of the segment&#39;s disparity, i.e. new depth calculation.   2. Minor stability, indicating that enough of the pixels have changed that depth is to be recalculated.
 
If segment stability does not fall into either of the above mentioned categories, and it is therefore determined that the segment is unstable, then pixels associated with this segment are preferably classified as unstable and the entire segmentation process may be repeated.
       

     All pixels in corresponding images are preferably marked with their respective states. This is particularly important since matching relevant pixels with each other across frames requires a mechanism with which such pixels are correctly marked. From an implementation perspective, marking pixels during disparity decomposition in a manner as described in the above-mentioned &#39;038, &#39;055 and &#39;070 applications, while matching, is an effective interpretation of this approach. Marked out pixels cannot contribute to further matching during the disparity decomposition step, and so false positives are reduced. Disparity decomposition, as described in the above-mentioned &#39;038, &#39;055 and &#39;070 applications can be conducted left-to-right or right-to-left, and pixels with existing and accurate disparity can be marked out to reduce the search space that is associated with the disparity decomposition. 
     Block-Based GPU Clustering and Implementation on a Discrete GPU or an Integrated GPU of a System on a Chip 
     GPU technology allows for launching of multiple simultaneously processed threads for processing video images. The threads are preferably managed by a thread scheduler, each thread adapted to work on one or more pixels in an image. See (NVIDIA: CUDA compute unified device architecture, prog. guide, version 1.1, 2007) for more details. Groups of threads may be combined to process pixel blocks with having rectangular or other desirable dimensions. One or more methods for clustering of such pixels employing GPU-based implementations are described in the above-mentioned &#39;038, &#39;055 and &#39;070 applications, in which block based statistics are first computed and then combined across blocks. As a direct result of this process, localized statistics representing intermediate results of various clusters at GPU block-level (from the GPU architecture) are available. Additionally, one or more global statistics constituting localized combinations of all the localized block-level statistics are also available. This means that for any given cluster, both localized as well as global statistical information is available for segmentation. This same paradigm would also apply to GPUs that are integrated onboard an SoC, like ARM&#39;s MALI or Imgtec&#39;s SGX PowerVR or any other GPU or GPU IP representation involving the utilization of SIMD architectures and calling functions. 
     When performing segmentation of an image, one of the biggest challenges involves finding the correct optimizations of local and global metrics that are associated with a given segment or cluster to allow for appropriate clustering of different segments in an image. For any given residual segment, clustering an existing stable segment not only requires global statistics, but also local ones. This is especially true for larger segments, in which global statistics may vary drastically from local ones, especially in the presence of a color or texture gradient. Two segments may have very different overall global statistics, but they may also have local statistics that are well suited to allow them to cluster together. Utilizing the GPU&#39;s intrinsic properties involving launching blocks of threads to operate on contiguous data, adjacent blocks that belong to two different clusters may be very similar and can be used to combine clusters together. This can also apply for tracking changes in blocks of data that are associated with larger segments. Utilizing block-based statistics allows segments to remain relatively stable as they transition between states, and as they temporally progress and evolve through an image sequence. 
     The thread scheduler can also be modified through configuration settings, to account for such a computational stereo approach. 
     The inventive approach specifically utilizes the GPU&#39;s thread scheduler as a means of imposing local metrics on image segmentation. As a result, local metrics become an intrinsic consequence of the GPU architecture, provided appropriate implementation in either software or hardware or both. 
     A GPU-based architecture can then be designed to optimize the utilization of the GPU&#39;s thread scheduler for segmentation. Arithmetic Logic Units (ALUs) can be used to process adjacent pixels in an image, local changes being associated with thread blocks and global changes being represented as combinations of such local changes. Merging at the block level before merging on the grid level, i.e. entire image, allows all threads in a block to write to fewer locations, mitigating many atomic operations. Atomic operations are a common bottleneck associated with computer vision algorithms being implemented on GPGPU architectures. 
     Shallow Depth of Field 
     Depth of field is that part of the field of view of a camera that contains the sharpest edges (the amount of sharpness in the scene), see (Peterson, 2010). Peterson defines three major factors contributing to depth of field: 
     The focal length of the lens 
     The distance between the sensor and the object in the field-of-view 
     Aperture of the lens 
     A shallow depth of field has the effect of blurring objects outside regions with high sharpness (i.e. outside regions in focus). The blurring effect can aid in identifying background objects. Features associated with scale and frequency can be exploited to mitigate the background objects, reduce scene clutter, and improve depth computation accuracy. 
     Various embodiments of the present invention include at least two approaches to mitigate excessive FLOPs computation based on exploiting properties of the field-of-view through blurring the background with a shallow depth of field. In doing so, the background selectively stands in contrast to the foreground, and can be removed through the utilization of large-scale low pass filtering kernels or selective wavelet-based filtering, since background blurriness becomes a salient feature of the scene and can be exploited. During residual segmentation, having a shallow depth of field enhances matching foreground-segmented objects, since erroneous background objects are minimized with a more blurred background model. There are many techniques to highlight the fundamental differences between the foreground and background in a scene with a shallow depth of field. Techniques like PCA, SVM, or training a Neural Network can be used to detect such regions&#39; features. There also exists prior work in the literature on sharpness metrics that can also be applied in this case to enhance foreground-background discriminability. The two methods for reducing such depth of field will now be described. 
     Space-Frequency Feature Extraction for Segment Matching 
     One inventive approach for matching segments or image regions is to utilize space-frequency features utilizing tools such as wavelet decomposition. Therefore, in accordance with an embodiment of the present invention, the following process may be employed. First, a candidate segment is preferably defined, {tilde over (s)} R (x, y), whose disparity is being evaluated. An operator F{ψ R (x, y)} is also defined such that ψ R (x, y) is a basis function. A space-frequency decomposition may therefore be defined as:
 
 R   {tilde over (s)}     R   ( x,y )= {tilde over (s)}   R ( x,y )* F{ψ   R ( x,y )}
 
     As noted above, such features allow a background model to be extracted and utilized in matching and segmentation. With a background that is relatively uniform and smooth, frequency-space decomposition can then be applied to the scene, with a background model whose main features constitute spatially larger scales as well as lower frequencies. The task of matching foreground objects with their correct disparities then becomes simpler, given the relative consistency of background features. 
     Utilizing Micro-Electronic Machines (MEMS) for Adaptive Focus/Defocus and Aperture Size Modification 
     An alternative approach to enabling background defocus, or blurring is through changing the background model via varying the focal length by mounting the lens on microelectronic machines (MEMs). Therefore, as is shown in  FIG. 7 , a lens  710  is mounted to a MEM  720  allowing for varying a distance between the lens  710  and a sensor  730 . Once lens  710  is mounted, MEM  720  can modify the focal length based on optimal depth engine feedback. This can be performed iteratively with the depth engine. So, if the foreground segmentation quality is poor, a shallower depth of field may be accomplished by employing MEM  720  that allows lens  710  to expand away from, or towards sensor  730 , varying the focal length in real-time. Another advantage of utilizing MEMs lies in the ability to define a narrow depth of field by varying both the aperture as well as the focal length. 
     As a result, another approach can be suggested in which an artificial intelligence system, such as the one that has been described in the above-mentioned &#39;038, &#39;055 and &#39;070 applications, can be used to evaluate the quality of segmentation. The AI can then interactively vary the image by enhancing segmentation through a narrower, or shallower depth of field, in whichever configuration that the application requires. 
     Therefore, in accordance with various embodiments of the present invention, a series of steps are provided for enhancing stability criteria of computational stereo. Inventive segment definitions are presented, as well as their transition criteria from unstable to stable, and between the various inventive additional segment definitions. The concept of computing depth on one or more residual components of an image sequence is also presented. Orthogonal decomposition of an image sequence in the color space may enhance disparity decomposition by reducing the overall population of candidate pixels that can match for a given disparity. A final depth map may be comprised of composites of all the different depth maps that are produced in these orthogonal projections. Additionally, depth of field of a scene may be manipulated to highlight differences between the foreground and background and improve depth computation through segment matching and background manipulation/modeling. A new, dynamic approach to varying the depth of field and the subsequent depth compute via MEMs is also presented. 
     API/SDK 
     In accordance with a further embodiment of the invention, an API is presented that preferably takes advantage of the information provided from the depth computation, such that critical points, gesture events, as well as overall depth information is provided as part of the API. Additionally, an SDK is preferably presented such that software developers can take advantage of these various features.