# Patent

## Title
Method for focusing by using a pre-flash

## Abstract

A method for focusing by using a pre-flash is provided. The method includes the following steps. First, the image sensor captures a first image of the object, wherein the average brightness of the first image is calculated to be Y0. Next, the image sensor captures a second image of the object with the aid of a first pre-flash having a first energy, wherein the average brightness of the second image is calculated to be Y1. Afterwards, the image sensor captures a third image of the object with the aid of a second pre-flash having a second energy, wherein the average brightness of the third image is calculated to be Y2. Then, the distance D to the object is calculated according to the brightness Y0 and the difference ΔY between Y1 and Y2. Finally, the image sensor adjusts the focus according to the distance D.

## Background
CROSS-REFERENCE TO RELATED APPLICATION
This application claims the priority benefit of Taiwan application serial no. 94108738, filed on Mar. 22, 2005. All disclosure of the Taiwan application is incorporated herein by reference.
BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates to an automatic focusing method, and particularly to a method for focusing by using a pre-flash.
2. Description of Related Art
Nowadays, the technology of digital cameras and digital camcorders is ever-developing, and the conventional disadvantages such as complicated operation and poor portability in the conventional cameras or analogue camcorders are improved. Nearly all the recent digital cameras have built-in auto-focus mode and multiple manual focus modes provided for the users to properly focus the object. Also, without auxiliary focusing system to measure the distance, a conventional digital camera operating in a dark environment or insufficient light in the indoors could easily lose focus when using only the brightness data obtained from the image sensor. Therefore, some newly developed auxiliary focusing systems mounted with, for example, projection focus auxiliary light or even infrared focus function, are introduced. Unfortunately, such high-end digital cameras are rather costly.
An auto-focus complementary device is disclosed to use a red-eye-reduction means as an auxiliary focusing device, and the method thereof is disclosed therewith. As shown in FIG. 1, the method includes the following steps. Firstly, at step S401, a flash module flashes and provides red-eye-reduction function. Next, at step S402, it is determined whether the brightness provided is proper or not. If it is too dark, then set the focus to a predetermined far position, for example, 3 meters away (as shown in step S406). If it is too bright, then move the focus to a predetermined near position, for example, 1 meter away (as shown in step S405). If the brightness is proper, then roughly adjust the focus of the image capturing means according to the focus data captured by the image sensor at step S403. Afterward, capture the estimated focus of the object sequentially to finely adjust the focus as the red-eye-reduction means flashes sequentially at step S404.
Nevertheless, the red-eye-reduction means is only adapted to short-distance shots for facial expression. As to other short-distance shots for, such as pictures or articles, the auto-focusing effect is not obvious, especially those under insufficient indoor light. Furthermore, the brightness sensed by the image sensor is not equal to the brightness sensed by the red-eye-reduction means when it flashes. And whenever the red-eye-reduction means flashes, the auto-focus module would finely adjust the focus, sometimes even up to four or five times, which is time consuming and power wasting.
SUMMARY OF THE INVENTION
In view of the above, an object of the present invention is to provide a method for focusing by using a pre-flash for enhancing focusing accuracy without adding extra devices.
Another object of the present invention is to provide a method for focusing by using a pre-flash for shortening focus adjusting time and saving power.
The present invention provides a method for focusing by using a pre-flash. The method includes the following steps. First, the image sensor captures a first image of an object, wherein the average brightness of the first image is calculated to be Y0. Next, the image sensor captures a second image of the object with the aid of a first pre-flash having a first energy, wherein the average brightness of the second image is calculated to be Y1. Afterward, the image sensor captures a third image of the object with the aid of a second pre-flash having a second energy, wherein the average brightness of the third image is calculated to be Y2. Then, calculate the distance D to the object according to the brightness Y0 and the difference ΔY between Y1 and Y2. Finally, the image sensor adjusts the focus according to the distance D.
According to an embodiment of the invention, Y0 is, for example, smaller than a predetermined minimum YL, and the first energy is not equal to the second energy.
According to an embodiment of the invention, the distance D to the object can be obtained by either checking a conversion table that records a corresponding value of D with respect to Y0 and ΔY, or calculating from an equation that represents the relationship between D, Y0, and ΔY, wherein the conversion table or the equation are obtained from previous collected experiment data, for example.
According to an embodiment of the invention, the method further includes obtaining a reflection ratio R of the third image for calculating the distance D to the object according to Y0, ΔY and the reflection ratio R. The relationship between Y0, ΔY, the reflection ratio R and the distance D to the object is obtained from previously collected experiment data, for example. In addition, the reflection ratio R is the ratio of the area in the third image having brightness greater than a predetermined value YT to the whole area of the third image. The predetermined value YT is obtained from previous collected experiment data, for example.
Instead of adding extra expensive auxiliary focusing module or modifying the original system structure with extra budget, the present invention employs the pre-flash function to obtain the distant D to the object to be photographed, by which the image sensor can improve the focusing accuracy to measure the distance to the object to be photographed under insufficient indoor light for capturing a clear image.



