You are here: Start » AVL.NET » Function Reference » Image » Image Thresholding » AVL.ThresholdImage_Dynamic

AVL.ThresholdImage_Dynamic

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

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void ThresholdImage_Dynamic
(
	AvlNet.Image inImage,
	NullableRef<AvlNet.Region> inRoi,
	NullableRef<AvlNet.Region> inSourceRoi,
	AvlNet.ThresholdDynamicReferenceMethod inReferenceMethod,
	AvlNet.KernelShape inKernel,
	int inRadiusX,
	int? inRadiusY,
	float? inMinRelativeValue,
	float? inMaxRelativeValue,
	float inFuzziness,
	AvlNet.Image outMonoImage,
	AvlNet.Image diagBaseImage
)

Parameters

Name Type Range Default Description
inImageAvlNet.ImageInput image.
inRoiAvlNet.NullableRef<AvlNet.Region>Region in which pixels are written. Default value: atl::NIL.
inSourceRoiAvlNet.NullableRef<AvlNet.Region>Region from which pixels are read. Default value: atl::NIL.
inReferenceMethodAvlNet.ThresholdDynamicReferenceMethodMeanSpecifies how the local threshold value will be calculated (see SmoothImage filter family). Default value: Mean.
inKernelAvlNet.KernelShapeBoxKernel shape. Default value: Box.
inRadiusXint<0, 65535>5Horizontal radius of local neighbourhood. Default value: 5.
inRadiusYint?<0, 65535>Vertical radius of local neighbourhood (Auto = inRadiusX). Default value: atl::NIL.
inMinRelativeValuefloat?0.0fMinimum relative value of a pixel that is considered foreground (Auto = -INF). Default value: 0.0f.
inMaxRelativeValuefloat?Maximum relative value of a pixel that is considered foreground (Auto = +INF). Default value: atl::NIL.
inFuzzinessfloat<0.0f, INF>0.0fA 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). Default value: 0.0f.
outMonoImageAvlNet.Image
diagBaseImageAvlNet.ImageDiagnostic 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 (2 \cdot \text{\textbf{inRadiusX} }+1) \times (2 \cdot \text{\textbf{inRadiusY} }+1) 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.

Examples

ThresholdImage_Dynamic performed on the sample image with inMinRelativeValue = 5.0, inMaxRelativeValue = auto, inFuzziness = 0.0.

ThresholdImage_Dynamic performed on the sample image with inMinRelativeValue = 5.0, inMaxRelativeValue = auto, inFuzziness = 10.0.

Hardware Acceleration

This operation is optimized for SSE2 technology for pixels of type: 1xUINT8.

Hardware acceleration settings may be manipulated with Settings class.

Errors

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.

Function Overrides

See also