Question

I need to do a "fuzzy" image comparison in c# - I have used ImageMagick.NET for stuff in the past and know it's good for the job.

There is a compare command in Image Magick: http://www.imagemagick.org/script/compare.php

And there is a Compare(Image reference) method in ImageMagick.NET however it seems that it's be hugely simplified so there is no way of getting at the verbose output.

I need to be able to get at that so I can match the images using a threshold. Am I missing something - is there a way to get this stuff into ImageMagick.NET if there isn't already? (I'm no C++ dev by a long shot) or am I barking up the wrong tree?

Was it helpful?

Solution

Pardon me if I don't get your question, but won't IsImagesEqual or SimilarityImage work?

IsImagesEqual returns "The normalized maximum quantization error for any single pixel in the image. This distance measure is normalized to a range between 0 and 1. It is independent of the range of red, green, and blue values in your image.

A small normalized mean square error, accessed as image->normalized_mean_error, suggests the images are very similar in spatial layout and color."

The corresponding method in the .NET bindings is Image.Compare which takes an image and returns a bool. However, if the result is false - the mean error (according to the metric above) is set on the current instance's meanErrorPerPixel, normalizedMaxError, and normalizedMeanError.

Aren't these three metrics enough to give you the result of your "fuzzy" compare?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top