This invention related to a method of distinguishing between foreground and background regions of a digital image, known as foreground/background segmentation.
For some applications the ability to provide foreground/background separation in an image is useful. In PCT Application No. PCT/EP2006/005109 separation based on an analysis of a flash and non-flash version of an image is discussed. However, there are situations where flash and non-flash versions of an image may not provide sufficient discrimination, e.g. in bright sunlight.
Depth from de-focus is a well-known image processing technique which creates a depth map from two or more images with different focal lengths. A summary of this technique can be found at: http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/FAVARO1/dfdtutorial.html. Favaro is based on a statistical analysis of radiance of two or more images—each out of focus—to determine depth of features in an image. Favaro is based on knowing that blurring of a pixel corresponds with a given Gaussian convolution kernel and so applying an inverse convolution indicates the extent of defocus of a pixel and this in turn can be used to construct a depth map. Favaro requires a dedicated approach to depth calculation once images have been acquired in that a separate radiance map must be created for each image used in depth calculations. This represents a substantial additional processing overhead compared to the existing image acquisition process.
US 2003/0052991, Hewlett-Packard, discloses for each of a series of images taken at different focus distances, building a contrast map for each pixel based on a product of the difference in pixel brightness surrounding a pixel. The greater the product of brightness differences, the more likely a pixel is considered to be in focus. The image with the greatest contrast levels for a pixel is taken to indicate the distance of the pixel from the viewfinder. This enables the camera to build a depth map for a scene. The camera application then implements a simulated fill flash based on the distance information. Here, the contrast map needs to be built especially and again represents a substantial additional processing overhead over the existing image acquisition process.
US 2004/0076335, Epson, describes a method for low depth of field image segmentation. Epson is based on knowing that sharply focussed regions contain high frequency components. US 2003/0219172, Philips, discloses calculating the sharpness of a single image according to the Kurtosis (shape of distribution) of its Discrete Cosine Transform (DCT) coefficients. US 2004/0120598, Xiao-Fan Feng, also discloses using the DCT blocks of a single image to detect blur within the image. Each of Epson, Philips and Feng is based on analysis of a single image and cannot reliably distinguish between foreground and background regions of an image.
Other prior art includes US 2003/0091225 which describes creating a depth map from two “stereo” images.
It is an object of the invention to provide an improved method of distinguishing between foreground and background regions of a digital image.
According to a first aspect of the present invention there is provided a method of distinguishing between foreground and background regions of a digital image of a scene, the method comprising capturing first and second images of nominally the same scene and storing the captured images in DCT-coded format, the first image being taken with the foreground more in focus than the background and the second image being taken with the background more in focus than the foreground, and assigning regions of the first image as foreground or background according to whether the sum of selected higher order DCT coefficients decreases or increases for the equivalent regions of the second image.
In the present context respective regions of two images of nominally the same scene are said to be equivalent if, in the case where the two images have the same resolution, the two regions correspond to substantially the same part of the scene or if, in the case where one image has a greater resolution than the other image, the part of the scene corresponding to the region of the higher resolution image is substantially wholly contained within the part of the scene corresponding to the region of the lower resolution image.
If the two images are not substantially identical, due, for example, to slight camera movement, an additional stage of aligning the two images may be required.
Preferably, where the first and second images are captured by a digital camera, the first image is a relatively high resolution image, and the second image is a relatively low resolution pre- or post-view version of the first image.
When the image is captured by a digital camera, the processing may be done in the camera as a post processing stage, i.e. after the main image has been stored, or as a post processing stage externally in a separate device such as a personal computer or a server computer. In the former case, the two DCT-coded images can be stored in volatile memory in the camera only for as long as they are needed for foreground/background segmentation and final image production. In the latter case, however, both images are preferably stored in non-volatile memory. In the case where a lower resolution pre- or post-view image is used, the lower resolution image may be stored as part of the file header of the higher resolution image.
In some cases only selected regions of the two images need to be compared. For example, if it is known that the images contain a face, as determined, for example, by a face detection algorithm, the present technique can be used just on the region including and surrounding the face to increase the accuracy of delimiting the face from the background.
The present invention uses the inherent frequency information which DCT blocks provide and takes the sum of higher order DCT coefficients for a DCT block as an indicator of whether a block is in focus or not. Blocks whose higher order frequency coefficients drop when the main subject moves out of focus are taken to be foreground with the remaining blocks representing background or border areas. Since the image acquisition and storage process in a conventional digital camera codes the captured images in DCT format as an intermediate step of the process, the present invention can be implemented in such cameras without substantial additional processing.
This technique is useful in cases where the differentiation created by camera flash, as described in PCT Application No. PCT/EP2006/005109, may not be sufficient. The two techniques may also be advantageously combined to supplement one another.
The method of the invention lends itself to efficient in-camera implementation due to the relatively simple nature of calculations needed to perform the task.
In a second aspect of the invention, there is provided a method of determining an orientation of an image relative to a digital image acquisition device based on a foreground/background analysis of two or more images of a scene.
Embodiments of the invention will now be described, by way of example, with reference to the accompanying drawings, in which:
In the case of preview images which are generated in the pre-capture mode 32 with the shutter button half-pressed, the display 100 can assist the user in composing the image, as well as being used to determine focusing and exposure. Temporary storage 82 is used to store one or plurality of the preview images and can be part of the image store 80 or a separate component. The preview image is usually generated by the image capture device 60. For speed and memory efficiency reasons, preview images usually have a lower pixel resolution than the main image taken when the shutter button is fully depressed, and are generated by subsampling a raw captured image using software 124 which can be part of the general processor 120 or dedicated hardware or combination thereof. Depending on the settings of this hardware subsystem, the pre-acquisition image processing may satisfy some predetermined test criteria prior to storing a preview image. Such test criteria may be chronological, such as to constantly replace the previous saved preview image with a new captured preview image every 0.5 seconds during the pre-capture mode 32, until the final high resolution image is captured by full depression of the shutter button. More sophisticated criteria may involve analysis of the of the preview image content, for example, testing the image for changes, before deciding whether the new preview image should replace a previously saved image. Other criteria may be based on image analysis such as the sharpness, or metadata analysis such as the exposure condition, whether a flash will be used for the final image, the estimated distance to the subject, etc.
If test criteria are not met, the camera continues by capturing the next preview image while discarding preceding captured preview image. The process continues until the final high resolution image is acquired and saved by fully depressing the shutter button.
Where multiple preview images can be saved, a new preview image will be placed on a chronological First In First Out (FIFO) stack, until the user takes the final picture. The reason for storing multiple preview images is that the last preview image, or any single preview image, may not be the best reference image for comparison with the final high resolution image in, for example, a red-eye correction process or, in the present embodiments, portrait mode processing. By storing multiple images, a better reference image can be achieved, and a closer alignment between the preview and the final captured image can be achieved in an alignment stage discussed later.
The camera is also able to capture and store in the temporary storage 82 one or more low resolution post-view images when the camera is in portrait mode, as will be to be described. Post-view images are essentially the same as preview images, except that they occur after the main high resolution image is captured.
In this embodiment the camera 20 has a user-selectable mode 30. The user mode 30 is one which requires foreground/background segmentation of an image as part of a larger process, e.g. for applying special effects filters to the image or for modifying or correcting an image. Thus in the user mode 30 the foreground/background segmentation is not an end in itself; however, only the segmentation aspects of the mode 30 are relevant to the invention and accordingly only those aspects are described herein.
If user mode 30 is selected, when the shutter button is depressed the camera is caused to automatically capture and store a series of images at close intervals so that the images are nominally of the same scene. The particular number, resolution and sequence of images, and the extent to which different parts of the image are in or out of focus, depends upon the particular embodiment, as will be described. A user mode processor 90 analyzes and processes the stored images according to a workflow to be described. The processor 90 can be integral to the camera 20—indeed, it could be the processor 120 with suitable programming—or part of an external processing device 10 such as a desktop computer. In this embodiment the processor 90 processes the captured images in DCT format. As explained above, the image acquisition and storage process in a conventional digital camera codes and temporarily stored the captured images in DCT format as an intermediate step of the process, the images being finally stored in, for example, jpg format. Therefore, the intermediate DCT-coded images can be readily made available to the processor 90.
First, user mode 30 is selected, step 200. Now, when the shutter button is fully depressed, the camera automatically captures and stores two digital images in DCT format:
These two images are taken in rapid succession so that the scene captured by each image is nominally the same.
In this embodiment steps 200 to 206 just described necessarily take place in the camera 20. The remaining steps now to be described can take place in the camera or in an external device 10.
Images A and B are aligned in step 206, to compensate for any slight movement in the subject or camera between taking these images. Alignment algorithms are well known. Then, step 208, a high frequency (HF) map of the foreground focussed image A is constructed by taking the sum of selected higher order DCT coefficients for each, or at least the majority of, the DCT blocks of the image. By way of background, for an 8×8 block of pixels, a set of 64 DCT coefficients going from the first (d.c.) component to the highest frequency component is generated. In this embodiment, the top 25% of the DCT coefficients for a block are added to provide an overall HF index for the block. If not all the DCT blocks of the image are used to construct the map, those that are should be concentrated on the regions expected to contain the foreground subject of interest. For example, the extreme edges of the image can often be omitted, since they will almost always be background. The resultant map is referred to herein as Map A.
Next, step 210, an HF map (Map B) of the background focussed image 13 is constructed by calculating the HF indices of the DCT blocks using the same procedure as for Map A.
Now, step 212, a difference map is constructed by subtracting Map A from Map B. This is done by subtracting the HF indices obtained in step 208 individually from the HF indices obtained in step 210. Since Image A has a higher pixel resolution than image B, a DCT block in Image B will correspond to a larger area of the scene than a DCT block in Image A. Therefore, each HF index of Map A is subtracted from that HF index of Map B whose DCT block corresponds to an area of the scene containing or, allowing for any slight movement in the subject or camera between taking the images, substantially containing the area of the scene corresponding to the DCT block of Map A. This means that the HF indices for several adjacent DCT blocks in Image A will be subtracted from the same HF index of Map B, corresponding to a single DCT block in Image B.
At step 214, using the values in the difference map, a digital foreground/background map is constructed wherein each DCT block of Image A is assigned as corresponding to a foreground or background region of the image according to whether the difference between its HF index and the HF index of the DCT block of Image B from which it was subtracted in step 212 is respectively negative or positive.
Finally, step 216, additional morphological, region filling and related image processing techniques, alone or combination with other foreground/background segmentation techniques, can further improve and enhance the final foreground/background map.
The final foreground/background map 218 may now be applied to the DCT-coded or jpg version of Image A for use in processing the image according to the function to be performed by the user-selectable mode 30.
Where the processor 90 is integral to the camera 20, the final processed jpg image may be displayed on image display 100, saved on a persistent storage 112 which can be internal or a removable storage such as CF card, SD card or the like, or downloaded to another device, such as a personal computer, server or printer via image output device 110 which can be tethered or wireless. In embodiments where the processor 90 is implemented in an external device 10, such as a desktop computer, the final processed image may be returned to the camera 20 for storage and display as described above, or stored and displayed externally of the camera.
Variations of the foregoing embodiment are possible. For example, Image B could be a low resolution preview image rather than a post-view image. Alternatively, both Images A and B could be high resolution images having the same resolution. In that case a DCT block in Image B will correspond to the same area of the scene as a DCT block in Image A. Thus, in step 212, the difference map would be constructed by subtracting each HF index of Map A from a respective different HF index of Map B, i.e. that HF index of Map B corresponding to the same or, allowing for any slight movement in the subject or camera between taking the images, substantially the same area of the scene. In another embodiment both Images A and B are low resolution preview and/or post-view images having the same resolution, and the foreground/background map derived therefrom is applied to a third, higher resolution image of nominally the same scene. In a still further embodiment Images A and B have different pixel resolutions, and prior to DCT coding the pixel resolutions of the two images are matched by up-sampling the image of lower resolution and/or sub-sampling the image of higher resolution.
Although the embodiment described above contemplates the creation and storage of a digital foreground/background map, it may be possible to use the foreground/background designation of the image region corresponding to each DCT block directly in another algorithm, so that the formal creation and storage of a digital map is not necessary.
In another embodiment, rather than basing the maps and comparison on a DCT block by block analysis, each map can first be pre-processed to provide regions, each having similar HF characteristics. For example, contiguous blocks with HF components above a given threshold are grouped together and contiguous blocks with HF components below a given threshold are grouped together. Regions from the foreground and background images can then be compared to determine if they are foreground or background.
As mentioned above, the ability to provide foreground/background separation in an image is useful in many applications.
In a further aspect of the present invention, a particular application using a foreground/background map of an image, regardless of whether it has been calculated using the embodiment described above or for example using the flash-based technique of PCT/EP2006/005109, is to detect the orientation of an image relative to the camera. (The technique is of course applicable to any digital image acquisition device.) For most situations, this also implies the orientation of the camera when the image was taken without the need for an additional mechanical device.
Referring to
Using flash-based foreground/background segmentation, being closer to the camera, the close foreground 30 reflects the flash more than the far background. Thus, by computing the difference between a flash and non-flash version image of the scene, the image orientation can be detected and camera orientation implied. (A corresponding analysis applies when analysing the DCT coefficients of two images as in the above described embodiment.)
An exemplary implementation uses 2 reference images (or preview images or combination of previous and main image suitably matched in resolution), one flash and one non-flash and transforms these into grey level.
For each pixel, the grey level of the non-flash image is subtracted from the one corresponding to the flash image to provide a difference image. In other implementations, a ratio could be used instead of subtraction.
For each potential image/camera orientation direction, a box is taken in the difference image. So for an image sensing array 10 in an upright camera, box 12 is associated with an upright orientation of the camera, box 16 with an inverted orientation of the camera, box 14 with a clockwise rotation of the camera relative to a scene and box 18 with an anti-clockwise rotation of the camera relative to the scene.
For each box 12-18, an average value of the difference image is computed. As such, it will be seen that in some implementations, the difference need only be calculated for portions of the image corresponding to the boxes 12-18.
For clarity, the boxes of
The maximum of the average values for the boxes 12-18 is computed and the box corresponding to the largest value is deemed to be a region with the greatest degree of foreground vis-a-vis the remaining regions. This is deemed to indicate that this region lies at the bottom of the reference image(s). In the example of
In some implementations it can be of benefit to run some tests in order to validate the presumptive image orientation. For example, the maximum of the average values is tested to determine if is dominant vis-a-vis the other values and a level of confidence can be implied from this dominance or otherwise. The degree of dominance required can be varied experimentally for different types of images (indoor/outdoor as described in PCT/EP2006/005109, day/night). Information from other image analysis components which are used within the camera may be combined in this step for determining level of confidence. One exemplary image analysis component is a face tracking module which is operable on a stream of preview images. This component stores historical data relating to tracked face regions, including a confidence level that a region is a face and an associated orientation. Where multiple faces are present their data may be combined in determining a level of confidence.
If the difference values for the presumed left and right sides of an image are similar and smaller then the presumed bottom and larger than the presumed top, then it is more likely that the orientation has been detected correctly.
Because foreground/background maps can be provided for both indoor and outdoor images according to whether the maps have been created using flash or non-flash based segmentation, knowing image orientation can be useful in many further camera applications. For example, knowing the likely orientation of objects in an image reduces the processing overhead of attempting to identify such objects in every possible orientation.
The invention is not limited to the embodiments described herein which may be modified or varied without departing from the scope of the invention.
This application claims the benefit of priority under 35 USC 119 to U.S. provisional patent application No. 60/773,714, filed Feb. 14, 2006, and under 35 USC 371 to PCT application no. PCT/EP2006/008229, filed Aug. 21, 2006.
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/EP2006/008229 | 8/21/2006 | WO | 00 | 2/14/2007 |
Publishing Document | Publishing Date | Country | Kind |
---|---|---|---|
WO2007/093199 | 8/23/2007 | WO | A |
Number | Name | Date | Kind |
---|---|---|---|
4683496 | Tom | Jul 1987 | A |
5046118 | Ajewole et al. | Sep 1991 | A |
5063448 | Jaffray et al. | Nov 1991 | A |
5086314 | Aoki et al. | Feb 1992 | A |
5109425 | Lawton | Apr 1992 | A |
5130935 | Takiguchi | Jul 1992 | A |
5164993 | Capozzi et al. | Nov 1992 | A |
5329379 | Rodriguez et al. | Jul 1994 | A |
5500685 | Kokaram | Mar 1996 | A |
5504846 | Fisher | Apr 1996 | A |
5534924 | Florant | Jul 1996 | A |
5594816 | Kaplan et al. | Jan 1997 | A |
5621868 | Mizutani et al. | Apr 1997 | A |
5724456 | Boyack et al. | Mar 1998 | A |
5812787 | Astle | Sep 1998 | A |
5844627 | May et al. | Dec 1998 | A |
5878152 | Sussman | Mar 1999 | A |
5880737 | Griffin et al. | Mar 1999 | A |
5949914 | Yuen | Sep 1999 | A |
5990904 | Griffin | Nov 1999 | A |
6005959 | Mohan et al. | Dec 1999 | A |
6008820 | Chauvin et al. | Dec 1999 | A |
6018590 | Gaborski | Jan 2000 | A |
6061476 | Nichani | May 2000 | A |
6069635 | Suzuoki et al. | May 2000 | A |
6069982 | Reuman | May 2000 | A |
6122408 | Fang et al. | Sep 2000 | A |
6198505 | Turner et al. | Mar 2001 | B1 |
6240217 | Ercan et al. | May 2001 | B1 |
6243070 | Hill et al. | Jun 2001 | B1 |
6292194 | Powell, III | Sep 2001 | B1 |
6326964 | Snyder et al. | Dec 2001 | B1 |
6407777 | DeLuca | Jun 2002 | B1 |
6483521 | Takahashi et al. | Nov 2002 | B1 |
6526161 | Yan | Feb 2003 | B1 |
6535632 | Park et al. | Mar 2003 | B1 |
6538656 | Cheung et al. | Mar 2003 | B1 |
6577762 | Seeger et al. | Jun 2003 | B1 |
6577821 | Malloy Desormeaux | Jun 2003 | B2 |
6593925 | Hakura et al. | Jul 2003 | B1 |
6631206 | Cheng et al. | Oct 2003 | B1 |
6670963 | Osberger | Dec 2003 | B2 |
6678413 | Liang et al. | Jan 2004 | B1 |
6683992 | Takahashi et al. | Jan 2004 | B2 |
6744471 | Kakinuma et al. | Jun 2004 | B1 |
6756993 | Popescu et al. | Jun 2004 | B2 |
6781598 | Yamamoto et al. | Aug 2004 | B1 |
6803954 | Hong et al. | Oct 2004 | B1 |
6804408 | Gallagher et al. | Oct 2004 | B1 |
6836273 | Kadono | Dec 2004 | B1 |
6842196 | Swift et al. | Jan 2005 | B1 |
6850236 | Deering | Feb 2005 | B2 |
6930718 | Parulski et al. | Aug 2005 | B2 |
6952225 | Hyodo et al. | Oct 2005 | B1 |
6956573 | Bergen et al. | Oct 2005 | B1 |
6987535 | Matsugu et al. | Jan 2006 | B1 |
6989859 | Parulski | Jan 2006 | B2 |
6990252 | Shekter | Jan 2006 | B2 |
7013025 | Hiramatsu | Mar 2006 | B2 |
7035477 | Cheatle | Apr 2006 | B2 |
7042505 | DeLuca | May 2006 | B1 |
7054478 | Harman | May 2006 | B2 |
7064810 | Anderson et al. | Jun 2006 | B2 |
7081892 | Alkouh | Jul 2006 | B2 |
7102638 | Raskar et al. | Sep 2006 | B2 |
7103227 | Raskar et al. | Sep 2006 | B2 |
7103357 | Kirani et al. | Sep 2006 | B2 |
7149974 | Girgensohn et al. | Dec 2006 | B2 |
7206449 | Raskar et al. | Apr 2007 | B2 |
7218792 | Raskar et al. | May 2007 | B2 |
7295720 | Raskar | Nov 2007 | B2 |
7317843 | Sun et al. | Jan 2008 | B2 |
7359562 | Raskar et al. | Apr 2008 | B2 |
7394489 | Yagi | Jul 2008 | B2 |
7469071 | Drimbarean et al. | Dec 2008 | B2 |
20010000710 | Queiroz et al. | May 2001 | A1 |
20010012063 | Maeda | Aug 2001 | A1 |
20020028014 | Ono | Mar 2002 | A1 |
20020080261 | Kitamura et al. | Jun 2002 | A1 |
20020093670 | Luo et al. | Jul 2002 | A1 |
20020191860 | Cheatle | Dec 2002 | A1 |
20030038798 | Besl et al. | Feb 2003 | A1 |
20030052991 | Stavely | Mar 2003 | A1 |
20030091225 | Chen | May 2003 | A1 |
20030103159 | Nonaka | Jun 2003 | A1 |
20030169944 | Dowski et al. | Sep 2003 | A1 |
20030184671 | Robins et al. | Oct 2003 | A1 |
20040047513 | Kondo et al. | Mar 2004 | A1 |
20040145659 | Someya et al. | Jul 2004 | A1 |
20040201753 | Kondo et al. | Oct 2004 | A1 |
20040208385 | Jiang | Oct 2004 | A1 |
20040223063 | DeLuca et al. | Nov 2004 | A1 |
20050017968 | Wurmlin et al. | Jan 2005 | A1 |
20050031224 | Prilutsky et al. | Feb 2005 | A1 |
20050041121 | Steinberg et al. | Feb 2005 | A1 |
20050058322 | Farmer et al. | Mar 2005 | A1 |
20050140801 | Prilutsky et al. | Jun 2005 | A1 |
20050213849 | Kreang-Arekul et al. | Sep 2005 | A1 |
20050243176 | Wu et al. | Nov 2005 | A1 |
20050271289 | Rastogi | Dec 2005 | A1 |
20060008171 | Petschnigg et al. | Jan 2006 | A1 |
20060039690 | Steinberg et al. | Feb 2006 | A1 |
20060104508 | Daly et al. | May 2006 | A1 |
20060153471 | Lim et al. | Jul 2006 | A1 |
20060181549 | Alkough | Aug 2006 | A1 |
20060193509 | Criminisi et al. | Aug 2006 | A1 |
20070237355 | Song et al. | Oct 2007 | A1 |
Number | Date | Country |
---|---|---|
1367538 | Dec 2003 | EP |
02281879 | Nov 1990 | JP |
04-127675 | Apr 1992 | JP |
06-014193 | Jan 1994 | JP |
08-223569 | Aug 1996 | JP |
10-285611 | Oct 1998 | JP |
2000-102040 | Apr 2000 | JP |
2000-299789 | Oct 2000 | JP |
2001-101426 | Apr 2001 | JP |
2001-223903 | Aug 2001 | JP |
22112095 | Apr 2002 | JP |
2003-281526 | Oct 2003 | JP |
24064454 | Feb 2004 | JP |
2004-166221 | Jun 2004 | JP |
2004-185183 | Jul 2004 | JP |
26024206 | Jan 2006 | JP |
2006-080632 | Mar 2006 | JP |
26140594 | Jun 2006 | JP |
WO-9426057 | Nov 1994 | WO |
WO-02052839 | Jul 2002 | WO |
WO-02089046 | Nov 2002 | WO |
WO-2004017493 | Feb 2004 | WO |
WO-2004036378 | Apr 2004 | WO |
WO-2004059574 | Jul 2004 | WO |
WO-2005015896 | Feb 2005 | WO |
WO-2005076217 | Aug 2005 | WO |
WO-2005099423 | Oct 2005 | WO |
WO-2005101309 | Oct 2005 | WO |
WO-2007025578 | Mar 2007 | WO |
WO-2007073781 | Jul 2007 | WO |
WO 2007093199 | Aug 2007 | WO |
WO-2007095477 | Aug 2007 | WO |
Number | Date | Country | |
---|---|---|---|
20090273685 A1 | Nov 2009 | US |
Number | Date | Country | |
---|---|---|---|
60773714 | Feb 2006 | US |