两张白色图像的 pHash 互相关为 0
pHash cross correlation of two white images is 0
我正在使用 Shipwreck.Phash 进行图像比较。
我刚刚认识到两个相同的白色图像 return 互相关为 0,尽管它应该 return 1.
哈希 1:0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
哈希 2:0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
互相关:0
我的代码:
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);
}
有人可以解释一下我的结果吗?提前致谢。
给出的图片:whiteImage
我直接问了 Shipwreck 开发者,他们的回答是:
As the cross-correlation calculation is based on a kind of division,
it doesn't support zero vectors. So the pHash doesn't support
single-color-image.
实现来自@Bagus Tesa 的 fiddle 它正在运行,尽管它是来自 Shipwreck.Phash 的副本。因此,我将 CrossCorrelation 方法从 NuGet 更改为他的。
我正在使用 Shipwreck.Phash 进行图像比较。 我刚刚认识到两个相同的白色图像 return 互相关为 0,尽管它应该 return 1.
哈希 1:0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
哈希 2:0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
互相关:0
我的代码:
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);
}
有人可以解释一下我的结果吗?提前致谢。
给出的图片:whiteImage
我直接问了 Shipwreck 开发者,他们的回答是:
As the cross-correlation calculation is based on a kind of division, it doesn't support zero vectors. So the pHash doesn't support single-color-image.
实现来自@Bagus Tesa 的 fiddle 它正在运行,尽管它是来自 Shipwreck.Phash 的副本。因此,我将 CrossCorrelation 方法从 NuGet 更改为他的。