1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

ml: refactor non-virtual methods

This commit is contained in:
berak
2018-04-24 12:11:59 +02:00
parent 4d7d630e92
commit fc5bba66af
4 changed files with 39 additions and 76 deletions
+3 -23
View File
@@ -1250,7 +1250,7 @@ public:
uncompressed_sv.release();
}
Mat getUncompressedSupportVectors_() const
Mat getUncompressedSupportVectors() const CV_OVERRIDE
{
return uncompressed_sv;
}
@@ -1982,10 +1982,10 @@ public:
bool returnDFVal;
};
bool trainAuto_(InputArray samples, int layout,
bool trainAuto(InputArray samples, int layout,
InputArray responses, int kfold, Ptr<ParamGrid> Cgrid,
Ptr<ParamGrid> gammaGrid, Ptr<ParamGrid> pGrid, Ptr<ParamGrid> nuGrid,
Ptr<ParamGrid> coeffGrid, Ptr<ParamGrid> degreeGrid, bool balanced)
Ptr<ParamGrid> coeffGrid, Ptr<ParamGrid> degreeGrid, bool balanced) CV_OVERRIDE
{
Ptr<TrainData> data = TrainData::create(samples, layout, responses);
return this->trainAuto(
@@ -2353,26 +2353,6 @@ Ptr<SVM> SVM::load(const String& filepath)
return svm;
}
Mat SVM::getUncompressedSupportVectors() const
{
const SVMImpl* this_ = dynamic_cast<const SVMImpl*>(this);
if(!this_)
CV_Error(Error::StsNotImplemented, "the class is not SVMImpl");
return this_->getUncompressedSupportVectors_();
}
bool SVM::trainAuto(InputArray samples, int layout,
InputArray responses, int kfold, Ptr<ParamGrid> Cgrid,
Ptr<ParamGrid> gammaGrid, Ptr<ParamGrid> pGrid, Ptr<ParamGrid> nuGrid,
Ptr<ParamGrid> coeffGrid, Ptr<ParamGrid> degreeGrid, bool balanced)
{
SVMImpl* this_ = dynamic_cast<SVMImpl*>(this);
if (!this_) {
CV_Error(Error::StsNotImplemented, "the class is not SVMImpl");
}
return this_->trainAuto_(samples, layout, responses,
kfold, Cgrid, gammaGrid, pGrid, nuGrid, coeffGrid, degreeGrid, balanced);
}
}
}