CompareValue
Performs a comparison test between an image and value and outputs the number of pixels that successfully passed the test.
Access to parameter description
For an introduction:
The proposed comparison criteria are less-than, less-or-equal, equal-to, greater-or-equal, greater-than and not-equal-to.
See also
Access to parameter description
For an introduction:
- section Image Analysis
- section Image Statistics
The proposed comparison criteria are less-than, less-or-equal, equal-to, greater-or-equal, greater-than and not-equal-to.
See also
Function Syntax
This function returns outputMeasurement.
// Function prototype
CompareMsr::Ptr compareValue( std::shared_ptr< iolink::ImageView > inputImage, double value, CompareValue::ComparisonCriterion comparisonCriterion, CompareMsr::Ptr outputMeasurement = NULL );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | nullptr | ||||||||||||
![]() |
value |
The floating value to compare. | Float64 | Any value | 0 | ||||||||||||
![]() |
comparisonCriterion |
The comparison test to perform between images.
|
Enumeration | NOT_EQUAL_TO | |||||||||||||
![]() |
outputMeasurement |
The output measurement result. | CompareMsr | nullptr |
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); CompareValue compareValueAlgo; compareValueAlgo.setInputImage( polystyrene ); compareValueAlgo.setValue( 0 ); compareValueAlgo.setComparisonCriterion( CompareValue::ComparisonCriterion::NOT_EQUAL_TO ); compareValueAlgo.execute(); std::cout << "pixelCount: " << compareValueAlgo.outputMeasurement()->pixelCount( 0 , 0 ) ;
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = compareValue( polystyrene, 0, CompareValue::ComparisonCriterion::NOT_EQUAL_TO ); std::cout << "pixelCount: " << result->pixelCount( 0 , 0 ) ;