Removed "FORMAT_XML" to generalize format
Removed the "FileStorage::FORMAT_XML" to generalize format of the String model.
This commit is contained in:
parent
f54b80d2c8
commit
b35f5d115f
@ -827,15 +827,15 @@ public:
|
|||||||
return model->isTrained() ? model : Ptr<_Tp>();
|
return model->isTrained() ? model : Ptr<_Tp>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Loads model from an XML String
|
/** @brief Loads model from a String
|
||||||
@param strModel The string variable containing the model (in an XML format) you want to load.
|
@param strModel The string variable containing the model you want to load.
|
||||||
|
|
||||||
This is static template method of StatModel. It's usage is following (in the case of SVM):
|
This is static template method of StatModel. It's usage is following (in the case of SVM):
|
||||||
Ptr<SVM> svm = StatModel::loadFromString<SVM>(myXMLStringModel);
|
Ptr<SVM> svm = StatModel::loadFromString<SVM>(myStringModel);
|
||||||
*/
|
*/
|
||||||
template<typename _Tp> static Ptr<_Tp> loadFromString(const String& strModel)
|
template<typename _Tp> static Ptr<_Tp> loadFromString(const String& strModel)
|
||||||
{
|
{
|
||||||
FileStorage fs(strModel, FileStorage::READ + FileStorage::MEMORY + FileStorage::FORMAT_XML);
|
FileStorage fs(strModel, FileStorage::READ + FileStorage::MEMORY);
|
||||||
Ptr<_Tp> model = _Tp::create();
|
Ptr<_Tp> model = _Tp::create();
|
||||||
model->read(fs.getFirstTopLevelNode());
|
model->read(fs.getFirstTopLevelNode());
|
||||||
return model->isTrained() ? model : Ptr<_Tp>();
|
return model->isTrained() ? model : Ptr<_Tp>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user