# Patent

## Title
Simple method for calculating camera defocus from an image scene

## Abstract

An imaging acquisition system that generates a picture depth from an auto focus curve generated from picture of a three dimensional spatial scene is described. The auto focus curve comprises a step edge. The system generates the depth based on the step edge and a reference auto focus normalization curve.

## Background
RELATED APPLICATIONS
This is a continuation of U.S. patent application Ser. No. 11/384,135, entitled “A SIMPLE METHOD FOR CALCULATING CAMERA DEFOCUS FROM AN IMAGE SCENE” filed on Mar. 16, 2006 now U.S Pat. No. 7,616,254, and is related to the co-pending U.S. patent application, entitled “A NEW METHOD FOR CREATING A DEPTH MAP FOR AUTO FOCUS USING AN ALL IN FOCUS PICTURE AND 2D SCALE SPACE MATCHING”, Ser. No. 11/185,611 and “DEPTH INFORMATION FOR AUTO FOCUS USING TWO PICTURES AND TWO-DIMENSIONAL GAUSSIAN SCALE SPACE THEORY”, Ser. No. 11/204,942.


FIELD OF THE INVENTION
This invention relates generally to imaging, and more particularly to generating a depth map from a single image.
COPYRIGHT NOTICE/PERMISSION
A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever. The following notice applies to the software and data as described below and in the drawings hereto: Copyright© 2004, Sony Electronics, Incorporated, All Rights Reserved.
BACKGROUND OF THE INVENTION
A depth map is a map of the distance from objects contained in a three dimensional spatial scene to a camera lens acquiring an image of the spatial scene. Determining the distance between objects in a three dimensional spatial scene is an important problem in, but not limited to, auto-focusing digital and video cameras, computer/robotic vision and surveillance.
There are typically two types of methods for determining a depth map: active and passive. An active system controls the illumination of target objects, whereas a passive system depends on the ambient illumination. Passive systems typically use either (i) shape analysis, (ii) multiple view (e.g. stereo) analysis or (iii) depth of field/optical analysis. Depth of field analysis cameras rely of the fact that depth information is obtained from focal gradients. At each focal setting of a camera lens, some objects of the spatial scene are in focus and some are not. Changing the focal setting brings some objects into focus while taking other objects out of focus. The change in focus for the objects of the scene at different focal points is a focal gradient. A limited depth of field inherent in most camera systems causes the focal gradient.
In one embodiment, measuring the focal gradient to compute a depth map determines the depth from a point in the scene to the camera lens as follows:




  
    
      
        
          d
          o
        
        =
        
          fD
          
            D
            -
            f
            -
            
              2
              ⁢
              
                krf
                number
              
            
          
        
      
    
    
      
        (
        1
        )
      
    
  




where f is the camera lens focal length, D the distance between the image plane inside the camera and the lens, r is the blur radius of the image on the image plane, k is a scale factor, and fnumber is the fnumber of the camera lens. The fnumber is equal to the camera lens focal length divided by the lens aperture. Except for the blur radius, all the parameters on the right hand side of Equation 1 are known when the image is captured. Thus, the distance from the point in the scene to the camera lens is calculated by estimating the blur radius of the point in the image.

Capturing two images of the same scene using different apertures for each image is a way to calculate the change in blur radius. Changing aperture between the two images causes the focal gradient. The blur radius for a point in the scene is calculated by calculating the Fourier transforms of the matching image portions and assuming the blur radius is zero for one of the captured images.
SUMMARY OF THE INVENTION
An imaging acquisition system that generates a picture depth from an auto focus curve of a three dimensional spatial scene. The auto focus curve includes a step edge. The system generates the depth based on the step edge and a reference auto focus normalization curve.
The present invention is described in conjunction with systems, clients, servers, methods, and machine-readable media of varying scope. In addition to the aspects of the present invention described in this summary, further aspects of the invention will become apparent by reference to the drawings and by reading the detailed description that follows.



BRIEF DESCRIPTION OF THE DRAWINGS
The present invention is illustrated by way of example and not limitation in the figures of the accompanying drawings in which like references indicate similar elements.
FIG. 1 illustrates one embodiment of an imaging system.
FIG. 2 illustrates one embodiment of a set of image auto focus curves.
FIG. 3 is a flow chart of one embodiment of a method that computes a depth map from an auto focus normalization curve.
FIG. 4 illustrates one embodiment of a shifted and blurred step edge.
FIG. 5 illustrates one embodiment of a scaled step edge, with two neighboring locations used to compute a finite difference value.
FIG. 6A illustrates one embodiment of a scaled and blurred step edge, with two neighboring locations used to compute a finite difference value.
FIG. 6B illustrates embodiments of step functions with differing step edge angles.
FIG. 7 illustrates one embodiment of an auto focus normalization curve.
FIGS. 8A-C illustrate one embodiment of auto focus normalization curves computed for edges at zero, thirty-three, and forty-five degree orientations.
FIG. 9 illustrates a sample test image that contains step edges.
FIG. 10 illustrates one embodiment of a sample test image that has undergone increasing amounts of blur.
FIG. 11 illustrates one embodiment of computed pa(x) values (vertical scale for the auto focus normalization curve) for the scan line shown in FIG. 10 for increasingly blurred versions of the sample test image.
FIG. 12 illustrates one embodiment of an auto focus normalization curve calculated using two different filters.
FIG. 13 illustrates one embodiment of taking a step edge, blurring the step edge with a one-dimensional gaussian blur kernel and computing the derivative of the gaussian blurred step edge.
FIGS. 14A-C are figures illustrating one embodiment of computing the product of the one-dimensional gaussian blur kernel width (sigma) and the peak derivative of the blurred step edge.
FIG. 15 illustrates one embodiment of a one-dimensional computer simulation of the sigma-derivative maximum product. Different one-dimensional pillbox blur kernels are applied to the step edge. The pillbox blurred step edge is then blurred using one-dimensional Gaussian kernels of increasing width (sigma).
FIG. 16 illustrates one embodiment of a two-dimensional computer simulation of the sigma-derivative maximum product. Different two-dimensional pillbox blur kernels are applied to the step edge. The pillbox blurred step edge is then blurred using two-dimensional Gaussian kernels of increasing width (sigma).
FIGS. 17A-B illustrate one embodiment of applying an artificial two-dimensional pillbox blur kernel to an image.
FIG. 18 illustrates one embodiment of tracking maxima across gaussian blur.
FIG. 19 illustrates one embodiment of tracking maxima across gaussian blur and identifying the corresponding locations that satisfy the zero slope condition.
FIG. 20 is a block diagram illustrating one embodiment of an image device control unit that calculates a depth map.
FIG. 21 is a diagram of one embodiment of an operating environment suitable for practicing the present invention.
FIG. 22 a diagram of one embodiment of a computer system suitable for use in the operating environment of FIG. 3.



