| 20 | }; |
| 21 | |
| 22 | static void buildTreeRecursive(Node *node, const CvDTreeNode *cv_node, int maxCatCount) |
| 23 | { |
| 24 | if (!cv_node->left) { |
| 25 | node->value = cv_node->value; |
| 26 | node->left = node->right = NULL; |
| 27 | } else { |
| 28 | if (maxCatCount > 0) |
| 29 | for (int i = 0; i < (maxCatCount + 31)/32; i++) |
| 30 | node->subset.append(cv_node->split->subset[i]); |
| 31 | else |
| 32 | node->threshold = cv_node->split->ord.c; |
| 33 | |
| 34 | node->featureIdx = cv_node->split->var_idx; |
| 35 | |
| 36 | node->left = new Node; node->right = new Node; |
| 37 | buildTreeRecursive(node->left, cv_node->left, maxCatCount); |
| 38 | buildTreeRecursive(node->right, cv_node->right, maxCatCount); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | static void loadRecursive(QDataStream &stream, Node *node, int maxCatCount) |
| 43 | { |