AutoThresholdingDark
Computes and applies an automatic threshold on a gray level image to detect dark particles on a bright background.
Access to parameter description
For an introduction:
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 object or foreground pixels for which the output intensity is set to 1. Intensities lower than I1 are also set to 1.
- C1=[T+1,I2] represents the background pixels for which the output intensity is set to 0. Intensities greater than I2 are also set to 0.
The computed threshold is returned in the AutoThresholdingMsr object.
See also
Function Syntax
This function returns a AutoThresholdingDarkOutput structure containing outputBinaryImage and outputMeasurement.
// Output structure of the autoThresholdingDark function. struct AutoThresholdingDarkOutput { /// The output binary image. Its dimensions are forced to the same values as the input. std::shared_ptr< iolink::ImageView > outputBinaryImage; /// The computed threshold value. AutoThresholdingMsr::Ptr outputMeasurement; }; // Function prototype
AutoThresholdingDarkOutput autoThresholdingDark( std::shared_ptr< iolink::ImageView > inputGrayImage, AutoThresholdingDark::RangeMode rangeMode, iolink::Vector2d intensityInputRange, AutoThresholdingDark::ThresholdCriterion thresholdCriterion, std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL, 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 | |||||||||
![]() |
outputBinaryImage |
The output binary image. Its dimensions are forced to the same values as the input. | Image | nullptr | |||||||||
![]() |
outputMeasurement |
The computed threshold value. | AutoThresholdingMsr | nullptr |
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); AutoThresholdingDark autoThresholdingDarkAlgo; autoThresholdingDarkAlgo.setInputGrayImage( polystyrene ); autoThresholdingDarkAlgo.setRangeMode( AutoThresholdingDark::RangeMode::MIN_MAX ); autoThresholdingDarkAlgo.setIntensityInputRange( {0, 255} ); autoThresholdingDarkAlgo.setThresholdCriterion( AutoThresholdingDark::ThresholdCriterion::ENTROPY ); autoThresholdingDarkAlgo.execute(); std::cout << "outputBinaryImage:" << autoThresholdingDarkAlgo.outputBinaryImage()->toString(); std::cout << "threshold: " << autoThresholdingDarkAlgo.outputMeasurement()->threshold( 0 ) ;
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = autoThresholdingDark( polystyrene, AutoThresholdingDark::RangeMode::MIN_MAX, {0, 255}, AutoThresholdingDark::ThresholdCriterion::ENTROPY ); std::cout << "outputBinaryImage:" << result.outputBinaryImage->toString(); std::cout << "threshold: " << result.outputMeasurement->threshold( 0 ) ;