简体   繁体   English

两个白色图像的 pHash 互相关为 0

[英]pHash cross correlation of two white images is 0

I'm using Shipwreck.Phash for image comparison.我正在使用 Shipwreck.Phash 进行图像比较。 I just recognized that two identical white images return a cross correlation of 0, although it should return 1.我刚刚认识到两个相同的白色图像返回的互相关为 0,尽管它应该返回 1。

hash1: 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000哈希1:0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000

hash2: 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000哈希2:0x000000000000000000000000000000000000000000000000000000000000000000000000000000000

CrossCorrelation: 0互相关: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给定图像: whiteImage

I asked the Shipwreck Developers directly and that is their answer:我直接询问了 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.所以 pHash 不支持单色图像。

Implementing the fiddle from @Bagus Tesa it is working, although it's a copy from Shipwreck.Phash.从@Bagus Tesa 实现小提琴它正在工作,尽管它是 Shipwreck.Phash 的副本。 Therefore I changed the CrossCorrelation method from the NuGet to his.因此,我将 CrossCorrelation 方法从 NuGet 更改为他的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM