Skip to main content

Command Palette

Search for a command to run...

Flat-Field Correction for Machine Vision: DSNU, PRNU, and Vignetting

Updated
7 min readView as Markdown

Remove repeatable dark offsets and bright-field non-uniformity without erasing real defects or hiding a drifting optical system.

A uniform web appears darker at the corners and shows vertical structure. A global threshold fails near the edge. Flat-field correction can help—but only if dark and bright references represent the final optical configuration.

This article presents a vendor-neutral engineering method. Worked figures are hypothetical and must be replaced by evidence from the actual line.

What you will learn

  • Understand the physical and data-processing limits behind flat-field correction in machine vision.

  • Translate an inspection need into measurable component and system requirements.

  • Calculate or test the variable that most strongly controls reliability.

  • Recognize common integration mistakes before commissioning.

  • Validate the final method under representative production conditions.

Technical foundation

Dark-signal non-uniformity

DSNU is spatial variation in pixel or column offset measured without light. It can depend on exposure and temperature.

Photo-response non-uniformity

PRNU is spatial variation in response under nominally uniform illumination. The observed bright field also contains lens shading and lighting non-uniformity.

Correction model

A common model subtracts a dark reference and applies spatial gain from a bright reference. It corrects stable multiplicative and additive structure, not moving shadows or changing contamination.

[Suggested visual: dark, bright, coefficient, and corrected-flat image sequence]

Purpose: Clarify the physical or architectural mechanism before component selection.

Required elements: Use labelled rays, axes, signals, components, and the failure mode described; keep scale relationships physically plausible.

Suggested caption: “Dark, bright, coefficient, and corrected-flat image sequence.”

Accessible alt text: “Technical diagram of dark, bright, coefficient, and corrected-flat image sequence.”

Engineering workflow

1. Freeze the optical configuration

What to evaluate: camera mode, exposure, gain, lens, aperture, light, filter, and geometry.

Why it matters: correction data is configuration-specific.

How to measure or calculate it: record a configuration hash and reference images. Record the input conditions and keep the same method when comparing alternatives.

Trade-off: multiple recipes may need separate sets. What commonly goes wrong: reusing coefficients after a lens change.

2. Acquire dark references

What to evaluate: blocked light, operating temperature, exposure, and enough frames.

Why it matters: averaging isolates stable offset from temporal noise.

How to measure or calculate it: compute per-pixel or per-column means. Record the input conditions and keep the same method when comparing alternatives.

Trade-off: long sequences improve estimation but consume time. What commonly goes wrong: taking a dark frame while light leaks in.

3. Acquire bright references

What to evaluate: uniform target, final geometry, unsaturated level, and defocus where appropriate.

Why it matters: the flat must represent shading without target texture.

How to measure or calculate it: aim near a controlled fraction of saturation and average frames. Record the input conditions and keep the same method when comparing alternatives.

Trade-off: too dim increases noise; too bright clips. What commonly goes wrong: using textured paper in sharp focus.

4. Calculate and constrain gain

What to evaluate: dark-subtracted target level and minimum denominator.

Why it matters: extreme gain amplifies noise and bad pixels.

How to measure or calculate it: mask invalid regions and cap coefficients. Record the input conditions and keep the same method when comparing alternatives.

Trade-off: clipping coefficients leaves residual shading but improves stability. What commonly goes wrong: dividing by near-zero pixels.

5. Apply in the correct domain

What to evaluate: raw Bayer, mono, bit depth, and pipeline order.

Why it matters: demosaicing or nonlinear processing changes correction behaviour.

How to measure or calculate it: verify the camera or software pipeline order. Record the input conditions and keep the same method when comparing alternatives.

Trade-off: raw correction is precise but format-specific. What commonly goes wrong: correcting after gamma.

6. Monitor validity

What to evaluate: reference uniformity, temperature, light aging, contamination, and residuals.

Why it matters: a stale flat can create defects instead of removing them.

