/// <summary> /// Opens the decision tree used to classify the image /// </summary> /// <param name="path">The path to the decision tree file.</param> /// <param name="label">The label for what the tree recognizes.</param> internal Classifier_OpenCV(string path, string label = null) { // Open the classifier decision tree decisionTree = new DTrees(); // Read the decision tree in from the file using var fs = new FileStorage(path, FileStorage.Mode.Read); decisionTree.Read(fs.GetFirstTopLevelNode()); // Set the output label outputGrid[0, 0].Label = label; }
/// <summary> /// Release the IDiposable resources /// </summary> /// <param name="disposing">True if called from Dispose()</param> protected virtual void Dispose(bool disposing) { if (null == decisionTree) { return; } if (disposing) { decisionTree.Dispose(); output.Dispose(); } decisionTree = null; output = null; }