Cameras & sensorsTroubleshooting

Camera flicker under artificial lighting: diagnose and fix

Diagnose camera flicker under artificial lighting with exposure tests, modulation calculations, anti-flicker checks and controlled inspection lighting.

LumaSpec Vision10 min read Share on LinkedIn

On this page 8 sections
  1. 011. Identify which kind of flicker you have
  2. 022. Establish a manual-exposure baseline
  3. 033. Match exposure to modulation, not just mains frequency
    1. Why frame rate can be misleading
  4. 044. Understand what a 50 Hz or 60 Hz control can do
  5. 055. Check documented software and firmware support
  6. 066. Use controlled lighting when integration conflicts with inspection
  7. 077. Verify the fix and prevent recurrence
  8. 08Questions

Artificial lighting can make a steady scene produce moving bands or alternating bright and dark frames. For inspection and measurement, those changes can shift thresholds, hide defects and destabilize colour readings. Start by separating light modulation from automatic camera adjustments and display artifacts. You can then test exposure against the light's actual modulation period, check documented anti-flicker support, and decide whether ambient lighting is suitable for your task. Changing frame rate alone is not a dependable cure.

1. Identify which kind of flicker you have

Record a stationary, matte target under the suspect lighting. Keep the camera, target and light positions fixed. Save individual frames rather than judging only the live preview: a display or preview pipeline can introduce apparent flicker that is absent from captured images.

Look for these patterns before changing several settings together:

Symptom Likely cause First isolation test
Bands moving across the image Light modulation sampled at different row exposure times Compare short and long manual exposures
Whole frames alternating in brightness Light modulation sampled between frames Plot a fixed region's mean brightness over time
Brightness hunting after the scene changes Automatic exposure or gain reacting to image content Disable automatic controls and repeat
Different regions flickering differently Multiple lights with different modulation or phase Test each light source separately
Flicker visible only in the preview Display timing, rendering or preview processing Inspect saved frames outside the live viewer

Rolling-shutter cameras expose different rows at different times, so changing illumination can become a spatial pattern. A global shutter avoids that particular row-timing mechanism, but it can still capture alternating bright and dark frames.

Compare the rolling-shutter LS-CMR-0166 with the global-shutter MV-CU020-90GC when evaluating how modulation appears. Neither shutter type guarantees flicker-free operation under an uncontrolled light source.

Area scan cameras12 MP USB3 area scan camera, IMX226, 1/1.7" rolling shutter, 30 fps, 4000 × 3000 resolution (LS-CMR-0166)LS-CMR-0166
Sensor format
1/1.7"
Interface
USB3
$560.00View part
Area scan camerasHikrobot MV-CU020-90GC 2.5 MP Area Scan Camera, GigE, GMAX4002, ColorMV-CU020-90GC
Sensor format
1/1.7"
Lens mount
C-mount
$309.00View part

Use the area scan cameras category and camera finder to compare shutter types after identifying the failure mechanism, rather than replacing the camera first.

2. Establish a manual-exposure baseline

Automatic controls can conceal the cause by changing exposure or gain while you test. Establish a repeatable baseline before evaluating an anti-flicker setting.

  1. Disable automatic exposure and automatic gain. Disable automatic white balance if you are testing a colour camera and the application permits it.
  2. Fix the lens aperture, gain, image region and acquisition rate. Avoid saturated pixels throughout the test.
  3. Select a fixed region on the matte target, away from edges and reflections.
  4. Record a sequence at a short manual exposure, then repeat at candidate integration periods.
  5. Read back the accepted exposure after every change. A requested value may be rounded or limited by the current acquisition configuration.
  6. Compare both frame-to-frame brightness and row-to-row brightness. A stable frame average can conceal bands within each image.

For a suspected mains-related source, useful starting tests are approximately 10 ms and 20 ms for possible 100 Hz modulation, or 8.33 ms and 16.67 ms for possible 120 Hz modulation. These are diagnostic candidates, not universal settings.

Record several seconds at each setting. If a slow brightness cycle remains, extend the recording until you capture several cycles. Keep notes of exposure readback, frame rate, gain and which room lights were operating.

The guide to per-frame exposure and gain metadata explains how to verify which settings belonged to each image. If brightness changes track exposure changes rather than row timing, investigate the automatic-control behaviour first.

3. Match exposure to modulation, not just mains frequency

A camera pixel collects light throughout its exposure. If a stable periodic light waveform is integrated over an exact whole number of periods, its average contribution becomes independent of the exposure's starting phase.

