From 7edb818ce370591f849a492ff3d13688a3c6db9c Mon Sep 17 00:00:00 2001 From: Thomas Boy <thomas-boy@idiv.de> Date: Mon, 27 Aug 2018 11:16:18 +0200 Subject: [PATCH] bugfix some basic-string::substr: pos error --- Demo.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Demo.cpp b/Demo.cpp index 6fb2fc5..30314a5 100644 --- a/Demo.cpp +++ b/Demo.cpp @@ -316,6 +316,13 @@ int main(int argc, char * argv[]) clock_t begin = clock(); fileName = inputDir + TToolBox::getFileName(frameCounter); + + //check the string + cout <<"open fileName: "<< fileName<<endl; + if(fileName.empty()) + cerr <<"error: empty string fileName"<<endl; + + cout <<"\t"<<frameCounter<<"\tof \t"<<amountFiles<<" load file :"<< fileName<<endl; //cv::imwrite(convert.str().c_str(), img_output); //we open the file @@ -504,6 +511,12 @@ int main(int argc, char * argv[]) //! step 8: we write down all our results in yml file std::string nameOutPutFileData = outputDir + TToolBox::mNzero(frameCounter) + ".yml"; + //check the string + cout <<"write output nameOutPutFileData: "<< nameOutPutFileData<<endl; + if(nameOutPutFileData.empty()) + cerr <<"error: empty string nameOutPutFileData"<<endl; + + FileStorage fs(nameOutPutFileData.c_str(), FileStorage::WRITE); fs << "masscenters" << massCenters; fs << "polygonselection"<< contourSelection; @@ -546,6 +559,12 @@ int main(int argc, char * argv[]) addWeighted( imgDebugPaint2, 0.7, imgOverlay2, 0.3, 0.0, imgOverlay2); //we write the file down std::string nameOutPutFileDBGpic = outputDir + TToolBox::mNzero(frameCounter) + ".jpg"; + + //check the string + cout <<"write dbg file: "<< nameOutPutFileDBGpic<<endl; + if(nameOutPutFileDBGpic.empty()) + cerr <<"error: empty string nameOutPutFileDBGpic"<<endl; + imwrite(nameOutPutFileDBGpic.c_str(),imgOverlay2); } @@ -553,7 +572,7 @@ int main(int argc, char * argv[]) }//end if the loaded picture has data else { - cout<<"error loading file: "<< fileName<<", will skip this file"<<endl; + cerr<<"error loading file: "<< fileName<<", will skip this file"<<endl; myFileErrorList.push_back(fileName); } -- GitLab