# Patent

## Title
Apparatus and method for deciding in-focus position of imaging lens

## Abstract

An imaging lens is positioned at an initial position, the image of a subject is sensed and an overall focus evaluation value representing the degree of focus of the image of the subject is obtained. Face detection processing is only executed if the overall focus evaluation value obtained is equal to or greater than a threshold value. The imaging lens is then moved to the next position and the process repeated. A range in which face images are detected at positions of the imaging lens where the overall focus evaluation value is equal to or greater than the threshold value is decided upon as a focusing range. A graph of face-area focus evaluation values representing degree of focus of the image portion of the face is obtained and the position at which this graph is maximum is decided upon as the in-focus position of the imaging lens.

## Background
BACKGROUND OF THE INVENTION
1. Field of the Invention
This invention relates to a method and apparatus for deciding the in-focus position of an imaging lens.
2. Description of the Related Art
In an example of the prior art (see the specification of Japanese Patent Application Laid-Open No. 11-146405), a skin-tone area contained in the image of a subject is detected and the skin-tone area detected is adopted as a focusing area.
Even in a case where a skin-tone area is detected, however, it is difficult to detect the skin-tone area accurately when the very subject image in which the skin tone is to be detected is extremely out of focus. Consequently, there are occasions where focusing cannot be achieved accurately even when a skin-tone area is adopted as a focusing area. Similarly, even in a case where a target is detected solely from contrast (density) information without using color information, it is difficult to detect the target accurately in an extremely out-of-focus state.
SUMMARY OF THE INVENTION
Accordingly, an object of the present invention is to achieve focusing comparatively accurately.
According to a first aspect of the present invention, the foregoing object is attained by providing an apparatus for deciding an in-focus position of an imaging lens, comprising: a solid-state electronic image sensing device for sensing the image of a subject and outputting image data representing the image of the subject; an imaging lens moving device for moving an imaging lens, which has been placed in front of the solid-state electronic image sensing device, a prescribed distance along the direction of the optic axis; a focusing data output device for outputting focusing data representing degree of focus of the image of the subject formed by the imaging lens, which is at a position to which it has been moved by the imaging lens moving device; a determination device for determining whether the level of the focusing data that has been output from the focusing data output device is equal to or greater than a prescribed threshold value; a target detecting device for detecting whether the image of the subject contains a target in response to a determination by the determination device that the level of the focusing data is equal to or greater than the threshold value; a control device for controlling the imaging lens driving device, the focusing data output device, the determination device and the target detecting device so as to repeat processing for moving the imaging lens, processing for outputting the focusing data, processing for making the determination and processing for performing the detection; and an in-focus position deciding device for deciding on the position of the imaging lens as the in-focus position based upon data that corresponds to the target detected by the target detecting device.
The first aspect of the present invention also provides a method suited to the above-described apparatus for deciding an in-focus position of an imaging lens. More specifically, there is provided a method of deciding an in-focus position of an imaging lens comprising the steps of: moving an imaging lens, which has been placed in front of a solid-state electronic image sensing device that senses the image of a subject and outputs image data representing the image of the subject, a prescribed distance along the direction of the optic axis; obtaining focusing data representing degree of focus of the image of the subject formed by the imaging lens, which is at a position to which it has been moved; determining whether the level of the focusing data obtained is equal to or greater than a prescribed threshold value; detecting whether the image of the subject contains a target in response to a determination that the level of the focusing data is equal to or greater than the threshold value; repeating processing for moving the imaging lens, processing for outputting the focusing data, processing for making the determination and processing for performing the detection; and deciding on the position of the imaging lens as the in-focus position based upon data that corresponds to the target detected.
In accordance with the first aspect of the present invention, the imaging lens is moved a prescribed distance along the direction of the optic axis. Focusing data representing degree of focus of the image of the subject formed by the imaging lens, which is at a position to which it has been moved, is obtained and it is determined whether the level of the focusing data obtained is equal to or greater than a prescribed threshold value. If the level is determined to be equal to or greater than the threshold value, then it is detected whether or not a target is contained in the image of the subject represented by the image data representing the image of the subject formed by the position of the imaging lens at this time. Such processing for moving the imaging lens, processing for outputting the focusing data, processing for making the determination and processing for performing the detection is repeated.
Since it is attempted to detect the target from the image of the subject obtained in a case where the focusing data is equal to or greater than a prescribed threshold value, it is easier to detect the target accurately. The position of the imaging lens is decided on based upon the image data representing the image of the detected target. The position of the imaging lens can therefore be decided so as to bring the image of the target into focus comparatively accurately.
The apparatus may further comprise a focusing target area deciding device for deciding one or a plurality of focusing target areas based upon the target detected by the target detecting device; and a weighting coefficient deciding device for deciding a weighting coefficient in such a manner that a weighting coefficient of the target is enlarged in the one or plurality of focusing target areas decided by the focusing target area deciding device. In this case the in-focus position deciding device would decide on the position of the imaging lens as the in-focus position based upon image data, which is obtained from the focusing target area decided by the focusing target area deciding device, from among the image data that is output from the solid-state electronic image sensing device.
According to a second aspect of the present invention, the foregoing object is attained by providing an apparatus for deciding an in-focus position of an imaging lens, comprising: a solid-state electronic image sensing device for sensing the image of a subject and outputting image data representing the image of the subject; an imaging lens moving device for moving an imaging lens, which has been placed in front of the solid-state electronic image sensing device, a first prescribed distance along the direction of the optic axis; a first focusing data output device for outputting first focusing data representing degree of focus of the image of the subject formed by the imaging lens, which is at a position to which it has been moved by the imaging lens moving device; a determination device for determining whether the level of the first focusing data that has been output from the first focusing data output device is equal to or greater than a prescribed threshold value; a target detecting device for detecting whether the image of the subject contains a target in response to a determination by the determination device that the level of the first focusing data is equal to or greater than the threshold value; a control device for controlling the imaging lens driving device, the first focusing data output device, the determination device and the target detecting device so as to repeat processing for moving the imaging lens, processing for outputting the first focusing data, processing for making the determination and processing for performing the detection; a focusing range deciding device for deciding a focusing range, which contains the position of the imaging lens prevailing when the target detecting device has detected that the target is contained in the image of the subject, among ranges in which the imaging lens is situated in such a manner that the level of the first focusing data that has been output from the first focusing data output device is equal to or greater than a threshold value continuously; a second focusing data output device for moving the imaging lens along the direction of the optic axis in increments of a second prescribed distance, which is less than the first prescribed distance, in the focusing range that has been decided by the focusing range deciding device, and outputting second focusing data representing degree of focus of the image of the subject at every position to which the lens is moved; and an in-focus position deciding device for deciding on the position of the imaging lens, at which the image of the subject is brought into focus based upon the second focusing data that has been output from the second focusing data output device, as the in-focus position.
The second aspect of the present invention also provides a method suited to the above-described apparatus for deciding an in-focus position of an imaging lens. More specifically, there is provided a method of deciding an in-focus position of an imaging lens comprising the steps of: moving an imaging lens, which has been placed in front of a solid-state electronic image sensing device that senses the image of a subject and outputs image data representing the image of the subject, a prescribed distance along the direction of the optic axis; obtaining focusing data representing degree of focus of the subject whose image is formed by the imaging lens, which is at a position to which it has been moved; detecting a maximal value from among values of the focusing data obtained; executing processing for moving the imaging lens and processing for outputting the focusing data in response to non-detection of the maximal value; halting processing for moving the imaging lens and detecting whether the image of a target is contained in the image of the subject in response to detection of the maximal value; deciding on the position of the imaging lens as the in-focus position based upon image data representing the detected image of the subject in response to detection of the fact that the image of the subject contains the target; releasing halt on movement of the imaging lens in response to non-detection of the fact that the image of the subject contains the target and executing processing for moving the imaging lens, processing for outputting the focusing data and processing for detecting the maximal value.
In accordance with the second aspect of the present invention, the imaging lens is moved a first prescribed distance along the direction of the optic axis. Focusing data representing degree of focus of the subject whose image is formed by the imaging lens at the position to which it has been moved is obtained. Whether the level of the focusing data obtained is equal to or greater than a threshold value is determined. If the level is determined to be equal to or greater than the threshold value, then it is detected whether or not a target is contained in the image of the subject represented by the image data representing the image of the subject formed by the position of the imaging lens at this time. Such processing for moving the imaging lens, processing for outputting the focusing data, processing for making the determination and processing for performing the detection is repeated and a distribution indicating the relationship between the level of the first focusing data and the position of the imaging lens is obtained.
Among ranges in which the imaging lens is situated in such a manner that the level of the first focusing data is equal to or greater than a threshold value continuously, a focusing range prevailing when it has been determined that the target is contained in the image of the subject is decided upon as a focusing range. The imaging lens is moved along the direction of the optic axis in increments of a second prescribed distance, which is less than the first prescribed distance, in the focusing range that has been decided, and second focusing data is obtained at every position to which the lens is moved. The position of the imaging lens is decided upon as the in-focus position based upon the second focusing data.
The focusing range in which focusing control is to be performed finely is decided based upon the first focusing data and the position of the imaging lens is decided in this focusing range that has been decided. The position (in-focus position) of the imaging lens in which the image of the subject is to be focused is decide comparatively quickly and accurately.
According to a third aspect of the present invention, the foregoing object is attained by providing an apparatus for deciding an in-focus position of an imaging lens, comprising: a solid-state electronic image sensing device for sensing the image of a subject and outputting image data representing the image of the subject; an imaging lens moving device for moving an imaging lens, which has been placed in front of the solid-state electronic image sensing device, a first prescribed distance along the direction of the optic axis; a first focusing data output device for outputting first focusing data representing degree of focus of the image of the subject formed by the imaging lens, which is at a position to which it has been moved by the imaging lens moving device; a maximal value detecting device for detecting a maximal value from among values of the first focusing data output from the first focusing data output device; a first control device for controlling the imaging lens moving device and the focusing data output device, in such a manner that processing for moving the imaging lens and processing for outputting the focusing data will be executed, in response to non-detection of the maximal value by the maximal value detecting device; a target detecting device responsive to detection of the maximal value by the maximal value detecting device for halting processing for moving the imaging lens by the imaging lens moving device and detecting whether a target is contained in the image of the subject that prevailed when the maximal value was obtained; a second focusing data output device, which is responsive to detection by the target detecting device of the fact that a target is contained in the image of the subject, for moving the imaging lens along the direction of the optic axis in increments of a second prescribed distance, which is less than the first prescribed distance, in a focusing range in the vicinity of a position of the imaging lens at which the maximal value detected by the maximal value detecting device has been obtained, and outputting second focusing data representing degree of focus of the image of the subject at every position to which the lens is moved; an in-focus position deciding device for deciding on the position of the imaging lens, at which the image of the subject is brought into focus based upon the second focusing data that has been output from the second focusing data output device, as the in-focus position; and a second control device, which is responsive to non-detection by the target detecting device of the fact that a target is contained in the image of the subject, for releasing halt on movement of the imaging lens by the lens moving device and controlling the imaging lens moving device, the focusing data output device and the maximal value detecting device in such a manner that processing for moving the imaging lens, processing for outputting the focusing data and processing for detecting the maximal value is executed.
The third aspect of the present invention also provides a method suited to the above-described apparatus for deciding an in-focus position of an imaging lens. More specifically, there is provided a method of deciding an in-focus position of an imaging lens comprising the steps of: moving an imaging lens, which has been placed in front of a solid-state electronic image sensing device that senses the image of a subject and outputs image data representing the image of the subject, a first prescribed distance along the direction of the optic axis; obtaining first focusing data representing degree of focus of the subject whose image is formed by the imaging lens, which is at a position to which it has been moved; detecting a maximal value from among values of the first focusing data obtained; executing processing for moving the imaging lens and processing for outputting the focusing data in response to non-detection of the maximal value; halting processing for moving the imaging lens and detecting whether a target is contained in the image of the subject that prevailed when the maximal value was obtained; in response to detection of the fact that a target is contained in the image of the subject, moving the imaging lens along the direction of the optic axis in increments of a second prescribed distance, which is less than the first prescribed distance, in a focusing range in the vicinity of a position of the imaging lens at which the maximal value has been obtained, and obtaining second focusing data representing degree of focus of the image of the subject at every position to which the lens is moved; deciding on the position of the imaging lens, at which the image of the subject is brought into focus based upon the second focusing data obtained, as the in-focus position; and in response to non-detection of the fact that a target is contained in the image of the subject, releasing halt on movement of the imaging lens and executing processing for moving the imaging lens, processing for outputting the focusing data and processing for detecting the maximal value.
In accordance with the third aspect of the present invention, the imaging lens is moved a first prescribed distance along the direction of the optic axis. Focusing data representing degree of focus of the subject whose image is formed by the imaging lens at the position to which it has been moved is obtained. Whether the level of the focusing data obtained is equal to or greater than a threshold value is determined. If the level is determined to be equal to or greater than the threshold value, then it is detected whether or not a target is contained in the image of the subject represented by the image data representing the image of the subject formed by the position of the imaging lens at this time. If a target is detected, the imaging lens is moved a second prescribed distance less than the first prescribed distance in a focusing range in the vicinity of a position of the imaging lens at which a maximal value has been detected, and second focusing data is obtained. The in-focus position of the imaging lens is decided based upon the second focusing data obtained.
In the third aspect of the present invention, second focusing data is obtained in a focusing range in the vicinity of a maximal value and comparatively accurate focusing control can be performed. Moreover, if a maximal value is detected and a target image is detected, no subsequent processing for outputting first focusing data and for detecting maximal value is executed. This makes it possible to decide the in-focus position comparatively quickly.
The second focusing output device may be so adapted as to move the imaging lens along the direction of the optic axis in the above-mentioned focusing range and to output the second focusing data, which represents the degree of focus of the image within the target area decided based upon all targets that have been detected by the target detecting device among images of the subject, at every position to which the lens is moved.
The apparatus may further comprise a sub-target area deciding device for deciding one or a plurality of sub-target areas based upon all of the targets; and a weighting coefficient deciding device for deciding a weighting coefficient in such a manner that a weighting coefficient of the target is enlarged in the one or plurality of sub-target areas decided by the sub-target area deciding device. In such case the second focusing data output device would move the imaging lens along the direction of the optic axis within the focusing range that has been decided by the focusing range deciding device and would output the second focusing data, which represents the degree of focus of the target detected by the target detecting device among images of the subject, at every position to which the lens is moved while adjusting the level of the second focusing data based upon the weighting coefficient that has been decided by the weighting coefficient deciding device.
It may be so arranged that movement of the imaging lens in the first focusing data output device is performed from the NEAR side. An important target often is on the NEAR side. Detecting the target first, therefore, makes feasible the halting of subsequent processing.
Naturally, it may be so arranged that movement of the imaging lens in the first focusing data output device is performed from the INF (infinity) side, or it may be so arranged that movement of the imaging lens in the first focusing data output device is performed from either the NEAR side or INF side in accordance with a setting. The apparatus may further comprise a setting device for setting direction of movement of the imaging lens in the first focusing data output device. In such case movement of the imaging lens in the first focusing data output device would be performed from the NEAR side or INF side in accordance with the setting made by the setting device.
The apparatus may further comprise an image sensing mode determination device for determining whether a short-distance image sensing mode or a long-distance image sensing mode has been set; and a device for setting movement of the imaging lens in the first focusing data output device in such a manner that movement is performed from the NEAR side in response to a determination by the image sensing mode determination device that the short-distance image sensing mode has been set and from the INF side in response to a determination by the image sensing mode determination device that the long-distance image sensing mode has been set.
Furthermore, in a case where the imaging lens is a zoom lens, movement of the imaging lens in the first focusing data output device is performed from the NEAR side or INF side in accordance with the zoom magnification of the zoom lens.
Distance travelled by the imaging lens in the first focusing data output device may be greater than distance travelled by the imaging lens in the second focusing data output device. By executing processing for outputting the first focusing data coarsely and executing processing to output the second focusing data finely, the position of the imaging lens can be decided quickly and accurately.
Detection of the target is performed based upon at least one among target likeliness in the target area, size of the target, brightness of the target and position of the target area, by way of example.
The apparatus may further comprise a display device for displaying the image of the subject, which is represented by the image data that has been output from the solid-state electronic image sensing device, on a display screen; and a display control device for controlling the display device so as to display the area of the detected target on the image of the subject.
The apparatus may further comprise a display device for displaying the image of the subject, which is represented by the image data that has been output from the solid-state electronic image sensing device, on a display screen; and a display control device for controlling the display device so as to display the target area on the image of the subject.
The target is a face or an eye, by way of example.
Other features and advantages of the present invention will be apparent from the following description taken in conjunction with the accompanying drawings, in which like reference characters designate the same or similar parts throughout the figures thereof.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram illustrating the electrical structure of a digital still camera;
FIG. 2 illustrates the relationship between a digital still camera and subjects;
FIGS. 3 and 4 are flowcharts illustrating recording processing;
FIG. 5 is a flowchart illustrating preliminary search processing for autofocus;
FIG. 6 is a flowchart illustrating face detection processing;
FIG. 7 illustrates the relationship between the position of an imaging lens and an overall focus evaluation value;
FIG. 8A illustrates the area of the image of a subject when an overall focus evaluation value is obtained, and FIG. 8B illustrates an area when a face-area focus evaluation value is obtained;
FIG. 9 illustrates the relationship between an overall focus evaluation value and position of an imaging lens;
FIG. 10 illustrates the registration of faces of face information;
FIG. 11 is a flowchart illustrating processing for registering a face area;
FIG. 12 illustrates the relationship between a face-area focus evaluation value and position of an imaging lens;
FIG. 13 is a flowchart of other processing for face-area registration;
FIGS. 14 to 16 illustrate ways to decide weighting;
FIG. 17 is a flowchart illustrating another example of preliminary search processing for AF;
FIGS. 18A and 18B illustrate relationships between an overall focus evaluation value and position of an imaging lens; and
FIG. 19 illustrates the relationship between a face-area focus integration value and position of an imaging lens.



DESCRIPTION OF THE PREFERRED EMBODIMENTS
Preferred embodiments of the present invention will now be described in detail with reference to the drawings.
FIG. 1 is a block diagram illustrating the electrical configuration of a digital still camera according to an embodiment of the present invention.
The digital still camera according to this embodiment is so adapted that a face in the image of a subject will come into focus in suitable fashion.
The operation of the overall digital still camera is controlled by a control circuit 1. The control circuit 1 includes a CPU 2, a ROM 3 in which the operating program of the digital still camera and prescribed data, etc., have been stored, and a RAM 4 for storing data temporarily.
The digital still camera is provided with an operating device 5 having switches and buttons such as a shutter-release button of two-step stroke type. An operating signal that is output from the operating device 5 is input to the control circuit 1.
A diaphragm 10 and imaging lens 8 are provided in front of a CCD 12. The imaging lens 8 is supported so as to be freely movable along the direction of the optic axis of the lens. [The side of the lens facing the CCD 12 is referred to as the “NEAR” side, and the side facing away from the CCD 12 is referred to as the “INF” (infinity) side.] The position of the lens is controlled by a lens driving circuit 7 in such a manner that the image of the subject (the image of a face in a case where the image of the subject contains the image of a face, as will be described later) is focused and formed on the photoreceptor surface of the CCD 12. The diaphragm 10 has its f-stop number controlled by a diaphragm driving circuit 9 in such a manner that an appropriate amount of exposure is obtained. When the image of a subject is sensed, a video signal representing the image of the subject that has been formed on the photoreceptor surface of the CCD 12 is output under the control of a control circuit 11 for controlling the image sensing device. The video signal that has been output from the CCD 12 is input to an analog signal processing circuit 13. The lens driving circuit 7, diaphragm driving circuit 9 and image sensing device control circuit 11 are controlled by the control circuit 1.
The video signal is subjected to prescribed analog signal processing such as a white balance adjustment in the analog signal processing circuit 13. The video signal that has been output from the analog signal processing circuit 13 is converted to digital image data in an analog/digital signal converting circuit 14 and the digital image data is input to a digital signal processing circuit 15 and to the control circuit 1.
High-frequency components are extracted from the input digital image data in the control circuit 1, whereby focusing data is obtained. The focusing data obtained is integrated over the entire image or in an area that is part of the image to thereby obtain a focus evaluation value. The imaging lens 8 is controlled by the lens driving circuit 7 based upon the obtained focus evaluation value in such a manner that the image of the subject is focused upon the photoreceptor surface of the CCD 12.
Further, the digital image data is subjected to prescribed digital signal processing such as a gamma correction in the digital signal processing circuit 15. The image data that has been output from the digital signal processing circuit 15 is applied to a display unit 17 via a memory 16. The image of the subject is displayed on the display screen of the display unit 17. Image data that has been output from the digital signal processing circuit 15 is input also to a face extraction processing circuit 6. The latter extracts the image of a face contained in the image of the subject represented by the image data that has been output from the digital signal processing circuit 15. There is no particular limitation on the method of extracting the face. Methods which may be used include a method that relies upon brightness, a method using color or a method using both brightness and color. Data representing the extracted image of the face and data such as position and size indicative of the area of the extracted face is applied to the control circuit 1. As will be described later in greater detail, focusing control is carried out using the data representing the image of the face.
If the shutter-release button is pressed through the first step of its stroke, focusing control is performed in a manner described later. If the shutter-release button is pressed through the second step of its stroke, the image data that has been output from the digital signal processing circuit 15 is applied to and stored temporarily in memory 16, as described above. The image data is recorded by reading it from the memory 16 and applying it to a memory card 19 via an interface 18.
FIG. 2 illustrates the relationship between subjects and a digital still camera.
As illustrated in FIG. 2, a digital still camera 20 is arranged facing subjects 21 and 22. Subject 21 is a person and subject 22 a vehicle.
In this embodiment, the direction in which the imaging lens of the digital still camera 20 moves along the optic axis of the lens is defined as the direction along the Z axis. The plane in which the Z axis is the normal line is defined as the XY plane.
FIGS. 3 and 4 are flowcharts illustrating recording processing executed by the digital still camera.
Sensing of the image of the subject by the CCD 12 continues and image data representing the image of the subject is obtained in the manner described above. If the shutter-release button is pressed through the first step of its stroke (“YES” at step 31), automatic exposure (AE) processing in which luminance components are extracted from the obtained image data is executed (step 32). An appropriate amount of exposure is calculated based upon the luminance components extracted (step 33). The diaphragm 10 and the shutter speed (so-called “electronic shutter”) of the CCD 12 are controlled in such a manner that the calculated amount of exposure is achieved.
Next, a preliminary search for autofocus (AF) is carried out (step 34).
FIG. 5 is a flowchart illustrating preliminary search processing for AF.
The imaging lens 8 is freely movable within a prescribed range along the Z direction and is initially positioned at an initial position. The image of the subject is sensed in a state in which the imaging lens 8 is at the initial position, and image data representing the entirety I of the image of the subject is obtained, as indicated by the hatching in FIG. 8A. An overall focus evaluation value is obtained by extracting and integrating high-frequency components from the image data obtained (step 51).
If the overall focus evaluation value obtained is equal to or greater than a prescribed threshold value (“YES” at step 52), then it is construed that the image of the subject obtained at the position of the imaging lens 8 that prevailed when the overall focus evaluation value was obtained is in comparatively good focus. At this position of the imaging lens 8, therefore, processing for detecting a face is executed (step 53). If the overall focus evaluation value obtained is less than the threshold value (“NO” at step 52), then the processing of step 53 is skipped.
If the imaging lens 8 is not at the terminus of the range of movement thereof (“NO” at step 54), then the imaging lens 8 is moved a prescribed distance and is positioned at the next position (step 55). The processing of steps 51 to 53 is repeated until the imaging lens 8 arrives at the terminus in the range of movement (“YES” at step 54).
Thus, on each occasion that the overall focus evaluation value is equal to or greater than the prescribed threshold value, processing for detecting the image of a face is executed.
FIG. 7 illustrates the relationship between the position of an imaging lens 9 and the overall focus evaluation value at this position.
The imaging lens 8 is positioned at an initial position on the NEAR side and the overall focus evaluation value is obtained from the image data obtained by sensing the image of the subject at this position. For example, an overall focus evaluation value FeO obtained when the imaging lens is positioned at a position Z0 is less than a threshold value Th and therefore face detection processing is not executed.
The imaging lens 8 is then moved to the next position Z1, where the overall focus evaluation value is calculated. When the imaging lens 8 is at position Z1, the overall focus evaluation value is equal to or greater than the threshold value Th (equal to the threshold value Th) and therefore face detection processing is executed. When face detection processing ends, the imaging lens 8 is moved to the next position Z2. The overall focus evaluation value is calculated at position Z2 as well. The overall focus evaluation value obtained in a case where the imaging lens 8 is at position Z2 is Fe2, which is greater than the threshold value Th. Consequently, face detection processing for detecting whether a face is contained in the image of the subject is executed when the imaging lens 8 is at position Z2 as well.
The calculation of overall focus evaluation value and the decision regarding face detection processing (in a case where face detection is performed, the processing is face detection processing) are repeated alternatingly.
FIG. 6 is a flowchart illustrating face detection processing.
Image data obtained by sensing the image of a subject at a position of the imaging lens where the overall focus evaluation value is equal to or greater than the threshold value, as mentioned above, is input to the face extraction processing circuit 6, which proceeds to detect a face contained in the image of the subject (step 61). If a face is detected (“YES” at step 62), the result of face detection processing (position and size, etc., of the detected image area) is stored in correspondence with the face-detection execution position at which the imaging lens 8 is situated. If a face is not detected (“NO” at step 62), then the processing of step 63 is skipped.
FIG. 9 indicates focus evaluation values and face-detection execution positions obtained by preliminary search processing for AF.
The horizontal axis in FIG. 9 is the direction (Z direction) of movement of the imaging lens 8, and the vertical axis is the plot of overall focus evaluation values.
A graph G1 of overall focus evaluation values is obtained by obtaining the overall focus evaluation values (first focusing data) while moving the imaging lens 8 in increments of the prescribed distance, as described above. In the graph G1, the positions of the imaging lens 8 corresponding to the portion of the graph equal to or greater than a threshold value are Z1, Z2, Z3, Z4, Z5, Z6, Z7 and Z8. The above-described face detection processing has been executed at these positions Z1, Z2, Z3, Z4, Z5, Z6, Z7 and Z8 of the imaging lens.
The left side of FIG. 10 shows entire images obtained by face detection processing and faces contained in respective ones of these entire images.
As mentioned above, the imaging lens 8 is positioned at each of face-detection execution positions Z0, Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8 and Z9, in the order mentioned, and subject images I0 (not shown), I1, I2, I3, I4, I5, I6, I7, I8 and I9 (not shown) are respectively obtained, in the order mentioned, by sensing the image of the subject at these positions. The subject images I1, I2, I3, I4, I5, I6, I7 and I8 for which the overall focus evaluation value is equal to or greater than the threshold value Th are indicated in FIG. 10. Among the subject images I0, I1, I2, I3, I4, I5, I6, I7, I8 and I9 obtained by image sensing, face detection processing has been applied to those subject images I1, I2, I3, I4, I5, I6, I7 and I8 for which the overall focus evaluation value is equal to or greater than the threshold value Th, as described above. By virtue of this face detection processing, the fact that faces f2, f3 and f4 is contained in the subject images I2, I3 and I4, respectively, is detected.
With reference again to FIG. 3, processing (XY-plane processing) is executed to register the area of the face image, detected when face detection processing is executed, in face information regardless of the position of the imaging lens (step 36). In addition, processing (Z-direction processing) for deciding a focusing range that includes the face-detection execution positions at which the face was detected is executed (step 37).
FIG. 11 is a flowchart illustrating processing for registering a face area.
First, the stored result of face detection processing is read (step 71). The read result of face detection processing is registered in the face information (step 72). This reading of the results of face detection processing and registration of the results of face detection processing in the face information continues up to the final result of face detection processing (step 73).
The right side of FIG. 10 shows an example of face information.
As described above, faces f2, f3 and f4 are contained in subject images I2, I3 and I4, respectively, obtained when the imaging lens 8 has been positioned at the face-detection execution positions Z2, Z3 and Z4, respectively. The positions and sizes of these faces are registered as results of face detection processing in the same face information Iface of one frame.
Thus, all faces contained in the images of the subjects obtained at different positions of the imaging lens 8 are registered in the face information Iface. As a result, a face area (target area) A1 produced by overlapping the images f2, f3 and f4 of the faces obtained when the imaging lens 8 is situated at each of the face-detection execution positions Z2, Z3 and Z4, respectively, is registered as an area in which the images of the faces are contained.
With reference again to FIG. 3, a focusing range that includes the face-detection execution positions at which faces are detected is decided (step 37) in concurrence with the processing (step 36) for registering face information.
Since faces have been detected when the imaging lens 8 is situated at the face-detection execution positions Z2, Z3 and Z4 among the positions Z1 to Z4 and Z5 to Z8 of the imaging lens 8 at which the overall focus evaluation value is equal to or greater than the threshold value, as illustrated in FIG. 9 and the left side of FIG. 10, the positions Z1 to Z8 of imaging lens 8 at which the overall focus evaluation value is equal to or greater than the threshold value are decided upon as the focusing range.
With reference to FIG. 4, face area A1 that has been registered in the face information Iface undergoes a main search in the focusing range that has been decided (step 38), and the position (in-focus position) of the imaging lens 8 at which the image of the face contained in the image of the subject is in focus is decided (step 39).
As shown in FIG. 12, the focusing range is a range over which the positions of the imaging lens 8 are defined by Z1 to Z4. The imaging lens 8 is moved in prescribed increments in the focusing range Z1 to Z4 and the image of the subject is sensed at each position to which the lens is moved. Focusing data (second focusing data) is extracted from image data representing the interior of face area A1 (indicated by the hatching in FIG. 8B) from the sensed image of the subject. An evaluation value of the extracted focusing data is obtained as the face-area focus evaluation value. By obtaining the face-area focus evaluation value while the imaging lens 8 is moved within the focusing range Z1 to Z4, a graph G2 of face-image area focus integration values is obtained. This is the main search mentioned above. In the graph G2 obtained by the main search, a position Zf of the imaging lens 8 at which the face-area focus evaluation value is maximized is decided upon as an in-focus position Zf. The main search may just as well be conducted using the overall focus evaluation value without relying upon the face-area focus evaluation value.
With reference again to FIG. 4, when the in-focus position is decided, the imaging lens 8 is moved so as to be positioned at the in-focus position decided (step 40). The position to which the imaging lens 8 has been moved is that at which the face in the image of the subject is in best focus.
If the shutter-release button is pressed through the second step of its stroke (“YES” at step 41), actual picture-taking is performed at step 43. The image data obtained by actual picture-taking is recorded on the memory card 19.
If the shutter-release button continues to be pressed through the first step of its stroke (“YES” at step 42) without being pressed through the second step of its stroke (“NO” at step 41), then the determination as to whether or not the shutter-release button has been pressed through the second step of its stroke is performed repeatedly. If the shutter-release button stops being pressed through the first step of its stroke (“NO” at step 42) without being depressed through the second step of its stroke (“NO” at step 41), then control returns to the processing of step 31.
In the embodiment described above, the traveling distance of the imaging lens 8 in the preliminary search (step 34) for AF may be made larger than the traveling distance of the imaging lens 8 in the main search (step 38). This makes it possible to shorten the time needed to perform the preliminary search for AF.
FIG. 13 is a flowchart of other processing for registering a face area in face information. Here processing steps identical with those shown in FIG. 11 are designated by like step numbers and need not be described again.
In this processing for registering a face area, weighting is applied to a face area that has been registered in the face information in the manner described above (step 74).
How weighting is applied will be described with reference to FIGS. 14 to 16.
As shown in FIG. 14, it is assumed that subject images I11, I12 and I13 have been obtained by sensing the image of a subject while changing the position of the imaging lens 8 in the manner described above. It is assumed that subject image I11 contains faces a11 and a12, that subject image I12 contains faces a21 and a22, and that subject image I13 contains a face a31.
If the faces a11, a12, a21, a22 and a31 are registered in face information Iface1, the result is as shown on the right side of FIG. 14.
A face area (target area) A11 that has been registered in the face information Iface1 can be divided into three areas (sub-target areas) 81, 82 and 83. The area 81 is an area that is contained in the two faces a11 and a31. The area 82 is an area contained in all three of the areas of faces a11, a21 and a31. The area 83 is an area contained in the two faces a11 and a21.
Further, a face area A12 that has been registered in the face information Iface1 can also be divided into three areas 84, 85 and 86. The area 84 is an area contained in face a22, the area 85 is an area contained in faces a12 and a22, and the area 86 is an area contained in face a12.
The weighting in this case is the product of the number of face-detection execution positions at which a face has been detected and a constant k1. Hence, weighting coefficients of the areas 81, 82, 83, 84, 85 and 86 are 2k1, 3k1, 2k1, k1, 2k1 and k1, respectively.
By multiplying the face-area integration values obtained in the main search by these weighting coefficients, the face-area integration values are corrected and the above-mentioned graph G2 regarding the face-area integration values is obtained.
When the faces a11, a12, a21, a22 and a31 are registered in face information Iface2, the result is as shown on the right side of FIG. 15.
Face area A31 registered in face information Iface2 is the result of adding areas 87 and 88 to the top and bottom, respectively, of the face area A11 shown in FIG. 14. Similarly, face area A41 registered in face information Iface2 is the result of adding areas 89 and 90 to the top and bottom, respectively, of the face area A12 shown in FIG. 14.
Weighting is calculated as follows: (number of face-detection execution positions at which a face has been detected)×constant k1+(distance from face area)×constant k2. The weighting coefficients of areas 81, 82, 83, 84, 85, 86, 87, 88, 89 and 90 are 2k1+k2, 3k1+k2, 2k1+k2, k1+k2, K2k1+k2, k1+k2, k2, k2, k2 and k2, respectively.
When the faces a11, a12, a21, a22 and a31 are registered in face information Iface2, as shown in FIG. 16, the result is Iface3 indicated on the right side of FIG. 16.
Face area A51 registered in face information Iface3 is such that the areas 87 and 88 contained in the face area A31 of FIG. 14 have each been divided into areas 91 and 92. Similarly, the areas 89 and 90 contained in the face area A41 of FIG. 14 have each been divided into areas 93 and 94.
Weighting is calculated as follows: (number of face-detection execution positions at which a face has been detected)×constant k1×(distance from face area)×constant k2. The weighting coefficients of areas 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93 and 94 are 2k1, 3k1, 2k1, k1, 2k1, k1, k2/2, k2, k2/2 and k2, respectively.
FIGS. 17 to 19 illustrate another embodiment of the present invention.
In the above-described embodiment, a range containing a face is decided upon as a focusing range from a range of overall focus evaluation values equal to or greater than a threshold value, and a main search is conducted within this focusing range. By contrast, in the embodiment described below, maximal values are found from the graph G1 of overall focus evaluation values and face detection processing is executed at the positions of the imaging lens 8 corresponding to these maximal values. Positions of the imaging lens 8 in the vicinity of a maximal value at which a face has been detected are decided upon as the focusing range. The main search is conducted within the focusing range decided.
FIG. 17 is a flowchart illustrating preliminary search processing (which corresponds to FIG. 5) for autofocus.
First, the imaging lens 8 is placed at an initial position on the NEAR side (step 101). The image of the subject is sensed at this position and image data representing the image of the subject is obtained. An overall focus evaluation value is obtained from the obtained image data (step 102). It is determined whether maximal values are among the focus evaluation values obtained thus far (step 103). Since a maximal value is a value at a point where overall focus integration values undergo a transition from an increasing value to a decreasing value, a maximal value cannot be determined merely on the basis of a single overall focus integration value. The imaging lens 8 therefore is moved to the next position (step 108), the image of the subject is sensed again and the overall focus evaluation value is calculated at this position (step 102).
If a plurality of overall focus evaluation values are obtained and a maximal value exists among the plurality of overall focus integration values (“YES” at step 103), then face detection processing is executed from the image of the subject at the position of the imaging lens where the maximum value has been obtained (step 104).
If the image of the subject does not contain a face (“NO” at step 105), then the imaging lens 8 is moved to the next position (the position of the imaging lens following that at which an overall focus evaluation value was obtained last) (step 108) and the processing of steps 102 to 105 and step 108 is executed again. It the image of the subject contains a face (“YES” at step 105), then a range in the vicinity of the position of the imaging lens at which the maximal value was obtained is decided upon as the focusing range (step 106). The main search is conducted within this focusing range (step 107). Subsequent processing is identical with the processing from step 39 onward in FIG. 4.
FIGS. 18A and 18B illustrate relationships between an overall focus evaluation value and position of an imaging lens.
In FIG. 18A, the imaging lens 8 is moved from the NEAR side and an overall focus evaluation value is obtained at each position to which the lens is moved, as described above. The overall focus evaluation value obtained in a case where the position of the imaging lens is position Z11 is Fe11. Similarly, overall focus evaluation values Fe12, Fe13, Fe14 and Fe15 are obtained (graph G11) whenever the imaging lens 8 is moved to positions Z12, Z13, Z14 and Z15, respectively.
The overall focus evaluation values increase from overall focus evaluation value Fe13 to overall focus evaluation value Fe14 when the imaging lens 8 is moved from position Z13 to position Z14. Moving the imaging lens 8 from position Z14 to position Z15, however, causes the overall focus evaluation values to decrease from Fe14 to Fe15. Thus it can be understood that the overall focus evaluation value Fe14 is a maximal value.
The position of the imaging lens 8 when the maximal value is obtained is Z14. The imaging lens 8 therefore is moved to position Z14 and the image of the subject is sensed. Face detection processing is executed from the subject image (which may be stored in advance) 121 obtained by image sensing. It will be assumed that a face is not contained in the subject image I21. In such case the movement of the imaging lens 8 and the calculation of overall focus evaluation value are performed again to find a maximal value.
In FIG. 18B, the imaging lens 8 is moved to positions Z21, Z22, Z23 and Z24 and overall focus evaluation values Fe21, F22, F23 and Fe24 are obtained at these position in a manner similar to that shown in FIG. 18A. It will be understood that the overall focus evaluation value Fe23 is a maximal value for the same reasons described in connection with FIG. 18A. The image of the subject is sensed and a subject image I23 is obtained at the position Z23 of the imaging lens 8 prevailing when the maximal value was obtained. Face detection processing is executed with regard to the subject image I23 and a face a41 is obtained.
The range from Z22 to Z24 (other ranges are also acceptable) in the vicinity of the position Z23 is decided upon as the focusing range.
FIG. 19 illustrates the relationship between position of the imaging lens in the focusing range Z22 to Z24 and face-area focus evaluation value.
If the focusing range Z22 to Z24 is decided in a manner similar to that set forth above, the imaging lens is moved in prescribed increments within the decided focusing range Z22 to Z24 and the image of the subject is sensed at each position to which the lens is moved. Data representing the interior of the area corresponding to the face a41 is summed in the subject images obtained by image sensing and a graph G22 indicating face-area focus evaluation values is obtained.
A position Z2f at which the imaging lens 8 is situated when the graph G22 exhibits the maximal value is decided upon as the in-focus position.
In the embodiment described above, the imaging lens is set at an initial position on the NEAR side to obtain the focus evaluation value, then the imaging lens is moved to the next position to obtain the focus evaluation value again. However, it may be so arranged that the imaging lens is set at an initial position on the INF (infinity) side to obtain the focus evaluation value and is then moved to the next position to obtain the focus evaluation value again. It may be so arranged that whether the initial position of the imaging lens is on the NEAR side or INF side is set in advance, or it may be so arranged that the user is capable of making this setting. If the arrangement is such that the user can make the setting, then the operating device 5 of the above-described digital still camera would be provided with a setting device such as a button or switch to set the NEAR side or INF side. The signal resulting from the setting is applied to the control circuit 1, whereby the initial position of the imaging lens 8 is set to the NEAR side or INF side.
Furthermore, it may be so arranged that in a case where a short-distance image sensing mode such as a portrait shooting mode or macro shooting mode or a long-distance image sensing mode such as a scene shooting mode or night-scene shooting mode can be set as the shooting mode of the digital still camera, the initial position of the imaging lens 8 is set in accordance with the shooting mode. For example, in a case where the short-distance image sensing mode has been set, it can be construed that the main subject is at a location close to the digital still camera and therefore the imaging lens 8 is set at an initial position on the NEAR side. In a case where the long-distance image sensing mode has been set, it can be construed that the main subject is at a location far from the digital still camera and therefore the imaging lens 8 is set at an initial position on the INF side. Thus, the time it takes to detect the main subject in accordance with movement of the imaging lens is shortened in conformity with each image sensing mode.
Furthermore, in a case where the imaging lens 8 is a zoom lens, the initial position of the imaging lens (zoom lens) 8 may be set to the NEAR side or INF side in dependence upon the zoom magnification of the zoom lens. For example, in a case where zoom magnification of the zoom lens is set high (on the telephoto side), it can be construed that the main subject is far away and therefore the initial position is placed on the INF side. In a case where zoom magnification of the zoom lens is set low (on the close-up side), it can be construed that the main subject is near and therefore the initial position is placed on the NEAR side. Of course, this does not mean that the initial position must necessarily be placed on the INF side if the zoom magnification of the zoom lens is high and that it must necessarily be placed on the NEAR side if the zoom magnification of the zoom lens is low. The initial position may conversely be placed on the INF side if the magnification of the zoom lens is low and on the NEAR side if the zoom magnification is high.
As many apparently widely different embodiments of the present invention can be made without departing from the spirit and scope thereof, it is to be understood that the invention is not limited to the specific embodiments thereof except as defined in the appended claims.

