Optics & lighting

Calibrate flat-field shading without hiding bad data

Remove stable shading only after fixing illumination and optics. A correction map cannot restore saturated pixels or changing shadows.

Send samples for engineering review
Calibrate flat-field shading without hiding bad data — Illustrative engineering scene, not a photograph of a validated Deyi installation.
Illustrative engineering scene, not a photograph of a validated Deyi installation.

What the test resolves

Remove stable shading only after fixing illumination and optics. A correction map cannot restore saturated pixels or changing shadows.

This is a vendor-neutral commissioning method. Check the exact camera, lens, sensor or controller manual before changing settings. The numerical worksheet is hypothetical, not a Deyi Vision measurement or a product specification.

First determine whether the unwanted pattern is fixed relative to the sensor. Move or rotate the reference without changing the imaging assembly and compare where the pattern appears. A mark that follows the target belongs to the reference; a changing shadow needs an illumination or geometry investigation. A correction map is intended for a repeatable response, not for making every surface look uniform.

Operating prerequisites

Use linear raw data and an unsaturated uniform target filling the field. Camera correction implementations vary; verify the model before using any on-device calibration.

Choose whether the correction belongs in software, the camera or a frame grabber, and record that choice. The worksheet is an illustrative software calculation, not a coefficient file for a vendor device. For hardware calibration use the supported model-specific procedure. Do not enable overlapping correction stages unknowingly: subtracting an offset again after it has already been removed changes the data being inspected.

Bench and records

Prepare a lens cap or dark condition, diffuse reference, raw capture and map versioning. Warm the system and lock exposure, gain, aperture, ROI and lighting.

Identify the reference surface and inspect it for texture, scratches and dirt before recording calibration frames. Keep lens shading and source illumination in the same arrangement used for inspection. Record temperature state and acquisition processing. A preview with automatic display normalization can hide gradients, so inspect raw line profiles and clipped pixels before deciding that the reference is suitable.

Run the test

  1. Average 32 dark frames and 32 uniform bright frames at production settings.
  2. Inspect the reference for dirt, gradients and clipping before generating a map.
  3. Apply offset/gain correction only to valid denominators; retain a bad-pixel mask and raw data.
  4. Test a separate uniform target and actual defects; repeat after lens or illumination changes.

Review the individual dark and bright frames before averaging them. Movement, intermittent illumination or an unstable background cannot be repaired by simply pooling the captures. Keep rejected frames and their reasons separate from the accepted calibration set. Ensure the dark capture actually blocks light and that the bright reference remains within the sensor's valid range throughout the field.

Hypothetical worksheet

In this hypothetical software worksheet dark is 10 DN, flat is 130 DN, raw is 100 DN and reference level is 160 DN; corrected output is 120 DN. Near-zero denominators must be invalidated, not amplified without limit.

corrected = (raw - dark) * reference_level / (flat - dark)
Example: (100 - 10) * 160 / (130 - 10) = 120
Do not divide where flat - dark is near zero; flag invalid pixels.
Hypothetical worksheet; replace every input with your own recorded value.
QuantityHypothetical valueMeaning
Dark offset10 DNMeasured under blocked light
Flat minus dark120 DNValid response denominator
Corrected example120 DNHypothetical raw 100 DN

The denominator must represent usable response above the dark level. Where that response is inadequate, mark the pixel invalid rather than inventing a large compensating factor. Track the invalid mask through subsequent inspection so a masked region does not silently become a passing result. Compare raw and corrected values without display rescaling, and confirm which stage performs offset subtraction.

Test sequence

Test sequence

Acquire dark and bright references, validate them and create a versioned correction map.

  1. Dark frames
  2. Flat frames
  3. Map
  4. Validation
Acquire dark and bright references, validate them and create a versioned correction map. Schematic illustration; spacing is not to scale.
View full-size diagram

Read the process diagram as a versioned data path. Link the dark reference, bright reference, map and mask to the same configuration record. Store the uncorrected acquisition alongside the result so correction can be reproduced or removed. A renamed file is not sufficient version control if the lens, exposure or source configuration associated with that file is unknown.

Interpret the evidence

Interpret the evidence

Compare raw shading with corrected output and retain invalid regions rather than filling them as real measurements.

  1. Raw shading
  2. Corrected
  3. Noise
  4. Invalid mask
Compare raw shading with corrected output and retain invalid regions rather than filling them as real measurements. Schematic illustration; spacing is not to scale.
View full-size diagram

Evaluate the map on a separate reference capture rather than the frames used to generate it. Inspect residual patterns in the center and corners, but also inspect noise in areas receiving strong gain correction. Run representative good and defective parts through both raw and corrected processing. A flatter background is useful only if the required defect remains distinguishable and the inspection decision is reliable.

Troubleshooting

  • If target texture appears in corrected images, the reference was not uniform.
  • Noise rising strongly in dark corners suggests excessive gain correction; improve light rather than extending the map beyond its valid range.

If a repeated reference changes with warm-up, compare the recorded operating state before regenerating coefficients. If defects disappear under the correction, inspect whether the calibration target contained similar texture. If a map helps one setup but harms another, check configuration selection and registration. Do not keep an old map merely because the corrected display looks smoother than the raw image.

Acceptance and handoff

Require residual uniformity and defect tests to meet predefined limits on independent images. Store map, mask, settings and calibration date; reject a map after any relevant configuration change.

Archive the raw files, settings, sample identifiers and decision limits together. Discuss the documented requirements with Deyi Vision using the related product and preparation guides below.

Release a map only with an explicit validity envelope: the saved optical arrangement, acquisition settings and operating conditions tested. Confirm that restarting the application loads the intended map and mask and that missing calibration produces an identifiable condition. Define recalibration triggers for relevant setup changes. The handoff must include independent validation images and raw failure evidence, not just the calibration file and its best preview.

Sources and technical references

These references explain the methods and limits used in this tutorial. Example checks are guidance; production acceptance requires evidence from your own samples.

  1. Flat-Field CorrectionBasler

    Correction is calibrated at operating conditions; model-specific methods differ and static changes require recalibration.

    Checked
  2. Flat-Field Correction for Interface CardsBasler

    Offset subtraction and gain compensation correct nonuniform response; hardware implementations differ.

    Checked

Engineering review

Bring the inspection problem and the evidence.

Send sample images, your current setup and the check that failed. Include field of view, working distance, line speed and acceptance criteria for a practical review.

Send samples for engineering review
Contact

Direct RFQ contact

Talk to engineering about the inspection problem.

Send sample images, competitor model, FOV, working distance and line speed before model selection.

Target: selection brief within 24h
Send sample images