BRIEF DESCRIPTION OF THE DRAWINGS
The accompanying drawings are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
FIG. 1 is a flowchart of an auto-focus complementary device using an red-eye-reduction means as an image capturing device shown in the prior art.
FIG. 2 is a flowchart diagram of a method for focusing by using a pre-flash according to an embodiment of the present invention.
FIG. 3 is a curve diagram of the relationship between the difference ΔY and the distance to the object to be photographed.
FIG. 4 is a schematic diagram of a focusing process conducted by a system employing a method for focusing by using a pre-flash according to an embodiment of the present invention.



DESCRIPTION OF THE EMBODIMENTS
According to an embodiment of a method for focusing by using a pre-flash of the present invention, Y0 is preferred to be smaller than a predetermined minimum YL. According to the embodiment of the method for focusing by using a pre-flash of the present invention, the first energy is preferred to be substantially unequal to the second energy. According to the embodiment of the method for focusing by using a pre-flash of the present invention, the distance D to the object corresponding to Y0 and ΔY can be obtained by either checking a conversion table, or calculating from an equation. It is more preferred that the conversion table or the equation is obtained from previously collected experiment data. According to the embodiment of the method for focusing by using a pre-flash of the present invention, the distance D to the object is preferred to be obtained from Y0, ΔY and the reflection ratio R. Preferably, the relationship between the Y0, ΔY, the reflection ratio R and the distance D to the object is obtained from previously collected experiment data, wherein the reflection ratio R represents the ratio of the area in the third image having brightness greater than a predetermined value YT to the whole area of the third image. Preferably, the predetermined value YT is obtained from previously collected experiment data, for example.
FIG. 2 is a flowchart of a method for focusing by using a pre-flash according to an embodiment of the present invention. Referring to FIG. 2, the method for focusing by using a pre-flash includes the following steps. First, at step S110, the image sensor captures a first image of an object, wherein the average brightness of the first image is calculated to be Y0. Then, at step S120, the image sensor captures a second image of the object with the aid of a first pre-flash having a first energy, wherein the average brightness of the second image is calculated to be Y1. Afterward, at step S130, the image sensor captures a third image of the object with the aid of a second pre-flash having a second energy, wherein the average brightness of the third image is calculated to be Y2. Subsequently, at steps S140 and S150, the distance D to the object is calculated according to the brightness Y0 and the difference ΔY between Y1 and Y2, and then the image sensor adjusts the focus according to the distance D.
In the foregoing step S110, the image sensor calculates the average brightness Y0 of the first image by previewing an image of the object to be photographed, for example. When an image capturing device (such as a digital camera) is operating, the previewing function can be started by an internal image sensor module. The previewing function includes evaluating the environment brightness, fundamentally judging the distance to the object to be photographed, and displaying the obtained environmental brightness and distance to the object on an image window (such as an LCD window) for the users reference.
The foregoing steps S120 to S150 of the focusing process using a pre-flash are performed step by step as follows. The process is especially adapted to the condition when the average brightness Y0 is smaller than a predetermined minimum YL. At step S120, with the aid of a first pre-flash having a first energy, the image sensor captures the second image of the object and calculates average brightness Y1 of the second image. At step S130, with the aid of a second pre-flash having a second energy, the image sensor again captures the third image of the object and calculates the average brightness Y2 of the third image. The first energy is relatively lower then the second energy so that the average brightness Y1 is lower than the average brightness Y2 i.e. (Y1<Y2). However, in another embodiment, the first energy may be higher than the second energy so that the average brightness Y1 is higher than the average brightness Y2 i.e. (Y1>Y2).
After that, the steps S140 and S150 are performed. At step S140, the difference ΔY between the average brightness Y1 and the average brightness Y2 is calculated, wherein ΔY=|Y1−Y2|, and the distance D to the object to be photographed is calculated according to the brightness Y0 and the difference ΔY. The image sensor further adjusts the focus according to the distance D. Referring to FIG. 3, it is a curve diagram of the relationship between the difference ΔY and the distance to the object to be photographed, wherein the y-axis represents the difference ΔY between the average brightness Y1 and the average brightness Y2, the x-axis represents the distance D to the object. Each point on the real line represents the distances to the object corresponding to the difference ΔY when the environment brightness is relatively high, whereas the each point on the dashed line represents the distance D to the object corresponding to the difference ΔY when the environment brightness is relatively low.
According to an embodiment of the present invention, the foregoing experiment data can be previously built in a database of the digital capturing device, the embodiment including a rapid focusing process of obtaining the distance D to the object by either checking the corresponding value of Y0 and ΔY from a conversion table, or calculating the corresponding value of Y0 and ΔY by an equation. That is, the conversion table may record a corresponding value of D with respect to Y0 and ΔY from previously collected experiment data. The equation also may represent the relationship between D, Y0, and ΔY from previously collected experiment data.
Furthermore, the focusing process using pre-flash function may include obtaining a reflection ratio R. The reflection ratio R represents the ratio of the area in the third image having brightness greater than a predetermined value YT to the whole area of the third image, and the predetermined value YT is obtained, for example, from previously collected experiment data. In addition, the distance D to the object can be obtained from Y0, ΔY and the reflection ratio R, and the relationship between the Y0, ΔY, the reflection ratio R and the distance D to the object is obtained from previously collected experiment data, for example.
Therefore, at step S150, the system may obtain the distance to the object to be photographed according to a built-in data checking table, and thus deduce an optimum focusing value for further adjusting the focus of the image sensor. In particular, the focus of the image sensor is adjusted once, but not multiple times.
FIG. 4 is a schematic diagram of a focusing process by a system employing a method for focusing by using a pre-flash according to the present invention. Referring to FIG. 4, the focusing process includes the following steps. First, at step S110, the average brightness Y0 of the first image is calculated. When the average brightness Y0 is greater than a predetermined minimum YL, perform an ordinary auto-focus process to adjust the focus as shown in steps S112 to S114, and then perform step S116 of photo taking, including pressing the shutter to start an image sensor to capture an image containing an object to be photographed for obtaining a clear image. When the average brightness Y0 is smaller than the predetermined minimum YL, then perform the above-described focusing process using a pre-flash function as shown in steps S120 to S150 at step S118 for improving the focusing accuracy. Finally, go back to step S116 for photo taking to capture an image of the object to be photographed.
According to an embodiment of the present invention, the pre-flash function is performed with a flash of a digital camera. However, the pre-flash function can also be applied to other image capturing devices. Also, other built-in light sources or external light source module may be used for providing extra brightness, especially when the environment brightness is not enough. A flash is a necessary auxiliary light source. When using a flash as a focusing light source, not only the system structure of the original digital camera need not be modified, but also no extra component need be added. Therefore, the cost for installing other auxiliary focusing system or module can thus be efficiently reduced.
In view of the above, the present invention adopts a pre-flash function for deducing the distance to the object so that the image sensor can improve the focusing accuracy, even under insufficient environment light. In particular, the relationship between the distance to the object and the brightness difference can be obtained by checking a conversion table or calculating from an equation. With the method for focusing by using a pre-flash of the present invention, the focus of the image sensor needs only one time adjustment. In addition, the system structure of the original digital camera need not be modified, and no extra components should be added. Thus, the purpose of the invention can be achieved. Therefore, the cost will not increase.
It should be noted that specific embodiments of, and examples for, the invention are described herein for illustrative purposes, and various equivalent modifications are possible within the scope of the invention, as those skilled in the relevant art will recognize that modifications and adaptations of the above-described preferred embodiments of the present invention may be made to meet particular requirements. This disclosure is intended to exemplify the invention without limiting its scope. All modifications that incorporate the invention disclosed in the preferred embodiment are to be construed as coming within the scope of the appended claims or the range of equivalents to which the claims are entitled.

