コード例 #1
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;
 }
コード例 #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);
        }