1 | initial version |
Okay,
Was able to edit the decision tree by following the methods in source for how the CvBoost classifier saved and read itself from disk. For some reason cvGetSeqElem()
does not return valid pointers from the CvSeq object passed to it, for a Decision tree type object.
In order to get a copy of the the Decision Tree the CvSeqReader and the macro cvStartReadSeq worked best. The macro CV_READ_SEQ_ELEM() seems to update itself during the loop getting the next tree in the Seq.:
CvSeqReader reader;
cvStartReadSeq( weak, &reader );
for (int i = 0; i < weak->total; i++)
{
CvBoostTree* tree;
CV_READ_SEQ_ELEM( tree, reader );
const CvDTreeNode *root = 0;
root = tree->get_root();
printf("Root Split VarIdx : %d c: %f, ", root->split->var_idx, root->split->ord.c);
featureIdx.push_back(boost::tuple<int, CvDTreeSplit*>(root->split->var_idx, root->split));
//Search down the right hand side
depthFirstSearch(root->right, featureIdx);
//Search down the left hand side
depthFirstSearch(root->left, featureIdx);
}