Is it possible to compare 2 images and see the diff?
Posted: 2019-10-16T23:29:42-07:00
This code on ImageMagick, I would like to do the same on Magick.NET
As you can see, I have a image1, image2, and the third image is the diff. I was able to do this on command line with the code I previously showed
this is my code on c#:
But this is the result I m getting, I only drawed a line on the left side of the tiger image. The while image is highlighed with red color. I want the result just like the image I have shown.
Code: Select all
convert anot.jpg one_real.jpg -compose difference -composite -morphology dilate disk:10 +level-colors "black,red" -fuzz 20% -transparent black result.png
As you can see, I have a image1, image2, and the third image is the diff. I was able to do this on command line with the code I previously showed
this is my code on c#:
Code: Select all
var image1Path = @"D:\Spot\tiger_real.jpg";
var image2Path = @"D:\Spot\tiger_edit.jpg";
var diffImagePath = @"D:\Spot\imageDiff.jpg";
using (MagickImage image1 = new MagickImage(image1Path))
using (MagickImage image2 = new MagickImage(image2Path))
using (MagickImage diffImage = new MagickImage())
{
image1.Compare(image2, ErrorMetric.Absolute, diffImage);
diffImage.Write(diffImagePath);
}