DETAILED DESCRIPTION
In the following detailed description of embodiments of the invention, reference is made to the accompanying drawings in which like references indicate similar elements, and in which is shown by way of illustration specific embodiments in which the invention may be practiced. These embodiments are described in sufficient detail to enable those skilled in the art to practice the invention, and it is to be understood that other embodiments may be utilized and that logical, mechanical, electrical, functional, and other changes may be made without departing from the scope of the present invention. The following detailed description is, therefore, not to be taken in a limiting sense, and the scope of the present invention is defined only by the appended claims.
FIG. 1 illustrates one embodiment of an imaging system 100 that captures an image of a three dimensional spatial scene 110. References to an image or a picture are to an image of a three dimensional scene captured by imaging system 100. Imaging system 100 comprises an image acquisition unit 102, a control unit 104, an image storage unit 106, and lens 108. Imaging system 100 may be, but is not limited to, digital or film still camera, video camera, surveillance camera, robotic vision sensor, image sensor, etc. Image acquisition unit 102 captures an image of scene 110 through lens 108. Image acquisition unit 102 may acquire a still picture, such as in a digital or film still camera, or acquire a continuous picture, such as a video or surveillance camera. Control unit 104 typically manages the image acquisition unit 102 automatically and/or by operator input. Control unit 104 configures operating parameters of the image acquisition unit 102 and lens 108 such as, but not limited to, the lens focal length, f, the aperture of the lens, A, lens focus, and (in still cameras) the lens shutter speed. In addition, control unit 104 may incorporate a depth map unit 120 (shown in phantom) that generates a depth map of the scene based on the focusing information acquired by image acquisition unit 102. The image(s) acquired by image acquisition unit 102 are stored in the image storage 106.
In FIG. 1, imaging system 100 records an image of scene 110. While in one embodiment scene 110 is composed of four objects: a car 112, a house 114, a mountain backdrop 116 and a sun 118; other embodiments of scene 110 may be composed of several hundred objects with very subtle features. As is typical in most three dimensional scenes recorded by the lens of the imaging system 100, objects 112-118 in scene 110 are at different distances to lens 108. For example, in scene 110, car 112 is closest to lens 108, followed by house 114, mountain backdrop 116 and sun 118. Because of the limited depth of field inherent in imaging acquisition unit 102, a focal setting of lens 108 will typically have some objects of scene 110 in focus while others will be out of focus. Although references to objects in an image, portions of an image or image block do not necessarily reflect the same specific subdivision of an image, these concepts all refer to a type of image subdivision.
Typically, a focusing mechanism in imaging system 100 focus on one object or groups of objects that comprise scene 110. Focusing mechanisms may be either automatic (“auto focus”) or manually operated. An automatic focusing mechanism attempts to bring into focus some or all of the objects comprising scene 110. There are many known auto focusing scheme known in the art, such as, active, passive, etc. On the other hand, a manually operated focusing mechanism relies on the operator to focus lens 108. FIG. 2 illustrates one embodiment of a graph 200 comprising a set of image auto focus curves 202A-C for different scenes or regions of a scene. In FIG. 2, graph 200 plots curves 202A-C as a function of image gradient magnitude from an auto focus metric versus lens position. For example and by way of illustration, curve 202A is the auto focus curve for lens 108 focusing on car 112, curve 202B is the auto focus curve of lens 108 focusing on house 114, and curve 202C is the auto focus curve for lens 108 focusing on mountain backdrop 118. The peak of each curve 202A-C determines the in-focus position for the respective region under analysis. Each auto focus curve is computed from image gradient magnitudes. Non-zero image gradient magnitudes can result from image structures such as step edges, roof edges, textured edges, shadows, etc.
A traditional auto focus scheme searches for the peak of the auto focus curve. (e.g., peak-hold-integrate method, hill-climbing, etc.). Or, from another perspective, the auto focus information contained in the curve is a qualitative measure of image defocus, or blurring, and an auto focus scheme attempts to minimize the image blurring. Because an auto focus scheme measures qualitative blurring and blurring is related to depth, the auto focus curve contains depth information. For example, consider the case where the scene consists of a single object on a constant background. If the entire auto focus curve is known, the depth of the object is also known. This is because the peak of the curve corresponds to the in focus position. Once the in-focus position is known and the camera parameters associated with the in focus position are recorded, the depth of the object can be determined. If auto focus curves are created for two distinct objects at two different depths, the two curves will have peak values at two different locations. By knowing the depth of one of the objects, one can then determine the relative depth of the second versus the first object. Often, traditional auto focus schemes are directed towards a relatively large region of an image. Typically, an auto focus scheme will attempt to focus on a region of the image. While in one embodiment, the entire image could be used to generate an auto focus curve, in alternative embodiments, different regions of the image could be used to generate one or more auto focus curves. If multiple objects are located at different depths in a specific region of analysis, the depth of both objects cannot be determined if the auto focus curve contains a single peak. This is attributed to the scale of analysis. In this case, the analyzed region is too large.
Furthermore, if a specific region contains objects at different depths and these objects contain step edges, depth information resulting from the weaker step edges may be lost. For example and by way of illustration, consider an auto focus curve generated from a region containing step edges with contrasts of five, seven and 155. These edges correspond to objects at different depth locations in the region. The resulting auto focus curve will be primarily dominated from the 155 contrasted value step edge information. Many other scenarios are possible based on the contrast of the objects in the region under analysis. In some cases, auto focus curves with multiple maxima/peaks may result due to several different objects at different depths present in the region of analysis. However, without a finer scale, it is impossible to determine the spatial location of these objects in the scene.
FIG. 3 is a flow chart of one embodiment of a method 300 that computes a depth value from a step edge associated with an auto focus normalization curve. In FIG. 3 at block 302, method 300 reads in a scan line of information. While in one embodiment, the scan line of information is a horizontal scan line, in an alternate embodiment, the scan line is another line orientation (vertical, diagonal, etc.).
At block 304, method 300 locates step edges in the scan line. If there are no step edges in the scan line, no depth information can be recovered.
At block 306, method 300 shifts the step edges so that the minimum value of the step edge is zero. FIG. 4 illustrates one embodiment of a shifted, blurred step edge. In FIG. 4, method 300 transforms curve 400 into curve 402 by shifting curve 400 such that the minimum value of curve 400 is zero.
Method 300 uses the information derived from the shifted step edge to determine a position on the vertical axis corresponding to the auto focus normalization curve in FIG. 7. The auto focus normalization curve takes on values between zero and one.
FIG. 5 illustrates one embodiment of a scaled step edge. In FIG. 5, two step edges are illustrated. Step edge 500A has a step of A, whereas step edge 500B has a step of kA. The differences arise because step edges 500A-B represents edges of different contrast in the scene. For example, step edge 500A is a less strongly contrasted step edge with a smaller edge height, whereas step edge 500B is a more strongly contrasted step edge with edge height kA.
FIG. 6A illustrates one embodiment of a scaled and blurred step edge. As in FIG. 5, scaling occurs naturally in a scene because of different contrasts in the scene. In FIG. 6, two blurred step edges are illustrated. Blurred step edge 600A has a contrast of A whereas blurred step edge 600B has a contrast of kA. Blurred step edge 600A is a less strongly contrasted blurred step edge while blurred step edge 500B is a more strongly contrasted blurred step edge. Returning to FIG. 3, at block 308, method 300 computes the one-dimensional gradients of the shifted signal and stores the maximum gradient value associated with the shifted signal. For example and by way of illustration, the one-dimensional gradient is computed using the following two element filter: [−1 1]. Alternatively, other one-dimensional gradient filters known in the art can be used to compute the one-dimensional gradient.
At block 310, method 300 locates the center of the shifted step edge. Several methods are known in the art that may be employed: computing the zero crossing associated with the second derivative of the shifted step edge; sliding a (1×n) window over the shifted step edge and finding the location that corresponds to the maximum variance, using the location corresponding to the 1 D gradient maxima at block 308, etc.
Once the center of the shifted step edge is determined, the pixel intensity value of the shifted step edge at the immediate neighboring location is determined. If the shifted step edge corresponds to a rising edge and the computed location is x1, method 300 stores the pixel intensity value location x1+1, the pixel immediately adjacent to x1 on the right.
Alternatively, if the shifted step edge is a falling edge and the computed location is x1, method 300 stores the pixel intensity value at location x1−1, the pixel immediately adjacent to x1 on the left. In either case, the value is obtained from the shifted step edge. The rationale for the two embodiments described above is that method 300 chooses the embodiment that result in a pa(x) value for the auto focus normalization curve that is non-zero Pa(x) represents a defocus measurement tool for step edges at various angle orientations.
At block 312, method 300 computes pa(x) for the step edge by dividing the gradient value computed at block 308 by the value stored at block 310. As it will be shown later, method 300 computes pa(x) reference curves for different step edge angles. Each reference curve relates a pa(x) value to an amount of defocus. For example and by way of illustration, an auto focus curve of an in-focus picture has a pa(x) of one. As the step edge becomes blurrier, the pa(x) computed values monotonically decreases to zero. Thus, method 300 may use the computed pa(x) value to determine the amount of defocus (or blur) for the picture step edge.
At block 314, method 300 determines if there is significant noise in the image. If so, method 300 computes several additional pa(x) values by repeating blocks 302-312 for several neighboring scan lines at block 316. Method 300 computes an average pa(x) from the original and additional pa(x) values computed at block 318.
At block 320, method 300 computes an approximate angle of the blurred step edge using one the known in the art for computing step edge angles. For a continuous step edge, a step edge is a Heaviside step function. Similarly, a blurred step edge is a Heaviside step function convolved with a blur kernel, as illustrated in FIG. 6A with blurred step edges 600A-B. A step edge or blurred step edge at an angle is a rotated version of the step edge or blurred step edge, respectively. FIG. 6B illustrates one embodiment of a step function 620 with a zero degree step edge angle and a step edge 622 with a forty-five degree angle. Illustrating step edge 620 as a matrix with contrast of one is:




   
  
    
      
        
          
            
              
                
                  
                    
                      
                        
                          000111
                        
                      
                      
                        
                          000111
                        
                      
                    
                  
                
                
                  
                    000111
                  
                
              
            
          
          
            
              000111
            
          
        
      
      
        
          (
          2
          )
        
      
    
  




