Ask Your Question

Revision history [back]

Save Xml file directory problem. Openframeworks and fileStorage

Hello,

I'm working on an OpenFrameworks app, where I am using the OpenCV addon (ofxOpenCV). The problem occurs when I try to save the ANN parameters on a xml file. The xml does not appear on the entire system. I try another version with a simple matrix and the result is the same.

I am using Xcode (C++). OpenCV version : 2.4.9.

I try the following code and return the weights (one of the ANN parameters) so, maybe somewhere there is the xml file...

    FileStorage fs;
    fs.open("mlp.xml", FileStorage::WRITE);
    ann[0]->write(fs);
    fs.release();

    FileStorage opencv_file("mlp.xml", FileStorage::READ);
    Ptr<ANN_MLP> nn = ANN_MLP::create();

    nn->read(opencv_file.root());
    cout << nn->getWeights(0) <<endl; //RETURN THE WEIGHTS
    opencv_file.release();

I also try to read by fileNode and the output matrix is empty.

The idea is to load/save (write/read) different xml files (or other types of files) to set different ANN parameters.

Any idea?

Thank you! Ignasi.

Save Xml file directory problem. Openframeworks and fileStorage

Hello,

I'm working on an OpenFrameworks app, where I am using the OpenCV addon (ofxOpenCV). The problem occurs when I try to save the ANN parameters on a xml file. The xml does not appear on the entire system. I try another version with a simple matrix and the result is the same.

I am using Xcode (C++). OpenCV version : 2.4.9. 3.4.1.

I try the following code and return the weights (one of the ANN parameters) so, maybe somewhere there is the xml file...

    FileStorage fs;
    fs.open("mlp.xml", FileStorage::WRITE);
    ann[0]->write(fs);
    fs.release();

    FileStorage opencv_file("mlp.xml", FileStorage::READ);
    Ptr<ANN_MLP> nn = ANN_MLP::create();

    nn->read(opencv_file.root());
    cout << nn->getWeights(0) <<endl; //RETURN THE WEIGHTS
    opencv_file.release();

I also try to read by fileNode and the output matrix is empty.

The idea is to load/save (write/read) different xml files (or other types of files) to set different ANN parameters.

Any idea?

Thank you! Ignasi.