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 the outputMeasurement output parameter.
// Function prototype. CompareMsr::Ptr compareValue( std::shared_ptr< iolink::ImageView > inputImage, double value, CompareValue::ComparisonCriterion comparisonCriterion, CompareMsr::Ptr outputMeasurement = NULL );
This function returns the outputMeasurement output parameter.
// Function prototype. compare_value( input_image, value = 0, comparison_criterion = CompareValue.ComparisonCriterion.NOT_EQUAL_TO, output_measurement = None )
This function returns the outputMeasurement output parameter.
// Function prototype. public static CompareMsr CompareValue( IOLink.ImageView inputImage, double value = 0, CompareValue.ComparisonCriterion comparisonCriterion = ImageDev.CompareValue.ComparisonCriterion.NOT_EQUAL_TO, CompareMsr outputMeasurement = null );
Class Syntax
Parameters
Class Name | CompareValue |
---|
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 ) ;
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) compare_value_algo = imagedev.CompareValue() compare_value_algo.input_image = polystyrene compare_value_algo.value = 0 compare_value_algo.comparison_criterion = imagedev.CompareValue.NOT_EQUAL_TO compare_value_algo.execute() print( "pixelCount: ", str( compare_value_algo.output_measurement.pixel_count( 0 , 0 ) ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); CompareValue compareValueAlgo = new CompareValue { inputImage = polystyrene, value = 0, comparisonCriterion = CompareValue.ComparisonCriterion.NOT_EQUAL_TO }; compareValueAlgo.Execute(); Console.WriteLine( "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 ) ;
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) result = imagedev.compare_value( polystyrene, 0, imagedev.CompareValue.NOT_EQUAL_TO ) print( "pixelCount: ", str( result.pixel_count( 0 , 0 ) ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); CompareMsr result = Processing.CompareValue( polystyrene, 0, CompareValue.ComparisonCriterion.NOT_EQUAL_TO ); Console.WriteLine( "pixelCount: " + result.pixelCount( 0 , 0 ) );