Back to Adaptive Vision Library website

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

ThresholdToRegion_RGB


Header:AVL.h
Namespace:avl

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

Syntax

C++
C#
 
void avl::ThresholdToRegion_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,
	avl::Region& outRegion
)

Parameters

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

Requirements

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

Read more about pixel formats in Image documentation.

Description

The operation is a cousin of ThresholdImage_RGB yet it computes a region instead of an image. The three-channel inRgbImage is considered to be encoded using RGB color representation. The resulting region contains only those pixels of the input image, which meets all of the following conditions:

  • 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).

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.

Examples

ThresholdToRegion_RGB performed on the sample image with inMinRed = 120.0, inMaxGreen = 100.0, inMaxBlue = 100.0.

Hardware Acceleration

This operation is optimized for SSE41 technology for pixels of type: UINT8.

This operation supports automatic parallelization for multicore and multiprocessor systems.

Errors

List of possible exceptions:

Error type Description
DomainError Not an 8-bit image in ThresholdToRegion_RGB.
DomainError Unsupported image depth in ThresholdToRegion_RGB.
DomainError Not supported inRgbImage pixel format in ThresholdToRegion_RGB.

See Also

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