AutoThresholdingValue
Computes a threshold value partitioning automatically a gray level image into two classes.
Access to parameter description
For an introduction:
Four methods of classification are available to determine C0 and C1: Entropy, Factorisation, Moments, and Isodata. These methods are detailed in the AutoThresholdingBright documentation.
The computed threshold is returned in the AutoThresholdingMsr object. See also
Access to parameter description
For an introduction:
- section Image Segmentation
- section Binarization
- section AutoThresholdingBright
- C0=[I1,T] represents the first class pixels.
- C1=[T+1,I2] represents the second class pixels.
Four methods of classification are available to determine C0 and C1: Entropy, Factorisation, Moments, and Isodata. These methods are detailed in the AutoThresholdingBright documentation.
The computed threshold is returned in the AutoThresholdingMsr object. See also
Function Syntax
This function returns outputMeasurement.
// Function prototype
AutoThresholdingMsr::Ptr autoThresholdingValue( std::shared_ptr< iolink::ImageView > inputGrayImage, AutoThresholdingValue::RangeMode rangeMode, iolink::Vector2d intensityInputRange, AutoThresholdingValue::ThresholdCriterion thresholdCriterion, AutoThresholdingMsr::Ptr outputMeasurement = NULL );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
inputGrayImage |
The input grayscale image | Image | Grayscale | nullptr | ||||||||
![]() |
rangeMode |
The way to determine the input intensity range.
|
Enumeration | MIN_MAX | |||||||||
![]() |
intensityInputRange |
The input intensity range [a,b] inside which the threshold is searched. This parameter is ignored if the range mode is set to MIN_MAX. | Vector2d | Any value | {0.f, 255.f} | ||||||||
![]() |
thresholdCriterion |
The criterion to compute the threshold from the histogram.
|
Enumeration | ENTROPY | |||||||||
![]() |
outputMeasurement |
The output measurement containing the computed threshold. | AutoThresholdingMsr | nullptr |
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); AutoThresholdingValue autoThresholdingValueAlgo; autoThresholdingValueAlgo.setInputGrayImage( polystyrene ); autoThresholdingValueAlgo.setRangeMode( AutoThresholdingValue::RangeMode::MIN_MAX ); autoThresholdingValueAlgo.setIntensityInputRange( {0, 255} ); autoThresholdingValueAlgo.setThresholdCriterion( AutoThresholdingValue::ThresholdCriterion::ENTROPY ); autoThresholdingValueAlgo.execute(); std::cout << "threshold: " << autoThresholdingValueAlgo.outputMeasurement()->threshold( 0 ) ;
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = autoThresholdingValue( polystyrene, AutoThresholdingValue::RangeMode::MIN_MAX, {0, 255}, AutoThresholdingValue::ThresholdCriterion::ENTROPY ); std::cout << "threshold: " << result->threshold( 0 ) ;