Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

FileStorage Documetation Wrong/Failing

I am trying to use FileStorage. The sample code in the documentation crashes when it reaches the first "[" bracket. Also, the sample code specifies a "yml" file type but eh text in the documentation states that the sample code will output an "xml" file.

I have tried several variations on the sample code (specifying xml instead of yml, putting a ":" after the bracket, etc.) but still no luck.

        FileStorage fs(tFileName,FileStorage::WRITE);
        std::list<cvImages>::iterator itl;

        if(fs.isOpened())
        {
            fs << "style name";
            fs << "images" << "[";

            for(itl = MatchInstance->begin(); itl != MatchInstance->end(); ++itl)
            {
                fs << "{:";
                fs << "ImageID" << (*itl).ImageID;
                fs << "Height" << (*itl).ImageID;
                fs << "Width" << (*itl).ImageID;
                fs << "AnalysisFrameType" << (*itl).ImageID;
                fs << "ShowImageType" << (*itl).ImageID;
                fs << "ImageSize" << (*itl).ImageID;
                fs << "}";
            }
            fs << "]";
        }
        fs.release();

Any help great appreciated.