Automated scratch detection uses cameras, angled lighting and image analysis software to find scratches and other surface defects that a person would otherwise look for by eye. The key is lighting: a scratch is a tiny groove that only shows up when light strikes it from the right angle, so the lighting design decides what the camera can see. Resolution then decides how small a scratch can be found, and the software decides whether it is a real defect, how severe it is and whether the part passes.
Scratch and surface defect detection is one of the most common jobs in machine vision, and one of the hardest on shiny parts such as polished metal, glass, glossy plastic and coated surfaces. This article explains why reflective surfaces are difficult, which lighting techniques reveal which defects, how to size the camera, and how to choose between rule-based and AI software.
Why scratches on shiny parts are hard to see
A matte surface scatters light in every direction, so a camera sees an evenly lit surface and defects show up as changes in brightness. A shiny surface acts like a mirror: it reflects light in one direction, so the camera sees either a bright reflection of the light source or darkness, depending on the angle. Glare can hide a scratch completely, while reflections of the surroundings can look like defects. People handle this instinctively by tilting a part under a light. An inspection system has to do the same thing deliberately, with lighting placed at known angles.
Lighting techniques for scratch and surface defect detection
| Technique | How it works | What it reveals |
|---|---|---|
| Low-angle dark field | Light grazes the surface from a shallow angle; flat areas reflect away and look dark | Scratches, pits and dust light up as bright lines and spots on a dark background |
| Bright field / coaxial | Light comes from the camera’s direction; flat areas reflect straight back and look bright | Dents, scratches and non-flat areas look dark against a bright, flat surface |
| Diffuse dome | Even light from all directions removes glare | Stains, colour changes and print defects on curved shiny parts |
| Structured pattern (deflectometry) | The camera views a striped pattern reflected in the surface; bumps bend the stripes | Shallow dents, waves and orange peel on mirror-like surfaces |
| Polarized light | Polarizing filters cut specular glare | Defects otherwise hidden under reflections |
Most systems combine two or more of these, often taking several images of each part under different lights. For background, see our articles on machine vision lighting systems, light colors in machine vision and when to use polarization.
How small a scratch can a camera find?
A useful rule of thumb is that the smallest defect should span at least two to three pixels in the image. Fewer than that and it can disappear between pixels or be mistaken for noise.
Worked example
Suppose the part needs a 60 mm field of view on a camera that is 2,448 pixels wide. Each pixel covers 60 ÷ 2,448 ≈ 0.0245 mm, about 24.5 µm. A 50 µm wide scratch then spans about 50 ÷ 24.5 ≈ 2 pixels, which is at the edge of reliable detection. To get 3 pixels across the scratch, each pixel must cover about 50 ÷ 3 ≈ 16.7 µm, so the field of view shrinks to about 2,448 × 0.0167 ≈ 41 mm. The options are a higher-resolution camera, several cameras, or imaging the part in sections.
| Field of view | Pixel size (2,448 px) | Pixels across a 50 µm scratch |
|---|---|---|
| 60 mm | ≈ 24.5 µm | ≈ 2 (marginal) |
| 41 mm | ≈ 16.7 µm | ≈ 3 (reliable) |
Lighting stretches this rule: a well-lit scratch can glow brighter than its true width and be found below the two-pixel limit, but its size can no longer be measured accurately from the image.
Rule-based vs AI scratch detection
Rule-based software uses thresholds and measurements, such as “any bright line longer than 2 mm is a scratch”. It is fast, predictable and easy to validate when defects are consistent. AI and deep learning learn from labelled example images and handle defects that vary in shape, contrast and texture, or surfaces with natural patterns such as brushed metal. Many systems use both: rules to find candidates and AI to classify them. Our article on AI defect detection goes deeper on training and classification.
| Rule-based | AI / deep learning | |
|---|---|---|
| Best for | Consistent defects on uniform surfaces | Variable defects, textured or patterned surfaces |
| Setup | Engineered thresholds | Labelled good and bad images |
| Explainability | Easy to trace | Needs validation on real samples |
| Changes | Retune rules | Retrain with new examples |
From detection to grading
Finding a scratch is only part of the job. Most quality standards care about how long, deep, wide or visible it is, and where it sits on the part. A surface inspection system usually:
- Detects and locates every candidate defect.
- Classifies it: scratch, dent, crease, scuff, stain or pit.
- Measures it: length, width, area and contrast.
- Applies the grading rules for that zone of the part.
- Produces a pass/fail or a grade, with a defect map saved for traceability.
The surface defect detection example shows this on reflective parts, including chips, wear and colour defects.
Checklist: specifying a scratch detection system
- Material, finish and colour of every part variant, plus good and defective samples.
- The smallest scratch or dent that must be rejected, and the largest that is acceptable.
- Which surfaces and zones matter, and whether the grading differs by zone.
- Rate: parts per minute, and whether parts are stationary, indexed or moving.
- The output you need: pass/fail, grade, defect map, data to your quality system.
- A feasibility test on real parts. Sciotex offers free testing of sample parts to find the right configuration.
Grading surfaces by eye today?
The Sciotex benchtop surface defect inspection system detects, locates and classifies scratches, creases, dents, scuffs and staining, then grades each part with a defect map. Designed, built and supported in the US since 1997.
Frequently asked questions
Cameras image the part under lighting set at specific angles so scratches stand out, and software finds, measures and classifies each defect before deciding whether the part passes.
Low-angle dark field lighting is the most common choice: flat areas look dark and scratches light up. Coaxial, dome, structured-pattern and polarized lighting are used for other defects and surfaces.
A practical rule is two to three pixels across the defect. With a 60 mm field of view on a 2,448-pixel camera, each pixel covers about 24.5 µm, so a 50 µm scratch is near the limit; a narrower field or higher resolution improves that.
Shiny surfaces reflect light like mirrors, so glare can hide defects and reflections can look like defects. Lighting must be placed at known angles to control what the camera sees.
Not always. Rule-based software works well for consistent defects on uniform surfaces. AI helps when defects vary or the surface has texture.