Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

FileStorage: can write but can't read Size, Rect, etc.

I am writing Size to a yaml file using FileStorage:

FileStorage fs("info.yml", FileStorage::WRITE);
fs << "gridSize" << Size(31,31);

The file content is after writing:

%YAML:1.0
gridSize: [ 31, 31 ]

I cannot read the Size object again by doing:

Size gridSize;
FileStorage fs("info.yml", FileStorage::READ);
fs["gridSize"] >> gridSize;

Is this a bug? Lack of feature? Or is this completely planned behavior? What is the best way to read OpenCV data structures?

FileStorage: can write but can't read Size, Rect, etc.

I am writing Size to a yaml file using FileStorage:

FileStorage fs("info.yml", FileStorage::WRITE);
fs << "gridSize" << Size(31,31);

The file content is after writing:

%YAML:1.0
gridSize: [ 31, 31 ]

I cannot read the Size object again by doing:

Size gridSize;
FileStorage fs("info.yml", FileStorage::READ);
fs["gridSize"] >> gridSize;

Is this a bug? Lack of feature? Or is this completely planned behavior? What is the best way to read OpenCV data structures?