In FIG. 6B, step function 620 illustrates a jump in value from x1 and x2. For example and by way of illustration, assuming the value of the step function 620 is zero at x1, the step function 620 value is 1 at x2. Similarly, a matrix representation of step edge 622 with contrast of one is:





   
  
    
      
        
          
            
              
                
                  
                    
                      
                        
                          
                            
                              
                                111111
                              
                            
                            
                              
                                011111
                              
                            
                          
                        
                      
                      
                        
                          001111
                        
                      
                    
                  
                
                
                  
                    000011
                  
                
              
            
          
          
            
              000001
            
          
        
      
      
        
          (
          3
          )
        
      
    
  




In practice, a step edge transition may not be abrupt since method 300 is sampling a continuous signal and the step edge may not lie in-between the sensor locations. For example, if the light and dark portions of the step edge lie to the right and left hand sides of the two pixel locations, the step edge is:

0 0 0 0 1 1 1  (4)

However, if the step edge lies somewhere in-between a single pixel location, then the step edge representation could be:

0 0 0 0.7 1 1 1  (5)

The same is true for step edges at different angle orientations. Auto focus normalization curves are generated for various edge orientations ranging from 0 to 45 degrees. For orientations outside this range, such as 45 to 90 degrees, a vertical scan line is used. The computed pa(x) value is mapped to the appropriate curve in the 0 to 45 degree range. For example, if the edge is oriented at 90 degrees, the auto focus normalization curve corresponds to 0 degrees is used.

