Back to Adaptive Vision Library website

You are here: Start » Function Reference » Conditional Processing » ClassifyByRange

ClassifyByRange


This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.

Header:STD.h
Namespace:avl

Separates the elements of the input array into three output arrays, depending on whether the related values fall below, into or above the specified range.

Syntax

void avl::ClassifyByRange
(
	const atl::Array<Type>& inArray,
	const atl::Array<float>& inValues,
	atl::Optional<float> inMinimum,
	atl::Optional<float> inMaximum,
	atl::Optional<atl::Array<Type>&> outAccepted = atl::NIL,
	atl::Optional<atl::Array<Type>&> outRejected = atl::NIL,
	atl::Optional<atl::Array<Type>&> outLower = atl::NIL,
	atl::Optional<atl::Array<Type>&> outHigher = atl::NIL,
	atl::Optional<atl::Array<bool>&> outIsAccepted = atl::NIL,
	atl::Optional<atl::Array<bool>&> outIsRejected = atl::NIL
)

Parameters

Name Type Default Description
inArray const Array<Type>& Elements to be classified
inValues const Array<float>& Corresponding values to be compared against the range
inMinimum Optional<float> NIL Lowest value of the range
inMaximum Optional<float> NIL Highest value of the range
outAccepted Optional<Array<Type>&> NIL Array of elements corresponding to values matching the range
outRejected Optional<Array<Type>&> NIL Array of elements corresponding to values outside the range
outLower Optional<Array<Type>&> NIL Array of elements corresponding to values lower than inMinimum
outHigher Optional<Array<Type>&> NIL Array of elements corresponding to values higher than inMaximum
outIsAccepted Optional<Array<bool>&> NIL Represents whether corresponding values are in the range
outIsRejected Optional<Array<bool>&> NIL Represents whether corresponding values are outside the range

Optional Outputs

The computation of following outputs can be switched off by passing value atl::NIL to these parameters: outAccepted, outRejected, outLower, outHigher, outIsAccepted, outIsRejected.

Read more about Optional Outputs.

Description

The filter accepts an array of objects of type T (decided on filter creation) along with corresponding array of float values and splits the array of objects into three output arrays, depending on how each of the values fits the (inMinimum, inMaximum) range.

  • Objects corresponding to values lower than inMinimum are passed onto outLower and outRejected.
  • Objects corresponding to values that fit closed range (inMinimum, inMaximum) are passed onto outAccepted.
  • Objects corresponding to values higher than inMaximum are passed onto outHigher and outRejected.

In the special case of inMinimum being greater than inMaximum, first matching condition is applied, which means that objects corresponding to values higher than inMaximum and lower than inMinimum are passed onto outLower.

Hints

  • Before using this filter you need to have an array of objects (to be classified) and an array of feature values that describe the objects.
  • Connect the array of objects to the inArray input and connect the array of feature values to the inValues input.
  • Set the range of inMinimum and inMaximum to define the accepted objects.
  • Consider showing additional outputs: outLower, outHigher, outIsAccepted, outIsRejected.
  • If you need the highest possible speed, also consider using a more simple filter SelectByRange.

Examples

inArray = {"Alice", "Bill", "Frank", "Patricia", "Thomas"}
inValues = {5.0, 4.0, 5.0, 8.0, 6.0}
inMinimum = 5.0
inMaximum = 6.0
outLower = {"Bill"}
outAccepted = {"Alice", "Frank", "Thomas"}
outHigher = {"Patricia"}

Errors

List of possible exceptions:

Error type Description
DomainError Inconsistent array lengths on input in ClassifyByRange.
DomainError Incorrect (NaN) float value on inValues input in ClassifyByRange.

See Also

  • ClassifyByPredicate – Separates the elements of the input array into two output arrays. The first output array contains all the elements for which the associated predicate is True.
  • SelectByRange – Selects the elements of the input that fall into the specified range.