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 provides a description of 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.
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.
Note: If using the Reference Image normalization method, separate mask options are available for the test images and the reference image.
Image Processing
Description
This method uses image processing-based methods to mask out the light source in the image.
Inputs
-
- Level Threshold Type: The type of threshold used for localizing the light source in the image.
- Level Threshold (Value or Percent): The threshold above which is considered the image of the light source, as either a value (digital number) or a percentage of the maximum value in the image.
- Minimum Source Level: The minimum image value (digital number) that can be considered a direct image of the light source. This is used to prevent masking stray light when the source is out of the FOV.
- Mask Area Threshold: The minimum number of pixels that the direct image of the light source should be (minimum area in pixels for the mask). This setting is meant to prevent noise or other small bright artifacts from being detected as potential mask regions.
- Image Close Radius: This setting is only accessible in the INI. The radius of an image close morphology step during Image Processing. This helps to remove holes in the mask. Set to 0 to skip this step.
- Multiple CC Strategy: This setting is only accessible in the INI. The strategy for how to deal with multiple connected components when computing the mask.
- The minimum pixel count threshold
Calculation
Calculation Overview
-
- Compute the level threshold for the image or use the entered Level Threshold (Value)
- 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.
- Create an initial mask by finding all of the pixels greater than the level threshold
- (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
- 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
- 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
- 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:
-
- Calculate the maximum value in the image
- The threshold is the user-provided percentage (Level Threshold (Percent)) of this value
If the Level Threshold Type is Value:
-
- Use the user-provided threshold (Level Threshold (Value))
If the Level Threshold Type is Otsu’s method
-
- Use Otsu’s method to calculate a threshold from the image
Multiple Connected Component Strategies
If there is only one connected component:
-
- This is assumed to be the light source.
- A mask of just this connected component is returned
If there are no connected components:
-
- The light source is assumed to be outside the field of view.
- A mask with no light source(s) is returned
If the user-provided multiple-connected component strategy (Multiple CC Strategy) is “Don’t mask”:
-
- A mask with no light source(s) is returned
If the user-provided multiple-connected component strategy (Multiple CC Strategy) is “Pick Biggest”:
-
- The largest of the remaining connected components is assumed to be the light source
- A mask of the largest connected component is returned
Assumptions
-
- There is only a single light source in the image
Notes
-
- The Image Processing method may not provide accurate localization of the direct image of the source if the level light source is above saturation and significantly blooming. The Image Processing + Circle (Radius) method is recommended in the case where the light source is saturated and significantly blooming.
Recommendations
-
- Level Threshold (Value)
- Pick the largest value (digital number) that the direct image of the source is always greater than in the image.
- Level Threshold (Percent)
- If the direct image of the source is completely saturated, set it to 100%
- If saturated, it is recommended to use the Image Processing + Circle (radius) method rather than just Image Processing because blooming and stray light may cause the Image Processing method to mask out more pixels than should be, leading to an underestimation of the stray light
- If the Mask Method is Image Processing, then the goal of the Level Threshold is to mask only the direct image of the source. Using a value between 95% and 100% will work well in most cases (a hot pixel being an exception)
- If the Mask Method is Image Processing + Circle (radius), then the goal of the Level Threshold is to get a good estimate of the center of the direct image of the source, so that a circle of a specified radius can be drawn there. Using a value between 90% and 95% will work well in many cases
- If following IEEE-P2020 Pre-Release, set to 95%. Note that this may not work well for images that exhibit saturation and/or blooming.
- If the direct image of the source is completely saturated, set it to 100%
- Minimum Source Level
- When configuring Test Image Mask Options, pick a value between the dimmest value (digital number) of the direct image of the source when it is in the FOV and the brightest stray light value in the image when the source is outside the FOV.
- When configuring Reference Image Mask Options, set the value to 0 (the source should always be in the reference image)
-
Note: This setting is only useful if the level threshold type is Percent of Max or Otsu’s Method
- Mask Area Threshold
- Use the default. Larger values will cause larger masses detected by the Level Threshold to be ignored.
- Image Close Radius (INI Only: image_close_radius)
- Use the default. Larger values will fill in bigger holes in the mask.
- Multiple CC Strategy (INI only: multiple_cc_strategy)
- Use the default.
- Level Threshold (Value)
Image Processing + Circle (Radius)
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
-
- Step 1
- Image Processing options
- Step 2
- Mask Radius: The radius (in pixels) to use for a circle (placed at the centroid of the region found in Step 1) that would represent the direct image of the light source
- Step 1
Calculation
-
- Apply the “first step” (Image Processing) to the image to determine a mask region
- If no mask region is found, the light source is assumed to be out of the FOV
- If a mask region is found, the light source is assumed to be in the FOV
- Compute the centroid of the mask region
- Apply the “second step” by creating a circle of specified radius at the found centroid to use as the final light source mask
- Apply the “first step” (Image Processing) to the image to determine a mask region
Assumptions
-
- There is only a single light source in the image
- This method assumes relatively low distortion
- The light source size is constant over the images
- The image of the light source is always a circle
Notes
-
- This method does not perform well if the light source is partially in and partially out of the FOV.
- The centroid is assumed to be relatively stable in the presence of noise or saturation.
- The centroid may be a non-integer (sub-pixel) value. Therefore the number of masked pixels is not constant.
- The first step is currently always an Image Processing mask method.
None
Description
Do not mask out the source.
Inputs
N/A
Calculation
N/A
Assumptions
N/A
Notes
-
- If the source is in the FOV, this will count both the stray light and direct image of the source as stray light
- None masking cannot be used for a reference image-based normalization method (Direct Reference Image or Lambertian Reference Image)
Warnings
- When the image of the light source is partially out of the FOV, the assumptions used to generate a mask may be violated.
- This may lead to improperly defined masks.
- It is recommended that all light source masks are checked.
- When the image of the light source is entirely out of the FOV, the assumptions used to generate a mask may be violated.
- This may lead to improperly defined masks.
- It is recommended that all light source masks are checked.
Generic Notes
- Mask creation channel
- If the analysis channel is Luminance or RGB + Luminance, then the luminance channel is used to create the mask.
- Otherwise, the mean of all provided channels is used to create the mask.
- Mask application channel
- For each capture position, the same mask is applied to each of the analysis channels.
- In color mapped metric images, masked pixels are indicated in pink.