September 2019
Intermediate to advanced
420 pages
10h 29m
English
Building the decision tree with OpenCV works in much the same way as in Chapter 3, First Steps in Supervised Learning. Recall that all of the machine learning functions reside in OpenCV 3.1's ml module:
In [16]: import cv2... dtree = cv2.ml.dtree_create()
In [17]: dtree.train(X_train, cv2.ml.ROW_SAMPLE, y_train)
Here, we have to specify whether the data samples in X_train occupy the rows (using cv2.ml.ROW_SAMPLE) or the columns (cv2.ml.COL_SAMPLE).
Read now
Unlock full access