added API for storing OpenCV data structures to text string and reading them back

This commit is contained in:
Vadim Pisarevsky
2012-05-28 15:38:58 +00:00
parent 18a8721f49
commit bc929a7d46
5 changed files with 219 additions and 103 deletions

View File

@@ -3941,7 +3941,12 @@ public:
{
READ=0, //! read mode
WRITE=1, //! write mode
APPEND=2 //! append mode
APPEND=2, //! append mode
MEMORY=4,
FORMAT_MASK=(7<<3),
FORMAT_AUTO=0,
FORMAT_XML=(1<<3),
FORMAT_YAML=(2<<3)
};
enum
{
@@ -3953,7 +3958,7 @@ public:
//! the default constructor
CV_WRAP FileStorage();
//! the full constructor that opens file storage for reading or writing
CV_WRAP FileStorage(const string& filename, int flags, const string& encoding=string());
CV_WRAP FileStorage(const string& source, int flags, const string& encoding=string());
//! the constructor that takes pointer to the C FileStorage structure
FileStorage(CvFileStorage* fs);
//! the destructor. calls release()
@@ -3964,7 +3969,7 @@ public:
//! returns true if the object is associated with currently opened file.
CV_WRAP virtual bool isOpened() const;
//! closes the file and releases all the memory buffers
CV_WRAP virtual void release();
CV_WRAP virtual string release();
//! returns the first element of the top-level mapping
CV_WRAP FileNode getFirstTopLevelNode() const;

View File

@@ -1740,6 +1740,11 @@ typedef struct CvFileStorage CvFileStorage;
#define CV_STORAGE_WRITE_TEXT CV_STORAGE_WRITE
#define CV_STORAGE_WRITE_BINARY CV_STORAGE_WRITE
#define CV_STORAGE_APPEND 2
#define CV_STORAGE_MEMORY 4
#define CV_STORAGE_FORMAT_MASK (7<<3)
#define CV_STORAGE_FORMAT_AUTO 0
#define CV_STORAGE_FORMAT_XML 8
#define CV_STORAGE_FORMAT_YAML 16
/* List of attributes: */
typedef struct CvAttrList