LightingGuide

Lighting for face recognition: fix illumination drift

How to build stable lighting for face recognition: fixed LED illumination, locked exposure, gain and white balance, and numbers that stop results drifting.

LumaSpec Vision8 min read Share on LinkedIn

On this page 11 sections
  1. 01Why the torch-mode idea points at the right problem
  2. 02Lock the camera controls first
  3. 03Set exposure from motion, not from the light meter
  4. 04Size the field of view and check the pixel budget
  5. 05Design the fixed light: geometry and wavelength
  6. 06Drive the light from a controller, not from a wall adapter
  7. 07Suppress ambient, don't fight it
  8. 08When the usual answer is wrong
  9. 09Pre-order checklist
  10. 10Where to start
  11. 11Questions

Face recognition that works at nine in the morning and fails at five in the afternoon is rarely an algorithm problem. Something automatic is rewriting the image: auto exposure, auto gain, auto white balance, or a normalization stage reacting to daylight. You cannot open a torch mode on a webcam to fix this, and you do not need to. The fix is to control the illumination yourself and lock every camera control that responds to light. This guide gives you the lighting geometry, the exposure arithmetic, and the checks to run before you order parts.

Why the torch-mode idea points at the right problem

A phone's flashlight works because the phone controls both the light and the camera. On a webcam or an integrated laptop camera, the LEDs sit next to the lens, the driver rarely exposes continuous control, and the flash fires for milliseconds when a capture starts. So the instinct fails, but the instinct is correct: recognition drifts because the lighting is uncontrolled.

The failure signature is easy to recognize. Your code measures the room and reports the lighting barely changed, yet results collapse. What changed is not the room; it is the camera's automatic response to the room. Daylight through a window at 10:00 shifts colour temperature and intensity, the camera re-balances exposure, gain and white balance, and your features move underneath it.

The same class of problem appears in industrial inspection, where automatic controls cause contour position jitter and unstable measurements. Our article on contour position jitter under automatic exposure shows the diagnostic in a metrology context, and the reasoning transfers directly.

Lock the camera controls first

Before spending anything on hardware, take the automatics away. Every industrial camera lets you set these manually, and our guide to industrial camera image quality settings walks through each one:

  1. Exposure: set a fixed value from your motion budget (next section).
  2. Gain: set the lowest fixed value that reaches target brightness under your own light.
  3. White balance: fix it once, under your lighting, with blinds closed or the light dominating.
  4. Focus: fix it; autofocus hunting is another silent image change.
  5. Auto functions: disable all of them, then verify by logging the camera's reported exposure and gain per frame, as described in our piece on per-frame exposure and gain verification.

If you cannot disable automatics on your current camera, that is the real upgrade to make. A global-shutter industrial camera with full manual control removes the whole problem class.

Area scan camerasHikrobot MV-CU020-90GC 2.5 MP Area Scan Camera, GigE, GMAX4002, ColorMV-CU020-90GC
Sensor format
1/1.7"
Interface
GigE
Resolution
Up to 3 MP
Shutter
Global
$309.00View partBuild a system with it

Set exposure from motion, not from the light meter

Exposure time follows from allowed motion blur, and lighting must then deliver enough photons in that window. The estimate:

t = blur / speed

A face moving at a walking pace past a gate moves at roughly 500 mm/s. If you allow 0.2 mm of blur, the exposure budget is 0.2 / 500 = 0.4 ms. A seated subject at a kiosk barely moves, so 2-10 ms is fine and cuts the lighting demand by a factor of five to twenty-five.

Our article on exposure time versus shutter speed for moving parts works this arithmetic in more detail, and the camera resolution calculator tells you how many pixels your field of view needs. Note that the short-exposure end has its own trap: at the highest frame rates, exposure and readout interact, which we cover in the piece on camera hardware trigger frame rate.

Size the field of view and check the pixel budget

For access-control style recognition, a field of view of about 300 mm wide frames a head and shoulders comfortably. Working out the pixel scale:

scale = FOV width / sensor width in pixels

Take a 1440-pixel-wide sensor over 300 mm: 300 / 1440 = 0.21 mm per pixel. The mean adult interocular distance is about 63 mm, so the eyes land roughly 300 pixels apart, which most recognition pipelines treat as comfortable. If your algorithm wants more, widen the sensor or narrow the field of view rather than raising gain.

Camera resolution for the smallest feature
Units
Pixels needed
–
Sensor size
– MP
Smallest sensor that fits
–
Pixel on the part
– mm
Pixels across the feature, that sensor
–

Pixels needed = field / feature × pixels per feature on each axis (field incl. margin). The lens must resolve the pixels too: Nyquist = 1000 / (2 × pixel µm) lp/mm.

Find cameras with enough pixels Open the full calculator

Design the fixed light: geometry and wavelength

Faces are curved, partly shiny and three-dimensional, which is exactly the geometry where hard point sources produce hot spots and shadows. A diffused ring around the lens is the workhorse: it lights the face along the camera axis, keeps shadows behind the head, and produces the same pattern on every visit regardless of the sun. Our guide on lighting shiny metal pins explains why on-axis diffuse light flattens specular hot spots, and the same physics applies to foreheads and noses.