## Claims

1. An apparatus for deciding an in-focus position of an imaging lens, comprising:
a solid-state electronic image sensing device for sensing the image of a subject and outputting image data representing the image of the subject;
an imaging lens moving device for moving an imaging lens, which has been placed in front of said solid-state electronic image sensing device, a prescribed distance along the direction of the optic axis;
a focusing data output device for outputting focusing data representing degree of focus of the image of the subject formed by the imaging lens, which is at a position to which it has been moved by said imaging lens moving device;
a determination device for determining whether the level of the focusing data that has been output from said focusing data output device is equal to or greater than a prescribed threshold value;
a target detecting device for detecting whether the image of the subject contains a target in response to a determination by said determination device that the level of the focusing data is equal to or greater than the threshold value;
a control device for controlling said imaging lens driving device, said focusing data output device, said determination device and said target detecting device so as to repeat processing for moving the imaging lens, processing for outputting the focusing data, processing for making the determination and processing for performing the detection; and
an in-focus position deciding device for deciding on the position of the imaging lens as the in-focus position based upon data that corresponds to the target detected by said target detecting device.

2. The apparatus according to claim 1, further comprising:
a focusing target area deciding device for deciding one or a plurality of focusing target areas based upon the target detected by said target detecting device; and
a weighting coefficient deciding device for deciding a weighting coefficient in such a manner that a weighting coefficient of the target image is enlarged in the one or plurality of focusing target areas decided by said focusing target area deciding device;
wherein said in-focus position deciding device decides on the position of the imaging lens as the in-focus position based upon data corresponding to the focusing target area decided by said focusing target area deciding device.