T_mod = 1 / f_mod T_exp = n / f_mod T_mod = light modulation period, in seconds f_mod = measured light modulation frequency, in hertz T_exp = exposure duration, in seconds n = a positive whole number

For a light modulating at 100 Hz:

  • Modulation period = 1 / 100 = 0.010 s = 10 ms.
  • Integrating two periods requires 2 × 10 ms = 20 ms.

For a light modulating at 120 Hz:

  • Modulation period = 1 / 120 ≈ 0.008333 s = 8.333 ms.
  • Integrating two periods requires approximately 16.667 ms.

These estimates explain why a suitable manual exposure can reduce both moving bands and frame brightness variation. They also explain why a nearby exposure may leave a residual pattern.

Mains frequency is only a clue. Some lamps driven from 50 Hz or 60 Hz power have strong modulation at 100 Hz or 120 Hz. Others use switching drivers, pulse-width modulation or more complicated waveforms. A dimmer can change the waveform without changing the nominal supply frequency.

When the simple tests disagree, measure the optical output with a suitable flicker meter or photodiode recording instrument. Its bandwidth and sampling must resolve the suspected modulation; a slow brightness meter may show only the average. Do not infer the true frequency from band travel alone, and do not probe exposed mains wiring for this camera test.

Why frame rate can be misleading

Frame rate determines when successive exposures start. Exposure duration determines how much of the light waveform each pixel integrates.

At 25 fps, successive frames begin 40 ms apart. Under exactly 100 Hz modulation, that interval spans four light cycles. A short exposure might therefore sample nearly the same phase repeatedly and look stable, despite collecting only a fraction of each cycle.

Small frequency differences, timing drift or a changed acquisition rate can bring the variation back. A stationary band is not proof that illumination has become uniform. Use exposure time and moving-part inspection to evaluate the motion consequences before accepting a longer exposure.

4. Understand what a 50 Hz or 60 Hz control can do

An anti-flicker control commonly constrains automatic exposure to durations chosen for a particular mains environment. The exact behaviour depends on the documented implementation: it may affect automatic exposure only, limit available exposure choices, or work only in certain acquisition modes.

Check the documentation for these details:

  • Does the control operate with manual exposure, automatic exposure, or both?
  • Does it assume mains-related modulation rather than measure the light waveform?
  • Is it available at the current frame rate and image format?
  • What exposure limits apply when the control is enabled?
  • Does it persist after disconnecting and restarting the camera?

Selecting 50 Hz does not mean every light powered from a 50 Hz supply will become stable. Independent PWM, mixed sources and irregular modulation can remain visible. The setting also cannot remove blur caused by the longer integration time it selects.

If a control appears ineffective, repeat the manual baseline and compare exposure readback. A setting that is visible in the interface may be inactive in the current operating mode.

For colour decisions, brightness stability alone is insufficient. Different light sources can also change the channel balance. The discussion of sorting under changing ambient light explains why illumination control matters beyond a steady preview.

5. Check documented software and firmware support

A missing anti-flicker option does not establish that a hidden switch exists. The camera may not implement the feature, the installed viewer may not expose it, or the feature may require a documented software and firmware combination.

Use this sequence:

  1. Record the exact camera identity, hardware revision, firmware version, driver version and viewer or SDK version.
  2. Check the manufacturer's feature documentation and release notes for that exact hardware.
  3. Confirm whether the feature is supported and which operating modes make it available.
  4. If an update is required, obtain the package and instructions only from the manufacturer or an authorized distributor.
  5. Preserve the current configuration, stop acquisition and follow the documented update procedure with a stable connection and power supply.
  6. Verify feature availability and repeat the saved-image test after updating.

Do not install firmware intended for a similar-looking camera, copy undocumented register values, or edit configuration files to force an unsupported option. If documentation is unclear, ask support to confirm compatibility before changing firmware.

The camera firmware version mismatch guide covers safe version alignment. After any supported change, use the startup settings and readback checks to verify that the intended exposure survives a restart.

6. Use controlled lighting when integration conflicts with inspection

Longer exposure is the wrong answer when it removes flicker but smears the feature you need to inspect. Calculate the motion limit before choosing the final remedy.

Consider an illustrative inspection with a 120 mm field width. A 0.20 mm feature requiring four pixels across its width needs:

Required image width = field width × pixels per feature / feature width Required image width = 120 mm × 4 / 0.20 mm = 2400 pixels Object sampling = 120 mm / 2400 pixels = 0.05 mm/pixel

Use the resolution calculator to adjust this sampling estimate for your own feature and field width.

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

If the part moves at 500 mm/s, limiting blur to one pixel gives:

