How to Choose the Right Color for Machine Vision Lighting? 4 Core Colors + 1 Contrast Strategy—Say Goodbye to Detection Misjudgments
Source:Shenzhen Kai Mo Rui Electronic Technology Co. LTD2026-06-29
In machine vision inspection, many people focus heavily on camera pixels and algorithm models, yet they overlook a crucial variable: “light source color.” Despite using a 20-megapixel camera and sophisticated detection algorithms, incorrect selection of the light source color can cause part scratches to become “invisible” and characters to “fail to read clearly,” reducing the inspection accuracy from 99% down to 80%.
In fact, the core function of light source color is to “enhance the contrast between the target and the background”: Choosing the right color can make even a 0.01mm scratch stand out clearly; but selecting the wrong color will leave even the most sophisticated algorithms struggling to discern details—just like someone with nearsightedness. In this article, we’ll break down the characteristics of four key light source colors—white light, blue light, red light, and green light—and illustrate them with real-world examples from industries such as electronics, automotive, and food. We’ll also share with you a “color-contrast strategy” that will help you quickly select the right light source and significantly improve detection accuracy.

1. White Light: The “Universal Benchmark” for Industrial Vision—An Ideal Choice for Beginners with No Threshold Requirements
White light covers the entire visible spectrum from 380 to 750 nm, just like natural light, faithfully reproducing the true colors and details of objects. It’s the “default choice” for machine vision inspection. Its key advantage lies in its “versatility”—you don’t have to worry about the material of the object being inspected; it delivers quick and reliable results in most scenarios, making it particularly well-suited for initial “baseline testing.”
1. Core advantage: Full-spectrum coverage, with flawless detail reproduction and no blind spots.
The spectrum of white light comprises the three primary colors—red, green, and blue—enabling it to illuminate object surfaces evenly without “focusing excessively on certain details,” as with monochromatic light. For example, when inspecting plastic parts, white light not only clearly reveals surface scratches but also faithfully reproduces the part’s original color, making it easy to determine whether any color discrepancies exist. When inspecting metal parts, white light effectively balances the metal’s reflections and shadows, ensuring that edge contours are fully and accurately displayed.
2. Typical application scenarios: White light is preferred for the following three types of scenarios.
· Multi-category pooled testing scenarioMany production lines simultaneously inspect parts made of multiple materials—such as plastic components, metal parts, and paper labels—without needing to frequently change light sources when switching between different parts. White light is compatible with all material types, eliminating the time wasted on debugging caused by switching light sources. At a certain electronics factory, the connector inspection line uses white light sources to simultaneously inspect plastic housings, metal pins, and paper labels. This approach has boosted inspection efficiency by 30% compared to using monochromatic light sources.
· Color Difference Detection ScenarioThe food and cosmetics industries often need to detect “color differences”—for example, whether the roasting color of chocolate is uniform or whether lipstick formulations have any discolorations. White light can accurately reproduce the true colors of objects, and algorithms can easily identify color defects by comparing them against standard color charts.
· Initial debugging scenarioWhen first setting up the inspection system, start by testing with white light—observe how the object appears under white light. This allows you to quickly determine the “visibility” of defects and decide whether it’s necessary to switch to monochromatic light for optimization. For example, when inspecting surface defects on glass, if a 0.1mm scratch is visible under white light, there’s no need to switch additionally to blue light. However, if the scratch isn’t clearly visible, then try using blue light to enhance its visibility.
3. Important note: Avoid losing details due to “overgeneralization.”
Although white light is widely used, it can sometimes “fall short” in certain specialized applications: for example, when detecting tiny 0.05mm scratches on metal surfaces, the reflection from white light might obscure the scratches; or when inspecting bubbles inside dark-colored plastics, white light lacks sufficient penetration to reveal internal details. In such cases, it’s essential to use monochromatic light in combination—relying solely on white light isn’t always sufficient.
II. Blue Light: A “Magnifying Glass” for Metals and Glass—No Tiny Defects Can Hide!
Blue light has a shorter wavelength (450–495 nm) and, much like a “fine probe,” exhibits strong scattering when it encounters tiny structures—such as scratches, particles, or pits. In contrast, it reflects weakly from smooth surfaces, such as metallic mirrors or glass. This unique property makes blue light the ideal choice for detecting minute defects on highly reflective materials, allowing it to easily reveal details that are barely perceptible to the human eye.
1. Core advantages: Anti-glare, micro-defect detection, and precise edge positioning.
· Suppress specular reflectionSurfaces made of materials such as metal and glass are smooth, and when illuminated with white or red light, they produce glaring “mirror reflections,” resulting in large bright spots in the image that obscure defects. In contrast, blue light’s shorter wavelength reduces mirror reflections, leading to more uniform surface brightness. As a result, defect areas become clearly visible as dark spots due to scattering, creating strong contrast.
· Highlight minor defectsThe scattering characteristics of blue light are particularly sensitive to tiny structures—scratches as small as 0.01 mm and particles as fine as 0.005 mm will produce clear shadows under blue-light illumination, which the algorithm can easily detect.
· Precise edge positioningBlue light has strong directivity and can clearly outline the edges of objects, making it ideal for applications such as dimension measurement and pin positioning.
2. Typical application scenario: Three types of high-difficulty inspections rely on blue light.
· Metal Surface Defect DetectionSurface scratches, dents, and porosity are common defects in metal parts such as automotive bearings, mobile phone frames, and stainless steel kitchenware. At a certain automotive bearing factory, a blue-ring light source is used to inspect the bearing raceways. A 0.03 mm scratch that was previously invisible under white light becomes clearly visible under blue light, reducing the rate of missed defective products from 5% to 0.1%.
· Glass / Transparent Component Impurity DetectionTransparent materials such as glass substrates, mobile phone cover glasses, and transparent plastic bottles pose challenges for detecting tiny impurities—such as bubbles or dust—either inside or on the surface. When illuminated with blue light, these impurities scatter the blue light, creating dark spots against a transparent background. A display manufacturer has adopted blue-light inspection for glass substrates, boosting the impurity detection rate to 99.8%.
· Precision part edge positioningFor dimension measurements of chip pins and connector pins, precise edge localization is essential. Blue light can clearly highlight the edge contours of the pins. A semiconductor manufacturer uses a blue-light source to measure the spacing between chip pins, reducing the measurement error from ±0.005 mm to ±0.001 mm.
3. Precautions: Protection and Environmental Control
Blue light causes significant stimulation to the human retina; therefore, when operating, it is essential to wear specialized blue-light-blocking glasses and avoid direct, prolonged eye exposure. Additionally, blue light has weak penetrating power. If the surface of the object being tested has oil stains or water marks, this will affect the scattering effect. Thus, before testing, the surface of the object must be thoroughly cleaned.

