Start » Filter Reference » Image » Image Thresholding » ThresholdImage_Dynamic
Module: | FoundationLite |
---|
Thresholds an image relatively to some value calculated in a local rectangular neighbourhood.
Applications
Name | Type | Range | Description | |
---|---|---|---|---|
inImage | Image | Input image | ||
inRoi | Region* | Region in which pixels are written | ||
inSourceRoi | Region* | Region from which pixels are read | ||
inReferenceMethod | ThresholdDynamicReferenceMethod | Specifies how the local threshold value will be calculated (see SmoothImage filter family) | ||
inKernel | KernelShape | Kernel shape. | ||
inRadiusX | Integer | 0 - 65535 | Horizontal radius of local neighbourhood. | |
inRadiusY | Integer* | 0 - 65535 | Vertical radius of local neighbourhood (Auto = inRadiusX) | |
inMinRelativeValue | Real* | Minimum relative value of a pixel that is considered foreground (Auto = -INF) | ||
inMaxRelativeValue | Real* | Maximum relative value of a pixel that is considered foreground (Auto = +INF) | ||
inFuzziness | Real | 0.0 - | A tolerance for inMin/MaxRelativeValue that results in intermediate output values. Clamped on half of pixel max value (e.g. max fuzziness for uint8 image is 128). | |
outMonoImage | Image | |||
diagBaseImage | Image | Diagnostic threshold values. |
Description
The operation transforms each pixel value to the maximum or minimum level thus creating binary image. The result of the transformation depends on the relative pixel intensity:
- Pixel values that are brighter than local average of the pixel neighbourhood by at least inMinRelativeValue and at most inMaxRelativeValue are transformed to the maximum level.
- Other pixel values are transformed to the minimum level.
If any of the parameters inMinRelativeValue, inMaxRelativeValue is not set, it is assumed to be, accordingly, -infinity or infinity.
Pixel neighbourhood used to compute the local average is a rectangle of dimensions centered at the pixel being processed.
Parameter inFuzziness (set to 0 by default) allows to perform fuzzy thresholding which linearly interpolates those pixel values that differ by at most inFuzziness from the border intensities; thus creating smooth transition between minimum and maximum values in the resulting image.
In the multichannel images the operation uses an average of channel values in each pixel, thus the resulting image is always monochromatic.
Hints
- Define inMinRelativeValue to obtain white pixels for objects which are brighter than the neighborhood.
- Define inMaxRelativeValue to obtain white pixels for objects which are darker than the neighborhood.
- Increase inRadiusX (and optionally inRadiusY) to define a bigger neighborhood.
- Use inFuzziness to add some smooth transitions between black and white pixels in the result.
Examples
Hardware Acceleration
This operation is optimized for SSE2 technology for pixels of type: 1xUINT8.
Errors
This filter can throw an exception to report error. Read how to deal with errors in Error Handling.
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Incorrect fuzziness value in ThresholdImage_Dynamic. |
DomainError | Roi exceeds image dimensions in ThresholdImage_Dynamic. |
DomainError | Source roi exceeds image dimensions in ThresholdImage_Dynamic. |
Complexity Level
This filter is available on Basic Complexity Level.
Filter Group
This filter is member of ThresholdImage filter group.
See Also
- ThresholdToRegion_Dynamic – Thresholds an image relatively to the average pixel value in a local rectangular neighborhood.