Inheritance: IXmlSerializable, ICloneable
示例#1
0
        private void equals(HaarFeature expected, HaarFeature actual)
        {
            Assert.AreNotEqual(expected, actual);

            Assert.AreEqual(expected.Tilted, actual.Tilted);
            Assert.AreNotEqual(expected.Rectangles, actual.Rectangles);
            Assert.AreEqual(expected.Rectangles.Length, actual.Rectangles.Length);

            for (int i = 0; i < expected.Rectangles.Length; i++)
                equals(expected.Rectangles[i], actual.Rectangles[i]);
        }
示例#2
0
        /// <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;
        }
示例#3
0
 /// <summary>
 ///   Constructs a new feature tree node.
 /// </summary>
 /// 
 public HaarFeatureNode(double threshold, double leftValue, double rightValue, bool tilted, params int[][] rectangles)
 {
     this.Feature = new HaarFeature(tilted, rectangles);
     this.Threshold = threshold;
     this.LeftValue = leftValue;
     this.RightValue = rightValue;
 }