diff --git a/modules/ml/include/opencv2/ml.hpp b/modules/ml/include/opencv2/ml.hpp index 3614a91298..0369272d9e 100644 --- a/modules/ml/include/opencv2/ml.hpp +++ b/modules/ml/include/opencv2/ml.hpp @@ -1115,6 +1115,17 @@ public: file using Algorithm::load\(filename). */ CV_WRAP static Ptr create(); + + /** @brief Loads and creates a serialized DTrees from a file + * + * Use DTree::save to serialize and store an DTree to disk. + * Load the DTree from this file again, by calling this function with the path to the file. + * Optionally specify the node for the file containing the classifier + * + * @param filepath path to serialized DTree + * @param nodeName name of node containing the classifier + */ + CV_WRAP static Ptr load(const String& filepath , const String& nodeName = String()); }; /****************************************************************************************\ @@ -1229,6 +1240,17 @@ public: /** Creates the empty model. Use StatModel::train to train the model, Algorithm::load\(filename) to load the pre-trained model. */ CV_WRAP static Ptr create(); + + /** @brief Loads and creates a serialized Boost from a file + * + * Use Boost::save to serialize and store an RTree to disk. + * Load the Boost from this file again, by calling this function with the path to the file. + * Optionally specify the node for the file containing the classifier + * + * @param filepath path to serialized Boost + * @param nodeName name of node containing the classifier + */ + CV_WRAP static Ptr load(const String& filepath , const String& nodeName = String()); }; /****************************************************************************************\ diff --git a/modules/ml/src/boost.cpp b/modules/ml/src/boost.cpp index 3b6bd7aee8..bc0ba00f90 100644 --- a/modules/ml/src/boost.cpp +++ b/modules/ml/src/boost.cpp @@ -507,6 +507,11 @@ Ptr Boost::create() return makePtr(); } +Ptr Boost::load(const String& filepath, const String& nodeName) +{ + return Algorithm::load(filepath, nodeName); +} + }} /* End of file. */ diff --git a/modules/ml/src/tree.cpp b/modules/ml/src/tree.cpp index c02b7440e7..6e066177bf 100644 --- a/modules/ml/src/tree.cpp +++ b/modules/ml/src/tree.cpp @@ -1941,6 +1941,12 @@ Ptr DTrees::create() return makePtr(); } +Ptr DTrees::load(const String& filepath, const String& nodeName) +{ + return Algorithm::load(filepath, nodeName); +} + + } }