1 | initial version |
i can't tell about the deprecation status, with current 4.1 it seems to be still the same: Algorithm::load/save handles the FileStorage, and e.g. RTrees::read/write handle the data inside it.
given you have your xml data inside a std::string xml
you can initialize a FileStorage from that memory, and read the tree data:
std::string xml; // "<?xml version="1.0"?>\n<opencv_storage>\n<opencv_ml_rtrees>\n ......"
FileStorage fs(xml, FileStorage::MEMORY|FileStorage::READ);
Ptr<ml::RTrees> another_tree = ml::RTrees::create();
another_tree->read(fs.getFirstTopLevelNode());
//cout << another_tree->isTrained() << " " << another_tree->getVarCount() << endl;
the next problem is, you have to get somehow creative, to get the xml content into something you can save as code, maybe you need to hexencode it:
char bytes = {
0x36, 0x44,0x45,0x33,.....
};
string xml = string(bytes);
so, workflow would be:
2 | No.2 Revision |
i can't tell about the deprecation status, with current 4.1 it seems to be still the same: Algorithm::load/save handles the FileStorage, and e.g. RTrees::read/write handle the data inside it.
given you have your xml data inside a std::string xml
you can initialize a FileStorage from that memory, and read the tree data:
std::string xml; // "<?xml version="1.0"?>\n<opencv_storage>\n<opencv_ml_rtrees>\n ......"
FileStorage fs(xml, FileStorage::MEMORY|FileStorage::READ);
Ptr<ml::RTrees> another_tree = ml::RTrees::create();
another_tree->read(fs.getFirstTopLevelNode());
//cout << another_tree->isTrained() << " " << another_tree->getVarCount() << endl;
the next problem is, you have to get somehow creative, to get the xml content into something you can save as code, maybe you need to hexencode it:
char bytes bytes[] = {
0x36, 0x44,0x45,0x33,.....
};
string xml = string(bytes);
so, workflow would be:
3 | No.3 Revision |
i can't tell about the deprecation status, with current 4.1 it seems to be still the same: Algorithm::load/save handles the FileStorage, and e.g. RTrees::read/write handle the data inside it.
given you have your xml data inside a std::string xml
you can initialize a FileStorage from that memory, and read the tree data:
std::string xml; // "<?xml version="1.0"?>\n<opencv_storage>\n<opencv_ml_rtrees>\n ......"
FileStorage fs(xml, FileStorage::MEMORY|FileStorage::READ);
Ptr<ml::RTrees> another_tree = ml::RTrees::create();
another_tree->read(fs.getFirstTopLevelNode());
//cout << another_tree->isTrained() << " " << another_tree->getVarCount() << endl;
the next problem is, you have to get somehow creative, to get the xml content into something you can save (and compile !) as code, maybe you need to hexencode it:
char bytes[] = {
0x36, 0x44,0x45,0x33,.....
};
string xml = string(bytes);
so, workflow would be: