ImageEn, unit imageenproc

TImageEnProc.ComputeImageEquality

TImageEnProc.ComputeImageEquality


Declaration

function ComputeImageEquality(SecondImage: TIEBitmap; var psnr_min, psnr_max: Double; var mse_min, mse_max: Double; var rmse_min, rmse_max: Double; var pae_min, pae_max: Double; var mae_min, mae_max: Double): Boolean;


Description

Calculate the level of similarity between the current image and SecondImage. Returns True if the images are identical.

Returned values:
Parameter Description
psnr_min, psnr_max Minimum and maximum peak signal to noise ratio
mse_min, mse_max Minimum and maximum mean squared error
rmse_min, rmse_max Minimum and maximum root mean squared error
pae_min, pae_max Minimum and maximum peak absolute error
mae_min, mae_max Minimum and maximum mean absolute error

Note: The images must be the same size and of PixelFormat ie24RGB.


Demos

Demo  Demos\ImageAnalysis\Compare\Compare.dpr
Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Example

Var
  psnr_min, psnr_max: Double;
  mse_min, mse_max: Double;
  rmse_min, rmse_max: Double;
  pae_min, pae_max: Double;
  mae_min, mae_max: Double;
..
  if ImageEnView1.Proc.ComputeImageEquality(ImageEnView2.IEBitmap, psnr_min, psnr_max, mse_min, mse_max, rmse_min, rmse_max, pae_min, pae_max, mae_min, mae_max) then
    showmessage('Images are identical')
  else
  begin
    // shows the similitude values
    lblPSNR.caption := 'Peak signal to noise ratio:' + IEFloatToFormatString(psnr_min, 2, True) + ' (min) , ' + IEFloatToFormatString(psnr_max, 2, True) + ' (max)';
    lblMSE .caption := 'Mean squared error: ' + IEFloatToFormatString(mse_min, 2, True) + ' (min) , ' + IEFloatToFormatString(mse_max, 2, True) + ' (max)';
    lblRMSE.caption := 'Root mean squared error: ' + IEFloatToFormatString(rmse_min, 2, True) + ' (min) , ' + IEFloatToFormatString(rmse_max, 2, True) + ' (max)';
    lblPAE .caption := 'Peak absolute error: ' + IEFloatToFormatString(pae_min, 2, True) + ' (min) , ' + IEFloatToFormatString(pae_max, 2, True) + ' (max)';
    lblMAE .caption := 'Mean absolute error: ' + IEFloatToFormatString(mae_min, 2, True) + ' (min) , ' + IEFloatToFormatString(mae_max, 2, True) + ' (max)';
  end;


Example Images

   

Peak signal to noise ratio: 13.65 (min) , 14.16 (max)
Mean squared error: 2,494.59 (min) , 2,806.16 (max)
Root mean squared error: 49.95 (min) , 52.97 (max)
Peak absolute error: 240 (min) , 255 (max)
Mean absolute error: 16.62 (min) , 17.26 (max)
Equality: False


See Also

CompareWith
CompareHistogramWith