Encapsulation of the ImageMagick ChannelPerceptualHash object.
Пример #1
0
        private void AddChannel(MagickImage image, IntPtr list, PixelChannel channel)
        {
            ChannelPerceptualHash instance = CreateChannelPerceptualHash(image, list, channel);

            if (instance != null)
            {
                _Channels.Add(instance.Channel, instance);
            }
        }
        /// <summary>
        /// Returns the sum squared difference between this hash and the other hash.
        /// </summary>
        /// <param name="other">The <see cref="ChannelPerceptualHash"/> to get the distance of.</param>
        /// <returns>The sum squared difference between this hash and the other hash.</returns>
        public double SumSquaredDistance(ChannelPerceptualHash other)
        {
            Throw.IfNull(nameof(other), other);

            double ssd = 0.0;

            for (int i = 0; i < 7; i++)
            {
                ssd += (_srgbHuPhash[i] - other._srgbHuPhash[i]) * (_srgbHuPhash[i] - other._srgbHuPhash[i]);
                ssd += (_hclpHuPhash[i] - other._hclpHuPhash[i]) * (_hclpHuPhash[i] - other._hclpHuPhash[i]);
            }

            return(ssd);
        }
        ///<summary>
        /// Returns the sum squared difference between this hash and the other hash.
        ///</summary>
        ///<param name="other">The ChannelPerceptualHash to get the distance of.</param>
        public double SumSquaredDistance(ChannelPerceptualHash other)
        {
            Throw.IfNull("other", other);

            double ssd = 0.0;

            for (int i = 0; i < 7; i++)
            {
                ssd += ((_SrgbHuPhash[i] - other._SrgbHuPhash[i]) * (_SrgbHuPhash[i] - other._SrgbHuPhash[i]));
                ssd += ((_HclpHuPhash[i] - other._HclpHuPhash[i]) * (_HclpHuPhash[i] - other._HclpHuPhash[i]));
            }

            return(ssd);
        }
Пример #4
0
 private void TestChannel(ChannelPerceptualHash channel, int index, double srgbHuPhash, double hclpHuPhash)
 {
   Assert.AreEqual(srgbHuPhash, channel.SrgbHuPhash(index), 0.0001);
   Assert.AreEqual(hclpHuPhash, channel.HclpHuPhash(index), 0.0001);
 }
Пример #5
0
    /// <summary>
    /// Returns the sum squared difference between this hash and the other hash.
    /// </summary>
    /// <param name="other">The <see cref="ChannelPerceptualHash"/> to get the distance of.</param>
    /// <returns>The sum squared difference between this hash and the other hash.</returns>
    public double SumSquaredDistance(ChannelPerceptualHash other)
    {
      Throw.IfNull(nameof(other), other);

      double ssd = 0.0;

      for (int i = 0; i < 7; i++)
      {
        ssd += (_SrgbHuPhash[i] - other._SrgbHuPhash[i]) * (_SrgbHuPhash[i] - other._SrgbHuPhash[i]);
        ssd += (_HclpHuPhash[i] - other._HclpHuPhash[i]) * (_HclpHuPhash[i] - other._HclpHuPhash[i]);
      }

      return ssd;
    }
Пример #6
0
 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);
 }