Analysis of three-dimensional scenes

- Apple

A method for processing data includes receiving a depth map of a scene containing a humanoid form. The depth map is processed so as to identify three-dimensional (3D) connected components in the scene, each connected component including a set of the pixels that are mutually adjacent and have mutually-adjacent depth values. Separate, first and second connected components are identified as both belonging to the humanoid form, and a representation of the humanoid form is generated including both of the first and second connected components.

Skip to: Description  ·  Claims  ·  References Cited  · Patent History  ·  Patent History
Description
CROSS-REFERENCE TO RELATED APPLICATION

This application is a continuation of U.S. patent application Ser. No. 13/867,085, filed Apr. 21, 2013, which is a division of U.S. patent application Ser. No. 12/854,187, filed Aug. 11, 2010 (now U.S. Pat. No. 8,594,425), which claims the benefit of U.S. Provisional Patent Application 61/349,907, filed May 31, 2010, which is incorporated herein by reference.

FIELD OF THE INVENTION

The present invention relates generally to methods and systems for three-dimensional (3D) mapping, and specifically to processing of 3D map data.

BACKGROUND OF THE INVENTION

A number of different methods and systems are known in the art for creating depth maps. In the present patent application and in the claims, the term “depth map” refers to a representation of a scene as a two-dimensional matrix of pixels, in which each pixel corresponds to a respective location in the scene and has a respective pixel value indicative of the distance from a certain reference location to the respective scene location. (In other words, the depth map has the form of an image in which the pixel values indicate topographical information, rather than brightness and/or color of the objects in the scene.) Depth maps may be created, for example, by detection and processing of an image of an object onto which a laser speckle pattern is projected, as described in PCT International Publication WO 2007/043036 A1, whose disclosure is incorporated herein by reference.

Depth maps may be processed in order to segment and identify objects in the scene. Identification of humanoid forms (meaning 3D shapes whose structure resembles that of a human being) in a depth map, and changes in these forms from scene to scene, may be used as a means for controlling computer applications. For example, PCT International Publication WO 2007/132451, whose disclosure is incorporated herein by reference, describes a computer-implemented method in which a depth map is segmented so as to find a contour of a humanoid body. The contour is processed in order to identify a torso and one or more limbs of the body. An input is generated to control an application program running on a computer by analyzing a disposition of at least one of the identified limbs in the depth map.

SUMMARY OF THE INVENTION

Embodiments of the present invention provide methods, devices and software for extracting information from depth maps.

There is therefore provided, in accordance with an embodiment of the present invention, a method for processing data, which includes receiving a temporal sequence of depth maps of a scene containing a stationary background and one or more moving foreground objects that conceal a part of the background, the depth maps comprising a matrix of pixels, at least some of which have respective pixel depth values and correspond to respective locations in the scene. A digital processor processes a first depth map in the sequence so as to identify a first portion of the stationary background that is not concealed by the moving foreground objects in the first map. At least a second depth map in the sequence is processed so as to identify at least a second portion of the stationary background, which is different from the first portion due to motion of at least one of the foreground objects over the sequence. The processor constructs a background model of the scene by combining at least the first and second portions of the stationary background.

In some embodiments, the method includes generating a foreground map by finding, based on the background model, pixels that are closer than the background model. A humanoid figure may be found, including pixels belonging to the foreground map and pixels that were found to belong to the figure in a previous frame.

In a disclosed embodiment, the method includes identifying a planar floor in the depth maps. A shadow of one of the objects may be identified in the depth map, and the depth of the object casting the shadow may be used in evaluating the background model.

Typically, constructing the background model includes updating the background model responsively to changes that appear in the background over the sequence of the depth maps. In a disclosed embodiment, the depth maps are captured by an imaging assembly, and the method includes assessing an extent of the changes in the background model between the depth maps in the sequence, and detecting that the imaging assembly has moved when the extent of the changes exceeds a predetermined threshold.

There is also provided, in accordance with an embodiment of the present invention, a method for processing data, including receiving a depth map of a scene containing one or more foreground objects positioned in relation to a surface. A digital processor processes the depth map so as to identify and generate a parametric model of the surface, and to segment one or more of the objects in the scene by removing the surface represented by the parametric model from the depth map.

In a disclosed embodiment, the surface is a planar surface corresponding to a floor on which at least one of the objects is positioned. Processing the depth map includes computing local normals at the pixels in the depth map, and clustering the pixels according to the planes predicted by the local normals in order to identify the planar surfaces. Typically, the depth maps are captured by an imaging assembly, and the clustering operation includes processing respective depth values of at least some of the pixels in order to predict a height of the imaging assembly with respect to each pixel, and clustering the pixels having the same predicted height of the imaging assembly.

There is additionally provided, in accordance with an embodiment of the present invention, a method for processing data, including receiving a depth map of a scene containing a humanoid form. A digital processor processes the depth map so as to identify three-dimensional (3D) connected components in the scene. Each connected component includes a set of the pixels that are mutually adjacent and have mutually-adjacent depth values. The processor identifies separate connected components as belonging to the humanoid form and generates a representation of the humanoid form including several connected components.

In a disclosed embodiment, processing the depth map includes locating edges in the depth map and blocks of pixels between the edges, and clustering adjacent blocks of the pixels in three dimensions in order to identify 3D clusters.

