SimilarityMetricValue
Computes a similarity criterion between two images and outputs the corresponding metric value.
Access to parameter description
This algorithm computes a similarity between two images I1 and I2.
The proposed comparison metrics are:
Figure 1. Comparison of similarity metrics after adding an artificial gaussian noise of standard
deviation σ on an original image:
(a) the reference image to compare, (b) σ=25, MSE = 513, NCC = 0.95 , (c) σ=80, MSE = 3235, NCC = 0.74
Note : Both input images must have same size and type.
See also
Access to parameter description
This algorithm computes a similarity between two images I1 and I2.
The proposed comparison metrics are:
- The Mean Square Error:
MSE=1NN∑i=1(I1(i)−I2(i))2 - The normalized crossed correlation:
NCC=∑Ni=1(I1(i)−¯I1)∗(I2(i)−¯I2)√∑Ni=1(I1(i)−¯I1)2∗√∑Ni=1(I2(i)−¯I2)2
![]() (a) |
![]() (b) |
![]() (c) |
(a) the reference image to compare, (b) σ=25, MSE = 513, NCC = 0.95 , (c) σ=80, MSE = 3235, NCC = 0.74
Note : Both input images must have same size and type.
See also
Function Syntax
This function returns outputMeasurement.
// Function prototype
SimilarityMetricValueMsr::Ptr similarityMetricValue( std::shared_ptr< iolink::ImageView > inputImage1, std::shared_ptr< iolink::ImageView > inputImage2, SimilarityMetricValue::MetricType metricType, SimilarityMetricValueMsr::Ptr outputMeasurement = nullptr );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage1 |
The first input image to compare. | Image | Binary, Label or Grayscale | nullptr | ||||
![]() |
inputImage2 |
The second input image to compare. Its dimensions and type must be the same as the first input. | Image | Binary, Label, Grayscale or Multispectral | nullptr | ||||
![]() |
metricType |
The metric used to compare both input images
|
Enumeration | MEAN_SQUARE_ERROR | |||||
![]() |
outputMeasurement |
The output measurement result containing the similarity value in accordance with the selected metric. | SimilarityMetricValueMsr | nullptr |
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto foam_gaussian_noise = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_gaussian_noise.vip" ); SimilarityMetricValue similarityMetricValueAlgo; similarityMetricValueAlgo.setInputImage1( foam ); similarityMetricValueAlgo.setInputImage2( foam_gaussian_noise ); similarityMetricValueAlgo.setMetricType( SimilarityMetricValue::MetricType::MEAN_SQUARE_ERROR ); similarityMetricValueAlgo.execute(); std::cout << "metric: " << similarityMetricValueAlgo.outputMeasurement()->metric( 0 ) ;
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto foam_gaussian_noise = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_gaussian_noise.vip" ); auto result = similarityMetricValue( foam, foam_gaussian_noise, SimilarityMetricValue::MetricType::MEAN_SQUARE_ERROR ); std::cout << "metric: " << result->metric( 0 ) ;