public void Test_SumSquaredDistance() { using (IMagickImage image = new MagickImage(Files.ImageMagickJPG)) { PerceptualHash phash = image.PerceptualHash(); using (IMagickImage other = new MagickImage(Files.MagickNETIconPNG)) { other.HasAlpha = false; Assert.AreEqual(3, other.ChannelCount); PerceptualHash otherPhash = other.PerceptualHash(); #if Q8 OpenCLValue.Assert(312.06, 311.71, phash.SumSquaredDistance(otherPhash), 0.01); #elif Q16 OpenCLValue.Assert(311.40, 311.45, phash.SumSquaredDistance(otherPhash), 0.02); #elif Q16HDRI OpenCLValue.Assert(311.24, 311.27, phash.SumSquaredDistance(otherPhash), 0.02); #else #error Not implemented! #endif } } }
private void TestChannel(ChannelPerceptualHash channel, int index, double srgbHuPhashWithOpenCL, double srgbHuPhashWithoutOpenCL, double hclpHuPhashWithOpenCL, double hclpHuPhashWithoutOpenCL) { OpenCLValue.Assert(srgbHuPhashWithOpenCL, srgbHuPhashWithoutOpenCL, channel.SrgbHuPhash(index), 0.0001); OpenCLValue.Assert(hclpHuPhashWithOpenCL, hclpHuPhashWithoutOpenCL, channel.HclpHuPhash(index), 0.0001); }