diff --git a/modules/ml/include/opencv2/ml.hpp b/modules/ml/include/opencv2/ml.hpp index 013d9187fe..cfd95a5240 100644 --- a/modules/ml/include/opencv2/ml.hpp +++ b/modules/ml/include/opencv2/ml.hpp @@ -720,9 +720,14 @@ public: find the best parameters for your problem, it can be done with SVM::trainAuto. */ CV_WRAP static Ptr create(); - CV_WRAP virtual void read( const FileNode& fn ) = 0; - - CV_WRAP static Ptr load(const String& fs); + /** @brief Loads and creates a serialized svm from a file + * + * Use SVM::save to serialize and store an SVM to disk. + * Load the SVM from this file again, by calling this function with the path to the file. + * + * @param fs Filename + */ + CV_WRAP static Ptr load(const String& filepath); }; /****************************************************************************************\ diff --git a/modules/ml/src/svm.cpp b/modules/ml/src/svm.cpp index 639f6e2168..34acebb991 100644 --- a/modules/ml/src/svm.cpp +++ b/modules/ml/src/svm.cpp @@ -2261,14 +2261,14 @@ Ptr SVM::create() return makePtr(); } -Ptr SVM::load(const String& filename) +Ptr SVM::load(const String& filepath) { FileStorage fs; - fs.open(filename, FileStorage::READ); + fs.open(filepath, FileStorage::READ); Ptr svm = makePtr(); - svm->read(fs.getFirstTopLevelNode()); + ((SVMImpl*)svm.get())->read(fs.getFirstTopLevelNode()); return svm; }