public void ComputeHammingDistanceWithAverageHash() { ulong imageHashA = ImageHasher.ComputeAverageHash(ImageA); ulong imageHashC = ImageHasher.ComputeAverageHash(ImageC); int distanceAA = ImageHasher.ComputeHammingDistance(imageHashA, imageHashA); int distanceAC = ImageHasher.ComputeHammingDistance(imageHashA, imageHashC); Assert.That(distanceAA, Is.EqualTo(0)); Assert.That(distanceAC, Is.EqualTo(10)); }
public void ComputeSimilarityWithAverageHash() { ulong imageHashA = ImageHasher.ComputeAverageHash(ImageA); ulong imageHashC = ImageHasher.ComputeAverageHash(ImageC); double similarityAA = ImageHasher.ComputeSimilarity(imageHashA, imageHashA); double similarityAC = ImageHasher.ComputeSimilarity(imageHashA, imageHashC); Assert.That(similarityAA, Is.EqualTo(1.0)); Assert.That(similarityAC, Is.InRange <double>(0.8, 0.85)); }
public void ComputeAverageHash() { ulong hash = ImageHasher.ComputeAverageHash(ImageA); Assert.That(hash, Is.EqualTo(16701559407061564136)); }