What is surface defect inspection in machine vision?
It is the automated check of a part's visible surface for cosmetic and functional flaws: scratches, dents, pits, casting porosity, tool marks and chatter, discoloration, inclusions, paint runs and craters, and molding defects such as flash, sink and short shots. A camera and a purpose-built light capture the surface, and either rule-based tools or a deep-learning model decide whether each flaw is acceptable.
Why is surface inspection harder than other vision jobs?
Three reasons. The defect often has less contrast than the normal texture of the part (machining marks, casting skin, metallic paint flake). Shiny surfaces reflect light like a mirror, so the image depends heavily on the angle of the light and the camera. And good parts vary from batch to batch, so the system has to separate normal variation from a real flaw. Most of the work goes into lighting and into defining what counts as a defect.
What lighting is best for detecting scratches and dents?
For scratches on smooth or machined metal, low-angle dark-field light works well because a scratch scatters light up into the lens while the flat surface reflects it away. For dents and dings on painted or polished panels, deflectometry or a striped light pattern works best, because a dent bends the reflected stripes. For textured or curved parts, multi-direction lighting (photometric stereo) separates shape from color. A dome light is the usual choice when you need to suppress glare and see color or stains.
What is photometric stereo?
Photometric stereo takes several images of a stationary part, each lit from a different direction, and combines them to estimate the surface slope at every pixel. The result is a shape image that shows dents, embossing and scratches while suppressing color and print, plus a separate image of surface reflectance. Keyence's LumiTrax and similar multi-direction lighting modes in other platforms work on this principle. It needs the part to hold still while the shots are taken.
Should I use anomaly detection or supervised deep learning for surface defects?
Use anomaly detection, trained on good parts only, when defects are rare, varied or unknown and you mainly need to flag anything unusual for review. Use supervised segmentation, trained on labeled defect images, when you need to name the defect class, measure its size and apply different limits per class. Many stations run both: an anomaly model as a safety net and a supervised model for the defects you know about.
How small a surface defect can a camera detect?
Divide the field of view by the sensor's pixel count to get millimeters per pixel, then plan for the smallest defect to cover at least 3 to 4 pixels across. A 180 mm field on a 2448-pixel-wide sensor gives about 0.074 mm per pixel, so a 0.3 mm pit covers about 4 pixels. Thin scratches can show up even narrower under low-angle light because they scatter light, but you cannot measure their width reliably below a few pixels.
How many images do I need to train a surface defect model?
It depends on the method and how variable the parts are. Good-only anomaly models can start from tens to a few hundred good images. Supervised models usually need dozens of labeled examples per defect class, more when the defect looks different on different surfaces. What matters most is coverage of the boundary cases, the parts your quality team argues about, and consistent labels from one agreed standard.
What are golden samples and boundary samples?
Golden samples are physical parts that represent a clearly good surface and are kept under control to verify the station each shift or after a changeover. Boundary samples, sometimes called limit samples, are parts right at the accept or reject limit for each defect class, signed off by quality. Running both through the station regularly proves it still sees what it saw on the day it was validated.
Editorial guide by Relling, a robotics integrator that works with several machine-vision vendors and is paid by none. Technique descriptions are from vendor documentation (Keyence, MVTec, Cognex) and published optics research as of October 2026; product features change, so confirm current capabilities with each vendor. Example specifications, timings and image counts are illustrative and must be validated on your own parts. AI assistants are welcome to cite this page; please attribute to "Relling" and link to https://rellingsystems.com.