3. The apparatus according to claim 1, wherein the target is a face or eye.

4. An apparatus for deciding an in-focus position of an imaging lens, comprising:
a solid-state electronic image sensing device for sensing the image of a subject and outputting image data representing the image of the subject;
an imaging lens moving device for moving an imaging lens, which has been placed in front of said solid-state electronic image sensing device, a first prescribed distance along the direction of the optic axis;
a first focusing data output device for outputting first focusing data representing degree of focus of the image of the subject formed by the imaging lens, which is at a position to which it has been moved by said imaging lens moving device;
a determination device for determining whether the level of the first focusing data that has been output from said first focusing data output device is equal to or greater than a prescribed threshold value;
a target detecting device for detecting whether the image of the subject contains a target in response to a determination by said determination device that the level of the first focusing data is equal to or greater than the threshold value;
a control device for controlling said imaging lens driving device, said first focusing data output device, said determination device and said target detecting device so as to repeat processing for moving the imaging lens, processing for outputting the first focusing data, processing for making the determination and processing for performing the detection;
a focusing range deciding device for deciding a focusing range, which contains the position of the imaging lens prevailing when said target detecting device has detected that the target is contained in the image of the subject, among ranges in which the imaging lens is situated in such a manner that the level of the first focusing data that has been output from said first focusing data output device is equal to or greater than a threshold value continuously;
a second focusing data output device for moving the imaging lens along the direction of the optic axis in increments of a second prescribed distance, which is less than the first prescribed distance, in the focusing range that has been decided by said focusing range deciding device, and outputting second focusing data representing degree of focus of the image of the subject at every position to which the lens is moved; and
an in-focus position deciding device for deciding on the position of the imaging lens, at which the image of the subject is brought into focus based upon the second focusing data that has been output from said second focusing data output device, as the in-focus position.

