Remove Outlier Pixels
Use this tool to remove outlier pixels from an image, e.g., invalid pixel data in 3D height images. This might be especially helpful if a 3D sensor could not provide valid gray value data for some pixels. To ensure, that these invalid gray value data do not influence the actual image processing task, they need to be filtered out first.
The tool provides different methods to detect the outlier pixels that will be removed: using predefined values for the desired gray range, determining the desired gray range automatically by ignoring the lowest and the highest gray value, or determining the outliers using a gray histogram analysis. All methods generate a region, "Removed Outlier Region", that excludes the detected outlier pixels. You can use the resulting region as processing region in subsequent tools to ensure that the invalid gray value data are excluded in the actual image processing tasks.
In addition, the tool also provides the functionality to fill up holes in the images. This might be helpful if you want to use the images in subsequent tools with easyTouch.
If you are working with images that have been acquired from a 3D sensor, it might be necessary to perform some additional preprocessing steps. The conversion of the images to 8-bit images is mandatory to ensure that the images can be processed correctly in subsequent tools. Other preprocessing steps can be performed according to your requirements. The provided MERLIC tools of the category 3D Height Image are especially designed for this preprocessing tasks. For more detailed information about the recommended order of the preprocessing steps, please see the topic 3D Height Image.
The following section describes the different methods how the outlier pixels can be identified.
Determine the Outlier Pixels to Be Removed
You can choose between different methods to determine the outlier pixels that shall be removed from the resulting region.
Defining the Gray Value Range Via Predefined Values
This mode enables you to manually define the lower and upper limit of the desired gray value range of the image. The region "Removed Outlier Region" that is returned for the use in subsequent tools will only contain the gray values within the defined range. Pixels with a gray value outside of the defined range will not be included in the region.
- Select the method "Predefined Minimum/Maximum Gray Values" at the parameter "Method".
- Set the desired minimum value of the gray value range at the additional parameter "Predefined Minimum Gray Value". In case the parameter is hidden, click on the
button to show the parameter at the tool board.
- Set the desired maximum value of the gray value range at the additional parameter "Predefined Maximum Gray Value". In case the parameter is hidden, click on the
button to show the parameter at the tool board.
Since the gray value range is defined manually, possibly defined regions of interest (ROIs) have no effect on the upper and lower limits.
Determining the Gray Values Range Automatically
This mode enables you to determine the outlier pixels automatically by removing singular bins in the gray value histogram.
- Select the method "Automatic Suppression of Outliers" at the parameter "Method".
- Optionally, draw an ROI into the image or connect an ROI result of a previous tool to define a specific area in which the gray value range is determined. The minimum and maximum gray value will then be determined only from the gray values within the defined ROI area.
Determining the Gray Values Range Automatically (Fast)
This mode enables you to automatically identify the outlier pixels by determining the minimum and maximum gray value from the image and then reducing the gray range by a specific gray value unit depending on the pixel type. For byte images, the gray value range is reduced by 1 at the lower and upper limit. For other pixel types, the upper and lower limits of the gray value range is reduced by the value that results from the multiplication of the gray range with the factor 0.0001. As a last step, the maximum and minimum gray value that lie within the reduced gray range are determined from the image.
The region "Removed Outlier Region" that is returned for the use in subsequent tools will only contain the gray values within the automatically determined gray range. Pixels with a gray value outside of the determined gray range will not be included in the region.
- Select the method "Automatic Suppression of Outliers (Fast)" at the parameter "Method".
- Optionally, draw an ROI into the image or connect an ROI result of a previous tool to define a specific area in which the gray value range is determined. The minimum and maximum gray value will then be determined only from the gray values within the defined ROI area and all pixels outside of this gray range will be removed from the image area that has been defined by the ROI.
Parameters
Depending on the selected method at the parameter "Method", some connectors are grayed out. This means that they are not applicable for the currently selected method and thus have no effect.
Basic Parameters
Image:
This parameter represents the image from which the invalid gray value pixels are estimated and removed from the region.
Method:
This parameter defines the method how to detect the outlier pixels to be removed. It is set to "Automatic Suppression of Outliers (Fast)" by default. You may choose the following methods:
|
Value |
Description |
|---|---|
|
Predefined Minimum/Maximum Gray Values |
The minimum and maximum values of the desired gray value range are defined manually. Pixels with a gray value outside of the defined range will be removed from the resulting region "Removed Outlier Region". Use this method if you want to remove outlier pixels that lie outside of a predefined range of gray values. |
|
Automatic Suppression of Outliers |
The outlier pixels are determined by considering singular bins in a gray value histogram. First the gray value histogram is created and divided into 256 bins. These bins are then analyzed in detail, i.e., the histogram is checked for singular peaks and their surrounding values. Pixels with gray values that lie within a singular peak in the histogram will be removed from the resulting region "Removed Outlier Region". To remove outlier pixels only in a specific image area, you can draw an ROI or use the ROI of a previous tool to define the desired image area. |
|
Automatic Suppression of Outliers (Fast) |
The minimum and maximum values of the desired gray range are determined automatically from the image. In addition, the desired gray range is slightly reduced by restricting the range by a specific gray value unit depending on the pixel type. For byte images, the gray value range is reduced by 1 at the lower and upper limit. For other pixel types, the upper and lower limits of the gray value range is reduced by the value that results from the multiplication of the gray range with the factor 0.0001. As a last step, the maximum and minimum gray value that lie within the reduced gray range are determined from the image. Pixels with a gray value outside of the final gray range will be removed from the resulting region "Removed Outlier Region". To remove outlier pixels only in a specific image area, you can draw an ROI or use the ROI of a previous tool to define the desired image area. Use this method to automatically remove the most common outlier pixels, e.g., pixels with a gray value of 0 that represent only the background of an image. |
See also the section Determine the Outlier Pixels to Be Removed for a detailed description how to work with each conversion method.
Fill Holes:
This parameter defines if possible holes in the image will be filled. It is set to "true" by default. To define the size of the holes to be filled, you can adjust the parameter "Mask Size" accordingly. To adjust the precision in which the holes are filled, please use the parameter "Precision".
|
Value |
Description |
|---|---|
|
true |
The holes with a size of approximately up to the value specified in the parameter "Mask Size" are filled. The parameter "Precision" defines how precise the holes are filled. |
|
false |
The holes in the images are not filled. The parameters "Mask Size" and "Precision" will have no effect. The image returned in "Filled Image" corresponds to the original image. |
Mask Size:
This parameter defines the size of the holes to be filled in case the parameter "Fill Holes" is set to "true". It is defined in pixels and set to 6 px by default. This means, that holes with a diameter of up to 6 px will be closed. The mask size should be defined to the same or a slightly higher size as the holes to be filled.
This parameter is only used if the parameter "Fill Holes" is set to "true". Otherwise, this parameter will have no effect.
Precision:
This parameter defines how precise holes are filled in case the parameter "Fill Holes" is set to "true". It is set to "standard" by default. You can change the precision to be more accurate or coarse. However, the precision also affects the speed of the processing. The more accurate the precision, the slower the processing to fill the holes.
|
Value |
Description |
|---|---|
|
very coarse |
The holes are filled with very coarse precision. |
|
coarse |
The holes are filled with coarse precision. |
|
standard |
The holes are filled with standard precision. This precision works for the most cases. |
|
accurate |
The holes are filled with accurate precision. |
|
very accurate |
The holes are filled with very accurate precision. |
This parameter is only used if the parameter "Fill Holes" is set to "true". Otherwise, this parameter will have no effect.
Additional Parameters
ROI:
This parameter defines the region of interest (ROI) for the processing. Image parts outside of the ROI are not processed. If no ROI is defined, the whole image is processed.
By default the ROI is defined as an empty ROI. If you want to use a non-empty ROI for the processing, you either have to connect the parameter to an appropriate ROI result of a previous tool or you have to draw new ROIs into the image using the available ROI buttons.
Alignment Data:
This parameter represents the alignment data that are used to align the ROI. By default no alignment data are connected and thus no effect is visible. If you want to use specific alignment data, you have to connect the parameter to an appropriate result of a previous tool such as Determine Alignment with Matching, Determine Alignment with Straight Border, Align Image, or Rotate Image.
Predefined Minimum Gray Value:
This parameter defines the minimum value of the desired gray value range. Pixels with a gray value outside of the predefined gray value range will be removed. This parameter is only applied if the method "Predefined Minimum/Maximum Gray Values" has been selected at the parameter "Method".
The parameter is set to "undefined" by default. However, as soon as "Predefined Minimum/Maximum Gray Values" has been selected as method, the minimum value is automatically determined from the pixel type of the image and set accordingly. You can also adjust the value manually to the desired gray value.
The following table shows the value range of the respective pixel type of an image:
|
Pixel type |
Value range |
|---|---|
|
byte |
[0, 255] |
|
int1 |
[-127, 127] |
|
int2 |
[-32768, 32767] |
|
uint2 |
[0, 65535] |
|
all other pixel types |
[-100000.0, 100000.0] |
Predefined Maximum Gray Value:
This parameter defines the maximum value of the desired gray value range. Pixels with a gray value outside of the predefined gray value range will be removed. This parameter is only applied if the method "Predefined Minimum/Maximum Gray Values" has been selected at the parameter "Method".
The parameter is set to "undefined" by default. However, as soon as "Predefined Minimum/Maximum Gray Values" has been selected as method, the maximum value is automatically determined from the pixel type of the image and set accordingly. You can also adjust the value manually to the desired gray value. The respective value range also depends on the pixel type of the images. See the table in the description of the parameter "Predefined Minimum Gray Value" for an overview of the different value ranges.
Results
Basic Results
Filled Image:
This result returns the processed image. In case the parameter "Fill Holes" has been set to "true", the image with the filled holes is returned. Otherwise, the image corresponds to the original input image.
Removed Outlier Region:
This result returns the region of the image in which outlier pixels have been removed.
Minimum Gray Value Used:
This result returns the minimum gray value of the range that has been used to determine the outlier pixels. The range between the "Minimum Gray Value Used" and the "Maximum Gray Value Used" represents the pixel values that are allowed in the resulting region. Pixels with a gray value outside of this range have been removed.
Maximum Gray Value Used:
This result returns the maximum gray value of the range that has been used to determine the outlier pixels. The range between the "Minimum Gray Value Used" and the "Maximum Gray Value Used" represents the pixel values that are allowed in the resulting region. Pixels with a gray value outside of this range have been removed.
Tool State:
"Tool State" returns information about the state of the tool and thus can be used for error handling. Please see the topic Tool State Result for more information about the different tool state results.
Additional Results
Processing Time:
This result returns the duration of the most recent execution of the tool in milliseconds. The result is provided as additional result. Therefore, it is hidden by default but it can be displayed via the button beside the tool results. For more information see the section Processing Time in the tool reference overview.
Application Examples
This tool is used in the following MERLIC Vision App examples:
- check_correct_filling_on_3d_height_images.mvapp
- read_text_in_3d_height_image.mvapp