At block 322, method 300 computes one or more reference auto focus normalization curves. As mentioned above, the reference auto focus curve correlates a step edge pa(x) value to a known amount of blurring. Because the curve differs for different step edge angles, method 300 generates several different curves. While in one embodiment, method 300 calculates curves for angles zero, eleven, twenty-two, thirty-three, and forty-five degrees, alternates embodiments may calculate curves for more, less, and/or different angles.
FIG. 7 illustrates one embodiment of an auto focus normalization curve. In FIG. 7, pa(x) is the y-axis of curve 700, while lens position is the x-axis. When the step edge is sharp and in focus, a maximum pa(x)=1 value is obtained. At this lens position, there is no de-focus. As the lens is moved away from this position, the step edge becomes blurred, and hence, defocus occurs. As the lens is moved even further away, even more defocus results. As the lens position moves from in focus on the left to positions resulting in more defocus, the pa(x) value drops monotonically from one towards zero. Curve 700 is a representative normalization curve and not intended to show a curve for a particular step edge angle. Nevertheless, method 300 uses the curve 700, or a curve similar to curve 700, to determine the amount of blur associated with a given pa(x) value. For example and by way of illustration, for curve 700, pa(x1) corresponds to a defocus of F1. However, curve 700 is dependent on the step edge angle and is different for differing step angles.
FIGS. 8A-C illustrate one embodiment of an auto focus normalization curve computed for angles of zero, thirty-three, and forty-five. In FIG. 8A, curves 802A-D are auto focus normalization curves for a step edge at zero degrees. As in FIG. 7, curves 802A-D relates a pa(x) value to an amount of defocus. However, unlike in FIG. 7, the step edge represented in curves 802A-D represents step edges for different edge offsets. Previously, equation 5 provided a 1 D matrix representation for an edge with a specific offset of 0 0 0 0.7 1 1 1. Curves 802A-D represent offsets ranging in values between 0 and 1. Said another way, the step edges represented by steps 804A-D are shifted with respect to the sensor location.
FIGS. 8B and 8C illustrate a similar offset concept, but the edges are oriented at thirty-three and forty-five degrees. In FIG. 8A, only four edge offsets are shown. As a result, four different auto focus normalization curves result. In FIG. 8B, four edge offsets are shown. However, depending on the scan line chosen for each edge offset, different auto focus normalization curves may result. Hence, this is the reason why there are more than four auto focus normalization curves shown for the thirty-three degree edge orientation. In practice, for each edge orientation, method 300 generates a set of curves for various edge offsets. For example, in FIG. 8A, method 300 generates four curves corresponding to four edge offsets. The resulting offset pixel intensities were 0.2, 0.4, 0.6 and 0.8. The computed and stored auto focus normalization curve can then be generated from the four curves resulting from the four edge offsets. For example, the computed and stored auto focus normalization curve can be generated by averaging the four curves, thereby generating mean auto focus normalization curve. This stored curve is the one that we use in the real world scenario.
Method 300 repeats this procedure for the other angle orientations, generating the computed auto focus normalization curve for various specific orientations.
Returning to FIG. 3, at block 324, method 300 chooses the appropriate auto focus normalization curve for the step edge being analyzed. Typically, method 300 chooses the curve with the step edge angle nearest the step edge angle computed at block 320. Alternatively, method 300 chooses the curve with the step edge nearest and at least (or at most) the step angle computed at block 320.
At block 326, method 300 computes the defocus (or blur) of the step edge using the chosen auto focus normalization curve. Using the step edge pa(x) value, method 300 computes the defocus with the chosen normalization curve.
At block 328, method 300 generates a picture depth value from the computed blur using the geometric optics model. As explained above, the geometric optics model relates the distance of an object in a picture to a blurring of that object. Method 300 calculates a distance using Equation 1 from the associated defocus value. Because the lens focal length, f, distance between the camera lens 202 and image plane 206, D, and fnumber are constant at the time of acquiring the finite depth of field picture, method 300 computes the picture depth from the computed blur. In addition, because scene 110 typically contains several step edges, method 300 may compute a picture depth map by computing a picture depth value for each step edge.
At block 330, method 300 applies a clustering algorithm to the depth map. The clustering algorithm is used to extract regions containing similar depths and to isolate regions corresponding to outliers and singularities. Clustering algorithms are well-known in the art. For example, in one embodiment, method 300 applies nearest neighbor clustering to the picture depth map.
FIG. 9 illustrates one embodiment of a test image 900 that includes step edges. Scan line 902 crosses several of the objects in test image 900. At each crossing point 904, there is typically a step edge in the auto focus metric.
FIG. 10 illustrates one embodiment of the test image 1002A-D that illustrates step edges undergoing different amounts of blur. In FIG. 10, four images 1002A-D of test pattern 900 represent increasing amounts of blur applied to each test image. For example and by way of illustration, the first image 1002A appears as the sharpest image, followed by (as increasingly blurred images) the second image 1002B, third image 1002C, and fourth image 1002D. For each image, method 300 analyzes the step edges along a scan line 1004 across the different images 1002A-D.
FIG. 11 illustrates one embodiment of a chart 1100 plotting computed pa(x) values at various scan lines. In FIG. 11, chart 1100 illustrates the results for the four different images 1002A-D and the corresponding pa(x) values for nine step edges 1104A-I. Each pa(x) value represents an average of five scan lines. The different groupings of pa(x) values reflect the relative focus value. That is, for each step edge 1104A-I, pa(x) values are largest for the first image 1002A corresponding to 1102A, followed by pa(x) values for second image 1002B corresponding to 1102B, the third image 1002C corresponding to 1102C, and the fourth image 1002D corresponding to 1102D.
FIG. 12 illustrates one embodiment of an auto focus normalization curve 1200 calculated with an alternative filters. For example, curve 1202 can result using filter [−1 0 0 1] and curve 1204 can result using filter [−1 0 1]. The filter referred to is the one used in FIG. 3, Block 308. These two filters are examples of many different gradient filters that can be applied. As illustrated in FIG. 12, curve 1202 has a pa(x) value closer to one for values of defocus between zero and twenty one. In some embodiments, this is a desirable result. Alternate filters that can be used for FIG. 3, block 308 are [−1 0 0 0 1], [−1 0 0 0 0 0 1], etc.
FIG. 13 illustrates one embodiment calculating a derivative of a blurred step edge. In FIG. 13, method 300 applies Gaussian blurring functions 1304A-C to step edge 1302. Initially, a step edge can be blurred using a blurring function known in the art (Gaussian, pillbox, etc.). However, subsequent blurring that is artificially applied requires the blur function to be Gaussian smooth. As illustrated, blurring functions 1304A-C represent sigma values of two, five, and eight. In this embodiment, smaller sigma values give a smaller blur, whereas larger sigma values represent larger blurring. Alternate embodiments may use smaller, and/or larger sigma values. Applying blurring functions 1304A-C to step edge 1302 result in blurred step edge 1306A-C, respectively. Blurring a step edge results in a step 1306A-C edge that has a gradual increase in auto focus metric value instead of a sharp increase in value as in step edge 1302.
Furthermore, the derivatives of blurred step edges 1306A-C are curves 1308A-C. The derivatives of the blurrier step edges 1306A-C have lower maxima and wider peak than less blurred step edge derivatives. For example and by way of illustration, derivative blurred step edge 1308A has narrow peak and maxima near 100. On the other hand, derivative blurred step edge 1308C that has a wide peak and a maximum of twenty-five.
FIGS. 14A-C illustrate one embodiment of the product of the gaussian blurring function and the peak of the derivative of a blurred step edge. As in FIG. 13, in FIG. 14A, three derivatives of blurred step edges 1402A-C are illustrated. Furthermore, the derivative maxima have values of twenty-five, forty, and ninety-six for blurred step edges 1402A-C, respectively.
FIG. 14B illustrates one embodiment of a curve 1404 plotting blurred step edge derivative maxima versus sigma value. As illustrated in FIG. 14B, there is an inverse relationship between the sigma value of the blurring function and the derivative maxima. For example and by way of illustration, as the value of sigma increases (2→5→8), the derivative maxima decreases respectively (96→40→25).
FIG. 14C illustrates one embodiment of a curve 1406 plotting the product of sigma and derivative maxima versus sigma. In FIG. 14C, as sigma increases, the product flattens out to a constant value. For example and by way of illustration, the product is 192 for sigma value of two, whereas the product is 200 for sigma values of five and eight. This suggests that as blurred step edge becomes completely blurred, the product between the derivative maxima and sigma value approaches a constant value.
FIG. 15 illustrates one embodiment of a one-dimensional computer simulation 1500 of the sigma-derivative maximum product for different pillbox radius values. In FIG. 15, a one-dimensional pillbox blurring function is applied to zero degree one-dimensional step edge. For example and by way of illustration, the step edge used for curve 1502A has a pillbox blurring function of zero applied to it, while the step edges used for curves 1502B-E has a five, ten, fifteen, and twenty applied to them, respectively.
Furthermore, increasing the amounts of Gaussian blur applied to each pillbox blurred step edge results in curves 1502A-E. As in FIG. 14C, increased blur results in the product of sigma and step edge derivative maxima flattening out to a constant value. For example and by way of illustration, the sigma-derivative maximum product flattens out around 200 for curves 1502A-C, curve 1502D flattens out at a value of approximately 190, and curve 1502E flattens out at a value of approximately 185. The simulation in FIG. 15 illustrates that applying increasing amounts of Gaussian blur to pillbox blurred step edges results in a constant sigma-derivative maximum product.
FIG. 16 illustrates one embodiment of a two-dimensional computer simulation 1600 of the sigma-derivative maximum product for different pillbox radius values. Similar to FIG. 16, in FIG. 16, a two-dimensional pillbox blurring function is applied to zero degree two-dimensional step edge. For example and by way of illustration, the step edge used for curve 1602A has a pillbox blurring functions of zero applied to it, while the step edges used for curves 1602B-E has a pillbox blurring functions of five, ten, fifteen, and twenty applied to them, respectively. In general, blurring in the one dimensional case yields different results than blurring in the two dimensional case, because the blurring function for the two case are different.
Furthermore, increasing the amounts of Gaussian blur applied to each pillbox blurred step edge results in curves 1602A-E. As in FIG. 15C, increased blur results in the product of sigma and step edge derivative maxima flattening out to a constant value. For example and by way of illustration, the sigma-derivative maximum product flattens out around 200 for curves 1602A-E. As with FIG. 16, the simulation in FIG. 16 also illustrates that applying increasing amounts of Gaussian blur to pillbox blurred step edges result in a constant sigma-derivative maximum product.
FIGS. 17A-B illustrate one embodiment applying an artificial pillbox blur to an image. In FIG. 17A, an original image 1700 of a baseball player swings a bat is illustrated. Image 1700 has step edges or varying angles, for example, where the boundary of the player intersects with the background.
On the other hand, FIG. 17B illustrates one embodiment of image 1700 that is the result of applying a blurring pillbox function of radius five to image 1700. The resulting image 1702 illustrates a blurred player against a blurred background. Alternate embodiments may apply more or less blurring using a pillbox function and/or an equivalent functions used to blur images.
FIG. 18 illustrates one embodiment of mask 1800 that tracks maxima across gaussian blur. In FIG. 18, image 1800 tracks the derivative maxima of the step edges. Image 1800 illustrates a faint outline of the ballplayer from image 1800. For example and by way of illustration, method 300 generated image 1800 using gaussian blur scale sigma values from between zero to sixteen. In addition, image 1800 illustrates maxima 1802 that tracks the back of the ballplayer.
FIG. 19 illustrates one embodiment of tracking maxima across gaussian blur where locations satisfy a zero slope condition. In FIG. 19, image 1900 tracks the derivative maxima of the step edges that satisfy the zero slope condition. A zero slope condition is where the curves shown in FIG. 16 or 17 flatten out to zero slope. The resulting image 1800 comprises faint outlines that are parts of the ballplayer from image 1700. Because of the zero slope condition, only some of the ballplayer step edges are illustrated in image 1800.
FIG. 20 is a block diagram illustrating one embodiment of an image device control unit that calculates a depth map. In one embodiment, image control unit 104 contains depth map unit 120. Alternatively, image control unit 104 does not contain depth map unit 120, but is coupled to depth map unit 120. Depth map unit 120 comprises picture capture module 2002, auto focus processing module 2004, step edge processing module 2006, picture depth map module 2008, clustering module 2010, pa(x) computation module 2012, blur module 2014, and auto focus normalization curve module 2016. Picture capture module 2002 causes imaging acquisition unit 102 to capture the pictures. Auto focus processing module 2004 processes the auto focus information as illustrated in FIG. 3, block 302. Step edge processing module 2006 locates and scales the step edges in the scan line auto focus curve as illustrated in FIG. 3, blocks 304-310. In addition, picture depth map module 2008 calculates the depth value and map from blur module 2014. Blur module 2014 computes the blur from an associated pa(x) value as illustrated in FIG. 3, block 326. Clustering module 2010 applies a clustering algorithm to the depth map to extract regions containing similar depths and to isolate depth map regions corresponding to outliers and singularities as illustrated in FIG. 3, block 330. Pa(x) computation module 2012 calculates the step edge pa(x) value as illustrated in FIG. 3, block 312-320. Auto focus normalization curve module 2016 computes the auto focus normalization curves for different step edge angles as illustrated in FIG. 3, blocks 322-324.
In practice, the methods described herein may constitute one or more programs made up of machine-executable instructions. Describing the method with reference to the flowchart in FIG. 3 enables one skilled in the art to develop such programs, including such instructions to carry out the operations (acts) represented by logical blocks on suitably configured machines (the processor of the machine executing the instructions from machine-readable media). The machine-executable instructions may be written in a computer programming language or may be embodied in firmware logic or in hardware circuitry. If written in a programming language conforming to a recognized standard, such instructions may be executed on a variety of hardware platforms and for interface to a variety of operating systems. In addition, the present invention is not described with reference to any particular programming language. It will be appreciated that a variety of programming languages may be used to implement the teachings of the invention as described herein. Furthermore, it is common in the art to speak of software, in one form or another (e.g., program, procedure, process, application, module, logic . . . ), as taking an action or causing a result. Such expressions are merely a shorthand way of saying that execution of the software by a machine causes the processor of the machine to perform an action or produce a result. It will be further appreciated that more or fewer processes may be incorporated into the methods illustrated in the flow diagrams without departing from the scope of the invention and that no particular order is implied by the arrangement of blocks shown and described herein.
FIG. 21 shows several computer systems 2100 that are coupled together through a network 2102, such as the Internet. The term “Internet” as used herein refers to a network of networks which uses certain protocols, such as the TCP/IP protocol, and possibly other protocols such as the hypertext transfer protocol (HTTP) for hypertext markup language (HTML) documents that make up the World Wide Web (web). The physical connections of the Internet and the protocols and communication procedures of the Internet are well known to those of skill in the art. Access to the Internet 2102 is typically provided by Internet service providers (ISP), such as the ISPs 2104 and 2106. Users on client systems, such as client computer systems 2112, 2116, 2124, and 2126 obtain access to the Internet through the Internet service providers, such as ISPs 2104 and 2106. Access to the Internet allows users of the client computer systems to exchange information, receive and send e-mails, and view documents, such as documents which have been prepared in the HTML format. These documents are often provided by web servers, such as web server 2108 which is considered to be “on” the Internet. Often these web servers are provided by the ISPs, such as ISP 2104, although a computer system may be set up and connected to the Internet without that system being also an ISP as is well known in the art.
The web server 2108 is typically at least one computer system which operates as a server computer system and is configured to operate with the protocols of the World Wide Web and is coupled to the Internet. Optionally, the web server 2108 may be part of an ISP which provides access to the Internet for client systems. The web server 2108 is shown coupled to the server computer system 2110 which itself is coupled to web content 2112, which may be considered a form of a media database. It will be appreciated that while two computer systems 2108 and 2110 are shown in FIG. 21, the web server system 2108 and the server computer system 2110 may be one computer system having different software components providing the web server functionality and the server functionality provided by the server computer system 2110 which will be described further below.
Client computer systems 2112, 2116, 2124, and 2126 may each, with the appropriate web browsing software, view HTML pages provided by the web server 2108. The ISP 2104 provides Internet connectivity to the client computer system 2112 through the modem interface 2114 which may be considered part of the client computer system 2112. The client computer system may be a personal computer system, a network computer, a Web TV system, a handheld device, or other such computer system. Similarly, the ISP 2106 provides Internet connectivity for client systems 2116, 2124, and 2126, although as shown in FIG. 21, the connections are not the same for these three computer systems. Client computer system 2116 is coupled through a modem interface 2118 while client computer systems 2124 and 2126 are part of a LAN. While FIG. 21 shows the interfaces 2114 and 2118 as generically as a “modem,” it will be appreciated that each of these interfaces may be an analog modem, ISDN modem, cable modem, satellite transmission interface, or other interfaces for coupling a computer system to other computer systems. Client computer systems 2124 and 2116 are coupled to a LAN 2122 through network interfaces 2130 and 2132, which may be Ethernet network or other network interfaces. The LAN 2122 is also coupled to a gateway computer system 2120 which may provide firewall and other Internet related services for the local area network. This gateway computer system 2120 is coupled to the ISP 2106 to provide Internet connectivity to the client computer systems 2124 and 2126. The gateway computer system 2120 may be a conventional server computer system. Also, the web server system 2108 may be a conventional server computer system.
Alternatively, as well-known, a server computer system 2128 may be directly coupled to the LAN 2122 through a network interface 2134 to provide files 2136 and other services to the clients 2124, 2126, without the need to connect to the Internet through the gateway system 2120. Furthermore, any combination of client systems 2112, 2116, 2124, 2126 may be connected together in a peer-to-peer network using LAN 2122, Internet 2102 or a combination as a communications medium. Generally, a peer-to-peer network distributes data across a network of multiple machines for storage and retrieval without the use of a central server or servers. Thus, each peer network node may incorporate the functions of both the client and the server described above.
The following description of FIG. 22 is intended to provide an overview of computer hardware and other operating components suitable for performing the methods of the invention described above, but is not intended to limit the applicable environments. One of skill in the art will immediately appreciate that the embodiments of the invention may be practiced with other computer system configurations, including set-top boxes, hand-held devices, multiprocessor systems, microprocessor-based or programmable consumer electronics, network PCs, minicomputers, mainframe computers, and the like. The embodiments of the invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network, such as peer-to-peer network infrastructure.
FIG. 22 shows one example of a conventional computer system that may be used as encoder or a decoder. The computer system 2200 interfaces to external systems through the modem or network interface 2202. It will be appreciated that the modem or network interface 2202 may be considered to be part of the computer system 2200. This interface 2202 may be an analog modem, ISDN modem, cable modem, token ring interface, satellite transmission interface, or other interfaces for coupling a computer system to other computer systems. The computer system 2202 includes a processing unit 2204, which may be a conventional microprocessor such as an Intel Pentium microprocessor or Motorola Power PC microprocessor. Memory 2208 is coupled to the processor 2204 by a bus 2206. Memory 2208 may be dynamic random access memory (DRAM) and may also include static RAM (SRAM). The bus 2206 couples the processor 2204 to the memory 2208 and also to non-volatile storage 2214 and to display controller 2210 and to the input/output (I/O) controller 2216. The display controller 2210 controls in the conventional manner a display on a display device 2212 which may be a cathode ray tube (CRT) or liquid crystal display (LCD). The input/output devices 2218 may include a keyboard, disk drives, printers, a scanner, and other input and output devices, including a mouse or other pointing device. The display controller 2210 and the I/O controller 2216 may be implemented with conventional well known technology. A digital image input device 2220 may be a digital camera which is coupled to an I/O controller 2216 in order to allow images from the digital camera to be input into the computer system 2200. The non-volatile storage 2214 is often a magnetic hard disk, an optical disk, or another form of storage for large amounts of data. Some of this data is often written, by a direct memory access process, into memory 2208 during execution of software in the computer system 2200. One of skill in the art will immediately recognize that the terms “computer-readable medium” and “machine-readable medium” include any type of storage device that is accessible by the processor 2204 and also encompass a carrier wave that encodes a data signal.
Network computers are another type of computer system that may be used with the embodiments of the present invention. Network computers do not usually include a hard disk or other mass storage, and the executable programs are loaded from a network connection into the memory 2208 for execution by the processor 2204. A Web TV system, which is known in the art, is also considered to be a computer system according to the embodiments of the present invention, but it may lack some of the features shown in FIG. 22, such as certain input or output devices. A typical computer system will usually include at least a processor, memory, and a bus coupling the memory to the processor.
It will be appreciated that the computer system 2200 is one example of many possible computer systems, which have different architectures. For example, personal computers based on an Intel microprocessor often have multiple buses, one of which may be an input/output (I/O) bus for the peripherals and one that directly connects the processor 2204 and the memory 2208 (often referred to as a memory bus). The buses are connected together through bridge components that perform any necessary translation due to differing bus protocols.
It will also be appreciated that the computer system 2200 is controlled by operating system software, which includes a file management system, such as a disk operating system, which is part of the operating system software. One example of an operating system software with its associated file management system software is the family of operating systems known as Windows® from Microsoft Corporation of Redmond, Wash., and their associated file management systems. The file management system is typically stored in the non-volatile storage 2214 and causes the processor 2204 to execute the various acts required by the operating system to input and output data and to store data in memory, including storing files on the non-volatile storage 2214.
In the foregoing specification, the invention has been described with reference to specific exemplary embodiments thereof. It will be evident that various modifications may be made thereto without departing from the broader spirit and scope of the invention as set forth in the following claims. The specification and drawings are, accordingly, to be regarded in an illustrative sense rather than a restrictive sense.

