Ejemplo n.º 1
0
        public object Clone()
        {
            HaarFeatureNode r = new HaarFeatureNode();

            r.Feature = (HaarFeature)Feature.Clone();
            r.Threshold = Threshold;

            r.RightValue = RightValue;
            r.LeftValue = LeftValue;

            r.LeftNodeIndex = leftNodeIndex;
            r.RightNodeIndex = rightNodeIndex;

            return r;
        }
        private void writeFeature(HaarFeatureNode node)
        {
            writer.Write("new HaarFeatureNode({0}, {1}, {2}, ",
                node.Threshold.ToString("R", NumberFormatInfo.InvariantInfo),
                node.LeftValue.ToString("R", NumberFormatInfo.InvariantInfo),
                node.RightValue.ToString("R", NumberFormatInfo.InvariantInfo));

            if (node.Feature.Tilted)
                writer.Write("true, ");

            // Write haar-like rectangular features
            for (int k = 0; k < node.Feature.Rectangles.Length; k++)
            {
                writeRectangle(node.Feature.Rectangles[k]);

                if (k < node.Feature.Rectangles.Length - 1)
                    writer.Write(", ");
            }

            writer.Write(" )");
        }
Ejemplo n.º 3
0
        public object Clone()
        {
            HaarFeatureNode[][] newTrees = new HaarFeatureNode[Trees.Length][];

            for (int i = 0; i < newTrees.Length; i++)
            {
                HaarFeatureNode[] tree = Trees[i];
                HaarFeatureNode[] newTree = newTrees[i] =
                    new HaarFeatureNode[tree.Length];

                for (int j = 0; j < newTree.Length; j++)
                    newTree[j] = (HaarFeatureNode)tree[j].Clone();
            }

            HaarCascadeStage r = new HaarCascadeStage();
            r.NextIndex = NextIndex;
            r.ParentIndex = ParentIndex;
            r.Threshold = Threshold;
            r.Trees = newTrees;

            return r;
        }