Maximum exposure = allowed object blur / object speed Maximum exposure = 0.05 mm / 500 mm/s Maximum exposure = 0.0001 s = 0.10 ms

An exposure of 10 ms would produce 500 mm/s × 0.010 s = 5 mm of motion, or 100 pixels at that sampling. That setting may average the room light well while making the inspection unusable.

In this case, reduce the ambient contribution and provide controlled inspection illumination. Choose continuous output with verified low modulation, or a synchronized light pulse that fits the camera's exposure timing. For rolling shutters, confirm the documented flash window or supported illumination method rather than assuming one short pulse exposes every row equally.

The LS-BAR-1276 is a diffused white bar light. Evaluate its geometry on the actual surface rather than assuming diffuse illumination will suit every defect.

Bar lightsBar light, 372 x 28 mm, White (LS-BAR-1276)LS-BAR-1276
Size
200-400 mm
Type
Diffused
Voltage
24 V
$439.00View partBuild a system with it

Compare other bar lights in the lighting finder. Mechanical layout, reflections and coverage still matter after electrical flicker has been addressed.

The LS-CTL-0070 lists a strobe feature. Confirm its documented pulse timing, trigger interface, output limits and light compatibility before specifying a pairing.

Light controllersDigital control box, 4 ch, 200 W, RS232 (LS-CTL-0070)LS-CTL-0070
Output
Constant voltage 24 V
Channels
4 channels
Control
Digital
Feature
Strobe
$549.00View partBuild a system with it

Use the light controllers category and controller finder to narrow the electrical requirements. The guide to strobe duty cycle and timing explains the additional checks; a strobe label alone does not establish safe overdrive capability.

7. Verify the fix and prevent recurrence

Judge the final configuration using inspection performance, not just a comfortable-looking preview. Repeat the test at the shortest production exposure, the intended acquisition rate and every relevant room-light setting.

For a fixed target region, one useful trend metric is:

Brightness variation = 100 × (maximum mean − minimum mean) / overall mean

Here, each mean is the average pixel value within the same region in a different frame. This metric is meaningful only when the region is unsaturated and its overall mean is sufficiently above the noise floor. Also inspect row profiles because whole-frame averaging can conceal bands.

Do not adopt a universal percentage limit. Set the acceptance criterion from the smallest defect contrast, measurement tolerance or classification margin the application needs. Test representative good parts and known defects under the worst observed lighting condition.

Before closing the issue, confirm:

  • [ ] Saved frames, not just the preview, meet the acceptance criterion.
  • [ ] Exposure and gain readback match the approved configuration.
  • [ ] No bright region clips and hides the remaining variation.
  • [ ] Motion blur remains within the inspection budget.
  • [ ] Each relevant light and dimmer condition has been tested.
  • [ ] Settings remain correct after restarting acquisition and power cycling.
  • [ ] Firmware, software versions and lighting conditions are recorded with the recipe.

If manual integration works but fails the motion budget, stop adjusting frame rate and redesign the illumination. Start with the lighting configuration step, or send your exposure limit, image sequence and lighting details through application support to narrow the next test.

Questions

Will selecting 50 Hz always remove camera flicker?

Not necessarily. Mains frequency does not uniquely determine a lamp's optical modulation. A supported anti-flicker mode may help with mains-related variation, but independent PWM, mixed lighting and exposure limits can leave bands. Verify the outcome in saved images at the acquisition settings your application actually uses.

Why does changing frame rate change the speed of moving bands?

Changing frame rate changes the phase relationship between successive exposures and the light waveform. That can make bands move faster, slower or appear stationary without removing their contrast. Exposure integration and controlled illumination address the underlying brightness variation more directly than adjusting preview cadence.

Will a global-shutter camera eliminate artificial-light flicker?

A global shutter removes the row-by-row exposure timing that commonly turns modulated light into bands. It does not make the illumination constant. Successive global-shutter frames can still receive different amounts of light, so evaluate exposure duration and light modulation before replacing the camera.

What should I do when the camera has no anti-flicker control?

Confirm feature support for the exact hardware revision and installed software using manufacturer documentation. Some controls are unavailable in particular modes, while others are not implemented. Update only when a documented compatible release provides the needed function, and obtain files from the manufacturer or an authorized distributor.

When is dedicated inspection lighting preferable to longer exposure?

Use controlled lighting when an exposure long enough to average ambient modulation causes unacceptable motion blur, limits acquisition speed or still leaves inconsistent contrast. Specify the required exposure first, then verify light output, modulation, trigger timing and electrical compatibility under representative inspection conditions.