5. The apparatus according to claim 4, wherein said second focusing data output device moves the imaging lens along the direction of the optic axis again in the focusing range and outputs the second focusing data, which represents the degree of focus of the image within the target area decided based upon all targets that have been detected by said target detecting device among images of the subject, at every position to which the lens is moved.

6. The apparatus according to claim 5, further comprising:
a sub-target area deciding device for deciding one or a plurality of sub-target areas based upon all of the targets; and
a weighting coefficient deciding device for deciding a weighting coefficient in such a manner that a weighting coefficient of the target is enlarged in the one or plurality of sub-target areas decided by said sub-target area deciding device;
wherein said second focusing data output device moves the imaging lens along the direction of the optic axis within the focusing range that has been decided by said focusing range deciding device and outputs the second focusing data, which represents the degree of focus of the target detected by said target detecting device among images of the subject, at every position to which the lens is moved while adjusting the level of the second focusing data based upon the weighting coefficient that has been decided by said weighting coefficient deciding device.

7. The apparatus according to claim 5, further comprising:
a display device for displaying the image of the subject, which is represented by the image data that has been output from said solid-state electronic image sensing device, on a display screen; and
a display control device for controlling said display device so as to display the target area on the image of the subject.

8. The apparatus according to claim 4, wherein movement of the imaging lens in said first focusing data output device is performed from a NEAR side.