## Claims

1. A computerized method comprising:
receiving an auto focus curve that is associated with a picture of a three dimensional spatial scene, wherein the auto focus curves comprises a step edge; and
computing, by a processor in a camera, a picture depth value using the step edge and an auto focus normalization reference curve, wherein the auto focus normalization reference curve includes a plurality of points and correlates the step edge to a known amount of blurring, and wherein the computing a picture depth comprises,
computing a defocus measurement value for a step edge in the auto focus curve using a one dimensional step edge gradient and a step edge center,
deriving a picture blur value using the defocus measurement value and the auto focus normalization reference curve, and
computing the picture depth value using the picture blur value.

2. The computerized method of claim 1, further comprising:
generating a plurality of auto focus normalization reference curves for different step edge angles.

3. The computerized method of claim 2, further comprising:
selecting the auto focus normalization reference curve from a plurality of auto focus normalization reference curves, where the auto focus normalization reference curve is associated with an attribute selected from the group consisting of a step edge angle and a step edge contrast.

4. The computerized method of claim 1, further comprising:
generating a picture depth map by computing a plurality of picture depth values for a plurality of step edges.

5. The computerized method of claim 4, further comprising:
extracting regions of similar depth from the picture depth map using a clustering algorithm.

6. The computerized method of claim 1, wherein the computing the picture depth value further comprises:
detecting the step edge in the auto focus curve;
shifting the step edge to have a baseline of zero;
computing an one dimensional gradient of the step edge; and
locating a step edge center.

