Commit a7aa198b authored by Christoph Spörk's avatar Christoph Spörk

fixing issue #4969 of Itseez/opencv.

Someone forgot to wrap the load function for SVMs in the
corresponding ml python module. Fixed that.
parent fade4028
...@@ -719,6 +719,10 @@ public: ...@@ -719,6 +719,10 @@ public:
Use StatModel::train to train the model. Since %SVM has several parameters, you may want to Use StatModel::train to train the model. Since %SVM has several parameters, you may want to
find the best parameters for your problem, it can be done with SVM::trainAuto. */ find the best parameters for your problem, it can be done with SVM::trainAuto. */
CV_WRAP static Ptr<SVM> create(); CV_WRAP static Ptr<SVM> create();
CV_WRAP virtual void read( const FileNode& fn ) = 0;
CV_WRAP static Ptr<SVM> load(const String& fs);
}; };
/****************************************************************************************\ /****************************************************************************************\
......
...@@ -2261,6 +2261,17 @@ Ptr<SVM> SVM::create() ...@@ -2261,6 +2261,17 @@ Ptr<SVM> SVM::create()
return makePtr<SVMImpl>(); return makePtr<SVMImpl>();
} }
Ptr<SVM> SVM::load(const String& filename)
{
FileStorage fs;
fs.open(filename, FileStorage::READ);
Ptr<SVM> svm = makePtr<SVMImpl>();
svm->read(fs.getFirstTopLevelNode());
return svm;
}
Mat SVM::getUncompressedSupportVectors() const Mat SVM::getUncompressedSupportVectors() const
{ {
const SVMImpl* this_ = dynamic_cast<const SVMImpl*>(this); const SVMImpl* this_ = dynamic_cast<const SVMImpl*>(this);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment