# Patent

## Title
Foreground / background separation in digital images

## Abstract

A method for providing improved foreground/background separation in a digital image of a scene is disclosed. The method comprises providing a first map comprising one or more regions provisionally defined as one of foreground or background within the digital image; and providing a subject profile corresponding to a region of interest of the digital image. The provisionally defined regions are compared with the subject profile to determine if any of the regions intersect with the profile region. The definition of one or more of the regions in the map is changed based on the comparison.

## Background
PRIORITY
This application claims the benefit of priority under 35 USC §119 to U.S. provisional patent application No. 60/746,363, filed May 3, 2006.


BACKGROUND OF THE INVENTION
The present invention provides a method and apparatus for providing improved foreground/background separation in a digital image.
A focus map may be built using a depth from defocus (DFD) algorithm, for example, as disclosed in “Rational Filters for Passive Depth from Defocus” by Masahiro Watanabe and Shree K. Nayar (1995), hereby incorporated by reference. The basic idea is that a depth map of a given scene can be theoretically computed from two images of the same scene. Ideally, for calculating a DFD map, a telecentric lens is used, and only focus varies between the two image acquisitions. This is generally not true of existing digital cameras.
Another technique for separating foreground from background is disclosed in US published patent application no. 2006/0285754, which is assigned to the same assignee as the present application, and is hereby incorporated by reference. Here, the difference in exposure levels between flash and non-flash images of a scene are used to provide a foreground/background map. The main advantage of using depth from defocus over a flash/non-flash based technique, is that depth from defocus is independent of the scene illumination and so can be advantageous for outdoor or well-illuminated scenes.
A further technique for separating foreground from background is disclosed in U.S. patent applications No. 60/773,714 and Ser. No. 11/573,713, which are hereby incorporated by reference. Here, a difference in high frequency coefficients between corresponding regions of images of a scene taken at different focal lengths are used to provide a foreground/background map. Again in this case, the foreground/background map is independent of the scene illumination and so this technique can be useful for outdoor or well-illuminated scenes.
In any case, the foreground/background map produced by each of the above techniques or indeed any other technique may not work correctly. It is thus desired to provide improved methods of foreground/background separation in a digital image.
SUMMARY OF THE INVENTION
A method is provided for providing foreground/background separation in a digital image of a scene. A first map is provided including one or more regions within a main digital image. Each region has one or more pixels with a common characteristic. A subject profile is provided corresponding to a region of interest of the main digital image. One or more of the regions is/are compared with the subject profile to determine if any of them intersect with the profile region. One or more of the regions are designated as a foreground region based on the comparison.
The providing of the first map may include provisionally defining each region of the image as foreground or background. The one or more regions include at least one region provisionally defined as foreground.
The designating may include comparing a foreground region with the subject profile. Responsive to the foreground region not substantially intersecting the subject profile, a designation of said foreground region is changed to a background region.
The providing of the first map may be based on a comparison of two or more images nominally of the same scene. One or more of the images that are compared may include a lower resolution version of the main image. One or more of the images that are compared may include the main digital image. Two or more images that are compared may be aligned and/or may be matched in resolution. One or more of the images that are compared may be captured just before or after the main digital image is captured.
The providing of said first map may include providing two of more images each of different focus and nominally of the scene. The method may include calculating from the images a depth of focus map indicating pixels of the main digital image as either foreground or background. The focus map may be blurred. The method may include thresholding the blurred map to an intermediate focus map indicating regions as either foreground or background. Regions within said intermediate focus map may be filled to provide the first map.
The providing of the first map may include providing two or more images each of different focus and nominally of the scene. High frequency coefficients of corresponding regions in the images may be compared to determine whether the regions are foreground or background to provide the first map.
The providing of the first map may include providing two or more images at different exposure levels nominally of the scene. Luminance levels of corresponding regions in the images may be compared to determine whether the regions are foreground or background to provide the first map.
Any of the methods described herein may be operable in a digital image acquisition device that is arranged to select the subject profile according to content of the main digital image and/or the device may be arranged to operate in a portrait mode wherein the subject profile includes an outline of a person. The outline may include one of a number of user selectable outlines and/or may be automatically selected from multiple outlines based on the content of the main digital image.
Any of the methods described herein may be operable in a general purpose computer arranged to receive the first map in association with the main digital image, and/or may be arranged to receive one or more additional images nominally of the scene in association with the main digital image and/or may be arranged to calculate the first map from a combination of one or more additional images and the main digital image.
The providing of a subject profile may include determining at least one region of the image including a face. An orientation may be determined of the face. The subject profile may be defined as including the face and a respective region below the face in the main image in accordance with the orientation.
The providing of the first map may also include analyzing at least one region of the main digital image in a color space to determine a color distribution within the regions. The color distribution may have multiple distinct color peaks. The regions may be segmented based on proximity of a pixel's color to the color peaks.
The comparing may include, for each region intersecting said subject profile, calculating a reference reflectance characteristic, and for each region not intersecting the subject profile, calculating a reflectance characteristic. The non-intersecting region reflectance characteristic may be compared with the reference reflectance characteristic for a region corresponding in color to the non-intersecting region. A non-intersecting region may be designated as foreground when the non-intersecting region reflectance characteristic is determined to be within a threshold of the reference reflectance characteristic.
A second image may be provided nominally of the scene. Reflectance characteristics may be calculated as a function of a difference in luminance levels between corresponding regions in the main image and the second image.
The main image may be one of a stream of images. The determining of at least one region of the main image including a face may include detecting a face in at least one image of the stream acquired prior to the main image. The face may be tracked through the stream of images to determine the face region in the main image.
A further method is provided for foreground/background separation in a digital image of a scene. A first map is provided including one or more regions provisionally defined as one of foreground or background within a main digital image. One or more of the regions may be analyzed to determine a distribution of luminance within pixels of the region. Responsive to the luminance distribution for a region having more than one distinct luminance peak, the region is divided into more than one sub-region based on proximity of pixel luminances to the luminance peaks. The method further includes changing in the map a designation of one or more sub-regions based on the division.
The method may include providing a subject profile corresponding to a region of interest of the main digital image. At least one provisionally defined region may be compared with the subject profile to determine whether the region intersects with the profile region. The method may further include changing in the map a designation of one or more regions or sub-regions based on comparison.
The providing of the first map includes analyzing one or more regions of the digital image in a color space to determine a color distribution within the region. The color distribution may have multiple distinct color peaks. The regions may be segmented based on proximity of pixel color to the color peaks. The analyzed regions may be provisionally defined as foreground within the first map. The digital image may be provided in LAB space, and the color space may include [a,b] values for pixels and the luminance may include L values for pixels.
A further method is provided for improved foreground/background separation in a digital image of a scene. A main digital image may be acquired. At least one region of said main image is determined to include a face, and an orientation of the face is determined. A foreground region is defined in the image including the face, and a respective region below the face is also defined in accordance with the orientation.
An apparatus is provided for providing improved foreground/background separation in a digital image of a scene. The apparatus includes a processor and one or more processor-readable media for programming the processor to control the apparatus to perform any of the methods described herein above or below



