System which uses threshold counts to achieve automatic focus
TECHNICAL FIELD 
     The present invention pertains to an automatic focus system which adjusts the focus as a function of the number of times incoming image intensity information exceed a selected threshold. 
     BACKGROUND OF THE INVENTION 
     There are numerous methods for automatically focusing a camera. Many of these methods have a common basis in that the high frequency components of the image are detected and accumulated for various focal positions of the lens. By comparing the present value of the accumulated high frequency components with their previous accumulated value, it can be determined at what lens position the high frequency components are at a maximum. This lens position is concluded to be the optimum focal position. 
     Somewhat related autofocus systems are discussed in U.S. Pat. No. 3,713,371 by Kurihara et al, where there is disclosed an autofocus system which operates as a function of the difference in brightness levels between adjacent elements of an image. 
     In U.S. Pat. No. 4,392,726 by Kimura there is disclosed an automatic focus control system which determines an optimum focus condition to exist when the high frequency components of the image are at a maximum value. 
     Furthermore, Fukuoka in U.S. Pat. No. 4,183,642, discloses an autofocus device which involves calculating a difference in brightness information between adjacent picture elements, effecting an operation to provide smoothness of the brightness change associated with this difference, providing an accumulated value of the smoothness of the brightness change with respect to all picture elements, and adjusting the focus to maximize this accumulated value. 
     And, in U.S. Pat. No. 4,437,743 by Sakai et al there is disclosed a signal processing system for processing signals from accumulating type photoelectric transducer elements wherein a means is incorporated for varying a threshold level of an input signal. 
     Due to the presence of noise, however, the method of adjusting the lens position until the high frequency components are maximized sometimes results in less than optimum focus. That is, the presence of high frequency noise can result in a maximum signal when the lens is still out of focus. It is therefore desirable to provide an autofocus system which displays some immunity to noise to generate a control signal for accurately achieving autofocus. 
     In addition, where the high frequency components of the video signal are accumulated to detect a maximum, the hardware necessary to generate this large accumulated value can be substantial. It is desirable therefore to reduce the hardware requirement while still generating accurate autofocus information. 
     SUMMARY OF THE INVENTION 
     In the present invention, there is provided a method for generating automatic focus signals to position a lens. The method includes the steps of receiving pixel information as a function of a position of the lens, and selecting high frequency components of this pixel information. Additional steps include establishing a selected threshold level and selecting those high frequency components which exceed the selected threshold level. Finally, the number of high frequency components which exceed the selected threshold level are counted, and the lens is positioned so that the high frequency component count is a maximum. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     These and other features and advantages of the present invention will become more appararent upon reading the following detailed description in conjunction with the attached drawings, in which: 
     FIG. 1 is a simplified block diagram of the autofocus system of the present invention; and 
     FIG. 2 is a more detailed diagram of a threshold circuit of the autofocus system; and 
     FIG. 3 is a timing diagram showing the generation of a focus counter clock signal. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     By way of introduction, in the present invention only those high frequency image signals which exceed a selected threshold amplitude are considered for autofocus purposes. The number of these threshold-exceeding signals are counted at each position of the lens, and when this count is determined to be a maximum, it is concluded that the lens is at an optimum focus position. 
     Now to describe the present invention in more detail by referring first to FIG. 1, there are shown three latches 10a, 10b, and 10c, which receive a continuous stream of digitized pixel data from an upstream video sensor system (not shown), and which is clocked out of the sensor system by a conventional pixel clock signal. An exemplary sensor system is described in U.S. Pat. No. 4,663,661 by Weldy et al, which is assigned to the assignee of the present invention. In a further exemplary embodiment, the sensor output is utilized to generate a video display. 
     In the present invention, the pixel intensity data (in gray scale from 0 through 255) is clocked by the pixel clock first into latch 10a, then at the next pixel clock pulse into latch 10b; and then into latch 10c on the next pixel clock pulse. For convenience of explanation, the pixel in latch 10a will be referred to as the left pixel, while the remaining pixels in latches 10b and 10c will be referred to as the center and right pixels respectively. 
     In order to detect the high frequency pixels from the upstream sensor system, the one&#39;s complement (negative) average of the pixel values from the left and right latches 10a, 10c are calculated in a conventional averaging circuit 12. This occurs over a period of one clock cycle during which the center pixel in latch 10b is simultaneously clocked into the right latch 10c. At the next pixel clock cycle, the negative value from averager 12 and the center pixel from latch 10c are added together by a conventional adder 14. This generates an output from adder 14 which is equal to the difference between the center pixel value and the average of the left and right pixel values. In this manner the presence of high frequency signals is determined. That is, a large calculated difference in the pixel intensity values between the center pixel and the average of the left and right pixels is indicative of a high frequency signal; while little or no calculated difference is indicative of a low frequency signal. 
     In order to minimize the effects of noise, the difference signal from adder 14 is fed to a thresholding circuit 16. The selected level at the thresholding circuit is based upon the assumption that the majority of noisy signals have low amplitudes. In an exemplary embodiment, the threshold is set at a level of seven in the 0 to 255 scale range. This threshold level assumes that the majority of the image is relatively flat field. Thus, at every pixel clock when the difference signal from adder 14 exceeds the threshold, a signal (focus counter clock) is fed to a conventional downstream counter 18 which is reset at the beginning of each new video field. This reset pulse may be generated in the manner described in a copending application entitled &#34;Video Timing System Which Has Signal Delay Compensation And Which Is Responsive To External Synchronization by A.W. Schrock, filed Jan. 11, 1988, and assigned to the assignee of the present; the contents of which are incorporated herein by reference. 
     To achieve an autofocus function, at the end of each field the current count of counter 18 is fed to a downstream microprocessor 20 which controls the position of an adjustable lens 21. This is accomplished by storing in a lookup table in the microprocessor memory the total count for each position of the lens. The microprocessor then moves the lens one distance increment, receives the new count, and compares the count associated with the new lens position with the previous count. As long as the count continues to increase, the micrprocessor continues to move the lens in the same direction. However, when the counts begins to decrease, the microprocessor determines that the lens has just passed the optimum focus position, and backs the lens one increment to the optimum focus position. 
     It should be appreciated that the present invention provides noise immunity in several ways. For one, the threshold level removes much of the lower level noise which can detract from accurate autofocusing. Furthermore, in the present invention the presence of one or more high amplitude noise spikes does not improperly weight the count. For example, in conventional apparatus where the high frequency signals are accumulated, the presence of high amplitude noise can have a significant effect on the accumulated total. However, in the present invention, a signal which exceeds the threshold is equal to only one count, regardless of its amplitude. In this manner, more accurate adjustment of the lens position is achieved. 
     In order to discuss the thresholding circuit 16 in greater detail, reference is made to FIG. 2. In the exemplary embodiment shown in FIG. 2, the eight bit (plus one sign bit) difference output from adder 14, which may be a positive value or a negative value (two&#39;s complement), is fed to the input of an absolute value circuit 22. In order to detect when the absolute value of the difference value from adder 14 exceeds seven, the upper five bits generated out of the absolute value circuit are fed to an OR gate 24. As long as the difference value is seven or below, the output from OR gate 24 is low. However when this value exceeds seven, the output from OR gate 24 is high. 
     The output from the OR gate 24 is fed to a downstream AND gate 26 where it is gated by the pixel clock which is fed to the other input of AND gate 26. This is because it is possible for the output from gate 24 to remain high throughout a number of pixel clock cycles as shown in FIG. 3. More specifically, should the difference value remain greater than seven for several pixel clock cycles, only one large pulse will be generated. Therefore in order to generate the proper number of pulses for clocking the counter, a focus counter clock output is generated for each pixel clock in which the absolute difference value exceeds the selected threshold.