In some embodiments, receiving the depth map includes receiving a temporal sequence of depth maps, and identifying connected components includes tracking the connected components over multiple, successive depth maps in the sequence. Tracking the connected components may include assigning a common identifier to the connected components belonging to the same humanoid form in a first depth map in the sequence, and using this common identifier to determine that the connected components belong to the humanoid form in a second, subsequent depth map. Typically, assigning the common identifier includes labeling the pixels of the connected components in the depth map with the common identifier. When the humanoid form in the second depth map is in contact with another object, thereby causing the second connected component to incorporate the other object, the common identifier may be used in separating the labeled pixels of the second connected component that belong to the humanoid form from the pixels belonging to other object in order to generate the representation of the humanoid form appearing in the second depth map.

Additionally or alternatively, tracking the connected components includes estimating a velocity of motion of the connected components, and generating the representation includes maintaining an identification of an occluded part of the humanoid form using the estimated velocity.

In one embodiment, the humanoid form in the depth map is partly occluded by another object, and the connected components correspond to parts of the humanoid form that are separated by the occluding object, and generating the representation includes identifying such a situation and preserving the connected components in the representation of the humanoid form.

There is moreover provided, in accordance with an embodiment of the present invention, apparatus for processing data, including an imaging assembly, which is configured to produce a depth map of a scene containing one or more objects positioned in relation to a surface. A processor is configured to process the depth map so as to identify and generate a parametric model of the surface, and to segment one or more of the objects in the scene by removing the surface represented by the parametric model from the depth map.

There is furthermore provided, in accordance with an embodiment of the present invention, apparatus for processing data, including an imaging assembly, which is configured to produce a depth map of a scene containing a humanoid form. A processor is configured to process the depth map so as to identify three-dimensional (3D) connected components in the scene, each connected component including a set of the pixels that are mutually adjacent and have mutually-adjacent depth values, to identify separate connected components as belonging to the humanoid form, and to generate a representation of the humanoid form including several connected components.

There is also provided, in accordance with an embodiment of the present invention, a computer software product, including a tangible computer-readable medium in which program instructions are stored, which instructions, when read by a computer, cause the computer to receive a temporal sequence of depth maps of a scene containing a stationary background and one or more moving foreground objects that conceal a part of the background, and to perform one or more of the methods described above.

The present invention will be more fully understood from the following detailed description of the embodiments thereof, taken together with the drawings in which:

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic, pictorial illustration of a system for 3D mapping and scene analysis, in accordance with an embodiment of the present invention;

FIG. 2 is a block diagram that schematically illustrates elements of a 3D imaging assembly and an associated computer, in accordance with an embodiment of the present invention;

FIG. 3 is a flow chart that schematically illustrates a method for 3D scene analysis, in accordance with an embodiment of the present invention;

FIG. 4 is a flow chart that schematically illustrates a method for identifying the floor in a 3D scene, in accordance with an embodiment of the present invention;

FIG. 5 is a schematic frontal representation of a depth map showing blocks corresponding to objects that have been identified in the depth map, in accordance with an embodiment of the present invention;

FIG. 6 is a schematic top view of a depth map showing clusters of blocks that have been identified in the depth map, in accordance with an embodiment of the present invention; and

FIG. 7 is a schematic frontal representation of a depth map showing segmentation of objects in the depth map, in accordance with an embodiment of the present invention.

DETAILED DESCRIPTION OF EMBODIMENTS Overview

Depth maps provide a wealth of information, particularly when they are presented in a continuous stream over time. Games and other applications based on depth maps, however, have developed only slowly due to the difficulties inherent in capturing, processing, and extracting high-level information from such maps.

Embodiments of the present invention that are described hereinbelow address these difficulties by providing robust, efficient methods for processing depth maps, and particularly for locating and tracking humanoid forms in sequences of depth maps. Such maps typically represent a scene containing a stationary background and one or more moving foreground objects (which conceal a part of the background). In the disclosed embodiments, a digital processor identifies and models the background, including the floor and walls that typically appear in the background in indoor scenes. The processor uses the model to in order to detect parts of humanoid forms in the foreground that are occluding the background model (and therefore will be considered henceforth to belong to the foreground), and may associate them with other parts of the forms that are not in the foreground. The processor analyzes the moving foreground objects in order to identify and track forms of interest, particularly humanoid forms.

In some of the disclosed embodiments, the processor constructs the background model by identifying portions of the stationary background in each depth map that are not concealed by the foreground objects. Because the foreground objects move from map to map, different parts of the background are typically revealed in different maps. The processor creates the background model by combining different portions of the stationary background from different maps in the sequence.

Additionally, the processor may specifically identify surfaces having certain geometrical forms that can be modeled parametrically, particularly planar surfaces, such as the floor and walls, which make up part of the background. For this purpose, in one embodiment, the processor computes local normals at the pixels in the depth map, by considering the depth values at the neighboring pixels. The processor clusters pixels whose local normals point in roughly the same direction in order to identify the floor and possibly other planar surfaces.

The processor extracts humanoid forms (and possibly other objects of interest) from the scene by identifying 3D connected components in the depth map. Each connected component comprises a set of the pixels that are mutually adjacent and have mutually-adjacent depth values, meaning that the depth values of neighboring pixels do not deviate by more than a (small) predetermined threshold amount. The processor identifies and tracks these connected components in order to compute geometrical models of the humanoid forms, which may then be processed further in order to identify high-level features such as body posture, movement, and gestures.