BRIEF DESCRIPTION OF THE DRAWINGS
Statement Regarding Black And White Drawings
This patent application file contains at least one drawing executed in black and white photographs. Copies of this patent or patent application publication with black and white photographs drawing(s) will be provided by the Office upon request and payment of the necessary fee.
Embodiments of the invention will now be described with reference to the accompanying drawings, in which:
FIG. 1(a) shows an in-focus image of a subject;
FIG. 1(b) shows a DFD map for the image; and
FIG. 1(c) shows the DFD map of FIG. 1(b) partially processed according to a preferred embodiment of the invention;
FIG. 2 shows a flow diagram of a method for improving foreground/background separation according to the preferred embodiment of the invention;
FIG. 3(a) shows a first color segmented version of the foreground regions of the image of FIG. 1(c);
FIG. 3(b) shows a profile for a subject;
FIG. 3(c) shows the result of combining the profile of FIG. 3(b) with the regions of FIG. 3(a) according to an embodiment of the present invention; and
FIG. 3(d) shows the image information for the identified foreground regions of the image of FIG. 3(c);
FIG. 4(a) shows another in-focus image of a subject;
FIG. 4(b) shows a DFD map of the image;
FIG. 4(c) shows a first color segmented version of the foreground regions of the image; and
FIG. 4(d) shows the result of combining a profile with the regions of FIG. 4(c) according to an embodiment of the present invention;
FIG. 5(a) shows another in-focus image of a subject;
FIG. 5(b) shows a first color segmented version of the foreground regions of the image; and
FIG. 5(c) shows a further improved color segmented version of the foreground regions of the image when processed according to an embodiment of the present invention;
FIG. 6(a)-(c) show luminance histograms for regions identified in FIG. 5(a);
FIG. 7 is a flow diagram illustrating an alternative segmentation method for foreground-background separation in digital images;
FIG. 8 shows regions identified with an image processed in accordance with the method of FIG. 7; and
FIG. 9 is a flow diagram illustrating a further alternative segmentation method for foreground-background separation in digital images.



DETAILED DESCRIPTION OF THE EMBODIMENTS
The present invention is employed where there is a need for foreground/background segmentation of a digital image. There are many reasons for needing to do so, but in particular, this is useful where one of the foreground or the background of an image needs to be post-processed separately from the other of the foreground or background. For example, for red-eye detection and correction, it can be computationally more efficient to only search and/or correct red-eye defects in foreground regions rather than across a complete image. Alternatively, it may be desirable to apply blur only to background regions of an image. Thus, the more effectively foreground can be separated from background, the better the results of image post-processing.
In the preferred embodiment, improved foreground/background segmentation is implemented within digital camera image processing software, hardware or firmware. The segmentation can be performed at image acquisition time; in a background process, which runs during camera idle time; or in response to user interaction with image post-processing software. It will nonetheless be seen that the invention could equally be implemented off-line within image processing software running on a general-purpose computer.
In any case, in the preferred embodiment, a user operating a camera selects, for example, a portrait mode and optionally a particular type of portrait mode, for example, close-up, mid-shot, full length or group. In portrait mode, the camera then acquires a main image or indeed the camera acquires one of a sequence of preview or post-view images generally of the main image scene. Generally speaking, these preview and post-view images are of a lower resolution than the main image. As outlined above, at some time after image acquisition, image processing software calculates either for the main image or one of the preview/post-view images an initial foreground/background map.
The preferred embodiment will be described in terms of the initial map being a DFD map, although it will be appreciated that the invention is applicable to any form of initial foreground/background map as outlined above. In the embodiment, the segmentation process provides from the initial map, a final foreground/background map, where the foreground region(s), ideally, contain the image subject and which can be used in further image processing as required.
FIG. 1(a) shows an in-focus image of a scene including a subject (person) 10 and FIG. 1(b) the resulting DFD map. The DFD map has, in general, a number of problems in that:

    
    
        objects such as the shutters 12 that lie in the neighborhood of the subject although at different depths appear in-focus (which is normal, but undesired) and as such can be falsely classified as foreground objects; and
        the DFD map is very noisy, i.e., it is far from being smooth.
    
    


