Example #1
0
 private void equals(HaarRectangle expected, HaarRectangle actual)
 {
     Assert.AreNotEqual(expected, actual);
     Assert.AreEqual(expected.X, actual.X);
     Assert.AreEqual(expected.Y, actual.Y);
     Assert.AreEqual(expected.Weight, actual.Weight);
     Assert.AreEqual(expected.Width, actual.Width);
     Assert.AreEqual(expected.Height, actual.Height);
 }
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        public object Clone()
        {
            HaarRectangle[] newRectangles = new HaarRectangle[Rectangles.Length];
            for (int i = 0; i < newRectangles.Length; i++)
            {
                HaarRectangle rect = Rectangles[i];
                newRectangles[i] = new HaarRectangle(rect.X, rect.Y,
                    rect.Width, rect.Height, rect.Weight);
            }

            HaarFeature r = new HaarFeature();
            r.Rectangles = newRectangles;
            r.Tilted = Tilted;

            return r;
        }