CompareImage
Performs a comparison test between two images 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.
Note : CompareImage can be useful to check whether two images are exactly identical. Both images must have same size and type.
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.
Note : CompareImage can be useful to check whether two images are exactly identical. Both images must have same size and type.
See also
Function Syntax
This function returns outputMeasurement.
// Function prototype
CompareMsr::Ptr compareImage( std::shared_ptr< iolink::ImageView > inputImage1, std::shared_ptr< iolink::ImageView > inputImage2, CompareImage::ComparisonCriterion comparisonCriterion, CompareMsr::Ptr outputMeasurement = NULL );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage1 |
The first input image. | Image | Binary, Label, Grayscale or Multispectral | nullptr | ||||||||||||
![]() |
inputImage2 |
The second input image. Its dimensions and type must be the same as the first input. | Image | Binary, Label, Grayscale or Multispectral | nullptr | ||||||||||||
![]() |
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" ); CompareImage compareImageAlgo; compareImageAlgo.setInputImage1( polystyrene ); compareImageAlgo.setInputImage2( polystyrene ); compareImageAlgo.setComparisonCriterion( CompareImage::ComparisonCriterion::NOT_EQUAL_TO ); compareImageAlgo.execute(); std::cout << "pixelCount: " << compareImageAlgo.outputMeasurement()->pixelCount( 0 , 0 ) ;
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = compareImage( polystyrene, polystyrene, CompareImage::ComparisonCriterion::NOT_EQUAL_TO ); std::cout << "pixelCount: " << result->pixelCount( 0 , 0 ) ;