Referring now to FIG. 2, the foreground/background segmentation processing of the DFD map to provide the final foreground/background map is shown:
The initial DFD map 20, for example, as shown in FIG. 1(b), is first smoothed or blurred with a Gaussian kernel, step 22. The DFD map of FIG. 1(b) is in a binary form with white regions being classified as foreground and black being background. Smoothing/blurring the map will tend to indicate foreground regions as generally lighter and background regions as generally darker.
A threshold is then applied, step 24, to the smoothed continuously valued image from step 22. This provides a binary map in general having larger and smoother contiguous regions than the initial DFD map 20.
Regions of the binary map obtained at step 24 are then filled, step 26, to remove small regions within larger regions. For the initial image of FIG. 1(a), an initial foreground/background map as shown in FIG. 1(c) is produced. Here foreground is shown as white and background as black. It will be seen that in this map, there is no distinction between the foreground subject region 14 and the region 16 which should be in the background.
The pixels classified as background in the image of FIG. 1(c) are excluded from further processing, step 28, and the remaining regions of the images are regarded as provisional foreground regions.
The remainder of the image is segmented by color, using any suitable technique, step 30. In the preferred embodiment, a “mean shift” algorithm, based on D. Comaniciu & P. Meer, “Mean Shift: A Robust Approach toward Feature Space Analysis” IEEE Trans. Pattern Analysis Machine Intell., Vol. 24, No. 5, 603-619, 2002) is employed. In general, this technique involves identifying discrete peaks in color space and segmenting the image into regions labelled according to their proximity to these peaks.
While this technique can be performed in RGB space, for the sake of computational complexity, the preferred embodiment operates on [a,b] parameters from an LAB space version of the foreground region 14, 16 pixels. This means that for an image captured in RGB space, only pixels for candidate foreground regions need to be transformed into LAB space. In any case, it should be noted that this [a,b] based segmentation is luminance (L in LAB space) independent. This segmentation produces a map as shown in FIG. 3(a), where the different shaded regions 30(a) . . . 30(f) etc represent a region generally of a given [a,b] color combination.
In a first improvement of foreground/background segmentation according to the present invention, a portrait template corresponding to the acquired image is provided, FIG. 3(b). The template includes a profile 32 of a subject. The exact size of a particular profile can be varied according to the focal length for the acquired image in accordance with the expected size of a subject. It will be seen that while the profile 32 shown in FIG. 3(b) is a mid-shot of a subject, the outline can be varied according to the expected pose of a subject. This can either entered manually by a user, by selecting a suitable portrait mode, or possibly predicted by the image processing software. Thus, the profile might be a head shot outline or a full body outline, in one of a plurality of poses, or indeed in the case of a group portrait, an outline of a group.
In any case, the color segments provided in step 30 are combined with the profile 32 to retain only color regions that overlap to a significant extent with the profile 32. Thus, with reference to FIG. 3(a), it will be seen that inter alia regions 30(b),(c) and (e) are removed from the foreground map, while inter alia regions 30(a),(d) and (f) are retained. The final set of foreground regions is shown shaded in FIG. 3(c), with the final background region being indicated as black. It will been seen, however, from FIG. 3(d)) that some regions such as sub-region 30(g) of region 30(a) are still not as accurately segmented as they might be.
It will be seen that sub-regions 30(g)(1) and 30(g)(2), because they may have similar [a,b], characteristics have been included in region 30(a) which in turn has been classified as a foreground region, whereas sub-region 30(g)(2) should more suitably be classed as a background.
It is also acknowledged that parts of the foreground can be (wrongly) removed from the foreground map from various reasons. For instance, in FIG. 3(d), it can be seen that the subject's right hand has been removed from the foreground map because it does not overlap with portrait profile 32.
Another example of the segmentation of steps 22-34 is illustrated with reference to FIG. 4. FIG. 4(a) shows an in-focus image and FIG. 4(b) the DFD map for the image. FIG. 4(c) shows the segmented map after color segmentation, step 30. FIG. 4(d) shows the final foreground/background map after elimination of regions, such as 40(a),(b) that do not overlap significantly to a portrait template 32 chosen for the image.
In this case that, because color segmentation did not separate the subject's hair from the balcony's edges, region 40(c), the balcony edges have been wrongly included in the final map as foreground regions.
In a still further example, FIG. 5(a) shows an in-focus image of a subject and FIG. 5(b), the foreground/background map after color segmentation, step 30, but before combining the foreground regions with a profile 32. Two segmentation artifacts can be seen at this stage: the subject's T-shirt 50 and the TV 52 behind are segmented in a single region; and, similarly, half the subject's face and hair 54 are merged into a single region. The latter defect (accidentally) will not affect the final results, as both hair and face are ideally included in a final foreground map. On the contrary, not separating the T-shirt 50 from the TV 52 results in (wrongly) retaining the latter in the foreground map.
In a second improvement of foreground/background segmentation according to the present invention, foreground regions are analysed according to luminance, step 36. This step can be performed in addition to, independently of, or before or after step 34. In the preferred embodiment, this analysis is again performed on an LAB space version of the foreground region 14, 16 pixels and so can beneficially use only the L values for pixels as is described in more detail below.
In step 36, the intensity of the pixels in regions of the image of interest is analysed to determine if the luminance distribution of a region is unimodal or bimodal. This, in turn, allows difficult images to have their foreground/background regions better separated by applying unimodal or bimodal thresholding to different luminance sub-regions within regions of the image.
In the case of FIG. 5, both the T-shirt/TV 50/52 and hair/face pairs 54 strongly differ in luminance. In step 36, the luminance histogram of each segmented foreground region is computed. FIG. 6 shows the luminance histograms of region #1 comprising the T-shirt/TV 50/52; region #2 comprising the hair/face 54; and region #3 shows a typical unimodal distribution. As can be seen from FIG. 6, the luminance histograms of regions that should be further segmented (i.e., regions # 1 and 2) are bi-modal, whereas others (region #3) are not.
It should also be noted that multi-modal histograms could also be found for a region, indicating that the region should be split into more than two regions. However, the instances of such a distribution are likely to be very rare.
Given that regions which exhibit such a bi-modal distribution in luminance should be ideally segmented further, it is useful to conveniently classify a given histogram as either unimodal or bimodal. Referring to FIG. 6, in the preferred embodiment, this classification comprises:

    (i) blurring/smoothing the histogram to reduce artifacts;
    (ii) finding a maximum luminance 60 in the histogram;
    (iii) discarding a given-width interval 62, FIG. 6(a), around the maximum coordinate (to avoid detection of false maxima);
    (iv) finding the next maximum 64;
    (v) from each of the two maxima, a mode-detection procedure is run to find the corresponding mode—a Bell shaped distribution around each maximum, 66, FIG. 6(b);
    (vi-a) if both found modes include a significant portion of the histogram (i.e., if each spans an interval of luminance levels that includes more than 20% of the pixels from regions of interest) then the histogram is declared bimodal, and the minimum value 68 in the interval between the two maxima is used as a threshold for splitting the region into 2 sub-regions; otherwise,
    (vi-b) the histogram is said to be unimodal, and nothing is changed.


