Skip to content
Shalaka
Engineering notes

AI for IoT · 14 November 2026 · Shalaka engineering team

Vision on a production line: why lighting and camera position come before the model

When a camera inspection system misses defects, the first instinct is a bigger model or more training images. In most cases the better move is to look at the pictures. If a person cannot see the defect reliably in the image, no model will.

Lighting decides what is visible

A defect shows up only if the light makes it differ from its surroundings. Different setups reveal different things.

  • Diffuse dome or ring light: evens out reflections on shiny parts such as metal caps or glossy plastic.
  • Dark field (low angle): makes scratches and embossed text glow against a dark surface.
  • Backlight: gives a clean silhouette for dimensions, holes and missing parts.
  • Coaxial light: helps on flat reflective surfaces like PCBs and polished metal.

Ceiling lights and sunlight through a window change across the day and across shifts. A shroud around the camera and a dedicated light, driven by a constant-current supply, removes that variable. Pulsing LEDs can also cause bands in the image if the exposure and the drive frequency interact, so check for it.

Camera position and optics

Fix the working distance and the angle, and hold them with a rigid mount. A bracket that flexes by a millimetre moves the image. Parts that arrive at slightly different positions need a fixture or a locating step, or the software has to find the part first, which costs accuracy.

Choose resolution from the smallest defect you must catch. A common rule is at least three to four pixels across the smallest feature. Use a global shutter sensor for moving parts, since a rolling shutter skews fast objects. Set exposure short enough to freeze motion. For example, a 100 mm wide field and a 0.2 mm defect at four pixels needs about 0.05 mm per pixel, so roughly 2000 pixels across, or a 2 to 3 megapixel sensor. A part moving at 0.5 m/s travels one pixel in about 100 microseconds, so exposure must be near that. Low lens distortion helps measurement more than presence checks.

Then the model

Once the image is stable, a classic method such as thresholding or template matching sometimes solves the task with no training. Where the variation is large, a small convolutional network running on an edge module can work well. Keep a record of every rejected image with the line, time and lighting setting, because that archive becomes the training set you wish you had started with.

What this does not fix

Good optics cannot recover a defect that is beneath the surface or inside the part. Those need a different method, such as X-ray, ultrasound or thermal imaging. And a stable setup still drifts: LEDs dim with age, lenses get dusty. Plan a periodic check with a reference part so the system tells you when the image has changed.


If you are planning a vision station for your line, book a discovery call. We build the software side through micro-apps for electronics and manufacturing and AI for devices and operations.

Tell us what you are building.

Book a discovery call