Merge pull request #5922 from DarwinsBuddy:fix_no_py_load_svm_bug

This commit is contained in:
Alexander Alekhin
2016-01-14 14:44:27 +00:00
3 changed files with 43 additions and 1 deletions

View File

@@ -1317,6 +1317,18 @@ Ptr<ANN_MLP> ANN_MLP::create()
return makePtr<ANN_MLPImpl>();
}
}}
Ptr<ANN_MLP> ANN_MLP::load(const String& filepath)
{
FileStorage fs;
fs.open(filepath, FileStorage::READ);
Ptr<ANN_MLP> ann = makePtr<ANN_MLPImpl>();
((ANN_MLPImpl*)ann.get())->read(fs.getFirstTopLevelNode());
return ann;
}
}}
/* End of file. */

View File

@@ -2261,6 +2261,17 @@ Ptr<SVM> SVM::create()
return makePtr<SVMImpl>();
}
Ptr<SVM> SVM::load(const String& filepath)
{
FileStorage fs;
fs.open(filepath, FileStorage::READ);
Ptr<SVM> svm = makePtr<SVMImpl>();
((SVMImpl*)svm.get())->read(fs.getFirstTopLevelNode());
return svm;
}
Mat SVM::getUncompressedSupportVectors() const
{
const SVMImpl* this_ = dynamic_cast<const SVMImpl*>(this);