FIG. 5(c) presents the result of the final segmentation, where one can see the correct separation of T-shirt/TV and of hair/face pairs. Regions which are considered unimodal are not changed.
Using the present invention, more of an in-focus subject can be correctly separated from the background, even in difficult images, i.e., images with background located very close to the subject. Even when portions of background cannot be separated from the foreground or vice versa, the artifacts are less likely to be big, and the final map can be more useful for further post-processing of the image.
There are a number of practical issues, which need to be considered when implementing the invention:
When the initial map is derived from a DFD map, then the scaling factor between the in-focus and out-of-focus images will need to be known. This needs to be accessible from the camera configuration at image acquisition, as it cannot be computed automatically. It is derivable from knowing the focal length for the acquired image, and so this should be made available by the camera producer with the acquired image.
It will also be seen that where the initial map is derived from a DFD map, some shifting between images may have taken place, depending upon the time between acquiring the two images. It will be seen that the subject may move significantly with respect to the background, or the whole scene may be shifted owing to camera displacement. As such appropriate alignment between images prior to producing the DFD map should be performed.
As indicated earlier, the invention can be implemented using either full resolution images or sub-sampled versions of such images, such as pre-view or post-view images. The latter may in fact be necessary where a camera producer decides double full resolution image acquisition to provide a full resolution DFD map is not feasible. Nonetheless, using a pair comprising a full-resolution and a preview/postview, or even a pair of previews/postviews for foreground/background mapping may be sufficient and also preferable from a computational efficiency point of view.
It will also be seen that it may not be appropriate to mix flash and non-flash images of a scene for calculating the DFD map. As such, where the main image is acquired with a flash, non-flash preview and post-view images may be best used to provide the foreground/background map in spite of the difference in resolution vis-à-vis the main image.
In a still further aspect of the present invention there is provided a further improved segmentation method for foreground-background separation in digital images.
In the embodiments of FIGS. 1 to 6, the portrait profile 32 is stored in a database for comparison with color segments for an image.
However, it has been found that an alternative profile can be provided by detecting the position and orientation of one or more faces in an image, and adding to the or each face region, a respective area, preferably including a column below the face region as indicated by the orientation of the face. As before, a profile including each face region and associated column can be assumed to comprise foreground pixels only.
While this profile can be used instead of the profile(s) 32 of FIGS. 1 to 6, the information provided in this presumed foreground column(s), can also be used to provide improved separation of the image into foreground and background as described in more detail below.
Referring now to FIG. 7, there is provided a flow diagram of this embodiment.
An image is acquired 700. As before, the image can be either be a pre- or post-view image or include a down-sampled version of a main acquired image.
A face is either detected in the acquired image or, if the face is detected in a previous image of a stream of images including the acquired image, the face region is tracked to determine a face position and its orientation within the acquired image 710. The detection of the position and orientation as well as tracking of a detected face is preferably carried out as disclosed in U.S. patent application No. 60/746,363 filed Aug. 11, 2006.
The orientation of a detected/tracked face is used to determine an area below the detected face in the direction of the face and the combined face region and associated area provides a profile template assumed to contain foreground pixels only, 720.
Referring now to FIG. 8, an acquired image 10 corresponding to the image of FIG. 5(a) includes a subject and the subject's face is detected and/or tracked to lie within the region 80. Given the orientation of the face, a region 82 bounding the face region 80 and extending from the bottom of the face region 80 to the edge of the image is defined.
It can be seen that a number of separate objects lie within or intersect the region 82. In the example, these might comprise regions bounding the subject's shirt (A), the subject's neck and face right side (B), the subject's face left side (C) and the subject's hair (D).
Preferably, these objects are segmented, step 730, by means of a color object detection technique such as Color Wizard, edge detection, or other region separation techniques applied on color or grey level images including but not limited to those described for the embodiments of FIGS. 1 to 6. In the present embodiment, each object A . . . D identified at step 730 and lying within or intersecting the region 82 is designated as being (at least in so far as it intersects the region 82) a foreground object 740.
Preferably, each foreground object that intersects the region 82 is further subjected to luminance analysis, step 750, to determine whether the luminance distribution of the object is unimodal or bimodal as described above. Applying unimodal or bimodal thresholding to different luminance sub-objects within objects intersecting the region 82 can lead to better separation of the foreground/background objects. Thus, objects previously identified as foreground, may now comprise a sub-object identified as a foreground object and a sub-object identified as a background object.
Again, this analysis is preferably performed on an LAB space version of the foreground object pixels and so can beneficially use only the L values for pixels.
Any object (or sub-object) identified in steps 740 and optionally 750 that does not lie within or intersect region 82 is designated as a background object, 760. In this manner, the image is separated into foreground and background objects.
In this embodiment of the present invention, foreground/background segmentation is carried out only on a restricted portion of the image including the region 82. In a still further aspect of the present invention there is provided a further improved segmentation method for foreground-background separation of complete digital images.
Referring now to FIG. 9, there is provided a flow diagram of this embodiment.
A first and second image nominally of the same scene are acquired, 900, 905. As before, these images can either be pre- or post-view images or include a down-sampled version of a main acquired image. For this embodiment, one of the images is taken with a flash and the other without a flash to provide a difference in exposure levels between images.
The images are aligned (not shown), so that object segments identified in the image in steps 900 to 950 (corresponding with steps 700 to step 750 of FIG. 7) are assumed to correspond with segments of the image acquired in step 905.
Where foreground objects identified in step 940/950 are segmented by color, each object comprises a number of pixels having a one of a number of particular color characteristics e.g. similar AB values in LAB space.
The embodiment of FIG. 9 is based on the assumption that each foreground object color combination has an associated average reflective characteristic k that represents the expected behavior of any foreground object having the same color combination. Therefore, by comparing the average reflective characteristic k of any object in the image with the average reflective characteristic k of an identified foreground object having the same color combination, the object can be identified as foreground or background.
In this embodiment, the acquired image on which face detection/tracking was performed is thus compared with the second image of the scene to determine 960 an average reflective characteristic k for each object in the aligned images according to the following equation:




  
    Avg
    ⁡
    
      (
      
        
          
            L
            Flash
          
          -
          
            L
            
              Non
              -
              Flash
            
          
        
        
          L
          
            Non
            -
            Flash
          
        
      
      )
    
  
  =
  k




