Introduction
Machine vision systems rely on accurate and consistent image data to perform tasks such as inspection, quality control, and object recognition. One critical factor that significantly impacts the performance of these systems is lighting. In this blog post, we’ll explore essential lighting techniques for machine vision and how they contribute to successful outcomes.
Types of Machine Vision
With the rapid evolution of machine vision in the manufacturing space, cameras and inspection systems have expanded to perform multiple operations using a single captured frame.
Examples:
- External inspection
- Character recognition
- Foreign object and material inspection (FOD)
- Dimension measurement
- Part count inspection
- Liquid volume inspection
- Detection inspection
- Code recognition
This additional reliance on machine vision and the multiple layers of dependencies on accurate results has created an essential need for a robust lighting system, with clearly addressed requirements and adequate testing and validation.
The Role of Lighting
Effective lighting serves several purposes in machine vision:
- Contrast Enhancement: Proper lighting enhances the contrast between the object and its background, making it easier for algorithms to detect edges and features.
- Shadow Reduction: Shadows can distort images and affect measurements. A well-designed lighting system minimizes shadows.
- Color Consistency: Lighting of a consistent wavelength ensures accurate color representation, crucial for applications such as product sorting.
Lighting Techniques
Backlighting
- Backlighting involves placing a light source behind the object being inspected.
- Ideal for detecting defects, cracks, or scratches on transparent or translucent materials.
- Creates a silhouette effect, emphasizing edges.
Frontlighting
- Frontlighting illuminates the object from the same direction as the camera.
- Provides uniform illumination and reduces shadows.
- Commonly used for surface inspection and reading barcodes.
Darkfield Lighting
- Darkfield lighting involves illuminating the object from an oblique angle.
- Highlights surface imperfections, scratches, or irregularities.
- Useful for inspecting reflective or specular surfaces.
Ring Lighting
- A circular light source is placed around the camera lens.
- Provides even illumination for cylindrical objects or flat surfaces.
- Minimizes glare and reflections.
Diffuse (Full Bright Field) Lighting
- Diffuse lighting scatters light in all directions.
- Softens shadows and reduces specular reflections.
- Suitable for inspecting textured or irregular surfaces.
Coaxial Lighting
- Coaxial lighting directs light parallel to the optical axis.
- Eliminates shadows and highlights surface features.
- Ideal for reading characters or symbols on reflective surfaces.
Lighting Technique, Effects, and Inspection Type
Lighting Technique | Effect | Inspection Type |
Backlighting | Silhouette | Transparent/Translucent Materials |
Frontlighting | Reduces Shadows | Surfaces |
Darkfield Lighting | Reduces Shadows | Surfaces |
Ring Lighting | Minimizes Reflections | Flat or Cylindrical Surfaces |
Diffuse Lighting | Minimizes Reflections | Textured or Reflective Surfaces |
Coaxial Lighting | Highlights Surface Features | Highly Reflective Surfaces |
Best Practices
Select the Appropriate Color Temperature
Choosing the right color temperature is critical for machine learning applications, especially for object detection and image processing. Color temperature, measured in Kelvin, influences how different colors appear, which can impact model accuracy and consistency.
- Warm light (lower Kelvin temperatures) enhances reds, oranges, and yellows, while cool light (higher Kelvin temperatures) brings out blues, greens, and cooler tones. Depending on the features the model needs to analyze, adjusting the temperature can help to emphasize relevant colors.
- To make specific colors in an image appear brighter, consider using a light color temperature that matches the object’s color. For example, illuminating a blue object with a cool (higher Kelvin) light will increase its brightness and contrast, helping the model capture more detail.
- In contrast (
nopun intended), to reduce the prominence of certain colors consider using a light color that is complementary to the object’s color. By applying a light color opposite to the object’s color on the color wheel, you increase light absorption, darkening the object in the image.
Control Intensity
Adjust the lighting intensity to avoid overexposure or underexposure of the object. Use dimmers or pulse-width modulation (PWM) controllers to control intensity.
- Light intensity and camera exposure time should be configured/tested together since they directly impact each other. This will help ensure that the target object is consistently visible without washing out details or introducing shadows.
- In applications with fast-moving objects, short exposure times are often required to capture clear images without motion blur. To compensate, higher light intensity is typically necessary to ensure the object is well-lit within the limited exposure window, allowing the model to analyze details accurately. Think of it like a photographer on a dance floor, using a bright flash and fast shutter speeds to freeze movement and capture details clearly.
- High light intensity can also be used to overwhelm ambient lighting conditions where that is a concern. Exposure time would need to be reduced accordingly.
Use Diffusers and Filters
Diffusers, as shown in the rendered image above, can significantly enhance image contrast, leading to improved model consistency. By scattering light, diffusers create a softer, more uniform illumination that reduces harsh reflections and enhances camera readability. This effect is similar to how softboxes work in photography, diffusing light to create a softer look on the subject. Even clouds act as natural diffusers, softening sunlight.
Filters, on the other hand, are used to block specific wavelengths and highlight particular colors in the spectrum, which can further enhance image contrast and highlight details important for accurate model analysis.
Test and Optimize
To achieve the best results in machine learning applications, it’s essential to test and optimize your lighting setup thoroughly. Experiment with different lighting configurations, including intensity, color temperature, and diffuser use, to see what yields the most consistent and accurate outputs. Test under a range of conditions, such as varying levels of ambient light, different object types, and diverse backgrounds, to understand how each factor affects image quality and model performance.
Real-Life Examples
Front Lighting for Optical Character Recognition (OCR)
Sparx developed a fully automated syringe filling machine system to fill and cap 10ml syringes in a clean-room production facility. The system was required to fill high numbers of syringes per hour with a FDA mandated accuracy in fluid volume.
Syringes are required to be inspected twice per cycle. First, empty syringes are inspected to detect graduations on the barrel and plunger position. These values are then used to calculate how far the plunger needs to be retracted for the fill volume.
The shape of the plunger, syringe labeling, and even the absence/presence of the syringe are inferred from the captured image.
The filled and capped syringes are finally inspected before being ejected from the system. This is used to identify under or over-filled syringes and uncapped syringes.
Since Sparx is a Cognex Certified System Integrator, we will often use the excellent technology available from Cognex in these types of applications. For this application Sparx used a Cognex IS700 Series camera with integrated front lighting – this approach works best here since we are looking for a clear and high-contrast image of the outer surface of the syringe barrel.
As a result the 1ml silkscreen graduations and the plunger are clearly visible against the translucent barrel.
Ring Lighting for Inspection – Pharmaceutical Verification
For this application, filled pill bottles exiting the fill station need to be inspected and recorded for a pharmaceutical process.
A high-brightness ring light was chosen for this purpose. Ring lights reduce shadows from ambient lighting, enhancing the detailed features. The even illumination from the ring light ensures uniform exposure and accurate color representation of the pills.
Syringe Illumination Examples
Filled syringes on the automated system are post-inspected manually for foreign particles. We were tasked with capturing training images for an automated inspection system. The first step was to select hardware and begin evaluating multiple lighting setups to evaluate for foreign particle detection.
Front Lighting
A Cognex IS700 with a C-mount lens and integrated lighting was the baseline setup. The camera and lighting fixture was mounted approximately 7 inches from the subject to maximize the focal length of the camera, reduce reflections from the direct lighting, and maintain consistency between all setups.
The resulting image produces a clear outer surface of the barrel. However, internal features and internal foreign object inclusions were not well defined.
Off-Axis Lighting
In this setup, a light source was positioned “off-axis” at approximately 45° from the syringe. This angle caused more reflections on the syringe barrel than desired and left internal particles poorly illuminated. Such a configuration is better suited for surface inspection, where light geometry can highlight surface embossments.
Backlighting
Backlighting was tested and ultimately selected as it illuminates the syringe cavity and syringe graduations best. Backlighting creates a strong contrast for the graduations, ensuring accurate reading and verification. By illuminating the syringe from behind, this setup also minimizes glare and unwanted reflections on the barrel, providing a clearer, more reliable view of the syringe’s interior features and markings.
Sparx is an experienced system integrator of machine vision and lighting products for robotic automation solutions in biotech, pharmaceutical, and clean room environments.
Conclusion
Mastering machine vision lighting techniques is essential for achieving accurate and reliable results. By understanding the role of lighting, choosing the right technique, and following best practices, you’ll illuminate the path to success in your machine vision applications. Remember, the right lighting can make all the difference!