1 | initial version |
you can use opencv's FileStorage to inspect the saved xml file.
i don't have a serialized RF xml file at hand, but for an SVM it is:
<?xml version="1.0"?>
<opencv_storage>
<opencv_ml_svm> // 1st level
...
<class_labels type_id="opencv-matrix"> // 2nd level
<rows>5</rows>
<cols>1</cols>
<dt>i</dt>
<data>
1 2 3 4 5</data></class_labels>
...
FileStorage fs("my.xml", FileStorage::READ);
Mat labels;
fs["opencv_ml_svm"]["class_labels"] >> labels; // change tag names to your need !
cerr << labels.t() << endl;
//[1,2,3,4,5]
2 | No.2 Revision |
you can use opencv's FileStorage to inspect the saved xml file.
i don't have a serialized RF xml file at hand, but for an SVM it is:
<?xml version="1.0"?>
<opencv_storage>
<opencv_ml_svm> // 1st level
...
<class_labels type_id="opencv-matrix"> // 2nd level
<rows>5</rows>
<cols>1</cols>
<dt>i</dt>
<data>
1 2 3 4 5</data></class_labels>
...
FileStorage fs("my.xml", FileStorage::READ);
Mat labels;
fs["opencv_ml_svm"]["class_labels"] >> labels; // change tag names to your need !
cerr << labels.t() << endl;
//[1,2,3,4,5]