where LFlash is the luminance of an object in the flash image and LNon-Flash is the luminance of the corresponding object in the non-flash image. If the value of k>0, the object is reflective and if k<0, the object is not reflective, which situations may occur due to interference or noise.

For each unlabeled object, i.e. objects which do not intersect or lie within the region 82, having the same color combination as an identified foreground object, its average reflective characteristic k is compared with a threshold value kth derived from that of the associated foreground object, step 970. So for example, in FIG. 8 a threshold value kth is calculated as 70% of the average reflective characteristic k for each object A . . . D, and a reflective characteristic k is calculated for each unlabeled object. The reflective characteristic k for each unlabeled object is compared with the threshold value kth of whichever one of objects A to D corresponds in color to the unlabeled object.
Thus, in the present embodiment, if the unlabeled object has an average reflective characteristic k of greater than approximately 70% of the associated foreground object, it is identified as a foreground object, 980. Otherwise, it is identified as a background object, 990.
In the case where an unlabeled object comprises pixels having a color combination that does not correspond to the color combination of any of the identified foreground objects, the threshold value kth for objects of that color may be estimated as a function of the reflective characteristic(s) of identified foreground objects, e.g. objects A . . . D, having the most similar color combinations.
In the embodiments of FIGS. 7 and 9 all of an object or sub-object intersecting the section if considered to be a foreground object. In a variation of these embodiments, foreground objects intersecting the region 82 identified in steps 940/950 further subjected to further luminance analysis based on their average reflective characteristic, k.
Thus, a sub-region of each intersecting object wholly within the region 82 is confirmed as a foreground object. Now a reflective characteristic is calculated for each pixel of the object lying outside the region 82. Growing out from the region 82, object pixels neighboring the sub-region are compared pixel-by pixel with the reflective characteristic of the object sub-region with the region 82. Again, where a pixel value is above a threshold proportion of the reflective characteristic k, say 70%, it is confirmed as being a foreground pixel. The sub-region is therefore grown either until all pixels of the object are confirmed as foreground or until all pixels neighbouring the growing sub-region are classed as background. Smoothing and hole filling within the grown region may then follow before the foreground/background map is finalized.

## Claims

1. A method for providing separation between foreground and background regions in a digital image of a scene, comprising:
using a processor-based digital image acquisition device including a processor programmed by processor-readable code embedded within one or more digital storage media;
providing a first map comprising two or more regions within a main digital image, each having one or more pixels with a common characteristic;
comparing values of a second characteristic of the one or more pixels that varies in accordance with a known relationship to the common characteristic;
providing a subject profile corresponding to a region of interest of said main digital image, wherein said providing a subject profile comprises:
determining at least one region of said main digital image including a subject's face;
determining an orientation of said at least one face within said main digital image; and
defining said subject profile as comprising said at least one face region including the subject's face and a respective region below said face region including at least a portion of the subject's neck or shirt, or both, in said main digital image in accordance with said orientation;
and wherein the method further comprises:
comparing one or more of said one or more regions with said subject profile to determine if any of said one or more of said one or more regions intersect with said subject profile; and
designating one or more of said one or more of said one or more regions as a foreground region based on said comparison.

2. A method as claimed in claim 1 wherein providing said first map comprises provisionally defining each of said one or more regions of said main digital image as foreground or background and wherein said one or more regions comprise at least one region provisionally defined as foreground.

3. A method as claimed in claim 2 wherein said designating comprises:
comparing a foreground region with said subject profile; and
responsive to said foreground region not substantially intersecting said subject profile, changing a designation of said foreground region to a background region.

