FileStorage read/write for cv::Size,Rect,Vec (Bug #3196)


Added by Kevin Hughes over 11 years ago. Updated over 11 years ago.


Status:Done Start date:2013-08-05
Priority:Low Due date:
Assignee:Roman Donchenko % Done:

100%

Category:core
Target version:2.4.7
Affected version:branch 'master' (2.9) Operating System:Any
Difficulty: HW Platform:Any
Pull request:

Description

FileStorage can write cv::Size,Rect,Vec fine but is unable to read them back in directly.

Either the attributes must be written separately then read back in and used with a constructor or they can be read as a std::vector.

eg.

// WRITE
cv::Size s(2,2);
cv::Vec3f v(1.,1.,1.);

cv::FileStorage fs;
fs.open("test.xml", cv::FileStorage::WRITE);

fs << "s" << s;
fs << "v" << v;

fs.release();

// READ
cv::FileStorage fs2;
fs2.open("test.xml", cv::FileStorage::READ);

cv::Size s;
cv::Vec3f v;

fs["s"] >> s; // this doesn't work
fs["v"] >> v; // neither does this

fs2.release();

/** test.xml **/

<opencv_storage>
<s>
2 2</s>
<v>
1. 1. 1.</v>
</opencv_storage>


Associated revisions

Revision 6cf9070b
Added by Bahram Dahi over 11 years ago

Added ability to read several opencv types (Size, Point, etc.) to FileStorage. Solves issue #3196

Revision 2e950eb4
Added by Vadim Pisarevsky over 10 years ago

Merge pull request #3196 from PhilLab:patch-4

History

Updated by Victor Kocheganov over 11 years ago

Hello Kevin,

thanks for submitting this ticket. Unfortunately we have limited resources at the moment. So if you find time to implement this feature by yourself that would be great! (Please see http://www.code.opencv.org/projects/opencv/wiki/How_to_contribute for details).

Thank you in advance,
Victor Kocheganov

  • Category set to core
  • Status changed from New to Open
  • Target version set to 3.0-alpha
  • Assignee set to Vadim Pisarevsky

Updated by Victor Kocheganov over 11 years ago

  • Assignee changed from Vadim Pisarevsky to Roman Donchenko

Updated by Bahram Dahi over 11 years ago

  • Target version changed from 3.0-alpha to 2.4.7
  • % Done changed from 0 to 100

Updated by Bahram Dahi over 11 years ago

  • Status changed from Open to Done

Also available in: Atom PDF