9. The apparatus according to claim 4, wherein movement of the imaging lens in said first focusing data output device is performed from an INF side.

10. The apparatus according to claim 4, wherein movement of the imaging lens in said first focusing data output device is performed from a NEAR side or an INF side in accordance with a setting.

11. The apparatus according to claim 10, further comprising a setting device for setting direction of movement of the imaging lens in said first focusing data output device;
wherein movement of the imaging lens in said first focusing data output device is performed from the NEAR side or INF side in accordance with the setting made by said setting device.

12. The apparatus according to claim 10, further comprising:
an image sensing mode determination device for determining whether a short-distance image sensing mode or a long-distance image sensing mode has been set; and
a device for setting movement of the imaging lens in said first focusing data output device in such a manner that movement is performed from the NEAR side in response to a determination by said image sensing mode determination device that the short-distance image sensing mode has been set and from the INF side in response to a determination by said image sensing mode determination device that the long-distance image sensing mode has been set.

13. The apparatus according to claim 10, wherein the imaging lens is a zoom lens; and
movement of the imaging lens in said first focusing data output device is performed from the NEAR side or INF side in accordance with zoom magnification of said zoom lens.

14. The apparatus according to claim 4, wherein distance travelled by the imaging lens in said first focusing data output device is greater than distance travelled by the imaging lens in said second focusing data output device.

