Stray Light Masking

Stray light (flare) documentation pages

Introduction: Intro to stray light testing and normalized stray light | Outputs from Imatest stray light analysis | History

Background: Examples of stray light | Root Causes | Test overview | Test factors | Test Considerations | Glossary

Calculations: Metric image | Normalization methods | Light source mask methods | Summary Metrics | Analysis Channels | Saturation

Instructions: High-level Imatest analysis instructions (Master and IT) | Computing normalized stray light with Imatest | Motorized Gimbal instructions

Settings: Settings list and INI keys/values | Standards and Recommendations | Configuration file input

Page Contents

This page describes Imatest’s light source Mask Methods.

Masking (shorthand for “light source masking”) is the process of creating a mask to exclude the direct image of the light source from the analysis. The direct image of the source is the small region in the image that represents the true size of the light source (i.e., if there were no stray light or blooming in the image). The direct image of the light source is not stray light, which is why it should be masked (ignored) in a stray light metric image. For reference images, the term "detection" is used instead of masking.

Mask Methods

The Imatest stray light source analysis has several options or methods available for masking the light source in the image(s). Different mask options have different inputs, allowing the user to configure the masking process and accuracy.

MethodDescriptionAnalysis Image MaskReference Image Detection
Geometric Camera Model + CircleUse a geometric camera model and the angles of the capture to locate the center. Apply a circular mask.Yes(Via Same As Analysis or Manual Circle)
Image ProcessingUse image processing methods to create the mask.YesYes
Image Processing + CircleUse the centroid of an image processing mask as the center. Apply a circular mask.YesYes
Manual CircleSpecify the center of a circular mask.NoYes
NoneDo not mask.YesNo
Same As AnalysisUse the analysis image mask settings for reference image detection.NoYes

Geometric Camera Model + Circle

Description

The Geometric Camera Model + Circle method uses a geometric camera model to project the source angles to create an image point. A circle of a specified radius is placed at the center of the projected point and is used as the mask for the image. This method can avoid over-masking in the presence of large areas of saturation.

Inputs
Mask Calculation
    1. Negate the field and azimuth, as specified
    2. Compute the camera-relative world point corresponding to the light source:
    3. Project the camera-relative world point through the geometric camera model
    4. Create a circular mask centered on the computed image point
Assumptions
Notes

Image Processing

Description

This method uses image processing-based methods to mask out the light source in the image. 

Inputs
Calculation
Calculation Overview
    1. Compute the level threshold for the image or use the entered Level Threshold (Value)
    2. Check that the level threshold for the image is greater than the entered Minimum Source Level. If less, the source is assumed to be outside the FOV and no mask is generated for the image. 
    3. Create an initial mask by finding all of the pixels greater than the level threshold
    4. (Optional) Perform an image-closing morphology with a disk of the user-specified size (Image Close Radius). This helps to fill in small holes within the mask
    5. Compute the number of connected components in the mask
      • If zero connected components are found, then the light source is assumed to be out of the FOV
    6. Filter out any connected components that have an area smaller than the user-provided Mask Area Threshold
      • If zero connected components remain, then the light source is assumed to be out of the FOV
    7. Apply the strategy for selecting from one or more connected-component (Multiple CC Strategy)
Level threshold calculation

If the Level Threshold Type is Percent of Max:

    1. Calculate the maximum value in the image
    2. The threshold is the user-provided percentage (Level Threshold (Percent)) of this value

If the Level Threshold Type is Value:

    1. Use the user-provided threshold (Level Threshold (Value))

If the Level Threshold Type is Otsu’s method

    1. Use Otsu’s method to calculate a threshold from the image
Multiple Connected Component Strategies

If there is only one connected component:

If there are no connected components:

If the user-provided multiple-connected component strategy (Multiple CC Strategy) is “Don’t mask”:

If the user-provided multiple-connected component strategy (Multiple CC Strategy) is “Pick Biggest”:

If the user-provided multiple-connected component strategy (Multiple CC Strategy) is “Pick Smallest”:

If the user-provided multiple-connected component strategy (Multiple CC Strategy) is “Keep All”:

Assumptions
Notes
Recommendations

Image Processing + Circle

Description

The Image Processing + Circle radius method uses two “steps” to determine the masked region. In the first step, the light source is localized via Image Processing methods. In the second step, a circle of a specified radius is placed at the center of the localized region and is used as the mask for the image. This method can avoid over-masking in the presence of large areas of saturation.

Inputs
Mask Calculation
    1. Apply the “first step” (Image Processing) to the image to determine a mask region
      1. If no mask region is found, the light source is assumed to be out of the FOV
      2. If a mask region is found, the light source is assumed to be in the FOV
    2. Compute the centroid of the mask region
    3. Apply the “second step” by creating a circle of specified radius at the found centroid to use as the final light source mask
Assumptions
Notes

Manual Circle

Description

The Manual Circle method places a circular mask centered at a specified point.

Inputs
Mask Calculation
Assumptions
Notes

None

Description

Do not mask out the source.

Inputs

N/A

Calculation

N/A

Assumptions

N/A

Notes

Same as Analysis Image

Description

Use the same settings as the analysis image masking for the reference image detection.

Inputs

Set via reference image mask settings.

Calculation

The chosen analysis image mask method.

Assumptions

N/A

Notes

Helper Methods

Circle

Description

The circle mask method places a circular disk at a specified position (which may not be within the image) with a given radius.

Inputs
Radius Calculation

IEEE Std 2020:2024 [1] provides a method to compute the radius of a mask from properties of the light source and camera

where

: radius of mask in pixels

: pixel pitch of the camera in μm/px

: focal length of the camera in mm

: focal length of the collimator in mm

: diameter of the pinhole in the collimator in mm

Mask Calculation
    1. Generate an x, y location for each pixel in the image. This is in the IEEE Std. 2020 Type IV [1] image coordinate system.
    2. The mask is all pixels that satisfy

where

: radius of mask in pixels

: an image coordinate in the IEEE Std. 2020 [1] Type IV image coordinate system.

: the circle center in the IEEE Std. 2020 [1] Type IV image coordinate system.

Assumptions
Notes

Warnings

Generic Notes

References

  1. IEEE Standard for Automotive System Image Quality, IEEE Std 2020-2024, 2024, doi: 10.1109/IEEESTD.2024.10935839. ↩a ↩b ↩c ↩d ↩e ↩f ↩g