4. A method as claimed in claim 1 wherein the providing of said first map is based on a comparison of two or more images nominally of said scene.

5. A method as claimed in claim 4 wherein one or more of said two or more images that are compared comprises a lower resolution version of said main digital image.

6. A method as claimed in claim 4 wherein one of said two or more images that are compared comprises said main digital image.

7. A method as claimed in claim 4 further comprising aligning said two or more images that are compared.

8. A method as claimed in claim 4 further comprising matching resolutions of said two or more images that are compared.

9. A method as claimed in claim 4 wherein at least one of said two or more images that are compared is captured just before or after said main digital image is captured.

10. A method as claimed in claim 1 wherein the providing of said first map comprises:
providing two of more images each of different focus and nominally of said scene;
calculating from said images a depth of focus map indicating pixels of said main digital image as either foreground or background;
blurring said focus map;
thresholding said blurred map to an intermediate focus map indicating regions as either foreground or background; and
filling regions within said intermediate focus map to provide said first map.

11. A method as claimed in claim 1, wherein the providing of said first map comprises:
providing two or more images each of different focus and nominally of said scene; and
comparing high frequency coefficients of corresponding regions in said images to determine whether said one or more of said one or more regions comprise foreground or background to provide said first map.

12. A method as claimed in claim 1 wherein the providing of said first map comprises:
providing two or more images at different exposure levels nominally of said scene; and
comparing luminance levels of corresponding regions in said images to determine whether said one or more of said one or more regions are foreground or background to provide said first map.

13. A method as claimed in claim 1 operable in a digital image acquisition device, said device being arranged to select said subject profile according to content of said main digital image.

14. A method as claimed in claim 1 operable in a digital image acquisition device, said device being arranged to operate in a portrait mode and wherein said subject profile comprises an outline of a person.

15. A method as claimed in claim 14 wherein said outline comprises one of a number of user selectable outlines.

16. A method as claimed in claim 14 wherein said outline is automatically selected from a plurality of outlines based on content of said main digital image.

17. A method as claimed in claim 1 operable in a general purpose computer arranged to receive said first map in association with said main digital image.

18. A method as claimed in claim 1 operable in a general purpose computer arranged to receive one or more additional images nominally of said scene in association with said main digital image and being arranged to calculate said first map from any combination of said one or more additional images and said main digital image.

19. A method as claimed in claim 1 wherein said providing a first map comprises:
analyzing at least one region of the main digital image in a color space to determine a color distribution within said at least one region, said color distribution having a plurality of distinct color peaks; and
segmenting said at least one region based on proximity of a pixel's color to said color peaks.

20. A method as claimed in claim 1 wherein said main digital image is one of a stream of images and wherein determining at least one region of said main image including a face comprises:
detecting a face in at least one image of said stream acquired prior to said main digital image; and
tracking said face through said stream of images to determine said face region in said main digital image.

21. An apparatus for providing improved separation between foreground and background regions in a digital image of a scene, comprising a processor and one or more processor-readable media for programming the processor to control the apparatus to perform a method comprising:
acquiring a main digital image;
providing a first map comprising one or more regions provisionally defined as one of foreground or background within said main digital image, each having one or more pixels with a common characteristic;
comparing values of a second characteristic of the one or more pixels that varies between foreground and background distances in accordance with a known relationship to the common characteristic;
providing a subject profile corresponding to a region of interest of said main digital image, wherein said providing a subject profile comprises:
determining at least one region of said image including a subject's face
determining a orientation of said at least one face within said main image; and
defining said subject profile as comprising said at least one face region including the subject's face and a respective region below said face region including at least a portion of the subject's neck or shirt, or both, in said main digital image in accordance with said orientation;
and wherein the method further comprises:
comparing at least one of said one or more provisionally defined regions with said subject profile to determine if any of said at least one of said one or more provisionally defined regions intersect with said profile region; and
changing in said map a designation of one or more of said at least one of said one or more provisionally defined regions as a foreground region based on said comparison.

22. The method of claim 1, wherein said comparing comprises comparing said at least one of said one or more provisionally defined regions with said subject profile to determine if any of said at least one of said one or more provisionally defined regions comprise a shape or luminance distribution, or both, that matches that of said subject profile.

23. The method of claim 1, wherein said one or more regions each comprise one or more approximately relatively still regions, and said comparing comprises comparing one or more approximately relatively still regions with said subject profile to determine if any of said one or more approximately relatively still regions intersect with said subject profile, and wherein said designating comprises designating one or more of said approximately relatively still regions as a foreground region based on said comparison.

24. The method of claim 1, wherein said providing a subject profile comprises providing data including a stored shape or luminance distribution, or both, said subject profile not being acquired from a previous image of substantially a same scene as said main digital image, for comparison with said at least one of said one or more regions.

