AUTOFOCUS CONTROL OF AN OPTICAL INSTRUMENT
BACKGROUND OF THE INVENTION
The present invention relates generally to cameras and similar optical instruments and, more particularly, concerns a method and apparatus for controlling automatic focus in such devices.
Today, automatic focus controllers are quite common in electronic cameras. An optical scanner, such as a bar code scanner, is a special purpose camera, which provides its own illumination to scan and then decode an optical code that may be present on a remote object. Providing an auto focus mechanism increases the effective depth of field of the optical instrument. However, maintaining effective focus requires a knowledge of the distance between the optical instrument and the object being photographed. Various distances measuring techniques for this purpose are well known in the field of photography, and they vary from trigonometric methods to methods utilizing various forms of radiation that determining distance from 'time-of-flight" of the radiation. Although distance measurement for the purpose of focusing is now performed on even relatively inexpensive cameras, it still presents a problem with optical code scanners, especially handheld ones, which should be compact, light in weight, and relatively inexpensive. The apparatus and methods used for distance measurement simply introduce too much complication, increased size, and expense for a simple bar code scanner. Accordingly, it is an object of the present invention to provide auto focus control in an optical instrument, without introducing any physical components to measure distance directly. Specifically, it is contemplated that appropriate adjustment of focus distance be determined indirectly for information which is already available to the optical instrument.
SUMMARY OF THE INVENTION
In accordance with one aspect of the present invention, focus adjustment in an automatic focus mechanism takes place without any actual measurement of distance. Specifically, the distance to a bar code can be determined sufficiently for purposes of automatic focus by measuring the intensity of light reflected by the object being imaged and comparing it to the intensity of light reflected when the bar code is at a known distance. Having made that determination, an adjustable element in an optical focus system, such as a zoom lens, can be adjusted accordingly, focusing the apparatus at the appropriate distance. In accordance with a preferred embodiment, the amplitude of the light reflected by a bar code and detected by a scanner is compared to the amplitude of light reflected when the scanner is at the closest zoom distance of the lens in the scanner. This provides a measurement of the distance between the bar code and the scanner, and the auto focus optics can be adjusted accordingly. Preferably the scanner measures the peak illumination being received from the bar code and compares it to the peak illumination record when the bar code is disposed at the closest zoom distance
In accordance with another aspect of the present invention, special steps are taken to calibrate distance measurement for low-contrast bar codes, which tend to provide an attenuated intensity indication resulting in a measured distance estimate which greater than the actual zoom adjustment or "beam waist location" of the lens. Under these circumstances, an automated procedure is followed, according to which the lens adjustment and the detected light measured is progressively reduced (a reduction in focal length) until a maximum aptitude is measured. This maximum is indicated when the detected intensity fails to increase after a reduction in lens adjustment. This then serves as a substitute reference value in determining the distance of the object.
BRIEF DESCRIPTION OF THE DRAWINGS
The forgoing brief description and further objects, features, and advantages of the present invention will be understood more completely from the following detailed description of presently preferred, but none the less illustrative, embodiments in accordance with the present invention with reference being had to the accompanying drawing in which :
FIG 1. is a sketch representing the reflected light received at a scanner from a bar code and illustrating the peak detection thereof;
FIG 2. is a graph of bar code distance versus peak amplitude of light reflected from the bar code for three different types of bar code display, a normal display being represented by curve 10, a low contrast display by curve 20, and the very low contrast display by curve 30;
FIG. 3 is a flow chart illustrating a preferred process for using the intensity of light reflected from a bar code to estimate its distance and then using that estimate to control automatic focus;
FIG. 4 is a graph illustrating detected intensity of reflected light varies with lens zoom adjustment in the vicinity of an adjustment which is exactly in focus;
FIG. 5 is a flow chart illustrating a preferred process using light intensity measurement to home in zoom adjustment to a setting which is precisely in focus.
DETAILED DESCRIPTION OF THE PREFERED EMBODIMENT
FIG. 1 is a sketch representing the intensity of light reflected from up scanned bar code as a function of time. As the scan beam passes over light and dark sections of the bar code, high and low intensity of light are respectively reflected. Typically, the reflected light is sensed by photo diode which would produce an electrical signal representing the bar code signal B of FIG. 1 in which amplitude varies as a function of light intensity. For the purposes of the present invention, the bar code signal is peak detected, a process which is well known by those skilled in the art to produce a peak amplitude signal M, which is basically the envelope of peaks of the bar code signals B. In order to obtain the useful peak amplitude signal, peak detection is performed with a sufficient amount of integration to prevent substantial variation in the peak amplitude signal M between peaks of the bar code signal B during normal operation.
An auto focus mechanism in an optical device would typically include a lens system with a moving element, which is adjusted to vary focal length or "beam waist position" of the lens system. Typically, for a bar code scanner, the beam waist position would be varied from about 75 millimeters to about 350 millimeters.
Given a bar code illuminated with a fixed intensity of light, a predictable relationship exists between the peak amplitude of the light from the detected bar code and the distance of the bar code from the scanner. That relationship is reflected by curve 10 in the graph of FIG. 2 which characterizes how peak intensity varies with barcode distance over the 75 millimeter- 350 millimeter focus range covered by a typical lens. In this graph, the peak amplitude of the detector bar code signal has been normalized to the amplitude at the 75 millimeter distance, and falls off sharply as the distance increases.
The information in this graph could be obtained by actual measurement and then stored in a lookup table in a processor inside the scanner. Once the intensity at 75 millimeters is calibrated, for example at the factory, the distance of the bar code could be estimated from the look up table, after detecting the peak value of the detected barcode signal. Basically, the information corresponding to the dots in curve 10 is coded in the table, and distances falling between dots on the graph could be estimated through a conventional interpolation algorithm, such as linear interpolation.
As an, example, the flow chart of FIG. 3 illustrates a process for zoom adjustment based on the measurement of detected bar-code intensity. The process begins at step 100 and, at step 102, the peak amplitude of the light returned from the bar code is determined. This could be done simply by applying an electrical signal derived from the reflected barcode light to a peak detector. At step 104, an interpolation is performed between the two values (dots on curve 10 of FIG. 2) on either side of the measured value, assuming the measured peak intensity does not fall exactly on a value of the table. This produces an estimate for the distance of the bar code, which the processor outputs at step 106. At step 108, the output value is utilized to adjust the lens focus in the scanner to the estimated distance, and the process ends at step 110. The process described with respect to the flow chart of FIG.3 should be successful in decoding most bar codes. However, low-contrast bar codes are currently in use which produces an attenuated peak intensity. The effect of low contrast bar codes is illustrated by curves 20 and 30 in FIG. 2. Basically, they produce an attenuated intensity curve. For example, curve 20 is the intensity versus barcode distance curve of a bar code with moderately reduced contrast (intensities reduced to 60% of their values in curve 10), and curve 30 is a similar curve for a low contrast bar code in which all intensities have been reduced to 30% of the values in curve 10. Assuming a low contrast bar code were encountered which exhibited the characteristic of curve 20, if the bar code scanner were programmed with curve 10, the intensity reading at a barcode distance of 75 millimeters would produce an intensity reading of .6 and an estimate that the bar code is at a distance of 110 millimeters. Similarly, a bar code exhibiting a characteristic in accordance with curve 30 would result in an estimate that the bar code is at a distance of 140 millimeters. In both instances, light intensity readings for the low-contrast bar code need to be scaled so that they fall back on the curve 10, which is programmed into the processor of the scanner.
A preferred method for determining the correct barcode distance when a low contrast barcode is first encountered is based upon on the observation of the behavior of the lens as its
zoom focal length is adjusted. Specifically, the peak amplitude of light read from a bar code is always maximized when the beam waist position or focal length of the lens equals the distance of the lens from the bar code. For example, the graph of FIG. 4 illustrates a lens at a distance of 140 millimeters from the bar code. When the beam waist position is adjusted to be 140 millimeters, the detected peak amplitude is maximized. As the lens position is increased or decreased, the value of the detected peak amplitude drops.
From curves 20 and 30 in FIG. 2, it will be appreciated that a low-contrast bar code always provides a distance estimate which is larger than the actual distance of the bar code, as reflected by the arrow 40 in FIG. 4. In other words, the distance estimate is on the right hand side of the peak in the curve 50 of FIG. 4. Therefore, if the lens adjustment for focal length is reduced in small steps, the detected peak amplitude of the bar code will increase with each step, until the lens focal length equals the distance of the bar code. If the lens adjustment is decreased beyond that point, the detected peak intensity of the bar code will drop. This decrease in detected peak intensity of the bar code indicates that the focal length corresponding to the distance of the bar code lies between the last two positions.
Applying the forgoing principal, a preferred process for determining the distance of a low-contrast bar code is illustrated by the flow chart of FIG. 5. The process starts at block 200, and, at block 202, the peak intensity of the bar code is detected. Using curve 10 of FIG. 2, the corresponding lens setting is determined and, at block 204, the lens is adjusted to that setting. This will cause a change in the detected peak bar code intensity, and the new peak amplitude of the bar code is detected at block 206. At block 208, the lens setting is then decreased by one step, that is, it is adjusted to a shorter focal length. As explained above in reference to FIG. 4, this should move the focus closer to a distance corresponding to the distance of the bar code. Accordingly, when the new peak amplitude of the bar code is detected at block 210, it should be larger than the peak amplitude detected immediacy before. At block 212, a test is performed to determine whether the detected peak amplitude has increased. If so, this is an indication that we have moved the zoom adjustment closer to the distance of the bar code, and control is returned to block 208.
It will be appreciated that control will continue to be returned to block 208 to decrease lens setting as long as the detected peak amplitude of the bar code continues to increase. Should the test at block 212 indicate that the amplitude has not increased, the focal point corresponding to the distance of the bar code lies between the two last ones. Accordingly to the process of FIG. 5, the lens setting is reverted to the last one that caused an increase in detected peak amplitude (block 214), and the process ends at block 216.
At this point, the setting of the lens provides an estimate of the distance of the bar code.
Those skilled in the art will appreciate that it may be possible to improve the estimate of the bar code distance by interpolating, for example linearly, between the last two lens settings. However, reversion to the previous lens setting is a simpler procedure and will usually produce sufficiently accurate results.
Once the distance to the bar code is known, the ratio between the peak amplitude detected at block 202 and the one that results in the final lens setting represents a weighting or amplification factor that may be applied to the peak bar code amplitudes detected from the low-contrast bar code in order to permit the use of the process illustrated in the flow chart of FIG. 2 (with the curve 10). In other words, when a new, low-contrast bar code is encountered, the process illustrated in FIG. 5 may be utilized to recalibrate the bar code reader, after which the process of FIG. 2 may again be utilized to estimate bar code distance and adjust the lens. After the recalibration, should a user encounter a bar code with normal contrast, he could immediately revert the scanner to operate under the process illustrated in FIG. 2. For example, the reset button could be provided for that purpose.
The recalibration could be triggered manually by a user when he encounters a low contrast bar code. However, it also possible to have the calibration triggered automatically when the scanner is unable to resolve a barcode.
As explained above, the characteristic curve 10 is preferably stored in the memory of the processor within the scanner. In the preferred embodiment, the dots indicated on curve 10 were stored in the form of a table. A question may arise as to how many such dots are sufficient to satisfy the requirements of auto focus performance over the entire range. Since each of the dots corresponds to an actual setting of the lens, the lens will exhibit a certain depth of field at each of those settings. One criterion for selecting the number of settings could therefore be to have the depths of field of adjacent settings overlap so that focus can be continuous. Another criterion might be to select the distance between dots so that the curve segments between dots are relatively linear, making linear interpolation convenient.
FIG. 6 is a functional block diagram of an optical scanner 300 embodying the present invention. Scanner 300 includes a scan subsystem 302, which produces an illuminating scan, which is common to every scanner. It could be as simple as a moving light beam which scans at one-dimensional bar code in linear fashion. It is also possible to illuminate an entire line or area, in which case scanning could be performed on an image of the optical code created inside scanner 300.
Scanner 300 also includes an optical subsystem 304. This sub system includes all of the optical components required to create an image of the scanned optical code. In the present instance, the optical subsystem includes a zoom lens, the zoom and focus of which are controlled automatically. The image created by optical subsystem 304 is focused on an imaging subsystem 306.
This can include an image sensing array, or it could it be as simple as a sensing diode, when the scan subsystem 302 produces a linear scan.
For convenience of the description, a peak detector 308 is shown separately in FIG. 6. However, those skilled in the art will appreciate that the imaging sub system 306 would typically have available electronic components necessary to perform peak detection, so it would be convenient for peak detector 308 to be part of the imaging subsystem. As explained previously, it is preferred that peak detector 308 included a certain amount of integration. However, it could also be the simplest type of peak detector, such as diode driving compactor, and averaging or integration could be performed by the CPU which is always present in a scanner (discussed further below).
CPU 310 performs all of the control and processing functions required by the other components of scanner 300. For example, it could decode the bar code from the signal provided by the imaging sub system, and it produces a control signal to adjust the focus and a zoom of a lens in an optical subsystem. With respect to the method in accordance with the present invention, it senses a signal produced by peak detector 308 which represents the peak amplitude of the bar code signal, and CPU 310 preferably performs the methods illustrated in FIGS. 3 and 5.
Although preferred embodiments of the invention have been disclosed for illustrative purposes, those skilled in the art will appreciate that many additions, modifications, and substations are possible without departing from the scope and spirit of the invention as defined by the accompanying claims.