Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Image » Image Thresholding » ThresholdToRegion


Module: FoundationBasic

Creates a region containing image pixels with values within the specified range.


Extraction of a region of objects that can be defined by a salient brightness.
Name Type Range Description
Input value
inImage Image Input image
Input value
inRoi Region* Region of interest
Input value
inMinValue Real* Minimum value of a pixel that is considered foreground (Auto = -INF)
Input value
inMaxValue Real* Maximum value of a pixel that is considered foreground (Auto = +INF)
Input value
inHysteresis Real 0.0 - Defines how much the threshold criteria are lowered for pixels neighboring with other foreground pixels
Output value
outRegion Region Output region


The operation is a cousin of ThresholdImage yet computes a region instead of an image. The resulting region contains those pixels of the input image that meet one of the following conditions:

  • Pixel value is in range [inMinValue, inMaxValue].
  • Pixel value is in range [inMinValue-inHysteresis, inMinValue) or in range (inMaxValue, inMaxValue+inHysteresis] and in the processed image there is a path of consecutive pixels of value in range [inMinValue-inHysteresis, inMaxValue+inHysteresis] that connects the pixel being considered and any pixel with value in range [inMinValue, inMaxValue].

If any of the parameters inMinValue, inMaxValue is not set, it is assumed to be, accordingly, -infinity or infinity.

In the multichannel images the operation uses an average of channel values in each pixel.


  • Define inMinValue to extract bright objects (brighter than the specified value).
  • Define inMaxValue to extract dark objects (darker than the specified value).
  • Use inHysteresis to allow weaker threshold for pixels neighboring with already extracted ones.


Description of usage of this filter can be found in examples and tutorial: Badge Measurement, Button Presence, Capsules, Fuses, Inset Distances, Molybdenum Foil, Seat Mount, Waffles, Washers, Count Nails, Finding PCB Missing Covering, Count the Mounts, Detecting Chocolate Coverage on a Wafer, Classify the Mounts, Sorting Blobs.

ThresholdToRegion performed on the sample image with inMinValue = 80.0, inMaxValue = auto.

Hardware Acceleration

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

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

This operation supports automatic parallelization for multicore and multiprocessor systems.


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 Region exceeds an input image in ThresholdToRegion.

Complexity Level

This filter is available on Basic Complexity Level.

Filter Group

This filter is member of ThresholdToRegion filter group.

See Also

  • ThresholdImage – Transforms each pixel value to maximum or minimum depending on whether they belong to the specified range.