Ring lightsRing light, 120 mm dia., 0°, White (LS-RNG-0426)LS-RNG-0426
Size
100-200 mm
Type
Diffused
$369.00View part
Ring lights120 mm dia. ring light, 60°, 620 nm, 24 V (LS-RNG-0100)LS-RNG-0100
Size
100-200 mm
Type
Standard
$179.00View part

Wavelength choice:

  • White, diffused: best with colour cameras and colour-based pipelines; keep ambient suppressed so the fixed white balance stays valid.
  • Red 620-640 nm: efficient, discreet, works well with mono sensors.
  • Infrared 850 nm with a mono camera: removes visible ambient almost completely and is invisible to users; check that your sensor still has useful response at the wavelength and that your algorithm tolerates mono input.

Our article on choosing LED colour for contrast covers the wavelength physics in depth.

Drive the light from a controller, not from a wall adapter

A light plugged into a fixed supply changes nothing by itself, which is the point, but you lose the ability to tune brightness or fire short pulses. A digital light controller lets you set the current once, trim it per station, and strobe later if you need to freeze faster motion or suppress ambient. The light controllers category starts at single-channel units; a four-channel digital unit leaves room for a second light or a background panel.

Light controllers4-Channel Digital LED light controller, 16-24V, AC100-240V 50/60 Hz, 8 A total output (LS-CTL-0322)LS-CTL-0322
Output
Constant voltage 24 V
Channels
4 channels
Control
Digital
$539.00View partBuild a system with it

If you later need to kill daylight completely, strobe the light and trigger the camera with it. Short pulses at high peak current, timed against the duty-cycle limits described in our article on strobe overdrive and duty cycle, give you an effective shutter against ambient that no software normalization can match.

Suppress ambient, don't fight it

Even a fixed light and fixed exposure drift if daylight swings by two orders of magnitude between morning and evening. Three layers, cheapest first:

  1. Shroud or hood. A simple enclosure around the camera and light removes the largest swings. Where the station lives in a washdown or outdoor housing, check the enclosure rating (for example NEMA 4X) before you specify it.
  2. Distance ratio. Put the light close relative to the working distance. A ring at 300 mm working distance that sits 50 mm from the face dominates a window two metres away by a wide margin.
  3. Spectrum. An infrared ring with a mono camera or a long-pass approach rejects most visible daylight outright.

A quick test: log mean image brightness for a fixed white target over a full day with only your light on. If the spread stays within a few percent, your suppression is adequate.

When the usual answer is wrong

Fixed light and locked exposure do not fix everything:

  • Recognition models trained on phone photos expect ambient variety; a sterile infrared look can fall outside the training distribution. Test your model under your proposed spectrum before committing to hardware.
  • Backlight through glass doors behind the subject can still silhouette faces. Reposition the camera or add a background panel lit by a second controller channel.
  • Software normalization (histogram equalization, retinal-style filters) is a legitimate second line of defence, but it must be applied to both training and test images, and it cannot recover information a saturated or black pixel lost. Control the light first; normalize last.

Pre-order checklist

  • [ ] Exposure, gain, white balance and focus all settable to fixed values, with per-frame values logged to verify
  • [ ] Exposure budget computed from face speed and allowed blur, not from a preview
  • [ ] Pixel scale computed from field of view and sensor width; eyes land well above 200 pixels apart
  • [ ] Diffused, on-axis light sized to cover the field of view with margin
  • [ ] Wavelength chosen for your camera type and ambient situation
  • [ ] Light driven by a controller with settable current, not a bare supply
  • [ ] Ambient suppression measured over a full day, not assumed

Where to start

Browse the ring lights category or use the light finder to shortlist diffused units in your size, then pick a matching light controller and area scan camera with full manual control. The lighting configurator walks the choices in order, and free expert support with every order means you can send us your exposure budget and geometry for a second opinion before ordering. For recognition results that stop moving with the sun, the sequence is always the same: fixed light, fixed current, locked camera, verified by logs.

Questions

Can I turn on a webcam's flashlight to stabilize lighting?

Most webcams and integrated laptop cameras do not expose a torch mode, and a built-in flash fires for milliseconds, not continuously. Even where a driver exposes one, the light sits next to the lens and washes out shading. A dedicated LED light, powered by a controller you command, gives you far better control over intensity and geometry.

Should I lock exposure and gain or keep them automatic?

Lock them. Automatic exposure, gain and white balance re-scale the image whenever the scene changes, so two captures of the same face produce different pixel statistics. Set exposure manually from your motion budget, set gain to the lowest value that reaches a target brightness, and fix white balance once under your own light with ambient light suppressed.

What exposure time works for a moving face?

Divide your allowed blur by the face speed. Allowing 0.2 mm of blur for a face moving at 500 mm/s gives a 0.4 ms exposure. Shorter is safer but demands more light. If recognition runs on a seated subject at a kiosk, 2-10 ms is usually fine and eases the lighting budget considerably.

Do I need infrared light for face recognition?

Infrared helps when visible light would distract people or when ambient light swings through the day. An 850 nm ring paired with a mono sensor removes almost all visible ambient influence. For a colour camera, visible white light with a fixed controller output and a locked white balance is usually enough and keeps colour information for the algorithm.

Why does my recognition work in the morning but fail in the evening?

That pattern almost always means something automatic is compensating: auto exposure, auto gain, auto white balance, or a software normalizer reacting to daylight. Measure it by logging the camera's reported exposure and gain per frame. If those values move during the day, your pipeline sees different images even when the room looks the same to you.