3. Red Light: A “translucent mirror” for dark-colored or semi-transparent objects—penetrating the surface to reveal the true nature beneath.
Red light has a longer wavelength (620–750 nm) and strong penetrating power, enabling it to pass through the surface of certain dark or translucent materials and reveal features beneath the surface or under covering layers—much like a “透视镜.” This solves the detection challenges associated with dark objects that are difficult to see inside and with covering layers that obscure fine details.
1. Core advantages: Strong penetration, resistance to absorption, and breakthrough of surface obstructions.
· Anti-dark color absorptionDark-colored objects (such as black plastic or dark-brown glass bottles) absorb short-wavelength light (such as blue and green light) but absorb red light relatively weakly; red light can penetrate the surface to illuminate the interior.
· Penetrate the translucent layer: Semi-transparent materials (such as silicone, resin, and multilayer films) scatter short-wavelength light, causing internal details to appear blurry. However, red light can reduce scattering, allowing the internal structure to be displayed clearly.
· Reduce background interferenceIn certain scenarios, red light can “mask” the background—for example, on a green conveyor belt. When illuminated by red light, the conveyor belt reflects weakly, making the object being measured—such as a black part—stand out more prominently.
2. Typical application scenario: Select red light for the 3 types of “insight needs.”
· Internal inspection of dark-colored containersFor dark-colored containers such as oral liquid bottles, ink bottles, and pesticide bottles, it’s necessary to check whether the liquid inside contains impurities and whether the labels are affixed correctly. A certain pharmaceutical factory uses red light to inspect brown oral liquid bottles. The red light penetrates the bottle walls, allowing clear visualization of impurities as small as 0.1 mm inside the bottle, thereby preventing these impurities from contaminating the medicinal solution.
· Internal Defect Detection in Translucent MaterialsSemi-transparent materials such as silicone sealing rings, resin parts, and multi-layer fabrics make it difficult to detect internal bubbles and interlayer impurities. A certain silicone manufacturer uses red light to inspect sealing rings and can detect bubbles as small as 0.05 mm inside them, whereas under white light, these bubbles are completely obscured.
· Feature Recognition Under the Cover LayerThe characters or markings beneath the paint or coating layer on a part’s surface need to be read through the covering layer. At a certain automotive parts factory, red light is used to read part numbers after painting. The red light can penetrate a 20-μm-thick paint layer, allowing the characters to be clearly identified. As a result, the recognition success rate has increased from 70% to 99%.
3. Precautions: Control the penetration depth.
Red light has strong penetrating power, but “the deeper, the better” isn’t necessarily true—excessive penetration can lead to a decrease in image contrast. For example, when inspecting a 1mm-thick transparent plastic sheet, red light might penetrate the entire sheet, causing internal defects to blend in with the background. In such cases, you can adjust the distance of the light source and reduce its brightness to control the penetration depth, ensuring that only the area to be inspected is illuminated.
4. Green Light: A “filter” for complex backgrounds, enabling more accurate character recognition.
Green light has a central wavelength (520–570 nm) and performs exceptionally well in black-and-white camera systems—it can effectively suppress backgrounds of specific colors while enhancing the features of the target object, much like a “filter” that “sifts out” the target from a complex background. This makes it particularly suitable for character recognition and detection of defects in specific colors.
1. Core advantages: High contrast, background suppression, making target features more prominent.
· Enhance specific color contrastOn the color wheel, green light is complementary to red light and closely resembles green—this means that a red target will appear brighter under green light, while a green background will appear darker under green light, creating a striking contrast.
· Suppress background interferenceIf the background is green (such as a green conveyor belt or green packaging), when illuminated with green light, the background will reflect weakly, making the target (such as white characters or red parts) stand out more and reducing interference from the background during detection.
· Compatible with black-and-white camerasMany industrial inspections use black-and-white cameras (which are low-cost and offer high frame rates). In black-and-white images, green light can display a richer range of grayscale levels, making it more suitable for character recognition than red or blue light.
2. Typical application scenario: Three types of “high-interference” scenarios rely on green light.
· Complex Background Character RecognitionThe white batch number on the green bottle cap and the black part numbers on the green conveyor belt have colors that are similar to their respective backgrounds, making them difficult to identify under white light. To address this issue, a beverage manufacturer used green light to illuminate the green bottle caps, causing the background to darken and the white characters to brighten. As a result, the character recognition success rate increased from 85% to 99.5%.
· Red Defect DetectionThe white impurities on the red rubber parts and the foreign fibers on the red fabric need to stand out against the red background, highlighting the white targets. At a certain rubber factory, green light is used to inspect red sealing rings; under green light, the white impurities form distinct bright spots that can be easily identified by algorithms.
· Target Localization Against a Green BackgroundThe positioning of parts on green trays and the inspection of components on green circuit boards require extracting the targets from a green background. At a certain electronics factory, green light is used to locate chips on green circuit boards. Since the edges of the chips contrast sharply with the background, the positioning error has been reduced from ±0.1 mm to ±0.01 mm.
3. Notes: Compatible camera types
Green light works best with black-and-white cameras. If using a color camera, pay attention to the overlapping effects of green light with other colors—for example, when a color camera captures a red part, green light might cause the part to appear yellow, thereby affecting color judgment. Therefore, in scenarios such as character recognition and target localization, it’s best to use black-and-white cameras paired with green light; for color detection applications, caution is advised.
5. Key Strategy: Enhance contrast with “adjacent colors / complementary colors” for doubled impact.
After selecting the right light source color, adopting a “color contrast strategy” can significantly enhance detection performance. This strategy is based on the “color wheel principle”: adjacent colors blend seamlessly with each other, while complementary colors create strong contrasts. By leveraging this characteristic, you can precisely control the contrast between the target and its background.
1. Adjacent Color Strategy: Conceal the background to highlight target details.
2. Complementary Color Strategy: Enhance Contrast, Extract Target Features
VI. Summary: Light Source Color Selection Chart + 3 Core Principles—Use for Direct Reference
To facilitate quick selection, we’ve compiled a selection table for 4 core light source colors—simply refer to the table and choose according to your scene:
Light source color | Wavelength range (nm) | Core Features | Typical application scenarios | Precautions |
White light | 380-750 | Universal, restoring authenticityColor | Multi-category pooled testing, color difference detection, initial debugging | Not suitable for detecting tiny defects or dark/semi-transparent objects. |
Blue light | 450-495 | Anti-glare, micro-defects visible | Metal scratches, glass impurities, precise edge alignment | Wear blue-light-blocking glasses and clean the surface of the object being tested. |
Red light | 620-750 | Strong penetration, resistant to dark color absorption | Internal inspection of dark-colored bottles, bubbles in translucent components, and characters beneath the coating layer | Control the penetration depth to avoid a decrease in contrast. |
Green light | 520-570 | Low background, high contrast | Complex background character recognition, red target detection, green background localization | Prioritize pairing with black-and-white cameras; compatibility testing is required for color cameras. |
In addition to referring to the comparison table, you should also remember the three core principles:
00001. Try white light first.When you're unsure which color to choose, start by testing with white light—80% of common scenarios can be adequately covered by white light. If the results aren't satisfactory, then switch to monochromatic light.
00001. Centered on “contrast”The essence of selecting a light source color is to “maximize the contrast between the target and the background.” There’s no need to pursue complexity—any choice that clearly distinguishes the target from the background is a good one.
00001. Debugging based on actual scenariosFor the same color light source, different distances, angles, and brightness levels will affect the results—for example, when using blue light to detect metal scratches, an excessively low light-source angle can result in overly heavy shadows, while an excessively high angle can cause glare. It’s necessary to adjust these parameters on-site to find the optimal settings.
Related News
- 2026-06-30
- 2026-06-30
- 2026-06-29
- 2026-06-29
Working Principle of Optical Filters
2026-06-29- 2026-06-27






+8613798538021