Esempio n. 1
0
        private bool CompareFingerPrint(FrameFingerPrintWrapper[] other)
        {
            if (FingerPrints == other)
            {
                return(true);
            }

            if (FingerPrints == null && other != null)
            {
                return(false);
            }

            if (FingerPrints != null && other == null)
            {
                return(false);
            }

            if (FingerPrints.Length != other.Length)
            {
                return(false);
            }

            FrameFingerPrintWrapper[] sortedFingerPrints      = new FrameFingerPrintWrapper[FingerPrints.Length];
            FrameFingerPrintWrapper[] otherSortedFingerPrints = new FrameFingerPrintWrapper[FingerPrints.Length];

            Array.Copy(FingerPrints, 0, sortedFingerPrints, 0, sortedFingerPrints.Length);
            Array.Copy(other, 0, otherSortedFingerPrints, 0, otherSortedFingerPrints.Length);

            Array.Sort(sortedFingerPrints, (a, b) => a.FrameNumber - b.FrameNumber);
            Array.Sort(otherSortedFingerPrints, (a, b) => a.FrameNumber - b.FrameNumber);

            for (int i = 0; i < FingerPrints.Length; i++)
            {
                if (Equals(sortedFingerPrints[i], otherSortedFingerPrints[i]) == false)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 2
0
 /// <summary>
 /// Calculate the distance from this frame to another frame
 /// </summary>
 /// <param name="other">The other Frame</param>
 /// <returns>The hamming distance</returns>
 public int CalculateDistance(FrameFingerPrintWrapper other)
 {
     return(DistanceCalculator.CalculateHammingDistance(PHash, other.PHashCode));
 }