25. The method of claim 1, wherein said providing a subject profile comprises providing data including a stored face region having a relative size next to a second feature, said subject profile not being acquired from a previous image of substantially a same scene as said main digital image, for comparison with one or more face regions of the one or more regions within said main digital image, and the comparing comprises comparing said relative size of said stored face region next to said second feature with that of said subject profile to determine if at least one of said one or more face regions intersect with said subject profile.

26. An apparatus for providing improved separation between foreground and background regions in a digital image, comprising a processor and one or more processor-readable media for programming the processor to control the apparatus to perform a method comprising:
acquiring a main digital image;
providing a first map comprising one or more regions within said main digital image, each having one or more pixels with a common characteristic;
comparing values of a second characteristic of the one or more pixels that varies in accordance with a known relationship to the common characteristic;
providing a subject profile that comprises a stored shape or luminance distribution, or both, said subject profile not being acquired from a previous image of substantially a same scene as said main digital image, for comparison with said one or more regions;
comparing one or more of said one or more regions with said subject profile to determine if any of said one or more of said one or more regions intersect with said subject profile, wherein said comparing comprises:
determining at least one region of said image including a subject's face;
determining an orientation of said at least one face within said main digital image; and
comparing said subject profile with said at least one face region including the subject's face and a respective region below said face region including at least a portion of the subject's neck or shirt, or both, in said main digital image in accordance with said orientation;

and wherein the method further comprises
designating one or more of said one or more of said one or more regions as a foreground region based on said comparison.

27. An apparatus for providing improved separation between foreground and background regions in a digital image of a scene, comprising a processor and one or more processor-readable media for programming the processor to control the apparatus to perform a method comprising:
acquiring a main digital image;
providing a first map comprising one or more face regions within a main digital image;
comparing values of a second characteristic of the one or more pixels that varies in accordance with a known relationship to the common characteristic;
providing a subject profile that comprises a stored face region having a relative size next to a second feature, said subject profile not being acquired from a previous image of substantially a same scene as said main digital image, for comparison with said one or more face regions within said main digital image;
comparing said relative size of said stored face region next to said second feature with that of said subject profile to determine if any of said one or more face regions intersect with said subject profile, wherein said comparing comprises:
determining at least one region of said main digital image including a subject's face;
determining an orientation of said at least one face within said main digital image; and
comparing said subject profile with said at least one face region including the subject's face and a respective region below said face region including at least a portion of the subject's neck or shirt, or both, in said main digital image in accordance with said orientation;

and wherein the method further comprises:
designating at least one of said one or more regions as a foreground region based on said comparison.

28. An apparatus for providing improved separation between foreground and background regions in a digital image of a scene, comprising a processor and one or more processor-readable media for programming the processor to control the apparatus to perform a method comprising:
acquiring a main digital image;
providing a first map comprising one or more regions within a main digital image, each having one or more pixels with a common characteristic;
comparing values of a second characteristic of the one or more pixels that varies in accordance with a known relationship to the common characteristic;
providing a subject profile corresponding to a region of interest of said main digital image, wherein said providing a subject profile comprises:
determining at least one region of said main digital image including a subject's face;
determining an orientation of said at least one face within said main digital image; and
defining said subject profile as comprising said at least one face region including the subject's face and a respective region below said face region including at least a portion of the subject's neck or shirt, or both, in said main digital image in accordance with said orientation;

and wherein the method further comprises:
comparing one or more of said one or more regions with said subject profile to determine if any of said one or more of said one or more regions comprise a shape or luminance distribution, or both, that matches that of said subject profile; and
designating one or more of said one or more of said one or more regions as a foreground region based on said comparison.

29. An apparatus for providing improved separation between foreground and background regions in a digital image of a scene, comprising a processor and one or more processor-readable media for programming the processor to control the apparatus to perform a method comprising:
acquiring a main digital image;
providing a first map comprising one or more approximately relatively still regions within said a main digital image, each having one or more pixels with a common characteristic;
comparing values of a second characteristic of the one or more pixels that varies in accordance with a known relationship to the common characteristic;
providing a subject profile corresponding to a region of interest of said main digital image, wherein said providing a subject profile comprises:
determining at least one region of said main digital image including a subject's face;
determining an orientation of said at least one face within said main digital image; and
defining said subject profile as comprising said at least one face region including the subject's face and a respective region below said face region including at least a portion of the subject's neck or shirt, or both, in said main digital image in accordance with said orientation;

and wherein the method further comprises:
comparing said one or more approximately relatively still regions with said subject profile to determine if any of said one or more approximately relatively still regions intersect with said subject profile; and
designating at least one of said one or more of said approximately relatively still regions as a foreground region based on said comparison.