Machine Vision

Vision inspection systems allow machines to function more autonomously by identifying and quantifying the quality of a given product more consistently and accurately than human workers. This works by imaging the product or group of products and using post-processing algorithms to determine whether the product passes inspection (e.g. reassuring that the lid on a jar is fully sealed). This article discusses a procedure for modeling a machine vision imaging system using non-sequential mode in OpticStudio 16.5, focusing on modeling three main components: an imaging system, lighting, and the product itself.
Jade Aiona


Machine vision inspection systems are vital in any automated system where accuracy is important. To confirm accuracy, machines generally use an imaging system to record visual information about the product. This allows the machine to determine whether each product passes or fails some predetermined criteria. For example, a system might need to look at bottles of soda to determine that each product is filled to a certain point. Using a machine vision inspection system in this case gives us a precise and consistent pass or fail method of determining which products are ready for delivery and which need to be fixed or discarded.

While these systems generally depend more on post-processing of the image, the initial imaging system can have a huge effect on the quality of the image. Therefore, machine vision systems with different purposes can benefit from various imaging systems. These factors can include type, position, and direction of the lighting element or ability of the sensor.

This article describes the process of modeling a machine vision inspection system using non-sequential mode. We will discuss simple methods for modeling three key parts of a machine vision system: a camera, a light source, and a product for testing the system.

Modeling the System

Modeling a Camera with a Paraxial Lens

To model the camera for the system, we used a lens and a detector. If the lens is available in the lens catalog or if the information for modeling the lens is accessible, you can proceed by inserting a lens from the Lens Catalog or modeling the lens by hand, respectively. However, if the information required to model the lens is inaccessible, you can still model the camera similarly with a Paraxial Lens. We used the Paraxial Lens object to model a lens with a focal length of 25 mm in both x and y. It is important to keep in mind that the Paraxial Lens assumes no aberration, but instead simulates the effective F/# by setting the aperture and focal length. The detector was placed 50 mm behind the lens to model the sensor of the camera and allows us to analyze the product with the detector viewer.

Modeling a Ring Light Source

To illuminate the product, OpticStudio has a variety of source options to consider. We’ve modeled a ring light with a circular array of rectangle sources. For help modeling an array of sources, see this article. In this system, the rays reflected off the product propagate through the center to the camera. To generate rays in all directions, we’ve placed an annulus with Lambertian scattering in front of the array of sources to act as a diffuser. Modeling a source rectangle followed by a surface with a Lambertian scatter distribution is a common way to model LED sources; but if the LED module is known, users should check if the model exists in the Radiant Source library as Radiant Source models will provide a more accurate representation of the light source. For more information on using Radiant Source models, feel free to look at this article.

Modeling a Product using CAD Imports

OpticStudio has many options for modeling the product in this type of system using CAD parts in SolidWorks, Creo Parametric, or Autodesk Inventor as well as various other CAD file types. For more information on using CAD objects in OpticStudio, see this article. For this system, we used a CAD: Zemax Part Designer object to import a premade example CAD object from the Zemax Part Designer objects.

Scattering Rays through the System

The system we’ve designed is dependent on the reflection of scattered rays off a product so we must define some scatter profile for the object. Here, we can take advantage of a couple of features in object properties to manipulate the way rays scatter in the system. The following sections discuss use of the Coat/Scatter and Importance Sampling options in OpticStudio.

In addition to defining the scatter profile, we want to use Importance Sampling to increase accuracy and decrease the rays needed to generate an accurate image of the product. This works by selecting only rays that are incident on a target sphere of a defined radius (size) and angle (limit) at the position of the listed object. It is important to note that while importance sampling traces only rays incident on the target sphere, it will not trace only rays incident on the selected object. This means that some rays will not hit the object and we must adjust the target sphere as necessary. For a more in-depth example of applying Importance Sampling, see this article. In this system, we have two objects with scatter profiles – the diffuser, and the CAD object – that can take advantage of Importance Sampling. As such, we’ve set the diffuser to trace only rays toward the product and the product to trace only rays towards the camera.

The resulting image of the product makes it easier to understand the necessary programming and placement of the product to achieve the goals of the inspection system.


Here, we’ve discussed common practices in modeling three main components in any machine vision inspection system:
  • Modeling a camera with a paraxial lens and a detector
  • Modeling an example light source with an array of sources and a diffuser
  • Modeling a product using CAD objects and scattering features in OpticStudio
Keep in mind that this is a base recipe for the process and the more information you have regarding the components of the system, the better your model of the system can be. For detailed descriptions of a few more advanced and precise techniques for modeling with more information, feel free to look at the links below!