Back to Aurora Vision Library website

You are here: Start » Function Reference » Image » Image Thresholding » ThresholdToRegion_Dynamic

ThresholdToRegion_Dynamic


Header: AVL.h
Namespace: avl
Module: FoundationBasic

Thresholds an image relatively to the average pixel value in a local rectangular neighborhood.

Applications: Useful in case of uneven illumination.

Syntax

C++
C#
 
void avl::ThresholdToRegion_Dynamic
(
	const avl::Image& inImage,
	atl::Optional<const avl::Region&> inRoi,
	atl::Optional<const avl::Region&> inSourceRoi,
	int inRadiusX,
	atl::Optional<int> inRadiusY,
	atl::Optional<float> inMinRelativeValue,
	atl::Optional<float> inMaxRelativeValue,
	float inHysteresis,
	avl::Region& outRegion,
	avl::Image& diagBaseImage
)

Parameters

Name Type Range Default Description
Input value inImage const Image& Input image
Input value inRoi Optional<const Region&> NIL Region in which pixels are written
Input value inSourceRoi Optional<const Region&> NIL Region from which pixels are read
Input value inRadiusX int 0 - 65535 5 Horizontal radius of internal mean blur
Input value inRadiusY Optional<int> 0 - 65535 NIL Vertical radius of internal mean blur (Auto = inRadiusX)
Input value inMinRelativeValue Optional<float> 5.0f Minimum relative value of a pixel that is considered foreground (Auto = -INF)
Input value inMaxRelativeValue Optional<float> NIL Maximum relative value of a pixel that is considered foreground (Auto = +INF)
Input value inHysteresis float 0.0 - 0.0f Defines how much the threshold criteria are lowered for pixels neighboring with other foreground pixels
Output value outRegion Region& Output region
Diagnostic input diagBaseImage Image& Diagnostic blurred image.

Description

The operation is a cousin of ThresholdImage_Dynamic yet computes a region instead of an image. The resulting region contains only those pixels of the input image, which are brighter at least by inMinRelativeValue and at most by inMaxRelativeValue than the local average. 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 (2 \cdot \text{\textbf{inRadiusX} }+1) \times (2 \cdot \text{\textbf{inRadiusY} }+1) centered at the pixel being processed.

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

Hints

  • Define inMinRelativeValue to extract objects which are brighter than the neighborhood.
  • Define inMaxRelativeValue to extract objects which are darker than the neighborhood.
  • Increase inRadiusX (and optionally inRadiusY) to define a bigger neighborhood.

Examples

ThresholdToRegion_Dynamic performed on the sample image with inMinRelativeValue = 5.0, inMaxRelativeValue = auto.

Errors

List of possible exceptions:

Error type Description
DomainError Region exceeds an input image in ThresholdToRegion_Dynamic.
DomainError Roi exceeds image dimensions in ThresholdToRegion_Dynamic.
DomainError Source roi exceeds image dimensions in ThresholdToRegion_Dynamic.

See Also

  • ThresholdImage_Dynamic – Thresholds an image relatively to some value calculated in a local rectangular neighbourhood.