7. The computerized method of claim 6, wherein the computing the picture depth value further comprises:
calculating, from the picture blur value, the picture depth value using the equation





  
    
      d
      o
    
    =
    
      fD
      
        D
        -
        f
        -
        
          2
          ⁢
          
            rf
            number
          
        
      
    
  
  ,




where f is the camera lens focal length, D the distance between the image plane inside the camera and the lens, r is the blur radius of the image on the image plane and fnumber is the fnumber of the camera lens.

8. A non-transitory machine readable storage medium having executable instructions to cause a processor to perform a method comprising:
receiving an auto focus curve, that is associated with a picture of a three dimensional spatial scene, wherein the auto focus curves comprises a step edge; and
computing a picture depth value using the step edge and an auto focus normalization reference curve, wherein the auto focus normalization reference curve includes a plurality of points and correlates the step edge to a known amount of blurring, wherein the computing a picture depth comprises,
computing a defocus measurement value for a step edge in the auto focus curve using a one dimensional step edge gradient and a step edge center,
deriving a picture blur value using the defocus measurement value and the auto focus normalization reference curve, and
computing the picture depth value using the picture blur value.

9. The non-transitory machine readable storage medium of claim 8, further comprising:
generating a plurality of auto focus normalization reference curves for different step edge angles.

