AutoSegmentation3Phases
Performs an automatic 2-level segmentation of a grayscale image.
Access to parameter description
As an introduction:
Three methods of classification are available: Entropy, Factorisation, or Moments. These methods are detailed in the AutoThresholdingBright documentation.
The computed threshold is returned in the AutoSegmentation3PhasesMsr object.
The output image is a label image with 2 non-zero levels.
See also
Access to parameter description
As an introduction:
- section Image Segmentation
- section Unsupervised Classification
- section AutoThresholdingBright
Three methods of classification are available: Entropy, Factorisation, or Moments. These methods are detailed in the AutoThresholdingBright documentation.
The computed threshold is returned in the AutoSegmentation3PhasesMsr object.
The output image is a label image with 2 non-zero levels.
See also
Function Syntax
This function returns a AutoSegmentation3PhasesOutput structure containing outputLabelImage and outputMeasurement.
// Output structure of the autoSegmentation3Phases function. struct AutoSegmentation3PhasesOutput { /// The output binary image. Its dimensions are forced to the same values as the input. std::shared_ptr< iolink::ImageView > outputLabelImage; /// The computed threshold values. AutoSegmentation3PhasesMsr::Ptr outputMeasurement; }; // Function prototype
AutoSegmentation3PhasesOutput autoSegmentation3Phases( std::shared_ptr< iolink::ImageView > inputGrayImage, AutoSegmentation3Phases::RangeMode rangeMode, iolink::Vector2d intensityInputRange, AutoSegmentation3Phases::ThresholdCriterion thresholdCriterion, std::shared_ptr< iolink::ImageView > outputLabelImage = NULL, AutoSegmentation3PhasesMsr::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 | |||||||
![]() |
outputLabelImage |
The output binary image. Its dimensions are forced to the same values as the input. | Image | nullptr | |||||||
![]() |
outputMeasurement |
The computed threshold values. | AutoSegmentation3PhasesMsr | nullptr |
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); AutoSegmentation3Phases autoSegmentation3PhasesAlgo; autoSegmentation3PhasesAlgo.setInputGrayImage( polystyrene ); autoSegmentation3PhasesAlgo.setRangeMode( AutoSegmentation3Phases::RangeMode::MIN_MAX ); autoSegmentation3PhasesAlgo.setIntensityInputRange( {0, 255} ); autoSegmentation3PhasesAlgo.setThresholdCriterion( AutoSegmentation3Phases::ThresholdCriterion::ENTROPY ); autoSegmentation3PhasesAlgo.execute(); std::cout << "outputLabelImage:" << autoSegmentation3PhasesAlgo.outputLabelImage()->toString(); std::cout << "thresholdLow: " << autoSegmentation3PhasesAlgo.outputMeasurement()->thresholdLow( 0 ) ;
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = autoSegmentation3Phases( polystyrene, AutoSegmentation3Phases::RangeMode::MIN_MAX, {0, 255}, AutoSegmentation3Phases::ThresholdCriterion::ENTROPY ); std::cout << "outputLabelImage:" << result.outputLabelImage->toString(); std::cout << "thresholdLow: " << result.outputMeasurement->thresholdLow( 0 ) ;