Start » Filter Reference » Image » Image Thresholding » ThresholdImage_Relative

ThresholdImage_Relative


Module: FoundationBasic

Thresholds an image with a different threshold value for each pixel (inBaseImage(x, y) + inValue).

Name Type Range Description
Input value
inImage Image Input image
Input value
inRoi Region* Region of interest
Input value
inBaseImage Image Pixels of this image are subtracted from inImage before thresholding
Input value
inMinRelativeValue Real* Minimum relative value of a pixel that is considered foreground (Auto = -INF)
Input value
inMaxRelativeValue Real* Maximum relative value of a pixel that is considered foreground (Auto = +INF)
Input value
inFuzziness Real 0.0 - A tolerance for inMin/MaxRelativeValue that results in intermediate output values
Output value
outMonoImage Image

Description

The operation transforms each pixel value of inImage to the maximum or minimum level thus creating binary image. The result of the transformation depends on the pixel intensity compared with the intensity of the inBaseImage pixels:

  • Pixels that are brighter than corresponding pixels of inBaseImage 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.

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 (see Remarks section).

In the multichannel images the operation uses an average of channel values in each pixel, thus the resulting image is always monochromatic.

Examples

A sample image used as inImage.

A sample image used as inBaseImage.

ThresholdImage_Relative performed with inMinRelativeValue = 0.0, inMaxRelativeValue = auto, inFuzziness = 0.0.

ThresholdImage_Relative performed with inMinRelativeValue = 0.0, inMaxRelativeValue = auto, inFuzziness = 10.0.

Remarks

When image pixel type is Real, parameter inFuzziness has no influence on the output (input is ignored). The reason is strictly mathematical. Namely, there does not exist a smooth transition between -infinity and infinity values, which are, correspondingly, minimum and maximum levels of pixel brightness.

Hardware Acceleration

This operation is optimized for SSE2 technology for pixels of types: 1xUINT8, 3xUINT8.

This operation is optimized for AVX2 technology for pixels of types: 1xUINT8, 3xUINT8.

This operation is optimized for NEON technology for pixels of types: 1xUINT8, 3xUINT8.

This operation supports automatic parallelization for multicore and multiprocessor systems.

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 Image formats are not the same in ThresholdImage_Relative.
DomainError Image sizes are not equal in ThresholdImage_Relative.
DomainError Region exceeds an input image in ThresholdImage_Relative.

Complexity Level

This filter is available on Advanced Complexity Level.

Filter Group

This filter is member of ThresholdImage filter group.

See Also

  • ThresholdToRegion_Relative – Thresholds an image with a different threshold value for each pixel (inBaseImage(x, y) + inValue).