Although ideally, each humanoid form should appear as a single connected component, it often occurs, because of aspects of the scene itself, that a given humanoid form will appear as a set of two or more separate connected components. This separation makes it difficult to identify the humanoid form altogether, let alone modeling the high-level features. For example, in some depth maps the humanoid form may be partly occluded by another object, so that the form is split into two or more separate connected components. In other cases, one part of the humanoid form may partly occlude another part in the depth map. In the embodiments that are described hereinbelow, however, the processor assigns a common identifier to all the connected components that make up a given humanoid form, and uses this identifier in tracking the connected components even when they become separated or occlude one another. The methods of these embodiments enable the processor to resolve anomalous situations and to generate a consistent representation of the humanoid form even in the face of occlusions.

System Description

FIG. 1 is a schematic, pictorial illustration of a 3D user interface system 20, in accordance with an embodiment of the present invention. The user interface is based on a 3D imaging assembly 22, which captures 3D scene information that includes at least a part of the bodies of users 28 and 30. Assembly 22 may also capture color video images of the scene. Assembly 22 outputs a sequence of frames containing 3D map data (and possibly color image data, as well) to a computer 24, which extracts high-level information from the map data. This high-level information is provided via an API to an application running on computer 24, which drives a display screen 26 accordingly. In the pictured example, for instance, users 28 and 30 interact with game software running on computer 24 by moving their limbs and changing their body postures.

