コード例 #1
0
        public int HammingDistance(BucketImage image)
        {
            if (buckets != image.buckets || map.GetLength(0) != image.map.GetLength(0) || map.GetLength(1) != image.map.GetLength(1))
            {
                throw new InvalidOperationException();
            }

            int width  = map.GetLength(0);
            int height = map.GetLength(1);

            int distance = 0;

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    if (map[x, y] != image.map[x, y])
                    {
                        distance++;
                    }
                }
            }

            return(distance);
        }
コード例 #2
0
        public int HammingDistance(BucketImage image)
        {
            if (buckets != image.buckets || map.GetLength(0) != image.map.GetLength(0) || map.GetLength(1) != image.map.GetLength(1))
                throw new InvalidOperationException();

            int width = map.GetLength(0);
            int height = map.GetLength(1);

            int distance = 0;
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    if (map[x, y] != image.map[x, y])
                        distance++;
                }
            }

            return distance;
        }