## Claims

1. An method for focusing by using a pre-flash, the method comprising the steps of:
an image sensor capturing a first image of an object when the pre-flash does not emit light to the object, wherein the average brightness of the first image is calculated to be Y0;
when Y0 is smaller than a predetermined minimum Y1, the image sensor capturing a second image of the object with the aid of a first pre-flash having a first energy, wherein the average brightness of the second image is calculated to be Y1;
the image sensor capturing a third image of the object with the aid of a second pre-flash having a second energy, wherein the average brightness of the third image is calculated to be Y2;
calculating the distance D to the object according to the brightness Y0 and the difference ΔY between Y1 and Y2; and
the image sensor adjusting the focus according to the distance D.

2. The method for focusing by using a pre-flash according to claim 1, wherein the first energy is not equal to the second energy.

3. The method for focusing by using a pre-flash according to claim 1, wherein the distance D to the object is obtained by checking a conversion table that records a corresponding value of D with respect to Y0 and ΔY.

4. The method for focusing by using a pre-flash according to claim 3, wherein the conversion table is obtained from previously collected experiment data.

5. The method for focusing by using a pre-flash according to claim 1, wherein the distance D to the object is calculated from an equation that represents the relationship between D, Y0, and ΔY.

6. The method for focusing by using a pre-flash according to claim 5, wherein the equation is obtained from previously collected experiment data.

7. The method for focusing by using a pre-flash according to claim 1, further comprising obtaining a reflection ratio R of the third image for calculating the distance D to the object according to Y0, ΔY and the reflection ratio R.

8. The method for focusing by using a pre-flash according to claim 7, wherein the relationship between Y0, ΔY, the reflection ratio R and the distance D to the object is obtained from previously collected experiment data.

9. The method for focusing by using a pre-flash according to claim 7, wherein the reflection ratio R is the ratio of the area in the third image having brightness greater than a predetermined value YT to the whole area of the third image.

10. The method for focusing by using a pre-flash according to claim 9, wherein the predetermined value YT is obtained from previously collected experiment data.