15. The apparatus according to claim 4, wherein detection of the target image is performed based upon at least one among target likeliness in the target area, size of the target, brightness of the target and position of the target area.

16. The apparatus according to claim 4, further comprising:
a display device for displaying the image of the subject, which is represented by the image data that has been output from said solid-state electronic image sensing device, on a display screen; and
a display control device for controlling said display device so as to display the area of the detected target image on the image of the subject.

17. An apparatus for deciding an in-focus position of an imaging lens, comprising:
a solid-state electronic image sensing device for sensing the image of a subject and outputting image data representing the image of the subject;
an imaging lens moving device for moving an imaging lens, which has been placed in front of said solid-state electronic image sensing device, a first prescribed distance along the direction of the optic axis;
a first focusing data output device for outputting first focusing data representing degree of focus of the image of the subject formed by the imaging lens, which is at a position to which it has been moved by said imaging lens moving device;
a maximal value detecting device for detecting a maximal value from among values of the first focusing data output from said first focusing data output device;
a first control device for controlling said imaging lens moving device and said focusing data output device, in such a manner that processing for moving the imaging lens and processing for outputting the focusing data will be executed, in response to non-detection of a maximal value by said maximal value detecting device;
a target detecting device responsive to detection of the maximal value by said maximal value detecting device for halting processing for moving the imaging lens by said imaging lens moving device and detecting whether a target is contained in the image of the subject that prevailed when the maximal value was obtained;
a second focusing data output device, which is responsive to detection by said target detecting device of the fact that a target is contained in the image of the subject, for moving the imaging lens along the direction of the optic axis in increments of a second prescribed distance, which is less than the first prescribed distance, in a focusing range in the vicinity of a position of the imaging lens at which the maximal value detected by said maximal value detecting device has been obtained, and outputting second focusing data representing degree of focus of the image of the subject at every position to which the lens is moved;
an in-focus position deciding device for deciding on the position of the imaging lens, at which the image of the subject is brought into focus based upon the second focusing data that has been output from said second focusing data output device, as the in-focus position; and
a second control device, which is responsive to non-detection by said target detecting device of the fact that a target is contained in the image of the subject, for releasing halt on movement of the imaging lens by said lens moving device and controlling said imaging lens moving device, said focusing data output device and said maximal value detecting device in such a manner that processing for moving the imaging lens, processing for outputting the focusing data and processing for detecting the maximal value is executed.

