Scene-based method for determining focus
A method and application specific integrated circuit for determining focus for an image capture system using scene content within an image, including the steps of: acquiring, from the image, image data having different focus positions; dividing the image data into sub-images; calculating a sub-image sharpness value for each sub-image; calculating an image sharpness value for each focus position using the sub-image sharpness values; plotting the sharpness values versus the focus position; fitting a curve to the plot of the image sharpness values versus the focus position, wherein the curve has a peak sharpness value; and determining the focus of the image capture system from a point on the curve.
Latest Eastman Kodak Company Patents:
- Coating providing ultraviolet scattering
- Flexographic printing with repeating tile including different randomly-positioned feature shapes
- Light-blocking elements with color-masking compositions
- Flexographic printing with repeating tile of randomnly-positioned feature shapes
- Lithographic printing plate precursors and method of use
[0001] The present invention relates generally to a method for determining the focus of image capture systems, for example cameras, input scanners, or document copiers, and in particular to a system and method for determining focus in such systems.
BACKGROUND OF THE INVENTION[0002] FIG, 1 illustrates an image capture system, such as a camera, including an imaging optics 10 having a focal length, f and an imaging sensor 12, wherein the focal length is a property of the imaging optics 10. An object 14 at a distance do in front of the camera will be properly focused at the imaging sensor 12 at a distance di behind the imaging optics 10 if the relationship between do, di, and f is 1 1 d o + 1 d i = 1 f ( Equation ⁢ ⁢ 1 )
[0003] If the camera-to-object distance changes to a distance do±&dgr;0 in front of the camera, as illustrated in FIG. 2, then the image will be out of focus by a distance &dgr;i given by 2 δ i = ± d i ( 1 - 1 1 + d i d o - d i d o ± δ o ) ( Equation ⁢ ⁢ 2 )
[0004] Similarly, the image will be out of focus by &dgr;i, if the focal length of the camera changes such that the focal plane is moved to a distance di-&dgr;i behind the imaging optics. No adverse effect to image quality will be perceived, if &dgr;i is within the depth of focus of the image capture system, given by 3 δ i ′ = ± 2 ⁢ ⁢ λ ⁡ ( f D ) 2 ( Equation ⁢ ⁢ 3 )
[0005] where D is the entrance aperture diameter of the image capture system. The corresponding depth of field &dgr;′o is given by 4 δ o ′ = ± 2 ⁢ ⁢ λ ⁡ ( d o D ) 2 ( Equation ⁢ ⁢ 4 )
[0006] hence objects within the range of do±&dgr;′o will not appear out of focus.
[0007] The correct focus of an image capture system can change over time due to dynamic changes to the system, such as those caused by the thermal environment. When the focal length changes the depth of field by more than &dgr;′or the camera-to-object distance changes more than &dgr;′0, it is necessary to refocus the image capture system. Many methods for correcting the focus of the imaging system have been disclosed in prior art, with most methods requiring additional optics and sensors. Scene-based methods have the advantage that focus is determined by analyzing the image data collected of the scene, usually using the same optics and detector used to acquire the in-focus images.
[0008] Prior scene-based methods for determining the focus have been proposed that compare the sharpness between image data formed at various focus positions. The focus method disclosed in U.S. Pat. No. 4,183,642 by Fukuoka, on Jan. 15, 1980, titled “AUTOMATIC FOCUSING DEVICES,” finds a focus position that maximizes the contrast difference between adjacent pixels as the focus changes between images. Many scene-based methods assume that the plurality of images collected at different focus positions do not shift, rotate, or change in scale; thus the only change between the images on a pixel-per-pixel basis is the change in focus. If the imaging system moves between images, then these methods with such an assumption do not work well, unless the plurality of images are spatially registered to sub-pixel accuracy.
[0009] The relative shift between images can be avoided by imaging the same scene multiple times at different focus positions, simultaneously, through the same boresight to determine focus. One such method proposed in U.S. Pat. No. 5,166,506 by Fiete et al. on Nov. 24, 1992, titled “METHOD FOR DETERMINING AN IMAGING SYSTEM FOCUS ERROR,” uses beam splitters to image the scene onto a plurality of sensors. This method, however, requires additional optical elements and the beam splitters reduce the signal arriving at each sensor. The method proposed in U.S. Pat. No. 6,023,056 by Fiete et al. on Feb. 8, 2000, titled “SCENE-BASED AUTOFOCUS METHOD,” correlates a step function with the edges in the scene at various focus positions, thus it is insensitive to changes in scale, rotation, and position; but the location of the edges are usually not known, hence, requiring the calculation of the edge correlation for all of the image data, which can be computationally intensive for large images.
[0010] There is a need therefore for a scene-based focus method that is not computationally intensive, does not require precise alignment or spatial registration of a plurality of images collected at different focus positions, and does not require additional optical elements in the design of the image capture system.
SUMMARY OF THE INVENTION[0011] The present invention is directed to overcoming one or more of the problems set forth above. Briefly summarized, according to one aspect of the present invention, the object of the present invention is to provide a method that determines the focus of an image for an image capture system. The image capture system includes an image processor that determines the focus position from the acquired image. According to the present invention, a method of determining focus in an image capture system of the type having an image sensor, optics for forming an image of a scene on the image sensor, and an image processor for determining the focus. Image data is acquired having different focus positions. The image data may be acquired from one or more images. The image data is divided into sub-images and a sharpness value is calculated for each sub-image. The sharpness values for each sub-image are used to produce a sharpness value for each focus position. The sharpness values are plotted versus the focus position and a curve is fit to the plot. The focus of the imaging system is determined from a point on the curve.
ADVANTAGEOUS EFFECT OF THE INVENTION[0012] The present invention has the advantage of determining the focus of an image capture system using image data of a scene, without additional optics or sensors, and without requiring precise alignment or registration between the plurality of images.
BRIEF DESCRIPTION OF THE DRAWINGS[0013] The above and other objects, features, and advantages of the present invention will become more apparent when taken in conjunction with the following description and drawings wherein identical reference numerals have been used, where possible, to designate identical features that are common to the figures, and wherein:
[0014] FIGS. 1 and 2 are schematic diagrams of a prior art imaging system useful in describing the background of the present invention, showing the imaging system in and out of focus respectively;
[0015] FIG. 3 is a schematic diagram of a focus detecting system according to one embodiment of the present invention;
[0016] FIG. 4 shows the image processing steps, according to the present invention, for determining the focus;
[0017] FIG. 5 illustrates the image processing steps, according to the present invention, for determining the sharpness value for each image;
[0018] FIG. 6 illustrates the plot of Sn as a function of z with the initial curve fit; and
[0019] FIG. 7 illustrates the plot of Sn as a function of z with the final curve fit and Zpeak determined.
[0020] To facilitate understanding, identical reference numerals have been used, where possible, to designate identical elements that are common to the figures.
DETAILED DESCRIPTION OF THE INVENTION[0021] It will be understood that the computer program product of the present invention may make use of image manipulation algorithms and processes that are well known. Accordingly, the present description will be directed in particular to those algorithms and processes forming part of, or cooperating more directly with, the method of the present invention. Thus, it will be understood that the computer program product embodiment of the present invention may embody algorithms and processes not specifically shown or described herein that are useful for implementation. Such algorithms and processes are conventional and within the ordinary skill in such arts.
[0022] Other aspects of such algorithms and systems, and hardware and/or software for producing and otherwise processing the images involved or co-operating with the computer program product of the present invention, are not specifically shown or described herein and may be selected from such algorithms, systems, hardware, components, and elements known in the art.
[0023] The computer program for performing the method of the present invention may be stored in a computer readable storage medium. This medium may comprise, for example: magnetic storage media such as a magnetic disk (such as a hard drive or a floppy disk) or magnetic tape; optical storage media such as an optical disc, optical tape, or machine readable bar code; solid state electronic storage devices such as random access memory (RAM), or read only memory (ROM); or any other physical device or medium employed to store a computer program. The computer program for performing the method of the present invention may also be stored on computer readable storage medium that is connected to the image processor by way of the Internet or other communication medium. Those skilled in the art will readily recognize that the equivalent of such a computer program product may also be constructed in hardware or firmware known as application specific integrated circuits (ASICs). An ASIC may be designed on a single silicon chip to perform the method of the present invention. The ASIC can include the circuits to perform the logic, microprocessors, and memory necessary to perform the method of the present invention. Multiple ASICs may be envisioned and employed as well for the present invention.
[0024] Referring to FIG. 3, a focus detecting system, according to the present invention, includes an image capture system 5, including imaging optics 10, an imaging sensor 12, and an image processor 18 used to determine the focus position 17. The method for determining the focus position 17 in the present invention requires the image capture system 5 to acquire image data such that the focus position changes for different sets of image data. In one embodiment, a plurality of N images 16, each denoted by in(x,y), with each image captured at a different focus position. The focus position 17 can be changed by changing the focal length of the imaging system 5 or by moving the imaging sensor 12. Let N be the total number of images captured for determining the focus position 17 and let n be the number of the image collected (1≦n≦N). The number of images N needs to be greater than 2, and the accuracy of the focus estimation will improve with increasing N.
[0025] In another embodiment, focus can be determined from a single image when a linear imaging sensor scans the scene 14, shown in FIG. 2, and changes the focus into N steps during the acquisition of the image. The lines of image data that share a common focus position become in(x,y). This embodiment performs well when the scene information is similar throughout the image. The embodiment using a plurality of images will be illustrated for the rest of the detailed discussion of the invention and it is understood that the plurality of images can be sections of image data in another embodiment.
[0026] The direction of the changing focus position 17 in the imaging system will be denoted as the z direction. The focus position 17 can be changed using many different methods, such as using a single imaging sensor and changing the focus by changing the focal length of the imaging system or the location z of the imaging sensor. Another method of acquiring a plurality of images at different focus positions uses different imaging sensors at different z locations. If different imaging sensors are used, then they must all be calibrated properly to remove detector response differences between the different sensors. In one embodiment, a single imaging detector is used and the focus position is changed by changing the distance di.
[0027] Each image in(x,y) is acquired with the focus position 17 at a different location z. The focus position should be within the range of focus change used to capture the image in(x,y). The range of defocus from the first image, il(x,y), to the last image, iN(x,y), should span a range much greater (e.g. 4 times greater) than the depth of focus of the image capture system, defined in Equation 3 above. The focus position z is recorded for each image in(x,y) and stored in the image processor 18. This is necessary so that a sharpness value calculated for each image can later be referenced to the corresponding focus position z.
[0028] The image processor 18 in FIG. 3 processes the images, in(x,y), to determine the value of z for focus position 17. The flow diagram 19 for the image processor 18 is shown in FIG. 4 and corresponding steps 20-28 of flow diagram 19 are illustrated in FIG. 5. In operation 20, shown in FIG. 5, each image in(x,y) is read into the processor and then operation 22 divides it into M sub-images, where m is the number of the sub-image (1≦m≦M). In one embodiment, the sub-images are divided into sub-images of size 8×8 pixels. In operation 24, a sharpness metric is used to calculate a sharpness value Smn for each sub-image. The sharpness metric can be any metric that relates to the variations of the image data. Candidate metrics include variance, covariance, skewness, kurtosis, energy, entropy, contrast, edge filtering, texture, and power spectrum of the image. In one embodiment the sub-image sharpness metric for calculating Smn is the variance of the image data within the sub-image. If the sub-image contains K pixels, then the sub-image sharpness metric of the mth sub-image in the nth image is given by 5 S mn = ∑ k = 1 K ⁢ ( i mn ⁡ ( k ) - i _ mn ) 2 K - 1 = K ⁢ ⁢ ∑ k = 1 K ⁢ i mn 2 ⁡ ( k ) - ( ∑ k = 1 K ⁢ i mn ⁡ ( k ) ) 2 K ⁡ ( K - 1 ) ( Equation ⁢ ⁢ 5 )
[0029] where {overscore (i)}mn is the mean of the image data within the sub-image.
[0030] The sub-image sharpness values Smn are used to calculate an image sharpness value Sn for each focus position. In one embodiment, operation 26 rank-orders the sub-image sharpness values from highest to lowest to form a list of values Smn (r), where r is the ranking number of the sub-image sharpness value. A summing operation 28 for a predetermined number R of sub-image sharpness values are summed to calculate an image sharpness value Sn, given by 6 S n = ∑ r = 1 R ⁢ S mn ⁡ ( r ) ( Equation ⁢ ⁢ 6 )
[0031] If R=1, then sharpness value for each image equals the highest sub-image sharpness value within each image. If R=M, then the sharpness value for each image is the sum of all of the sub-image sharpness values for that image, given by 7 S n ⁡ ( R = M ) = ∑ m = 1 M ⁢ S mn = ∑ m = 1 M ⁢ K ⁢ ⁢ ∑ k = 1 K ⁢ i mn 2 ⁡ ( k ) - ( ∑ k = 1 K ⁢ i mn ⁡ ( k ) ) 2 K ⁡ ( K - 1 ) ( Equation ⁢ ⁢ 7 )
[0032] The value for R can be chosen experimentally, i.e. the value for R that results in the most accurate determination of the proper focus from test data, or R can be calculated from image parameters, such as the number of sub-image sharpness values that are above a calculated noise level.
[0033] Some scenes do not contain enough high spatial frequency content to provide a significant change in the sharpness value as the focus position changes. Operation 30 of FIG. 4 performs an image metric, based on the image content, to determine whether or not the image data is valid for providing a measure for focus within the accuracy defined by the user. The image data will not be used if the metric determines that the image data cannot provide an accurate measure for focus. In one embodiment, two metrics are used to determine the validity of the image data. The first metric calculates the normalized variance of the image sharpness values, given by 8 A var = σ S n 2 S _ n = ∑ m = 1 M ⁢ ( S n - S _ n ) 2 ∑ m = 1 M ⁢ S n ( Equation ⁢ ⁢ 8 )
[0034] where &sgr;sn2 is the variance and {overscore (S)}n is the mean of the image sharpness values. Avar is compared to a threshold Tvar. If Avar<Tvar, then the image data is rejected for determining an accurate measure of focus. The second metric used in one embodiment calculates the normalized range of the image sharpness values, given by 9 A range = MAX ⁡ ( S n ) - MIN ⁡ ( S n ) S _ n ( Equation ⁢ ⁢ 9 )
[0035] where MAX(Sn) is the maximum value and MIN(Sn) is the minimum value of the image sharpness values. Arange is compared to a threshold Trange. If Arange<Trange, then the image data is rejected for determining an accurate measure of focus. In one embodiment, the values used for Tvar and Trange are derived from experimental data.
[0036] Operation 32 plots the image sharpness value Sn, for each image, in(x,y) versus the corresponding focal plane position z recorded for each image in(x,y). Subsequently operation 34 fits a curve 42 to the plot of Sn as a function of z, as illustrated in FIG. 6. In one embodiment of the invention a fifth order polynomial is used to fit the curve 42 to the plot. In another embodiment of the invention a mathematical model of the focus curve derived from empirical measurements is used to fit the curve 42 to the plot.
[0037] A statistical analysis operation 36 removes statistical outlier data points 44 (shown in FIG. 6) from further analysis. The statistical outliers 44 will be defined as points lying outside a boundary that is dependent on the standard error of estimate se, given by 10 s e = ∑ n = 1 N ⁢ [ S n - S ^ n ] 2 N - 2 ( Equation ⁢ ⁢ 10 )
[0038] where Ŝn is the curve fit 42 to Sn. Values of Sn that do not satisfy the condition |Sn−Ŝn|<Ts are determined to be outliers. The outlier threshold Ts is proportional to se and is typically set equal to 3se.
[0039] The statistical outliers 44 are removed from the plot and operation 38 fits a new curve 46 to the plot, as illustrated in FIG. 7. Finally, operation 40 determines the value Zpeak that corresponds to the peak of the curve 46. The focus position z that results in the focus and the sharpest image quality is Zpeak. In one embodiment, the focus position of the imaging system is adjusted to Zpeak. In another embodiment, the focus position of the imaging system is adjusted to a position within the depth of focus of Zpeak.
[0040] The method of determining focus according to the present invention was applied to an image capture system designed for remote imaging and compared to prior art methods of deter-mining focus. The method of the present invention proved more easily implemented than the methods of the prior art, and was consistently capable of determining focus. The method proved surprisingly robust across different type of scenes, even for scenes that did not appear to contain a great deal of edge information.
[0041] The invention has been described with reference to a preferred embodiment; However, it will be appreciated that variations and modifications can be effected by a person of ordinary skill in the art without departing from the scope of the invention.
PARTS LIST[0042] 5 imaging system
[0043] 10 imaging optics
[0044] 12 imaging sensor
[0045] 14 object in scene
[0046] 16 image data acquired at different focus positions
[0047] 17 focus position z
[0048] 18 image processor
[0049] 19 flow diagram
[0050] 20 read image in(x,y) into the image processor operation
[0051] 22 divide the image into sub-images operation
[0052] 24 calculate the sub-image sharpness value operation
[0053] 26 rank order the sub-image sharpness values operation
[0054] 28 sum the highest R sub-image sharpness values operation
[0055] 30 determine data validity operation
[0056] 32 create plot operation
[0057] 34 generate initial curve fit operation
[0058] 36 remove outliers operation
[0059] 38 generate curve fit operation
[0060] 40 determine the peak of the curve operation
[0061] 42 initial curve fit to image sharpness values
[0062] 44 data outliers
[0063] 46 final curve fit to image sharpness values
Claims
1. A method of determining focus for an image capture system using scene content within an image, comprising the steps of:
- a) acquiring, from the image, image data having different focus positions;
- b) dividing the image data into sub-images;
- c) calculating a sharpness value for each sub-image;
- d) calculating an image sharpness value for each focus position using the sub-image sharpness values;
- e) plotting the image sharpness value versus the focus position;
- f) fitting a curve to the plot of the image sharpness values versus the focus position, wherein the curve has a peak sharpness value; and
- g) determining the focus of the image capture system from a point on the curve.
2. The method of determining focus claimed in claim 1, wherein the point on the curve is within a depth of focus relative to the image capture system.
3. The method of determining focus claimed in claim 1, wherein the point on the curve is at a peak of the curve.
4. The method of determining focus claimed in claim 1, further comprising the step of performing the steps a-g for each desired image prior to capturing the desired image.
5. The method of determining focus claimed in claim 1, wherein the sub-image sharpness values are calculated from one or more equations selected from the group consisting of variances, covariances, skewness, kurtosis, energy, entropy, contrast, edges, textures, and a power spectrum of the image.
6. The method of determining focus claimed in claim 1, wherein the image sharpness value is calculated by summing some or all of the sub-image sharpness values.
7. The method of determining focus claimed in claim 1, wherein the image sharpness value is calculated by rank-ordering the sub-image sharpness values into high and/or low ranks and summing some or all of the highest sub-image sharpness values.
8. The method of determining focus claimed in claim 7, wherein the number of sub-image sharpness values summed is determined from the image data.
9. The method of determining focus claimed in claim 1, further comprising the step of rejecting data that does not meet specified criteria.
10. The method of determining focus claimed in claim 1, further comprising the step of eliminating sub-image sharpness values prior to fitting the curve to the plot of image sharpness values versus focus position.
11. The method of determining focus claimed in claim 1, wherein the image capture system is selected from the group consisting of a camera, a remote sensing system, an input scanner, and a document copier.
12. A method of determining focus for an image capture system using scene content from a plurality of images, comprising the steps of:
- a) acquiring image data from the plurality of images, wherein the plurality of images have different focus positions;
- b) dividing the image data into sub-images;
- c) calculating a sub-image sharpness value for each sub-image;
- d) calculating an image sharpness value for each focus position using the sub-image sharpness values;
- e) plotting the sharpness value versus the focus position;
- f) fitting a curve to the plot of the image sharpness values versus the focus position, wherein the curve has a peak sharpness value; and
- g) determining the focus of the image capture system from a point on the curve.
13. The method of determining focus claimed in claim 12, wherein the point on the curve is within a depth of focus relative to the image capture system.
14. The method of determining focus claimed in claim 12, wherein the point on the curve is at a peak of the curve.
15. The method of determining focus claimed in claim 12, further comprising the step of performing the steps a-g for each desired image prior to capturing the desired image.
16. The method of determining focus claimed in claim 12, wherein the sub-image sharpness values are calculated from one or more equations selected from the group consisting of variances, covariances, skewness, kurtosis, energy, entropy, contrast, edges, textures, and a power spectrum of the image.
17. The method of determining focus claimed in claim 12, wherein the image sharpness value is calculated by summing some or all of the sub-image sharpness values.
18. The method of determining focus claimed in claim 12, wherein the image sharpness value is calculated by rank-ordering the sub-image sharpness values into high and/or low ranks and summing some or all of the highest sub-image sharpness values.
19. The method of determining focus claimed in claim 18, wherein the number of sub-image sharpness values summed is determined from the image data.
20. The method of determining focus claimed in claim 12, further comprising the step of rejecting data that does not meet specified criteria.
21. The method of determining focus claimed in claim 12, further comprising the step of eliminating sub-image sharpness values prior to fitting the curve to the plot of image sharpness values versus focus position.
22. The method of determining focus claimed in claim 12, wherein the image capture system is selected from the group consisting of a camera, a remote sensing system, an input scanner, and a document copier.
23. An application specific integrated circuit for performing the steps of:
- a) acquiring, from an image, image data having different focus positions;
- b) dividing the image data into sub-images;
- c) calculating a sub-image sharpness value for each sub-image;
- d) calculating an image sharpness value for each focus position using the sub-image sharpness values;
- e) plotting the image sharpness value versus the focus position;
- f) fitting a curve to the plot of the image sharpness values versus the focus position, wherein the curve has a peak sharpness value; and
- g) determining the focus of the image capture system from a point on the curve.
24. An application specific integrated circuit for performing the steps of:
- a) acquiring image data from a plurality of images, wherein the plurality of images have different focus positions;
- b) dividing the image data into sub-images;
- c) calculating a sub-image sharpness value for each sub-image;
- d) calculating an image sharpness value for each focus position using the sub-image sharpness values;
- e) plotting the image sharpness value versus the focus position;
- f) fitting a curve to the plot of the image sharpness values versus the focus position, wherein the curve has a peak sharpness value; and
- g) determining the focus of the image capture system from a point on the curve.
25. A computer storage medium having instructions stored thereon for causing a computer to perform the method of claim 1.
26. A computer storage medium having instructions stored thereon for causing a computer to perform the method of claim 12.
27. A computer storage medium having instructions stored thereon for causing a computer to perform the method of claim 13.
28. A computer storage medium having instructions stored thereon for causing a computer to perform the method of claim 14.
29. A computer storage medium having instructions stored thereon for causing a computer to perform the method of claim 18.
30. The application specific integrated circuit according to claim 24 for performing the step of calculating the sub-image sharpness values by rank-ordering the sub-image sharpness values into high and/or low ranks and summing some or all of the highest sub-image sharpness values.
31. The application specific integrated circuit according to claim 24 for performing the step of calculating the sub-image sharpness values by summing some or all of the sub-image sharpness values.
Type: Application
Filed: May 1, 2003
Publication Date: Nov 4, 2004
Patent Grant number: 7171054
Applicant: Eastman Kodak Company
Inventors: Robert D. Fiete (Fairport, NY), David C. Wilbur (Rocheser, NY), Theodore A. Tantalo (Rochester, NY), Laura W. Loggi (Hilton, NY)
Application Number: 10427398
International Classification: G03B003/00; G02B007/04;