10. The non-transitory machine readable storage medium of claim 9, further comprising:
selecting the auto focus normalization reference curve from a plurality of auto focus normalization reference curves, where the auto focus normalization reference curve is associated with an attribute selected from the group consisting of a step edge angle and a step edge contrast.

11. The non-transitory machine readable storage medium of claim 8, further comprising:
generating a picture depth map by computing a plurality of picture depth values for a plurality of step edges.

12. The non-transitory machine readable storage medium of claim 11, further comprising:
extracting regions of similar depth from the picture depth map using a clustering algorithm.

13. The non-transitory machine readable storage medium of claim 8, wherein the computing the picture depth value further comprises:
detecting the step edge in the auto focus curve;
shifting the step edge to have a baseline of zero;
computing an one dimensional gradient of the step edge; and
locating a step edge center.

14. The non-transitory machine readable storage medium of claim 13, wherein the computing the picture depth value further comprises:
calculating, from the picture blur value, the picture depth value using the equation





  
    
      d
      o
    
    =
    
      fD
      
        D
        -
        f
        -
        
          2
          ⁢
          
            rf
            number
          
        
      
    
  
  ,




where f is the camera lens focal length, D the distance between the image plane inside the camera and the lens, r is the blur radius of the image on the image plane and fnumber is the fnumber of the camera lens.

