ThresholdingByCriterion
Performs a criterion based thresholding on a grayscale image.
Access to parameter description
For an introduction:
See also
See related examples
Access to parameter description
For an introduction:
- section Image Segmentation
- section Binarization
See also
See related examples
Function Syntax
This function returns the outputBinaryImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
thresholdingByCriterion( std::shared_ptr< iolink::ImageView > inputGrayImage,
ThresholdingByCriterion::ComparisonCriterion comparisonCriterion,
double comparisonValue,
std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL );
This function returns the outputBinaryImage output parameter.
// Function prototype.
thresholding_by_criterion( input_gray_image,
comparison_criterion = ThresholdingByCriterion.ComparisonCriterion.GREATER_THAN_OR_EQUAL_TO,
comparison_value = 128,
output_binary_image = None )
This function returns the outputBinaryImage output parameter.
// Function prototype.
public static IOLink.ImageView
ThresholdingByCriterion( IOLink.ImageView inputGrayImage,
ThresholdingByCriterion.ComparisonCriterion comparisonCriterion = ImageDev.ThresholdingByCriterion.ComparisonCriterion.GREATER_THAN_OR_EQUAL_TO,
double comparisonValue = 128,
IOLink.ImageView outputBinaryImage = null );
Class Syntax
Parameters
| Class Name | ThresholdingByCriterion |
|---|
| Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
inputGrayImage |
Input gray level image. | Image | Binary, Label, Grayscale or Multispectral | nullptr | ||||||||||||
![]() |
comparisonCriterion |
The criterion of comparison.
|
Enumeration | GREATER_THAN_OR_EQUAL_TO | |||||||||||||
![]() |
comparisonValue |
The threshold level. | Float64 | Any value | 128 | ||||||||||||
![]() |
outputBinaryImage |
The output binary image. Its dimensions are forced to the same values as the input. | Image | nullptr | |||||||||||||
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); ThresholdingByCriterion thresholdingByCriterionAlgo; thresholdingByCriterionAlgo.setInputGrayImage( foam ); thresholdingByCriterionAlgo.setComparisonCriterion( ThresholdingByCriterion::ComparisonCriterion::NOT_EQUAL_TO ); thresholdingByCriterionAlgo.setComparisonValue( 0.0 ); thresholdingByCriterionAlgo.execute(); std::cout << "outputBinaryImage:" << thresholdingByCriterionAlgo.outputBinaryImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))
thresholding_by_criterion_algo = imagedev.ThresholdingByCriterion()
thresholding_by_criterion_algo.input_gray_image = foam
thresholding_by_criterion_algo.comparison_criterion = imagedev.ThresholdingByCriterion.NOT_EQUAL_TO
thresholding_by_criterion_algo.comparison_value = 0.0
thresholding_by_criterion_algo.execute()
print( "output_binary_image:", str( thresholding_by_criterion_algo.output_binary_image ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );
ThresholdingByCriterion thresholdingByCriterionAlgo = new ThresholdingByCriterion
{
inputGrayImage = foam,
comparisonCriterion = ThresholdingByCriterion.ComparisonCriterion.NOT_EQUAL_TO,
comparisonValue = 0.0
};
thresholdingByCriterionAlgo.Execute();
Console.WriteLine( "outputBinaryImage:" + thresholdingByCriterionAlgo.outputBinaryImage.ToString() );
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = thresholdingByCriterion( foam, ThresholdingByCriterion::ComparisonCriterion::NOT_EQUAL_TO, 0.0 ); std::cout << "outputBinaryImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))
result = imagedev.thresholding_by_criterion( foam, imagedev.ThresholdingByCriterion.NOT_EQUAL_TO, 0.0 )
print( "output_binary_image:", str( result ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); IOLink.ImageView result = Processing.ThresholdingByCriterion( foam, ThresholdingByCriterion.ComparisonCriterion.NOT_EQUAL_TO, 0.0 ); Console.WriteLine( "outputBinaryImage:" + result.ToString() );

