Tag: phash

使用SOLR计算两个ulongs之间的“相似性”/“bitcount”

我们有一个图像数据库,我使用David Oftedal实施的Neal Krawetz博士的方法计算了PHASH。 部分示例代码计算这些长度之间的差异在这里: ulong hash1 = AverageHash(theImage); ulong hash2 = AverageHash(theOtherImage); uint BitCount(ulong theNumber) { uint count = 0; for (; theNumber > 0; theNumber >>= 8) { count += bitCounts[(theNumber & 0xFF)]; } return count; } Console.WriteLine(“Similarity: ” + ((64 – BitCount(hash1 ^ hash2)) * 100.0) / 64.0 + “%”); 挑战是我只知道其中一个哈希,我想查询SOLR以找到相似顺序的其他哈希值。 几点说明: 在这里使用SOLR(只有我有的替代品是HBASE) […]