15. An apparatus comprising:
means for receiving an auto focus curve, that is associated with a picture of a three dimensional spatial scene, wherein the auto focus curves comprises a step edge; and
means for computing a picture depth value using the step edge and an auto focus normalization reference curve, wherein the auto focus normalization reference curve includes a plurality of points and correlates the step edge to a known amount of blurring and the means for computing the picture depth value comprises
means for computing a defocus measurement value for the step edge using the one dimensional step edge gradient and step edge center,
means for deriving a picture blur value using the defocus measurement value and the auto focus normalization reference curve, and
means for computing the picture depth value using the picture blur value.

16. The apparatus of claim 15, further comprising:
means for generating a plurality of auto focus normalization reference curves for different step edge angles.

17. The apparatus of claim 16, further comprising:
means for selecting the auto focus normalization reference curve from a plurality of auto focus normalization reference curves, where the auto focus normalization reference curve is associated with an attribute selected from the group consisting of a step edge angle and a step edge contrast.

18. The apparatus of claim 15, further comprising:
means for generating a picture depth map by computing a plurality of picture depth values for a plurality of step edges.

19. The apparatus of claim 15, wherein the means for computing the picture depth value further comprises: means for detecting the step edge in the auto focus curve; means for shifting the step edge to have a baseline of zero; means for computing an one dimensional gradient of the step edge; and means for locating a step edge center.

20. A system comprising:
a processor;
a memory coupled to the processor though a bus; and

a process executed from the memory by the processor to cause the processor to receive an auto focus curve, that is associated with a picture of a three dimensional spatial scene, wherein the auto focus curves comprises a step edge; and compute a picture depth value using the step edge and an auto focus normalization reference curve, wherein the auto focus normalization reference curve includes a plurality of points and correlates the step edge to a known amount of blurring and the process further causes the processor to compute a defocus measurement value for the step edge using the one dimensional step edge gradient and step edge center, derive a picture blur value using the defocus measurement value and the auto focus normalization reference curve, and compute the picture depth value using the picture blur value.

21. The system of claim 20, wherein the process further causes the processor to generate a plurality of auto focus normalization reference curves for different step edge angles.

22. The system of claim 21, wherein the process further causes the processor to select the auto focus normalization reference curve from a plurality of auto focus normalization reference curves, where the auto focus normalization reference curve is associated with an attribute selected from the group consisting of a step edge angle and a step edge contrast.

23. The system of claim 20, wherein the process further causes the processor to generate a picture depth map by computing a plurality of picture depth values for a plurality of step edges.

24. The system of claim 20, wherein the process further causes the processor to detect the step edge in the auto focus curve, shift the step edge to have a baseline of zero, compute an one dimensional gradient of the step edge, and locate a step edge center.