Computer 24 processes data generated by assembly 22 in order to reconstruct a depth map of the scene (also referred to as a “3D map”) containing users 28 and 30. In one embodiment, assembly 22 projects a pattern of spots onto the scene and captures an image of the projected pattern. Assembly 22 or computer 24 then computes the 3D coordinates of points in the scene (including points on the surface of the user's body) by triangulation, based on transverse shifts of the spots in the pattern. This approach is advantageous in that it does not require the user to hold or wear any sort of beacon, sensor, or other marker. It gives the depth coordinates of points in the scene relative to a predetermined reference plane, at a certain distance from assembly 22. Methods and devices for this sort of triangulation-based 3D mapping using a projected pattern are described, for example, in PCT International Publications WO 2007/043036, WO 2007/105205 and WO 2008/120217, whose disclosures are incorporated herein by reference. Alternatively, system 20 may use other methods of 3D mapping, based on single or multiple cameras or other types of sensors, as are known in the art.

In the present embodiment, system 20 captures and processes a sequence of three-dimensional (3D) maps containing users 28 and 30, while the users move their bodies. Software running on assembly 22 and/or computer processes the 3D map data to extract the humanoid forms corresponding to the users in the scene. For this purpose (as described in detail hereinbelow), the software identifies and models the stationary scene background, including planar surfaces such as a floor 32 and walls 34, as well as other background objects, such as a window 36 in this example. The software combines foreground parts of the image with detected parts of humanoid forms in order to detect and track the humanoid forms of users 28 and 30, as well as other foreground objects (such as a chair 38).

Assembly 22 or computer 24 typically analyzes geometrical features of the humanoid forms in order to extract a skeleton of each body, including 3D locations and orientations of the users' hands and joints. It may also analyze the trajectory of the hands over multiple frames in order to identify gestures delineated by the hands. These aspects of the operation of system 20 are, however, beyond the scope of the present patent application. The skeleton and gesture information are provided via an API to an application program running on computer 24. This program may, for example, move and modify images presented on display 26 in response to the skeleton and/or gesture information.

Computer 24 typically comprises a general-purpose computer processor, which is programmed in software to carry out the functions described hereinbelow. The software may be downloaded to the processor in electronic form, over a network, for example, or it may alternatively be provided on tangible, non-transitory media, such as optical, magnetic, or electronic memory media. Alternatively or additionally, some or all of the described functions of the computer may be implemented in dedicated hardware, such as a custom or semi-custom integrated circuit or a programmable digital signal processor (DSP). Although computer 24 is shown in FIG. 1, by way of example, as a separate unit from imaging assembly 22, some or all of the processing functions of the computer may be performed by a suitable microprocessor and software or by dedicated circuitry within the housing of the imaging assembly or otherwise associated with the imaging assembly.

As another alternative, at least some of these processing functions may be carried out by a suitable processor that is integrated with display screen 26 (in a television set, for example) or with any other suitable sort of computerized device, such as a game console or media player. The sensing functions of assembly 22 may likewise be integrated into the computer or other computerized apparatus that is to be controlled by the sensor output.

FIG. 2 is a block diagram that schematically illustrates elements of imaging assembly 22 and computer 24 in system 20, in accordance with an embodiment of the present invention. Imaging assembly 22 comprises an illumination subassembly 42, which projects a pattern onto the scene of interest. A depth imaging subassembly 44, such as a suitably-configured video camera, captures images of the pattern on the scene. Typically, illumination subassembly 42 and imaging subassembly 44 operate in the infrared range, although other spectral ranges may also be used. Optionally, a color video camera 46 captures 2D color images of the scene, and a microphone 48 may also capture sound.

A processor 50 receives the images from subassembly 44 and compares the pattern in each image to a reference pattern stored in a memory 52. The reference pattern is typically captured in advance by projecting the pattern onto a reference plane at a known distance from assembly 22. Generally, this plane is perpendicular to the optical axis of subassembly 44. Processor 50 computes local shifts of parts of the pattern in the images captured by subassembly 44 relative to the reference pattern and translates these shifts into depth coordinates. Details of this process are described, for example, in PCT International Publication WO 2010/004542, whose disclosure is incorporated herein by reference. Alternatively, as noted earlier, assembly 22 may be configured to generate depth maps by other means that are known in the art, such as stereoscopic imaging or time-of-flight measurements.

Processor 50 outputs the depth maps via a communication link 54, such as a Universal Serial Bus (USB) connection, to a suitable interface 56 of computer 24. The computer comprises a central processing unit (CPU) 58 with a memory 60 and a user interface 62, which drives display 26 and may include other components, as well. As noted above, imaging assembly 22 may alternatively output only raw images from subassembly 44, and the depth map computation described above may be performed in software by CPU 58, or at least some of the functions attributed below to CPU 58 may be carried out by processor 50. Software for extracting higher-level information from the depth maps may run on processor 50, CPU 58, or both; and references in the present patent application and in the claims to a CPU or to a processor should be understood as referring to either or both of these elements. CPU 58 typically runs one or more application programs, which drive user interface 52 based on information provided by the middleware via an API, as described further hereinbelow.

Methods for Scene Analysis

FIG. 3 is a flow chart that schematically illustrates a method for 3D scene analysis, in accordance with an embodiment of the present invention. The method is described, for the sake of clarity, with reference to the components of system 20 that are described above and to the elements shown in FIGS. 1 and 2. The principles of this method, however, may be implemented in substantially any suitable system for depth mapping and analysis. It is assumed, again for convenience and clarity of description, that the steps of the method are carried out in software by CPU 58, but some or all of these steps may be carried out instead by processor 50 or by another suitable digital processor.

Computer 24 receives a temporal sequence of depth maps from imaging assembly 22, at a depth map input step 70. The depth maps are typically output by imaging assembly in the general format of video images, at a fixed frame rate, with pixel values in raster order. (The maps in the sequence are therefore also referred to herein as map frames, or simply frames.) The pixel values in the depth maps may be either actual depth coordinate values or pattern disparity values, in pixels, which have a known, monotonic relation to the actual depth values. The method is carried out iteratively over each map frame in the sequence

CPU 58 analyzes each depth map to locate and model floor 32, in a floor modeling step 72. This step is described in detail hereinbelow with reference to FIG. 4. Apparent changes in the floor location (or in other parts of the stationary background) can provide the CPU with an indication that the camera has moved, due to either accidental or intentional contact by one of the users, for example. The CPU removes the pixels that have been identified as belonging to the floor plane from the depth map, typically by assigning them null depth values.

CPU 58 builds a model of the scene background gradually, over the sequence of map frames, at a background construction step 74. For each pixel, the CPU saves its maximum depth value (or equivalently, the maximum disparity in comparison with the reference image) over the sequence. The depth value of a pixel in the background is the maximum disparity value over time of this pixel. If a pixel did not have depth value available (not due to shadows) for more than certain number of successive frames, the background model will lose its value at this pixel. If the pixel does not have a depth value due to shadow, and the object casting the shadow is further away than the current background depth value, the pixel will lose its current background value. If a pixel in the background model does not have a depth value and has a value in the current frame, and the foreground connected component containing this pixel is adjacent to the background, the background value in this pixel will become the current value.

With respect to pixels belonging to moving objects in a given map, CPU 58 may have saved background values for these pixels before they were blocked by a foreground object or after the foreground object has moved away. For example, an area of window 36 is obscured by the head of user 30 in the scene shown in FIG. 1, but this same area may be revealed to imaging assembly 22 when the user changes his posture in a subsequent map frame. Therefore, CPU 58 builds up the background model cumulatively, over multiple frames, as the union of the different portions of the background that are revealed in each frame.

As noted above, a foreground object, such as the bodies of users 28 and 30, may cast a shadow on objects behind it, with the result that imaging assembly 22 will be unable to extract depth values in the shadow. To avoid artifacts in the depth map due to the shadow, CPU 58 identifies areas with no depth value that are adjacent to an object as belonging to that object. The shadow is allowed to include pixels only up to a certain maximum shadow width, which is determined by the difference in pattern shift between foreground and background parts of the depth map. It can be shown geometrically that the maximum shadow width (in pixels) is ⅛ times the maximal difference in the shift of the pattern between background and foreground objects. CPU 58 may compute a shadow image, indicating shadowed areas of the map, for use as a mask in controlling update of the background model.

CPU 58 may “dump” the background model in order to eliminate artifacts that might otherwise add noise in subsequent processing. For example, if the CPU detects a connected component in a given area at a depth that is close to the depth of the background model in that area, it may correct the depth values of the background model according to the values of this component. On the other hand, if the CPU has been tracking the connected component in previous frames and identified it as a part of a humanoid form (or at least a candidate to be a part of a humanoid form), it will maintain the separation even when the connected component touches the background. Pixels with foreground depth values that are not identified as being a part of an moving object over a certain number of frames can likewise be attached to the background.

CPU 58 removes the floor, and then attempts to find, among the foreground pixels and previously detected pixels remaining in the map, 3D connected components that may correspond to parts of humanoid forms, at a component detection step 76. The CPU may “remove” pixels that were not previously identified as parts of humanoid forms and are not foreground, by assigning them artificial depth values, outside the range of the foreground depth values, so that they will not be considered in segmentation of the foreground pixels, but will still be considered as scene components for other uses that are explained below.

The CPU assigns an identifier to label each 3D connected component that it has found and computes properties of the component, including:

    • 1. Number of pixels;
    • 2. Bounding box containing the component;
    • 3. Center of mass;
    • 4. Area;
    • 5. Number of foreground pixels (in case part of the component has background depth values);
    • 6. Identifiers of other nearby components.
      Alternatively or additionally, other properties may be computed and saved. The CPU uses the identifiers and component properties in tracking movement of humanoid forms from frame to frame. Thus, the connected components in a given frame will typically be composed of foreground pixels and pixels that were found to belong to humanoid forms in the previous frame.

CPU 58 processes the depth map to identify new 3D clusters, at a cluster detection step 78. Such clusters may correspond to humanoid body that were not identified in previous frames and is used, inter alia, in the initial identification of humanoid forms when system operation begins. Step 78 is described in greater detail hereinbelow with reference to FIGS. 5 and 6.

The clusters identified at step 78 are made up of blocks of adjacent pixels having approximately the same depth value, which are grouped into 3D clusters with mutually-adjacent depth values. Clusters that appear in consecutive frames with relative movement no greater than a predetermined threshold (for example, 10 cm) are tracked. The CPU builds a bounding box around each candidate cluster and tracks its movement over multiple successive map frames. The CPU identifies candidates that move cumulatively by more than some minimum threshold (such as 20 cm) as moving objects. Movement is defined for this purpose as movement of both edges of the cluster, i.e., both the left and right sides should shift, generally in the same direction.

CPU 58 processes the connected components and clusters found at steps 76 and 78 in order to segment and identify the components that may correspond to humanoid body parts, at a segmentation step 80. It then groups together neighboring components to reconstruct humanoid body forms, at a component grouping step 82. This step may include a number of sub-operations. In simple cases, a humanoid form will appear as a single 3D connected component and will be labeled as such. Such a form can be identified readily, for example, by performing a calibration procedure, in which the user stands facing imaging assembly 22 in a prescribed posture. This procedure helps CPU 58 in tracking the user's body parts as he moves subsequently while running a game or other application on computer 24.

In other cases, CPU 58 may need to group two or more connected components at different depths in order make up a single humanoid body form, in a gluing sub-step 84. As noted above, if the entire form was identified in a previous map frame, the common identifier and metadata can be used to maintain the association between the components. Additionally or alternatively, unlabeled, moving connected components in mutual proximity may be grouped together and assigned a common identifier even if not labeled previously.

On the other hand, when a user touches a foreground object (including another user), the user and the object may temporarily appear as a single 3D connected component in one or more of the map frames. In this case, CPU 58 may erroneously assign them a common identifier. Subsequently, when the user moves away from the object, there may be two separate connected components in the depth map with the same identifier. In this case, the CPU may reset the identifier and rebuild the 3D connected component (or components) that actually correspond to the user's body.

Alternatively, in this sort of situation, CPU 58 may use an identifier that was assigned in a previous frame to separate the labeled pixels of the merged connected component that belong to the user's body from the pixels belonging to the other object with which the body is in contact. The CPU is thus able to segment to body correctly notwithstanding the contact. In particular, when the other object is another user, the CPU will assign a different, specific identifier to the pixels belonging to each of the two (or more) different humanoid forms in the scene. The different identifiers that have been assigned in one frame may then be used in a subsequent frame to assign each of the pixels of the merged connected component to the proper body.

Particular difficulties can arise when parts of a humanoid form are occluded by another object in one or more depth maps. CPU 58 detects and resolves such anomalies, at an occlusion detection step 86. This step is described in greater detail hereinbelow with reference to FIG. 7.

At the conclusion of step 82, all humanoid forms will, in most cases, have been identified. For each such humanoid form, CPU 58 assigns a common identifier to label all of the 3D connected components making up the form. The CPU labels all the pixels belonging to these connected components with the appropriate identifier. (Pixels that do not belong to any of the humanoid forms receive a null identifier.) The result is a segmented depth map, which can then be processed further to extract skeletons of the humanoid forms. At the same time, the matrix of labeled pixels is used as the point of departure in processing the next depth map that the CPU receives at step 70 in the next iteration through the method of FIG. 3.

Floor Detection

FIG. 4 is a flow chart that schematically shows details of a method used at step 72 for detecting the floor in a 3D scene, in accordance with an embodiment of the present invention. The floor is defined as a planar surface in the scene, which is expected to be located in the lower part of the depth map. Any plane in the scene satisfies an equation of the form AX+BY+CZ+D=0, wherein (X,Y,Z) are the coordinates in space, and A, B, C and D are constants. For depth maps that are based on disparity values s of a projected pattern, computed at each pixel (x,y), the plane equation can be recast in terms of pixel coordinates and shift values (x,y,s), with constants adjusted appropriately. Thus, the method of FIG. 4, as well as other elements of the method shown in FIG. 2, may be carried out on the raw map data, before even computing actual depth values. Details of the computation in the (x,y,s) domain are described in the above-mentioned provisional patent application.

For each successive depth map, CPU 58 begins the process of finding the floor by checking whether a floor model was already found in the previous map frame, at a floor finding step 90. If so, the CPU calculates a new model for the existing floor, at a new model calculation step 92. For this purpose, the CPU creates a floor image containing all pixels in the depth map that are in the plane of the existing floor, to within a predetermined tolerance, or below the plane. (This floor image can subsequently be removed from the depth map in step 74.) The CPU calculates a confidence score for the new model, at a model marking step 94, and uses the score in deciding whether to accept or reject the floor plane for the current map frame, at a model evaluation step 96. The confidence score may be based, for example, on the number of pixels in the floor plane compared to the number of pixels below this plane (and therefore appear to be erroneous). If the existing floor plane is found to be acceptable, the CPU may adjust the plane parameters based on the floor image, at a floor replacement step 98. For example, the CPU may perform a least-squares fit of a plane to the pixels in the floor image in order to adjust the plane parameters.

If too many of the pixels in the floor image (for example, more than ⅙ of the pixels) are below the existing floor plane, the CPU rejects the new floor model at step 96. The reason for the failure of the floor model may be that imaging assembly 22 has moved, due to intentional or inadvertent contact by one of users 28 and 30, for instance. The CPU evaluates this possibility at a camera motion checking step 100. The CPU may, for example, compute the rate of change of the depth values in the background model. If a large, sudden increase in the rate of change is found, the CPU concludes that the camera has moved. Otherwise, the floor model is preserved to the next frame.

If the CPU finds at step 100 that the camera has moved, and the new floor model is invalid, it sets the current floor model to false, at a floor invalidation step 102, and then proceeds to search for a new floor. The CPU similarly begins a new floor search at the start of any new sequence of map frames.

Following step 102, the CPU may initially attempt an exhaustive floor search, at an exhaustive search step 104. In this step, the CPU identifies all horizontal pixels in the depth map (or possibly in a decimated version of the depth map, for computational efficiency), i.e., pixels whose local normal points upward. The local normal is computed by comparing the depth values of neighboring pixels. Based on the rules of perspective, the coordinates in space of each horizontal pixel predict a certain camera height above the floor, assuming the point to be on the floor. The CPU clusters the horizontal pixels according to the respective camera height predictions. The CPU then chooses, as the basis for the floor, the cluster that is located at the lowest plane in space among those clusters containing more than a predetermined minimal area.

The CPU checks whether a suitable cluster was found, at a search checking step 106. If so, the CPU computes the floor plane by linear regression over the pixels in the cluster and proceeds to a marking step 112, as described below. If no suitable cluster was found, the CPU takes the alternative course of rough estimation, at a model guessing step 108. At this step, the CPU randomly selects three pixels from the lower third of the depth map and computes the plane containing the three corresponding points in space. The CPU checks whether this plane is horizontal (with normal pointing upward), at a model checking step 110. If so, the CPU adopts this plane as the floor. Otherwise, the floor search terminates until the next frame.

CPU 58 evaluates the floor model that was found at step 104 or 108, at a model marking step 112. This step proceeds in substantially the same manner as step 94, which was described above. The CPU then calculates a new model for comparison, at a new model calculation step 114. This step is carried out in similar fashion to step 92, as described above. The CPU evaluates this new model, at a new model marking step 116, compares the result to the previous model score from step 112, at a model comparison step 118, and replaces the previous model with the new model if the latter scores better. The CPU may iterate through steps 114-118 until it achieves no further improvement in the model, at which point the process terminates until the next frame.

Although the method described above relates specifically to identifying the floor in a depth map (and then removing the floor from subsequent analysis), the same method may be used, mutatis mutandis, to find (and remove, if desired) other planar surfaces, such as walls, ceilings, and even table-tops. Furthermore, the methods described above may be adapted to identify other types of non-planar surfaces that are capable of parametric representation, such as spherical and parabolic surfaces that may appear in a depth map. The parameters of such surfaces may be derived from the depth map, for example, by linear least squares fitting of an appropriate 3D function to the points in the depth map. Fitting techniques that may be used for this purpose are described, for example, by Flannery et al., in Numerical Recipes in C: The Art of Scientific Computing, Second Edition (Cambridge University Press, 1992), pages 671-681, which is incorporated herein by reference.

Extracting Humanoid Forms

FIGS. 5 and 6 schematically represent a depth map 120, in frontal and top views, respectively, in accordance with an embodiment of the present invention. FIG. 5 shows blocks 122, 124, 126 corresponding to objects in the depth map. FIG. 6 shows clustering of the blocks, based on their projection onto XZ plane. These figures illustrate an implementation of component detection step 74 (FIG. 3).

To find the blocks shown in FIG. 5, CPU 58 differentiates the depth map along the X (horizontal) direction. For this purpose, pixels for which no depth value could be found are assigned an arbitrary, very large depth value. Pixels where the derivative value is greater than a certain threshold are classified as edges. To avoid edge artifacts, before differentiating the depth map, the shadows of foreground objects (as explained above) are assigned the same depth value as the objects casting them. The CPU then searches the rows of the differentiated depth map to find runs of pixels bounded by a positive edge on the left and a negative edge on the right, with no edge in between.

The CPU creates blocks 122, 124, 126 containing runs of this sort that occur in multiple adjacent rows and meet the following criteria:

    • The runs occur in at least a minimum number (five, for example) of successive rows.
    • The difference in depth values between the rows is no greater than a predetermined threshold.
    • The runs overlap in the X direction by at least a minimum overlap percentage (for example, at least 80% of the shortest run in the block).
      The CPU computes geometrical features of each block, such as the bounding coordinates, median depth values, center of mass, and area.

CPU 58 then groups the blocks into 3D clusters, as illustrated in FIG. 6. This figure shows a view of the 3D depth map in the X-Z plane, with depth (Z) increasing from top to bottom of the figure. A triangular area 128 represents the field of view of imaging assembly 22. Here blocks 122, 124 and 126 can be seen as clusters at different, respective ranges of depths. Blocks 122 correspond to parts of a humanoid form at middle depth, as seen at the right in FIG. 5. Blocks 124 correspond to a chair in the foreground, while blocks 126 are a part of the background.

The CPU groups blocks together in a cluster if the blocks meet certain geometrical criteria. For example, the CPU may require that the respective bounding boxes of the blocks in the X-Z plane overlap by at least some minimum amount and that the respective center of mass of each block be contained within the bounding boxes of the other blocks in the cluster. A cluster is marked as a candidate to belong to a humanoid form if the sum of the areas of the blocks is at least the area of a small person.

As noted earlier, clusters are considered candidates to be humanoid forms if they persist, typically with some movement, over multiple map frames, in addition to meeting the above-mentioned geometrical criteria. Thus, if a given cluster appears in the same general location as an identified humanoid form in the previous frame, the CPU maintains this identification and labels the cluster with the same identifier as in the previous frame.

Otherwise, to determine whether a cluster (which has persisted over a number of consecutive frames) is a humanoid form, the computer projects the blocks in the cluster onto the floor plane (found at step 72) and computes the geometrical properties of the projection, such as area, center of mass, and bounding box. All connected components in the depth map that fall within this bounding box are assumed to belong to the same candidate form. If the cumulative area of all these connected components is larger than a given threshold, the CPU groups the cluster and its associated connected components and assigns them a common identifier as a humanoid form. The CPU computes and saves the properties of this form, and tracks it over subsequent map frames, as described above.

Thus, referring back to FIGS. 5 and 6, the CPU will find the cluster of blocks 122 to meet the geometrical criteria and will identify this cluster as belonging to the humanoid form of a user of the computer. The cluster of blocks 124 is too small and will be disregarded. Although the cluster of blocks 126 is of sufficient size, it will ultimately be disregarded because it is stationary.

FIG. 7 is a schematic frontal representation of a depth map 130 showing segmentation of objects in the depth map, in accordance with an embodiment of the present invention. This figure is based on an actual depth map of a person who has rapidly raised his right leg for a karate kick, as might occur in an active computer game, for example. The body of the person appears as a 3D connected component 132, which appeared in previous map frames and therefore has an identifier and is labeled with computed geometrical characteristics. A new connected component 134, corresponding to the leg, has suddenly appeared in this map, at a substantially shorter distance than the rest of the body. Component 134 partially occludes body component 132 and cuts off this component from another connected component 136 corresponding to the person's arm.

To handle this sort of situation, when a connected component, such as component 134, suddenly appears in a map frame (and thus has no previously-assigned identifier), CPU 58 searches other nearby connected components that have previously been identified and labeled as humanoid forms. If the new connected component is adjacent in X and Y (the horizontal and vertical directions in FIG. 7) and close in depth to the previously-identified connected component (component 132 in the present example), with no areas of different depth in between (other than no-depth areas and occluding objects), the CPU ties the connected components together and assigns a common identifier to both. Thus, in the example shown in FIG. 7, the CPU will attach component 134 and 136 to component 132. The CPU will assign the identifier of component 132 to both of components 134 and 136, and will thus recognize and track these components as belonging to a single humanoid form.

Other considerations that may be used in conjoining connected components into a single body unit in this sort of situation include intersection of the respective bounding boxes and distances between their centers of mass.

Another type of anomaly handled by system 20 at step (FIG. 3) is occlusion of one humanoid form by another humanoid form or other foreground object. This sort of situation is illustrated in FIG. 1, where the left leg of user 28 cuts across the body of user 30. The result of this sort of situation will be that when CPU 58 analyzes the 3D connected components in the depth map of the pictured scene, the lower part of the right leg of user 30 will be separate from the rest of his body.

CPU 58 deals with this sort of situation using the data structures described above. Assuming that the body of user 30 was identified in its entirety, without occlusion, in previous map frames, the CPU will have the same common identifier associated with the connected component in the region of the right leg of user 30 as with the rest of the user's body. Furthermore, the CPU will recognize that the connected components corresponding to the right leg and to the body of user 30 are located in the same depth range, while the connected component corresponding to the body of user 28, including the left leg that separates the parts of the body of user 30, is at a smaller depth. Under these circumstances, the CPU will conclude that the separate connected components corresponding to the leg and body of user 30 are actually parts of the same humanoid form and will “glue” them together with a common identifier.

Once an occlusion of this sort has been detected and resolved, CPU 58 saves, for each of the humanoid forms, a record of other humanoid forms (as well as other foreground objects) that occlude it and a record of other humanoid forms that it occludes. These records are useful in resolving occlusions that may occur in subsequent frames. Similar techniques may be used in detecting and resolving situations in which one human form touches the other.

Optionally, CPU 58 may track the motion of the parts of humanoid forms from frame to frame and thereby estimate the velocity of motion of these body parts. The CPU may use the velocity in extrapolating the locations of parts of the users' bodies even when they are occluded by other objects, and thus may maintain the proper identification of the occluded parts of humanoid forms in the depth maps.

As noted earlier, although the above embodiments are described, for clarity and convenience of explanation, with reference to a specific sort of depth mapping system and certain types of computer applications, the principles of the present invention may similarly be applied to substantially any sort of depth map, regardless of how it is acquired, in any suitable system. Specifically, the methods of 3D connected component analysis and segmentation that are described above may be used in extracting objects of other kinds, and not only humanoid forms, from depth maps. The resulting segmented maps may be displayed directly for viewing by a user and may be used as input to substantially any sort of application program that accepts segmented maps or other images as its input.

It will thus be appreciated that the embodiments described above are cited by way of example, and that the present invention is not limited to what has been particularly shown and described hereinabove. Rather, the scope of the present invention includes both combinations and subcombinations of the various features described hereinabove, as well as variations and modifications thereof which would occur to persons skilled in the art upon reading the foregoing description and which are not disclosed in the prior art.

Claims

1. A method for processing data, comprising:

receiving a depth map of a scene containing a background and one or more foreground objects that conceal and cast a shadow on parts of the background, the depth maps comprising a matrix of pixels, at least some of which have respective pixel depth values and correspond to respective locations in the scene;
using a digital processor, processing the depth map in the sequence so as to identify an area of the shadow, in which the pixels have no depth values in the depth map, with a foreground object that is adjacent to the identified area and casts the shadow in the area such that the identified area of the shadow includes only the pixels with no depth values that are located within a predefined maximum shadow width of the foreground object;
constructing, based on the depth map, a background model of the scene that includes the identified area of the shadow adjacent to the foreground object; and
segmenting the depth map using the background model.

2. The method according to claim 1, wherein receiving the depth map comprises receiving a temporal sequence of depth maps, wherein processing the depth map comprises computing a shadow image indicating shadowed areas of the depth map, and wherein constructing the background model comprises updating the background model over the sequence of the depth maps while using the shadow image in controlling the updating.

3. The method according to claim 1, wherein segmenting the depth map comprises generating a foreground map by removing, based on the background model, one or more background objects from the depth map, and identifying the foreground object in the foreground map.

4. Apparatus for processing data, comprising:

an imaging assembly, which is configured to produce a depth map of a scene containing a background and one or more foreground objects that conceal and cast a shadow on parts of the background, the depth maps comprising a matrix of pixels, at least some of which have respective pixel depth values and correspond to respective locations in the scene; and
a processor, which is configured to process the depth map so as to identify an area of the shadow, in which the pixels have no depth values in the depth map, with a foreground object that is adjacent to the identified area and casts the shadow in the area such that the identified area of the shadow includes only the pixels with no depth values that are located within a predefined maximum shadow width of the foreground object, to construct, based on the depth map, a background model of the scene that includes the identified area of the shadow adjacent to the foreground object, and to segment the depth map using the background model.

5. The apparatus according to claim 4, wherein the imaging assembly is configured to produce a temporal sequence of depth maps, and wherein the processor is configured to compute a shadow image indicating shadowed areas of the depth map, and to update the background model over the sequence of the depth maps while using the shadow image in controlling the update.

6. The apparatus according to claim 4, wherein the processor is configured to generate a foreground map by removing, based on the background model, one or more background objects from the depth map, and to identify the foreground object in the foreground map.

7. A computer software product, comprising a non-transitory computer-readable medium in which program instructions are stored, which instructions, when read by a computer, cause the computer to receive a depth map of a scene containing a background and one or more foreground objects that conceal and cast a shadow on parts of the background, the depth maps comprising a matrix of pixels, at least some of which have respective pixel depth values and correspond to respective locations in the scene,

wherein the instructions cause the computer to process the depth map so as to identify an area of the shadow, in which the pixels have no depth values in the depth map, with a foreground object that is adjacent to the identified area and casts the shadow in the area such that the identified area of the shadow includes only the pixels with no depth values that are located within a predefined maximum shadow width of the foreground object, to construct, based on the depth map, a background model of the scene that includes the identified area of the shadow adjacent to the foreground object, and to segment the depth map using the background model.

8. The product according to claim 7, wherein the instructions cause the computer to receive a temporal sequence of depth maps, to compute a shadow image indicating shadowed areas of the depth map, and to update the background model over the sequence of the depth maps while using the shadow image in controlling the update.

Referenced Cited
U.S. Patent Documents
6661918 December 9, 2003 Gordon et al.
7706571 April 27, 2010 Das et al.
7974443 July 5, 2011 Kipman et al.
8249334 August 21, 2012 Berliner et al.
8280165 October 2, 2012 Meng et al.
8433104 April 30, 2013 Cheng
20070086621 April 19, 2007 Aggarwal et al.
20100302395 December 2, 2010 Mathe et al.
20100322515 December 23, 2010 Cheng
20110102438 May 5, 2011 Mathe et al.
20110175984 July 21, 2011 Tolstaya et al.
Other references
  • U.S. Appl. No. 14/020,851 Office Action dated Jul. 2, 2015.
Patent History
Patent number: 9196045
Type: Grant
Filed: Jul 27, 2014
Date of Patent: Nov 24, 2015
Patent Publication Number: 20140333626
Assignee: APPLE INC. (Cupertino, CA)
Inventors: Amiad Gurman (Elkana), Tomer Yanir (Rinatya), Michael Brand (Bentleigh East), Eran Guendelman (Tel Aviv)
Primary Examiner: Soo Park
Application Number: 14/341,807
Classifications
Current U.S. Class: Image Segmentation (382/173)
International Classification: G06K 9/34 (20060101); G06T 7/00 (20060101); G06K 9/00 (20060101); G06T 15/00 (20110101); G06T 17/05 (20110101); G06T 15/06 (20110101);