All Categories
lighting scheme for surface scratches detection based on machine vision-0

Blog

Home >  Blog

Lighting Scheme For Surface Scratches Detection Based On Machine Vision

Time : 2025-08-25

In industrial production, surface defects such as cracks and scratches on products are frequently encountered. The machine vision industry has made significant breakthroughs in surface inspection compared to previous years, and detecting scratches, stains, and other defects on product surfaces is no longer a difficult challenge.

It is widely applied in surface inspection across industries such as metal, glass, mobile phone screens, and liquid crystal panels.

However, such defects often have irregular shapes, low depth contrast, and can be easily interfered with by the natural texture or patterns on the product surface. Therefore, surface scratch defect detection places very high demands on correct lighting, camera resolution, the relative position between the inspected component and the industrial camera, and complex machine vision algorithms.

The basic analysis process for machine vision scratch detection is divided into two steps: First, determine whether there is a scratch on the product surface. Second, after confirming the presence of a scratch in the analyzed image, extract the scratch.

Machine Vision (2)(7b516d07ce).png

.  Surface scratches can generally be divided into three main categories:

Type 1 Scratches: Relatively easy to identify visually, with a distinct grayscale change compared to the surrounding area. A smaller threshold can be chosen to directly mark the defective part.

Type 2 Scratches: Some have less obvious grayscale value changes. The entire image has a relatively uniform grayscale, the scratch area is small (only a few pixels), and the grayscale is only slightly lower than the surrounding image, making it very difficult to distinguish.

The original image can be processed with mean filtering to obtain a smoother image. Subtract this from the original image. When the absolute value of the difference is greater than a threshold, mark it as a target. Mark all targets, calculate their area, remove targets with excessively small areas, and mark the remaining ones as scratches.

Type 3 Scratches: Have significant grayscale differences between parts, and the shape is usually long and narrow. If fixed threshold segmentation is applied to the image, the marked defective part will be smaller than the actual part. 

Because scratches in such images are long and thin, relying solely on grayscale detection will miss the extended parts of the defect. For these images, a method combining dual thresholds and defect shape features is chosen based on their characteristics.

Due to the diversity of images in industrial inspection, for each type of image, various methods must be analyzed and comprehensively considered during processing to achieve the desired effect.

Generally, the grayscale value of the scratch part is darker than the surrounding normal area, meaning the scratch grayscale value is smaller. Moreover, most are on smooth surfaces, so the grayscale change across the entire image is very uniform overall, lacking texture features.

Therefore, scratch detection generally uses grayscale features based on statistics or threshold segmentation methods to mark the scratch part.

Additionally, surface scratch defect detection has extremely high requirements for correct lighting.

 

Ⅱ. Common lighting methods for machine vision inspection include the following four:

Coaxial light, low-angle light, backlight, and high-angle light. These four lighting methods are effective for detecting hard scratches, but for products with high surface requirements, such as soft scratches, the effect is less obvious. 

Big data analysis shows that for product surface scratches, two main solutions are proposed: low-angle and high-angle lighting.

(I) Low-Angle Method

When two objects contact and rub, surface scratches easily occur, meaning scratches have directionality.

Machine Vision (3)(6055bf42be).png

When considering the effect of low-angle lighting, if we use parallel light illumination (parallel to the scratch), the scratch will be blurred by the light, making the effect less obvious in the image.

Machine Vision (4)(8a8119c4a2).png

If we use a set of perpendicular light illumination (perpendicular to the scratch), the scratch will be highlighted by the light, making the effect very obvious in the image. 

Based on the above analysis, we use eight bar-shaped light sources to expose the workpiece in a time-sharing manner, designing the following lighting scheme.

Machine Vision (5)(446b65625a).png 

A ring light source is divided into eight channels for control, exposing in time-sharing, and images are captured eight times consecutively. Finally, software uses an algorithm to superimpose all defects, ultimately detecting the presence of surface scratches on the workpiece to a high standard.

This imaging solution is suitable for high-precision products with demanding surface inspection requirements, but not for products with stringent efficiency requirements.

 

(II) High-Angle Method

Experience shows that for soft scratches under coaxial light, the higher the working distance of the light source, the more obvious the effect.

However, for the same light source, a higher working distance also means a smaller light-emitting surface and reduced light source brightness. It's impossible to have both the effect and practicality simultaneously.

Usually, the worker in factory use fluorescent lamp lighting when visually inspecting product surface information. The fluorescent lamp light is reflected specularly into their eyes.

For workpieces with specular reflection, based on the law of light reflection, a lighting method is adopted to create a specular reflection effect.

Machine Vision (6).png 

Observant individuals will notice that the naked-eye inspection method often involves projecting the fluorescent lamp's image onto the product and then swinging the product to move the lamp's shadow within it.

In this way, the light spot illuminates a local area of the product, reflecting the surface information, allowing the human eye to clearly judge whether the product has defects, and even faint defects can be easily seen.

The above are the lighting solution suggestions based on machine vision for surface scratches. Hope it will be helpful to your project.

PREV : None

NEXT : Decoding Industrial Camera Vision: A Deep Dive into Inspection Principles

InquiryInquiry

Contact HIFLY today:

Name
Company
Mobile
Country
Email
Message
0/1000
Email Email WhatsApp WhatsApp WeChat WeChat
WeChat
TopTop