Commit 2ad0b01d authored by Mohcine Chraibi's avatar Mohcine Chraibi

properly parse framerate

parent 0440bbf4
Pipeline #5333 failed with stages
...@@ -73,6 +73,8 @@ bool Method_D::Process (const PedData& peddata,const std::string& scriptsLocatio ...@@ -73,6 +73,8 @@ bool Method_D::Process (const PedData& peddata,const std::string& scriptsLocatio
_projectRootDir = peddata.GetProjectRootDir(); _projectRootDir = peddata.GetProjectRootDir();
_measureAreaId = boost::lexical_cast<string>(_areaForMethod_D->_id); _measureAreaId = boost::lexical_cast<string>(_areaForMethod_D->_id);
_fps =peddata.GetFps(); _fps =peddata.GetFps();
Log->Write("INFO:\tFrame rate fps: <%.2f>", _fps);
int minFrame = peddata.GetMinFrame(); int minFrame = peddata.GetMinFrame();
if(_startFrame!=_stopFrame) if(_startFrame!=_stopFrame)
{ {
......
...@@ -111,12 +111,15 @@ bool PedData::InitializeVariables(const string& filename) ...@@ -111,12 +111,15 @@ bool PedData::InitializeVariables(const string& filename)
//looking for the framerate which is suppposed to be at the second position //looking for the framerate which is suppposed to be at the second position
if(line[0] == '#') if(line[0] == '#')
{ {
std::vector<std::string> strs;
boost::split(strs, line , boost::is_any_of(":"),boost::token_compress_on);
if(strs[0]=="#framerate" && strs.size()==2) if(line.find("framerate") != std::string::npos)
{ {
_fps= atof(strs[1].c_str()); std::vector<std::string> strs;
line.erase(0,1); // remove #
boost::split(strs, line , boost::is_any_of(":"),boost::token_compress_on);
if(strs.size()>1)
_fps= atof(strs[1].c_str());
Log->Write("INFO:\tFrame rate fps: <%.2f>", _fps); Log->Write("INFO:\tFrame rate fps: <%.2f>", _fps);
} }
...@@ -212,7 +215,6 @@ bool PedData::InitializeVariables(const string& filename) ...@@ -212,7 +215,6 @@ bool PedData::InitializeVariables(const string& filename)
std::vector<int>::iterator it; std::vector<int>::iterator it;
it = unique(unique_ids.begin(), unique_ids.end()); it = unique(unique_ids.begin(), unique_ids.end());
unique_ids.resize(distance(unique_ids.begin(),it)); unique_ids.resize(distance(unique_ids.begin(),it));
_numPeds = unique_ids.size(); _numPeds = unique_ids.size();
Log->Write("INFO: Total number of Agents: %d", _numPeds); Log->Write("INFO: Total number of Agents: %d", _numPeds);
CreateGlobalVariables(_numPeds, _numFrames); CreateGlobalVariables(_numPeds, _numFrames);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment