Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

load file in cv::rect opencv

I'm trying to compare code by plotting ground truth bounding box on images saved in a txt file in the following format

198,214,34,81
197,214,34,81
195,214,34,81
193,214,34,81
...

how can I load each line on a cv::Rect ? thank you in advance

I've tried this

  string fileName = "groundtruth_rect.txt";
  FileStorage fs;
  fs.open(fileName, FileStorage::READ);
  FileNode mr = fs[""];
  Rect r;
  r.x = (int)mr[0];
  r.y = (int)mr[1];
  r.width = (int)mr[2];
  r.height = (int)mr[3];

unfortunately i got this

Valid XML should start with '<?xml ...?>') in icvXMLParse, file C:\buildslave64\win64_amdocl\2_4_
PackSlave-win32-vc11-shared\opencv\modules\core\src\persistence.cpp, line 2252