From e3ec3566d95413374d6afd716fb007b48f51748c Mon Sep 17 00:00:00 2001 From: chrizandr Date: Fri, 13 Jan 2017 01:49:49 +0530 Subject: [PATCH] RTrees: Add wrapper for RTrees_load method to enable loading trained RTrees --- modules/ml/include/opencv2/ml.hpp | 11 +++++++++++ modules/ml/src/rtrees.cpp | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/ml/include/opencv2/ml.hpp b/modules/ml/include/opencv2/ml.hpp index 99f5883..3614a91 100644 --- a/modules/ml/include/opencv2/ml.hpp +++ b/modules/ml/include/opencv2/ml.hpp @@ -1169,6 +1169,17 @@ public: Algorithm::load to load the pre-trained model. */ CV_WRAP static Ptr create(); + + /** @brief Loads and creates a serialized RTree from a file + * + * Use RTree::save to serialize and store an RTree to disk. + * Load the RTree 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 RTree + * @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/rtrees.cpp b/modules/ml/src/rtrees.cpp index cab33ab..65fe682 100644 --- a/modules/ml/src/rtrees.cpp +++ b/modules/ml/src/rtrees.cpp @@ -41,7 +41,6 @@ //M*/ #include "precomp.hpp" - namespace cv { namespace ml { @@ -422,6 +421,12 @@ Ptr RTrees::create() return makePtr(); } +//Function needed for Python and Java wrappers +Ptr RTrees::load(const String& filepath, const String& nodeName) +{ + return Algorithm::load(filepath, nodeName); +} + }} // End of file. -- 2.7.4