Search code examples
c#imagemagickimage-comparison

ImageMagick dll and Exe returns two different values for RMSE image comparison


I'm using ImageMagick with version 7.0 installed in my machine. For RMSE comparison for the below CLI input i'm getting some values which are different when i use dll in my c# code.

CLI code:

magick.exe compare -metric RMSE -subimage-search "image1.jpg" "image2.jpg" null:

C# code:

double diff = image1.Compare(image2, ErrorMetric.RootMeanSquared);

Is anyone know how to get the same results?


Solution

  • It looks like your Magick.NET code is different from what you want to do on the command line. That command would translated to this instead:

    var searchResult = image1.SubImageSearch(image2, ErrorMetric.RootMeanSquared);
    var diff = searchResult.SimilarityMetric;