1.  Field of the Invention
This invention relates to industrial machine vision inspection of objects, and more particularly to a focus adjustment mechanism that permits focus adjustment of optical components of a vision detector. 
2.  Description of the Related Art
Industrial manufacturing relies on automatic inspection of objects being manufactured.  One form of automatic inspection that has been in common use for decades is based on optoelectronic technologies that use electromagnetic energy, usually infrared or visible light, photoelectric sensors, and some form of electronic decision making. 
One well-known form of optoelectronic automatic inspection uses an arrangement of photodetectors.  A typical photodetector has a light source and a single photoelectric sensor that responds to the intensity of light that is reflected by a point on the surface of an object, or transmitted along a path that an object may cross.  A user-adjustable sensitivity threshold establishes a light intensity above which (or below which) an output signal of the photodetector will be energized. 
One photodetector, often called a gate, is used to detect the presence of an object to be inspected.  Other photodetectors are arranged relative to the gate to sense the light reflected by appropriate points on the object.  By suitable adjustment of the sensitivity thresholds, these other photodetectors can detect whether certain features of the object, such as a label or hole, are present or absent.  A decision as to the status of the object (for example, pass or fail) is made using the output signals of these other photodetectors at the time when an object is detected by the gate.  This decision is typically made by a programmable logic controller (PLC), or other suitable electronic equipment. 
Automatic inspection using photodetectors has various advantages.  Photodetectors are inexpensive, simple to set up, and operate at very high speed (outputs respond within a few hundred microseconds of the object being detected, although a PLC will take longer to make a decision). 
Automatic inspection using photodetectors can be difficult since simple sensing of light intensity reflected from a point on the object is often insufficient for inspection.  Instead it may be necessary to analyze a pattern of brightness reflected from an extended area.  For example, to detect an edge it may be necessary to analyze a pattern of brightness to see if it corresponds to a transition from a lighter to a darker region. 
Further, it may be hard to arrange the photodetectors when many points on an object need to be inspected.  Each such inspection point requires the use of a separate photodetector that needs to be physically mounted in such a way as to not interfere with the placement of the other photodetectors.  Interference may be due to space limitations, crosstalk from the light sources, or other factors. 
Manufacturing lines are usually capable of producing a mix of products, each with unique inspection requirements.  An arrangement of photodetectors is very inflexible, so that a line changeover from one product to another would require the photodetectors to be physically moved and readjusted.  The cost of performing a line changeover, and the risk of human error involved, often offset the low cost and simplicity of the photodetectors. 
Using an arrangement of photodetectors requires that objects be presented at known, predetermined locations so that the appropriate points on the object are sensed.  This requirement may add additional cost and complexity that can offset the low cost and simplicity of the photodetectors. 
Another well-known form of optoelectronic automatic inspection uses a device that can capture a digital image of a two-dimensional field of view in which an object to be inspected is located, and then analyze the image and make decisions.  Such a device is usually called a machine vision system, or simply a vision system.  The image is captured by exposing a two-dimensional array of photosensitive elements for a brief period, called the integration or shutter time, to light that has been focused on the array by a lens.  The array is called an imager and the individual elements are called pixels.  Each pixel measures the intensity of light falling on it during the shutter time.  The measured intensity values are then converted to digital numbers and stored in the memory of the vision system to form the image, which is analyzed by a digital processing element such as a computer, using methods well-known in the art to determine the status of the object being inspected. 
In some cases the objects are brought to rest in the field of view, and in other cases the objects are in continuous motion through the field of view.  An event external to the vision system, such as a signal from a photodetector, or a message from a PLC, computer, or other piece of automation equipment, is used to inform the vision system that an object is located in the field of view, and therefore an image should be captured and analyzed.  Such an event is called a trigger. 
Machine vision systems avoid the disadvantages associated with using an arrangement of photodetectors.  They can analyze patterns of brightness reflected from extended areas, easily handle many distinct features on the object, accommodate line changeovers through software systems and/or processes, and handle uncertain and variable object locations. 
Machine vision systems have disadvantages compared to an arrangement of photodetectors, including:                They are relatively expensive, often costing ten times more than an arrangement of photodetectors.         They can be difficult to set up, often requiring people with specialized engineering training.         They operate much more slowly than an arrangement of photodetectors, typically requiring tens or hundreds of milliseconds to make a decision.  Furthermore, the decision time tends to vary significantly and unpredictably from object to object.         
Machine vision systems have limitations that arise because they make decisions based on a single image of each object, located in a single position in the field of view (each object may be located in a different and unpredictable position, but for each object there is only one such position on which a decision is based).  This single position provides information from a single viewing perspective, and a single orientation relative to the illumination.  The use of only a single perspective often leads to incorrect decisions.  It has long been observed, for example, that a change in perspective of as little as a single pixel can in some cases change an incorrect decision to a correct one.  By contrast, a human inspecting an object usually moves it around relative to his eyes and the lights to make a more reliable decision. 
Also, the limitations of machine vision systems arise in part because they operate too slowly to capture and analyze multiple perspectives of objects in motion, and too slowly to react to events happening in the field of view.  Since most vision systems can capture a new image simultaneously with analysis of the current image, the maximum rate at which a vision system can operate is determined by the larger of the capture time and the analysis time.  Overall, one of the most significant factors in determining this rate is the number of pixels comprising the imager. 
The availability of new low-cost imagers, such as the LM9630 from National Semiconductor of Santa Clara, Calif. that operate at a relatively low-resolution (approximately 100×128 pixels), high frame rate (up to 500 frames per second) and high sensitivity allowing short shutter times with inexpensive illumination (e.g., 300 microseconds with LED illumination), have made possible the implementation of a novel vision detector that employs on-board processors to control machine vision detection and analysis functions.  A novel vision detector using such an imager, and overall inspection system employing such a vision detector, is taught in U.S. patent application Ser.  No.  10/865,155, entitled METHOD AND APPARATUS FOR VISUAL DETECTION AND INSPECTION OF OBJECTS, by William M. Silver, filed Jun. 9, 2004, and the teachings of which are expressly incorporated herein by reference. 
An advantage to the above-incorporated-by-reference detection and inspection METHOD AND APPARATUS is that the vision detector can be implemented within a compact housing that is programmed using a PC or other Human-Machine Interface (HMI) device (via, for example a Universal Serial Bus (USB)), and is then deployed to a production line location for normal runtime operation.  The outputs of the apparatus are (in one implementation) a pair of basic High/Low lines indicating detection of the object and whether that object passes or fails based upon the characteristics being analyzed.  These outputs can be used (for example) to reject a failed object using a rejection arm mounted along the line that is signaled by the apparatus' output. 
By way of example, FIG.  1 shows an illustrative embodiment of a vision detector 100 according to the above-incorporated-by-reference METHOD AND APPARATUS FOR VISUAL DETECTION AND INSPECTION OF OBJECTS inspecting objects on a production line.  A conveyor 102 transports objects to cause relative movement between the objects and the field of view of vision detector 100.  Objects 110, 112, 114, 116 and 118 are shown.  In this example, the objects include exemplary features upon which location and inspection are based, including a label 120 and a hole 124.  More particularly, the exemplary vision detector 100 detects the presence of an object by visual appearance and inspects it based on appropriate inspection criteria.  If an object is defective (such as the label-less object 116), the vision detector 100 sends a signal via link 150 to a reject actuator 170 to remove the object (116) from the conveyor stream.  An encoder 180 operatively related to the motion of the conveyor (or other relative motion) sends a signal 160 to the vision detector 100, which uses it to insure proper delay of signal 150 from the encoder count where the object crosses some fixed, imaginary reference point 190, called the mark point.  If an encoder is not used, the delay can be based on time instead. 
In an alternate example, the vision detector 100 sends signals to a PLC for various purposes, which may include controlling a reject actuator.  In another exemplary implementation, suitable in extremely high-speed applications or where the vision detector cannot reliably detect the presence of an object, a photodetector is used to detect the presence of an object and sends a signal to the vision detector for that purpose.  In yet another implementation, there are no discrete objects, but rather material flows past the vision detector continuously—for example a web.  In this case the material is inspected continuously, and signals are send by the vision detector to automation equipment, such as a PLC, as appropriate. 
Basic to the function of the vision detector 100 in the above-incorporated-by-reference METHOD AND APPARATUS is the ability to exploit the abilities of the imager's quick-frame-rate and low-resolution image capture to allow a large number of image frames of an object passing down the line to be captured and analyzed in real-time.  Using these frames, the apparatus' on-board processor can decide when the object is present and use location information to analyze designated areas of interest on the object that must be present in a desired pattern for the object to “pass” inspection. 
With brief reference to FIG.  2, a timeline is shown, which illustrates a typical operating cycle for a vision detector in visual event detection mode.  A portion 200 of the exemplary timeline corresponds to the inspection of a first object, and contains the capture and analysis of seven frames by the vision detector.  A second portion 210 corresponds to the inspection of a second object, and contains five frames. 
Boxes labeled “c”, such as box 220, represent image capture by the vision detector 100.  Boxes labeled “a”, such as box 230, represent image analysis.  It is desirable that capture “c” of the next image be overlapped with analysis “a” of the current image, so that (for example) analysis step 230 analyzes the image captured in capture step 220.  In this timeline, analysis is shown as taking less time than capture, but in general analysis will be shorter or longer than capture depending on the application details.  If capture and analysis are overlapped, the rate at which a vision detector can capture and analyze images is determined by the longer of the capture time and the analysis time.  This is the “frame rate”.  The above-incorporated-by-reference METHOD AND APPARATUS allows objects to be detected reliably without a trigger signal, such as that provided by a photodetector. 
Each analysis step “a” first considers the evidence that an object is present.  Frames where the evidence is sufficient are called active.  Analysis steps for active frames are shown with a thick border, for example analysis step 240.  In an exemplary implementation, inspection of an object begins when an active frame is found, and ends when some number of consecutive inactive frames are found.  In the example of FIG.  2, inspection of the first object begins with the first active frame corresponding to analysis step 240, and ends with two consecutive inactive frames, corresponding to analysis steps 246 and 248.  Note that for the first object, a single inactive frame corresponding to analysis step 242 is not sufficient to terminate the inspection. 
At the time that inspection of an object is complete, for example at the end of analysis step 248, decisions are made on the status of the object based on the evidence obtained from the active frames.  In an exemplary implementation, if an insufficient number of active frames were found then there is considered to be insufficient evidence that an object was actually present, and so operation continues as if no active frames were found.  Otherwise an object is judged to have been detected, and evidence from the active frames is judged in order to determine its status, for example pass or fail.  A variety of methods may be used to detect objects and determine status within the scope of the invention; some are described below and many others will occur to those skilled in the art.  Once an object has been detected and a judgment made, a report may be made to appropriate automation equipment, such as a PLC, using signals well-known in the art.  In such a case a report step would appear in the timeline.  The example of FIG.  5 corresponds instead to a setup such as shown in FIG.  1, where the vision detector is used to control a downstream reject actuator 170 via signal 150.  By considering the position of the object in the active frames as it passes through the field of view, the vision detector 100 estimates the mark time 250 and 252 at which the object crosses the mark point 190 (FIG.  1).  Note that in cases where an encoder 180 is used, the mark time is actually an encoder count; the reader will understand that time and count can be used interchangeably.  A report 260, consisting of a pulse of appropriate duration to the reject actuator 170, is issued after a precise delay 270 in time or encoder count from the mark time 250. 
Note in particular that the report 260 may be delayed well beyond the inspection of subsequent objects such as object 110 (FIG.  1).  The exemplary vision detector 100 uses well-known first-in first-out (FIFO) buffer methods to hold the reports until the appropriate time. 
Once inspection of an object is complete, the vision detector 100 may enter an idle step 280.  Such a step is optional, but may be desirable for several reasons.  If the maximum object rate is known, there is no need to be looking for an object until just before a new one is due.  An idle step will eliminate the chance of false object detection at times when an object couldn't arrive, and will extend the lifetime of the illumination system because the lights can be kept off during the idle step. 
The processor of the exemplary METHOD AND APPARATUS is provided with two types of software elements to use in making its decisions: “Locators” that locate the object and “Detectors” that decide whether an object feature is present or absent.  The decisions made by both Locators and Detectors are used to judge whether an object is detected and, if so, whether it passes inspection.  In one example, Locators can be simply described as a one-dimensional edge detector in a region of interest.  The vision detector is configured for locating objects by placing Locators at certain positions in an image where an edge feature of the object can be seen when the object is in the field of view.  The Locator can be oriented with respect to the direction the object is moving, and sized to ensure that the edge feature of the object can be located at multiple positions while in the field of view.  During analysis, the location of the edge feature of the object within the Locator can be reported, as well as a logical output state that the location is known. 
Detectors are vision tools that operate on a region of interest that produce a logical output state that detects the presence or absence of features in an image of the object.  The vision detector is configured for detecting features of an object by placing Detectors at certain positions in an image where object features can be seen when the object is located by the Locators.  Various types of Detectors can be used, such as Brightness Detectors, Edge Detectors, and Contrast Detectors. 
Detectors can be linked to the location of the feature determined by a Locator to further refine the presence detection and inspection of the object.  Accordingly, in each frame where the object may be viewed at a different perspective, the location of the object determined by the Locator will be different, and the position of the Detectors in the image can be moved according to the location determined by the Locator.  The operation of the vision detector at high frame rates, therefore permits the vision detector to capture and analyze multiple images of the object while it passes through the field of view. 
The above-discussion of Locators and Detectors is further illustrated by way of example in FIGS.  3 and 4.  FIG.  3, thus, represents an image of the object 110 from FIG.  1, containing label feature 120 and hole feature 124, with superimposed graphics (termed “Photos” in the above-incorporated METHOD AND APPARATUS) representing a region of the frame whose output can be used to base decisions and is displayed (at appropriate time, such as during vision detector setup—see below) as an “image view” on a Human-Machine Interface (HMI) for a user to view and manipulate.  See FIG.  1, for example, showing a detachable or remote HMI 194 with Graphical User Interface (GUI) screen 196 and image view window 198 which displays an associated image view (300) of an object (120, for example) within the vision detector's (100) field of view.  Accordingly, FIG.  3 represents an image view, showing the object 300 containing an image of a label 310 and a hole 312.  The object in this example contains six visible features to be inspected, corresponding to the two exemplary Locators and four Detectors further described below. 
The Locator 320 is used to detect and locate the top edge of the object, and the Locator 322 is used to detect and locate the right edge.  A Brightness Detector 330 is used to help detect the presence of the object.  In this example the background is brighter than the object, and the sensitivity threshold is set to distinguish the two brightness levels, with the logic output inverted to detect the darker object and not the brighter background.  Together the Locators 320 and 322, and the Brightness Detector 330, provide the evidence needed to judge that an object has been detected, as further described below.  A Contrast Detector 340 is used to detect the presence of the hole 312.  When the hole 312 is absent the contrast would be very low, and when present the contrast would be much higher.  A Spot Detector could also be used.  An Edge Detector 360 is used to detect the presence and position of the label 310.  If the label 310 is absent, mispositioned horizontally, or significantly rotated, the analog output of the Edge Detector would be very low.  A Brightness Detector 350 is used to verify that the correct label has been applied.  In this example, the correct label is white and incorrect labels are darker colors. 
As the object (110 in FIG.  1) moves from left to right through the field of view of the vision detector 100, the Locator 322 tracks the right edge of the object and repositions Brightness Detector 330, Contrast Detector 340, Brightness Detector 350, and Edge Detector 360 to be at the correct position relative to the object.  Locator 320 corrects for any variation in the vertical position of the object in the field of view, repositioning the Detectors based on the location of the top edge of the object.  In general Locators can be oriented in any direction.  A user can manipulate Photos in an image view by using well-known HMI techniques.  A Photo can be selected by clicking with a mouse, and its ROI can be moved, resized, and rotated by dragging.  Additional manipulations for Locators are described below. 
FIG.  4 shows a logic view containing a wiring diagram corresponding to the example setup of FIG.  3.  A wiring diagram shows a series of features (termed “Gadgets” in the above-incorporated METHOD AND APPARATUS) 420, 422, 430, 440, 450 and 460 being used to inspect objects and interface to automation equipment, and the connections between logic inputs and outputs of the Gadgets.  A wiring diagram may be displayed on an HMI for a user to view and manipulate.  A display of Gadgets and their logic interconnections on an HMI is called a logic view.  A Locator 420 named “Top”, corresponding to Locator 320 in the image view of FIG.  15, is connected to AND Gate 410 by wire 424.  Similarly, “Side” Locator 422 corresponding to Locator 322, and “Box” Detector 430, corresponding to Brightness Detector 330, are also wired to AND Gate 410.  The logic output of “Box” Detector 430 is inverted, as shown by the small circle 432, and as described above, to detect the darker object against a lighter background.  The logic output of AND Gate 410 represents the level of confidence that the top edge of the object has been detected, the right edge of the object has been detected, and the background has not been detected.  When confidence is high that all three conditions are true, confidence is high that the object itself has been detected.  The logic output of AND Gate 410 is wired to the ObjectDetect Judge 400 to be used as the object detection weight for each frame.  Since the logic input to the ObjectDetect Judge in this case depends on the current frame, the vision detector is operating in visual event detection mode.  Note, when operating in external trigger mode, an Input Gadget would be wired to ObjectDetect.  To operate in continuous analysis mode, nothing would be wired to ObjectDetect. 
The choice of Gadgets to wire to ObjectDetect is made by a user based on knowledge of the application.  In the example of FIGS.  3 and 4, a user may have determined that detecting just the top and right edges was not sufficient to insure that an object is present.  Note that Locator 322 might respond to the label's left edge just as strongly as the object's right edge, and perhaps at this point in the production cycle Locator 320 might occasionally find some other edge in the background.  By adding Detector 330, and requiring all three conditions by means of AND Gate 410, object detection is made reliable.  In the wiring diagram, Contrast Detector “Hole” 440, corresponding to Contrast Detector 340, Brightness Detector “Label” 450, corresponding to Brightness Detector 350, and Edge Detector “LabelEdge” 460, corresponding to Edge Detector 360, are wired to AND Gate 412.  The logic output of AND Gate 412 represents the level of confidence that all three image features have been detected, and is wired to ObjectPass Judge 402 to provide the object pass score for each frame. 
The logic output of ObjectDetect Judge 400 is wired to AND Gate 470.  The logic output of ObjectPass Judge 402 is inverted (circle 403) and also wired to AND Gate 470.  The ObjectDetect Judge is set to “output when done” mode, so a pulse appears on the logic output of ObjectDetect Judge 400 after an object has been detected and inspection is complete.  Since the logic output of ObjectPass 402 has been inverted, this pulse will appear on the logic output of AND Gate 470 only if the object has not passed inspection.  The logic output of AND Gate 470 is wired to an Output Gadget 480, named “Reject”, which controls an output signal from the vision detector than can be connected directly to a reject actuator 170 (FIG.  1).  The “Reject” Output Gadget 480 is configured by a user to perform the appropriate delay (270 in FIG.  2) needed by the downstream reject actuator. 
To aid the user's understanding of the operation of the exemplary vision detector 100, Gadgets and/or wires can change their visual appearance to indicate fuzzy logic values.  For example, Gadgets and/or wires can be displayed red when the logic value is below 0.5, and green otherwise.  In FIG.  4, wires 404 and 472 are drawn with dashed lines to indicate a logic value below 0.5, and other wires, for example wire 424, are drawn solid to indicate logic values equal to or greater than 0.5.  One skilled in the art will recognize that a wide variety of objects can be detected and inspected by suitable choice, configuration, and wiring of Gadgets.  One skilled in the art will also recognize that the Gadget class hierarchy of the above-incorporated-by-reference METHOD AND APPARATUS is only one of many software techniques that could be used to practice the invention. 
Machine vision systems and vision detectors can be configured with focus-adjustable lenses so that a properly focused image of the object can be acquired.  Typical installations require a focus adjustment step is during setup, or during operation, such as when line configuration changes are made.  In prior art machine vision system implementations, a focus setting is determined while a sample object is placed in a fixed position in the field of view.  If a focus adjustment is necessary subsequent to initial setup or during run-time, the machine vision system is taken off line while the focus adjustment is performed.  If the system is installed on a moving production line, safety requirements typically dictate that the line be stopped for a camera adjustment such as a focus setting. 
Further, if a machine vision imager is provided in a sealed housing to protect the imager components from the production environment, the housing seal must be temporarily broken to permit focus adjustment.  Typically, focus adjustment of a sealed imager requires opening the housing to adjust the focus setting, and re-sealing the housing. 
Vision detectors, as described above, are capable of being configured and setup on a running line.  Vision detectors acquire multiple images, any one of which can be used for configuration and initial setup.  Configuration and setup of a vision detector does not typically require stopping a production line once the unit is installed.  However, if a focus adjustment is necessary, access to the vision detector for such an adjustment may require production line interruption. 
Accordingly, a need exists for an imaging device in a machine vision system or a vision detector that permits focus adjustment without disturbing a production environment.