Abstract:
The present invention is an automatic focusing apparatus for automatically focusing on a subject in an image plane. The automatic focusing apparatus includes a focus lens for focusing on the subject, drive means for moving the focus lens, an image element for picking up image data from the subject through the focus lens, an image processor for extracting luminance signals of each pixel from the image data picked up by the image element, and a controller for computing contrast value under the luminance signals of each pixel extracted by the image processor, for computing moving quantity of the focus lens by using inverse number of the contrast value, and for controlling the drive means according to the moving quantity.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     This invention relates to an automatic focusing apparatus for camera, such as a video camera, an electronic camera, and so on. 
     2. Description of the Related Art 
     An apparatus for automatically focusing on a subject is disclosed in Japanese patent application number 4-6413 (Publication number 5-191708 published Jul. 30, 1993). 
     In this related art, a process circuit extracts a luminance signal from a picture signal picked up by a CCD via a lens system, and a contrast detection section detects a contrast of each image from the luminance signal. Then a focus drive circuit forwards a position of a lens system in a close end direction by a movement in response to a depth of field and when the contrast is larger than a value at a point before the movement, the circuit retracts the lens system position in the infinite end direction and uses a point at which a focal point is placed within a range of a depth of field as a focal position by the lens system. 
     However, a problem encountered with this prior art apparatus is that the focus drive circuit has to forward and retract a position of a lens system repeatedly. In addition, the focus drive circuit reduces with predetermined fixation ratio the range of the movement of the lens system gradually in order to place the focal point within a range of a depth of field. Consequently, the apparatus needs a lot of time until the focal point is placed within a range of a depth of field as a focal position by the lens system. Therefore, the apparatus can not focus on a subject quickly. 
     SUMMARY OF THE INVENTION 
     Accordingly, it is an object of the present invention to focus on a subject quickly by omitting a waste of a lens system&#39;s operation. 
     Another object of the invention is to stop the lens system at the closest possible position to a focal point. 
     Still another object of the invention is to provide an apparatus that an external device receiving an image data does not need to distinguish whether the image data is in focus or not. 
     The present invention is an automatic focusing apparatus for automatically focusing on a subject in an image plane. The automatic focusing apparatus includes a focus lens for focusing on the subject, drive means for moving the focus lens, an image element for picking up image data from the subject through the focus lens, an image processor for extracting luminance signals of each pixel from the image data picked up by the image element, and a controller for computing contrast value under the luminance signals of each pixel extracted by the image processor, for computing moving quantity of the focus lens by using inverse number of the contrast value, and for controlling the drive means according to the moving quantity. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The present invention is illustrated in the drawings in which: 
     FIG. 1 is a block diagram of an automatic focusing apparatus of the present invention; 
     FIG. 2 is a view illustrating a image picked up by an image element shown in FIG. 1; 
     FIGS. 3 and 5 are a graph illustrating the forces of contrast values and how they relate to focus lens positions within the implementation according to FIG. 1; and 
     FIG. 4 is a graph illustrating the movement amount of the contrast values and how they relate to the contrast value within the implementation according to FIG.  1 . 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     Referring to FIG. 1, there is shown an automatic focusing apparatus  100  which creates an image of a subject for photography passed through a lens system  10 , consisted of a first lens  11 , a focus lens  12  and a second lens  13  on an image element  20 . The first and second lenses  11  and  13  revise in an original image from an inverted image and the focus lens  12  focuses on the subject by moving toward an arrow A. The image element  20  picks up an image data via the lens system  10  from the image of the subject and an image processor  30  extracts luminance signals of each pixel from the image data, and a memory  40  stores the luminance signals. 
     A CPU  50  extracts a specific area  210  (shown in FIG. 2) from the image data according to a program stored in the memory  40  and calculates a contrast value X in the specific area  210 . Then the CPU  50  carries out a calculation of a moving range of the focus lens  12  and sends commands regarding range and direction for rotating a motor  71  to a motor driver  60 . The motor driver  60  drives the motor  71  according to the CPU  50 . A slider  73  supporting the focus lens  12  and a screw  72  is installed on the motor  71 , and the focus lens  12  is moved toward a focal point M by rotating the screw  72 . When the focus lens  12  reaches the focal point M by the motor  71 , the motor driver  60  sends a signal for informing a termination of operation to the CPU  50 , and the CPU  50  stops to send commands to the motor driver  60 . 
     Next, it is explained in detail about a mechanism in order to move the focus lens  12 . The CPU extracts the specific area  210  from the image data according to the program stored in the memory  40 . Then the CPU  50  calculates difference of the luminance signal in adjacent pixels and the result is raised to the Mth power. The above-mentioned calculation is executed by all of pixel and these results are all added. The sum total is stored in the memory  40  as the contrast value X. 
     Referring to FIG. 2, it explains a method for calculating the contrast value X in the specific area  210 . 
     The CPU  50  extracts the specific area  210  from a whole image area  200  to calculate the contrast value, and the location and size of the specific area  210  is extracted from the whole image area  200  optionally. For example, if the whole image area  200  has 640*480 pixels, the specific area  210  has 638*478 pixels because it is one pixel smaller in all directions than the whole image area  200 . Generally, there are various unevenness and color variations on the surface of the subject, and the shading of the subject changes by circumstances, for example, the change of brightness surrounding subject. Therefore, the program is set up so that the CPU  50  extracts the specific area  210  that is not influenced by circumstances. 
     After the specific area  210  is extracted, the CPU  50  calculates each contrast value to the pixel T(n) from the pixel T( 1 ) comprising of the specific area  210  (k=1 through n). For example, the contrast value X T  of the pixel T 90  is computed by using the following equation: 
     
       
           X   T =( A−T ) m +( B−T ) m +( C−T ) m +( D−T ) m   (1) 
       
     
     In the above-mentioned equation, the variable X T  is the contract value of the pixel T and the variables A, B, C, D and T are dimensions of the luminance signal of the pixels A 98 , B 92 , C 94 , D 96  and T 90 . Further, the pixels A 98 , B 92 , C 94 , and D 96  are selected from eight pixels A 98 , B 92 , C 94 , D 96 , E 91 , F 93 , G 95  and H 97  surrounding the pixel T 90 . And the variable m is an even number that is set up optionally according to an inclination of a curve of the contrast value. 
     Further, if the scale of the variable m is enlarged, the inclination of the curve of the contrast value shown in FIG. 5 is enlarged, too, and the movement quantity of the focus lens  12  is computed easily. However, the variable m is set up by considering circumstances because it takes much time in order to compute the contrast value X T . In addition, since the equation (1) uses subtractions, the variable m has to be an even number, for example four. 
     Each contrast value X T  (k) is also computed from pixel T( 1 ) to pixel T(n). Finally, the total contrast value X adding each contrast value X T (k) is computed by the following equation: 
     
       
           X=ΣX   T ( k )  (2) 
       
     
     If the whole image area  200  is 640*480 pixels and the specific area  210  is 100*100 pixels, the number of pixels for computing the contrast value X T (k) is 100*100 pixels, and the variable k of the above equation (2) becomes 100*100=10000. 
     Referring to FIGS. 3,  4  and  5 , it is explained how the, CPU  50  computes the moving quantity of the focus lens  12 . 
     If the location of the focus lens  12  is closer to the focal point M, the contrast value X becomes bigger. If the location of the focus lens  12  is on the focal point M, the contrast value X becomes the maximum value Xmax. Therefore, the moving quantity W of the focus lens  12  is computed by the following equation: 
     
       
           W=G/X   (3) 
       
     
     Further, the variable G is defining an inclination of a curve showed in FIG.  4  and is a fixed number not related to the contrast value. In addition, the variable G is set up optionally according to the shading of the subject. Further, the focus speed can be sped because the inclination of curve shown in FIG. 4 becomes big, if the variable G is enlarged. 
     Referring to FIG. 4, it is shown the moving quantity W of the focus lens  12  computed by the above equation (3). The moving quantity W becomes big value because the contrast value X is small as focus lens  12  is far from focal point M. But on the other hand, the moving quantity W becomes small value because the contrast value X is big as focus lens  12  is close to focal point M. Thus, the focus lens  12  moves largely toward the focal point M when the focus lens  12  starts on moving, and the moving quantity W of the focus lens  12  is small as it approaches the focal point M. 
     Referring to FIG. 5, it is explained how the focus lens  12  moves to the focal point M. Further, the horizontal axis means the position P of the focus lens  12  and the vertical line means the contrast X. 
     First of all, the CPU  50  computes a contrast value X( 0 ) by using the above equation (1) and (2) under image data picked up on an initial position P( 0 ) of the focus lens  12 . The CPU  50  stores the computed contrast value X( 0 ) in a memory  40  and executes the first moving of the focus lens  12 . The memory  40  stores previously data related in the moving direction D( 0 ) and quantity W( 0 ) of the focus lens  12 . The CPU  50  reads the moving direction D( 0 ) and quantity W( 0 ) stored in the memory  40  and directs them to the motor driver  60 . The motor driver  60  drives a motor  71  according to the moving direction D( 0 ) and quantity W( 0 ), and moves the focus lens  12  toward an optical axis  15 . After the focus lens  12  executes the first moving, the focus lens  12  is put on the position P( 1 ) shown by the following equation: 
     
       
           P ( 1 )= P ( 0 )+ W ( 0 )  (4) 
       
     
     Further, the variable P( 0 ) is the initial position and the variable W( 0 ) is the moving quantity. 
     After finishing the moving of the focus lens  12 , the motor driver  60  transmits the signal that informs the CPU  50  of the finish of the moving. At this time, each value P( 1 ), X( 0 ), W( 0 ) and D( 0 ) are stored in the memory  40 . 
     Next, the CPU  50  computes the contrast value X( 1 ) under the image data picked up through the focus lens  12  lying on the position P( 1 ) and computes the second moving quantity W( 1 ) under the computed contrast value X( 1 ). The CPU  50  decides the direction D( 1 ) for moving the focus lens  12  by comparing the computed second contrast value X( 1 ) with the first contrast value X( 0 ) stored in the memory  40 . If the result is X( 0 )&lt;X( 1 ), the direction D( 1 ) is the same as the direction D( 0 ). If the result is X( 0 )&gt;X( 1 ), the direction D( 1 ) is oppositely to the direction D( 0 ). 
     Further, a minimum moving quantity Wmin of the focus lens  12  is stored previously in the memory  40  and the CPU  50  compares the moving quantity W( 1 ) with the minimum moving quantity Wmin. If the comparison result is W( 1 )&gt;Wmin, the CPU  50  moves the focus lens  12  according to the moving quantity W( 1 ). If the comparison result is W( 1 )&lt;Wmin, the CPU  50  transmits the command in order to cancel the moving of the focus lens  12  to the motor driver  60 . In other words, if the moving quantity W( 1 ) is smaller than the moving quantity W( 0 ), the CPU  50  regards the focus lens  12  as reaching the focal point M and stops the moving of the focus lens  12 . 
     In this embodiment, the moving quantity W( 1 ) is bigger than the moving quantity W( 0 ) and the contrast value X( 0 ) is smaller than the contrast value X( 1 ). Therefore, the focus lens  12  is moved according to the moving quantity W( 1 ) and to the same direction as the direction D( 0 ). After the second moving, the focus lens  12  is put on the position P( 2 ) that is a value adding the position P( 1 ) to the moving quantity W( 1 ). That is, the position P( 2 ) is shown by the following equation: 
     
       
           P ( 2 )= P ( 1 )+ W ( 1 )  (5) 
       
     
     After finishing the moving of the focus lens  12 , the motor driver  60  transmits the signal that informs the CPU  50  of the finish of the moving. At this time, each value P( 2 ), X( 1 ), W( 1 ) and D( 1 ) are stored in the memory  40 . 
     And then, the focus lens  12  is moved to the moving quantity W( 4 ) from the moving quantity W( 1 ) in order according to the curve of the contrast value (FIG.  5 ). That is, the contrast value X(n) and moving quantity W(n) is computed and the contrast value X(n) is compared with the contrast value X(n−1) and the moving quantity W(n) is compared with the moving quantity Wmin and these processes is repeated until the variable n becomes 4. 
     Finally, when the moving quantity W(n) is smaller than the moving quantity Wmin, the CPU  50  regards the focus lens  12  as reaching the focal point M and stops the moving of the focus lens  12 . At this time, the apparatus  100  can pick up the image data that is in focus. Further, the moving quantity Wmin is the minimum moving quantity of the focus lens  12  limited mechanically by the motor driver  60 . 
     The memory  40  stores the programs needed to execute the above process, and the CPU  50  reads the programs from the memory  40  and executes a calculation. 
     As mentioned above, the focus lens  12  does not need operations for forwarding and retracting repeatedly since the focus lens  12  never crosses the focal point M in the present invention. In addition, the calculation for the moving quantity is simple and easy. Therefore, the focus lens  12  can be put on the focal point M quickly. 
     Further, even if the subject moves in the middle of the moving of the focus lens  12 , the top of the curve shown in FIG. 3 is merely moved. Thus, the focus lens  12  can be moved stably because the moving quantity W (=G/X) is not influenced. In addition, the focus lens  12  has the only condition that the depth of field is bigger than the moving quantity of the focus lens  12 , but the focus lens  12  can be set up freely concerning other condition, for example, diaphragm quantity or focal length. Therefore, the present invention provides a compact and economical automatic focusing apparatus used in a video camera and electronic camera because the specifications of the focus lens  12  can be set up freely. Especially, the apparatus suits a camera for taking an image while approaching to a subject, such as an iris camera for taking an iris of person. 
     When the focus lens  12  reaches the focal point M, that is, when the moving quantity W(n) is smaller than the moving quantity Wmin, the apparatus can pick up the image data that is in focus. A program for adding a discrimination data to the image data is stored in the memory  40 . Further, the discrimination data means that the moving quantity of the focus lens is smaller than the minimum moving quantity. That is, the discrimination data means that the subject is in focus. After the CPU  50  transmits the command in order to cancel the moving of the focus lens  12  to the motor driver  60 , the CPU  50  reads the program from the memory  40 . 
     Next, referring to FIG. 1, an image output device  80  reads an image data from the memory  40  and transmits the image data to external devices, for example a storage device  86  and pattern recognition device  87  and image printing device  88 , registered in the memory  40 . In an above-mentioned example, the image data is transmitted to the external device registered in the memory  40 , but the image output device  80  may transmit the image data to the external device requesting the image data. 
     As mentioned above, the external device does not need to judge whether the image data is in focus because the discrimination data is added to the image data. Therefore, the external device does not need a special component for judging whether the image data is in focus. In addition, since a clear image data is transmitted to external devices from the image output device, the image data is useful to execute pattern recognition, image recording and image printing. Especially, the apparatus in the present invention is suitable for the pattern recognition device since a pattern recognition device recognizes various data, for example an iris, a face, fingerprints and bar code.