I'm using Shipwreck.Phash for image comparison. I just recognized that two identical white images return a cross correlation of 0, although it should return 1.
hash1: 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000
hash2: 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000
CrossCorrelation: 0
My code:
static void Main(string[] args)
{
var firstImage = new Bitmap(@"Bilder\\hash1.JPG");
var secondImage = new Bitmap(@"Bilder\\hash1.JPG");
var hash = ImagePhash.ComputeDigest(firstImage.ToLuminanceImage());
var hash2 = ImagePhash.ComputeDigest(secondImage.ToLuminanceImage());
var score = ImagePhash.GetCrossCorrelation(hash, hash2);
Console.WriteLine(hash);
Console.WriteLine(hash2);
Console.WriteLine(score);
}
Can someone please explain me my result? Thanks in advance.
Given image: whiteImage
I asked the Shipwreck Developers directly and that is their answer:
Implementing the fiddle from @Bagus Tesa it is working, although it's a copy from Shipwreck.Phash. Therefore I changed the CrossCorrelation method from the NuGet to his.