Back to Aurora Vision Library website

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

ThresholdImage_RGB


Header: AVL.h
Namespace: avl
Module: FoundationLite

Transforms each pixel value to minimum or maximum depending on whether it belongs to the specified range for each individual pixel component.

Applications: Multi-channel thresholding.

Syntax

C++
C#
 
void avl::ThresholdImage_RGB
(
	const avl::Image& inRgbImage,
	atl::Optional<const avl::Region&> inRoi,
	atl::Optional<int> inMinRed,
	atl::Optional<int> inMaxRed,
	atl::Optional<int> inMinGreen,
	atl::Optional<int> inMaxGreen,
	atl::Optional<int> inMinBlue,
	atl::Optional<int> inMaxBlue,
	atl::Optional<int> inMinAlpha,
	atl::Optional<int> inMaxAlpha,
	float inFuzziness,
	avl::Image& outMonoImage
)

Parameters

Name Type Range Default Description
Input value inRgbImage const Image& Input image, usually in the RGB color space
Input value inRoi Optional<const Region&> NIL Region of interest
Input value inMinRed Optional<int> 0 - 255 128 Minimum for the first pixel component, usually Red (Auto = -INF)
Input value inMaxRed Optional<int> 0 - 255 NIL Maximum for the first pixel component, usually Red (Auto = +INF)
Input value inMinGreen Optional<int> 0 - 255 128 Minimum for the second pixel component, usually Green (Auto = -INF)
Input value inMaxGreen Optional<int> 0 - 255 NIL Maximum for the second pixel component, usually Green (Auto = +INF)
Input value inMinBlue Optional<int> 0 - 255 128 Minimum for the third pixel component, usually Blue (Auto = -INF)
Input value inMaxBlue Optional<int> 0 - 255 NIL Maximum for the third pixel component, usually Blue (Auto = +INF)
Input value inMinAlpha Optional<int> 0 - 255 NIL Minimum for the fourth pixel component, usually Blue (Auto = -INF)
Input value inMaxAlpha Optional<int> 0 - 255 NIL Maximum for the fourth pixel component, usually Blue (Auto = +INF)
Input value inFuzziness float 0.0 - Tolerance for the ranges that results in intermediate output values
Output value outMonoImage Image&

Requirements

For input inRgbImage only pixel formats are supported: 3⨯uint8, 4⨯uint8.

Read more about pixel formats in Image documentation.

Description

The operation transforms each pixel of three-channel inRgbImage to the maximum or minimum level thus creating binary image. The input image is considered to be encoded using RGB color representation.

  • Pixels meeting all of the following conditions are transformed to the maximum level:
    • Intensity of the "red" channel is in range (inMinRed, inMaxRed).
    • Intensity of the "green" channel is in range (inMinGreen, inMaxGreen).
    • Intensity of the "blue" channel is in range (inMinBlue, inMaxBlue).
  • Other pixels are transformed to the maximum level.

If any of the parameters inMinRed, inMinGreen, inMinBlue is not set, it is assumed to be -infinity. If any of the parameters inMaxRed, inMaxGreen, inMaxBlue is not set, it is assumed to be 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 channel intensities; thus creating smooth transition between minimum and maximum values in the resulting image.

Examples

ThresholdImage_RGB performed on the sample image with inMinRed = 120.0, inMaxGreen = 100.0, inMaxBlue = 100.0, inFuzziness = 0.0.

ThresholdImage_RGB performed on the sample image with inMinRed = 120.0, inMaxGreen = 100.0, inMaxBlue = 100.0, inFuzziness = 10.0.

Hardware Acceleration

This operation is optimized for SSSE4 (for inFuzziness = 0) technology.

This operation is optimized for AVX2 (for inFuzziness = 0) technology.

This operation is optimized for NEON technology for pixels of types: 1xUINT8 (for inFuzziness = 0), 3xUINT8 (for inFuzziness = 0).

This operation supports automatic parallelization for multicore and multiprocessor systems.

Errors

List of possible exceptions:

Error type Description
DomainError Not a 3-channel and 8-bit image in ThresholdImage_RGB.
DomainError Region exceeds an input image in ThresholdImage_RGB.
DomainError Not supported inRgbImage pixel format in ThresholdImage_RGB. Supported formats: 3xUInt8, 4xUInt8.

See Also

  • ThresholdToRegion_RGB – Creates a region containing image pixels which belongs to the specified range for each individual pixel component.