A shallow mark on a metal surface has the same color and brightness as its surroundings. So it is almost invisible in an image taken with ordinary lighting. But when light comes from the side, one wall of the mark gets brighter and the other gets darker. Photometric Stereo measures this effect systematically from several directions and computes the surface slope for each pixel.
Principle: Brightness Depends on the Angle Between Surface and Light
On a matte (diffuse) surface, the brightness of a point is roughly:
brightness = albedo × cos(angle between surface normal and light direction)
When light hits the surface head-on it is bright, and the more oblique it is, the darker. The unknowns per pixel are 1 albedo value and 2 normal-direction values (slopes), 3 in all. If you know the light directions, 3 or more images let you solve for these unknowns. With 8 directions, even if shadows or highlights make some images useless, you can still solve stably from the rest.
Four Outputs
- Albedo — The surface's own brightness with lighting shading removed. Stains, discoloration and printing defects show up.
- Normal map — The direction each pixel's surface faces. The X, Y and Z components are usually shown as RGB colors.
- Depth — Relative height obtained by integrating the normals. Use it to see overall warp or deformation.
- Mean curvature — How sharply the surface bends. A flat surface is near 0, and the value spikes at the edges of dents and scratches. Shallow defects show best in the curvature map.
How to Use It in Inspection
In Multi-Inspector, the inspection mode type (modeN_type) selects which map to use.
| Mode | Input image |
|---|---|
albedo, albedo-clahe |
Albedo map (with or without contrast correction) |
mean-curvature, mean-curvature-clahe |
Curvature map |
normal-map |
Normal map |
These maps are already tidy images, so they go straight into an anomaly detection model with no extra rotation. If you train on curvature maps of normal parts only, the model finds places where curvature spikes differently from normal as anomalies.
Cautions
- The part must stay still during capture. If the part moves while the 8 images are taken, the pixel correspondence breaks. Capture while it is stationary, or use a controller with fast lighting switching (such as IDGC).
- Shiny surfaces break the principle. Mirror reflection does not follow the formula above and creates highlights. Compute without the images that have highlights, or soften the light with a diffuser.
- You must know the light directions exactly. If a light position changes, recalibrate.
If you need true 3D shape (height in mm), use a 3D camera. The next lesson, 3D Vision and Point Clouds, covers it.