Approaching Machine Vision from an Optical Point of View
In this article we cover the basic questions that should be addressed by every vision system designer whenever an image is to be acquired through a lens/camera combination. There is a tremendous amount of interest in implementing vision systems since they hold forth the promise of eliminating tedious, repetitive measurements while at the same time increasing manufacturing yields and response times. Although the research community has been concentrating on optical parallel processing, the basic Machine Vision inspection systems today still contain a lens, a camera, and an image processing card.
What is "Machine Vision?"
Machine vision is an all encompassing term that covers everything from semiconductor inspection to automatic guidance systems. For our purposes, we define "Machine Vision" as the act of acquiring an image via a lens/camera combination and then digitally processing that image to locate and act upon a salient feature (see Figure 1). Furthermore, let us restrict the discussion to inspection tasks based upon pattern recognition where the end user needs to quickly and automatically locate a flaw in their product line.

Figure 1: Sketch of typical Machine Vision System
The basic procedure is to illuminate the object and use the lens system to produce an image on the camera which then communicates to the image processing board. The board can be programmed to perform any number of image operations, with a common one being template matching. A given template is then compared point by point and any significant differences on features triggers an alarm such that the piece is rejected.

Figure 2: Sketch of template matching paradigm.
The template is on the left and the acquired image on the right. At shown on the image on the bottom the nonmatching parts are accentuated in conjunction with an alarm from the control system. Computer Optics Inc. has been an OEM supplier of the optical front end for many such inspection devices. Due to our background, our approach has been to start the analysis with the features of the object under question so that the highest quality image is sent back to the camera plane.
What are some common problems with using stock lenses for machine vision?
- The image appears to be too dark.
- The image is the wrong size.
- The object being examined goes in and out of focus as it is being inspected.
- The resolution is not sufficient across the field.
The solution is to have a lens that is designed with the application in mind. In optics, just as in many other fields a lens system is a series of compromises, since no lens is perfect. The key is to choose the important features for your application such that performance is maximized. Occasionally a stock lens will suffice for a given application, however, when picking the stock lens care must be taken to insure that it was designed to work at the conjugates specified.
Often the application is not well defined when starting out. In this case a low cost stock option prototytpe may be the more cost efficient method in order to demonstrate a working system and line up potential clients. Regardless however, some of the questions that should be addressed when designing the system are :
What questions do I need to ask myself to select a stock lens?
- What is the distance to object plane from the camera focal plane? In other words, how far away is the thing you are looking at from the plane of the camera? Generally speaking this combined with the magnification can be used to specify the focal length of the lens.
- What is the required minimum feature size (resolution) in the object plane? This question can be a bit tricky especially when using coherent lighting since diffractive effects come into play. Generally speaking however one rule of thumb is to have your acquisition system have at least a factor of 2 better resolution then your minimum feature size. For coherent light, allow three to five times more system resolution than required by your minimum feature size.
- What detector are you using in the focal plane? Specifically, if using a pixelated device, how many pixels are available? If this is a parameter that can be left open, generally speaking, the more pixels the better. A cost/performance tradeoff will have to be carried out.
- What is the field of view? Specifically how large is the overall image? Do you need to capture the entire image at one time? Can you scan? Is the part moving?
- What depth of focus is necessary? Is the object moving in regard to the lens/sensor combination? If so, how much? For example, a section of paper being examined on a roller might vary in distance from the camera as air currents lift the paper up and down.
- What are the lighting requirements? Do you need a minimum amount of throughput in order for your system to function? Is there room to place illumination sources? What is the nature of the material to be viewed? Is it specular? Reflective?
- Is zoom capability required? Would digital zooming suffice or is pixelation a problem? A zoom lens is useful where pixelation during magnification is unacceptable. It also provides a method to examine different fields of view with the same lens.
- What are the mechanical constraints? Are there any Size or weight restrictions? Is there a restriction on length or outer diameter? What is the overall environment? Is the lens subject to vacuum, humidity, radiation or chemicals? What is going on outside the lens? Is the lens moving or subject to shock and vibration? What is being produced on the factory floor?
- Distortion tolerance? Can distortion be tolerated and taken out later with the digital system? For example, if a wide angle is required, then distortion occurs radially. If true object size is needed regardless of placement within the image, then a telecentric lens might be preferred.
- What is your estimated market price for your system? Using an expensive lens/camera combination may solve your imaging problems only to produce a wonderful system that cannot be sold. This list of questions allow optical engineers to get a feeling for the necessary performance requirements of a given lens/camera system.
The lens selection process: an example
For example, consider an application where a 1/2" camera is used with 10 micron square pixels. A typical camera contains 700 x 500 pixels so that the overall camera plane size is 7 x 5 millimeters. This means that the maximum resolution of the camera plane is 50 lp/mm under unity magnification. However the maximum field of view at this resolution is only 7 x 5 millimeters. If a 7 x 5 cm field of view were desired then the magnification necessarily must be 10:1 which reduces the maximum resolution to 5 lp/mm (100 microns). This basic constraint is called the "space-bandwidth" product and results from the physical parameters of the system. There has been a general movement towards smaller camera planes such as 1/2" or even 1/3". Although this may be acceptable for some applications, the space bandwidth product generally is smaller which makes the constraints outlined above more limiting. In other words, other things being equal, the 2/3" provides a larger field of view since there are more overall pixels. A similar tradeoff occurs when comparing light gathering ability versus depth of field. Generally speaking, the greater the depth of focus, the lower the light gathering ability. These tradeoffs make up the heart of what is physically possible with a lens system regardless of what lens is actually employed.
For the first time user, the stock lens solution may not meet all of the requirements, but at least an intelligent choice can be made of cost versus features. As the product is developed other less important but desirable features can be designed into the system.
About the Author
Dr. Jonathan Kane joined Computer
Optics Inc in 1996 as Director of R&D, and is now the President.
Prior to that he was a staff scientist with the Air Force Research Laboratory.
He has published a variety of articles and holds a series of patents in: Machine
Vision, Image Processing, Ferroelectric/VLSI display devices, Optical Processing,
Photorefractive Crystals, Phase Conjugation, Atomic Phenomena, Fourier Processing,
Neural Networks, and Optical Logic. His current interests include Prototype
electro-optical construction as well as Optical Lens Design and Optical Coating
design. Questions or comments about this article can be sent to him
at COI.