How to measure or calculate it: trend corrected flat residual and coefficient history. Record the input conditions and keep the same method when comparing alternatives.

Trade-off: recalibration adds downtime. What commonly goes wrong: using correction to conceal a failing light.

Worked example

Hypothetical mono correction: A pixel has dark reference D=80 DN, bright reference F=2,080 DN, and the target bright-field mean is 2,400 DN. A production pixel value is I=1,080 DN.

Corrected = (I - D) × (Target / (F - D))
          = (1,080 - 80) × (2,400 / 2,000)
          = 1,200 DN

This simplified calculation assumes linear response and stable conditions. Coefficient limits, bit depth, bad pixels, and noise propagation must be handled.

[Suggested visual: flat-field equation diagram showing additive and multiplicative correction]

Purpose: Turn the engineering workflow into a resource that can be used during commissioning and review.

Required elements: Include the inputs, decision points, measurable outputs, acceptance boundary, and major failure branches.

Suggested caption: “Flat-field equation diagram showing additive and multiplicative correction.”

Accessible alt text: “Technical diagram of flat-field equation diagram showing additive and multiplicative correction.”

Practical decision aid

Reference Captures Must avoid
Dark offset, DSNU, column structure light leakage and wrong exposure
Bright PRNU plus optics/light shading texture, clipping, nonuniform target
Corrected flat residual non-uniformity overfitting a single frame
Production monitor drift and contamination confusing real process change with optical drift

Use this table to choose the next experiment, not as a universal component recommendation. Record actual settings, part variants, and evidence beside the decision.

Common mistakes and how to prevent them

  1. Using one bright frame. Temporal noise enters coefficients. Prevent it by average a sequence.

  2. Skipping dark subtraction. Offset biases gain. Prevent it by capture matched dark data.

  3. Saturating the flat. Response information is lost. Prevent it by use controlled headroom.

  4. Changing aperture later. Shading pattern changes. Prevent it by recalibrate after optical changes.

  5. Unlimited gain correction. Noise explodes in dark regions. Prevent it by cap and mask coefficients.

  6. Treating dynamic shadows as flat field. Correction creates artifacts. Prevent it by fix mechanical lighting variation.

Validate under production conditions

Compare raw and corrected uniform fields, real defect samples, temperature states, exposure recipes, and contamination levels. Quantify residual uniformity, noise amplification, defect contrast, saturation, and false decisions, then define recalibration triggers.

A defensible validation set includes representative acceptable parts, defective parts, boundary cases, and nuisance variation. Repeat complete part presentations rather than processing one stored image many times. Include environmental extremes, line-speed limits, start-up and warm-up, maintenance states, interface faults, and long-duration operation where relevant.

Predefine acceptance criteria for false accepts, false rejects, invalid acquisitions, repeatability, cycle time, and recovery. Preserve raw counts and denominators. After release, trend leading indicators and audit labelled samples so that drift is detected before it becomes a customer escape.

Key takeaways

  • DSNU is additive; PRNU and shading are multiplicative.

  • Use matched dark and bright reference sequences.

  • Correct in a linear, appropriate image domain.

  • Limit coefficients and preserve bad-pixel information.

  • Monitor when the calibration stops representing the system.

Follow this Hashnode blog for more practical industrial machine-vision engineering, and connect with Kivanc Ekici on LinkedIn. For related engineering information, visit the ITAGE Türkiye website.

Frequently asked questions

Is flat-field correction the same as vignetting correction?

Vignetting can be one component of the bright-field non-uniformity; flat-field correction may also compensate sensor and illumination response.

How bright should the flat reference be?

Bright enough for good SNR but comfortably below saturation; follow the camera method where specified.

Must correction be repeated after changing the lens?

Yes, because the shading and dust pattern can change.

Can flat-field correction remove moving shadows?

No. It is intended for stable spatial effects.

Why can correction increase noise?

Pixels with weak bright-field response receive higher gain, which also amplifies their noise.

Sources