18. A method of deciding an in-focus position of an imaging lens, comprising the steps of:
moving an imaging lens, which has been placed in front of a solid-state electronic image sensing device that senses the image of a subject and outputs image data representing the image of the subject, a prescribed distance along the direction of the optic axis;
obtaining focusing data representing degree of focus of the image of the subject formed by the imaging lens, which is at a position to which it has been moved;
determining whether the level of the focusing data obtained is equal to or greater than a prescribed threshold value;
detecting whether the image of the subject contains a target in response to a determination that the level of the focusing data is equal to or greater than the threshold value;
repeating processing for moving the imaging lens, processing for outputting the focusing data, processing for making the determination and processing for performing the detection; and
deciding on the position of the imaging lens as the in-focus position based upon data that corresponds to the target detected.

19. A method of deciding an in-focus position of an imaging lens, comprising the steps of:
moving an imaging lens, which has been placed in front of a solid-state electronic image sensing device that senses the image of a subject and outputs image data representing the image of the subject, a first prescribed distance along the direction of the optic axis;
obtaining first focusing data representing degree of focus of the image of the subject formed by the imaging lens, which is at a position to which it has been moved;
detecting a maximal value from among values of the first focusing data obtained;
executing processing for moving the imaging lens and processing for outputting the focusing data in response to non-detection of a maximal value;
halting processing for moving the imaging lens and detecting whether the image of a target is contained in the image of the subject in response to detection of the maximal value;
in response to detection of the fact that a target is contained in the image of the subject, moving the imaging lens along the direction of the optic axis in increments of a second prescribed distance, which is less than the first prescribed distance, in a focusing range in the vicinity of a position of the imaging lens at which the maximal value has been detected, and obtaining second focusing data representing degree of focus of the image of the subject at every position to which the lens is moved;
deciding on the position of the imaging lens, at which the image of the subject is brought into focus based upon the second focusing data obtained, as the in-focus position; and
in response to non-detection of the fact that a target is contained in the image of the subject, releasing halt on movement of the imaging lens and executing processing for moving the imaging lens, processing for outputting the focusing data and processing for detecting the maximal value.

20. A method of deciding an in-focus position of an imaging lens, comprising the steps of:
moving an imaging lens, which has been placed in front of a solid-state electronic image sensing device that senses the image of a subject and outputs image data representing the image of the subject, a first prescribed distance along the direction of the optic axis;
obtaining first focusing data representing degree of focus of the image of the subject formed by the imaging lens, which is at a position to which it has been moved;
detecting a maximal value from among values of the first focusing data obtained;
executing processing for moving the imaging lens and processing for outputting the focusing data in response to non-detection of a maximal value;
halting processing for moving the imaging lens and detecting whether the image of a target is contained in the image of the subject that prevailed when the maximal value was obtained;
in response to detection of the fact that the image of a target is contained in the image of the subject, moving the imaging lens along the direction of the optic axis in increments of a second prescribed distance, which is less than the first prescribed distance, in a focusing range in the vicinity of a position of the imaging lens at which the maximal value has been obtained, and obtaining second focusing data representing degree of focus of the image of the subject at every position to which the lens is moved;
deciding on the position of the imaging lens, at which the image of the subject is brought into focus based upon the second focusing data obtained, as the in-focus position; and
in response to non-detection of the fact that a target is contained in the image of the subject, releasing halt on movement of the imaging lens and executing processing for moving the imaging lens, processing for outputting the focusing data and processing for detecting the maximal value.