Skip to content
Snippets Groups Projects
Commit 3f9d68aa authored by Thomas Boy's avatar Thomas Boy
Browse files

is working pretty well, so we do a full test run

parent 0b5a9d7f
No related branches found
No related tags found
No related merge requests found
/*
./bgs_demo -i test45/ -a 100 -o test45/results/
based on original demo.cpp
./bgs_demo -i test45/ -a 100 -o test45/results
*/
//cpp c
......@@ -20,6 +19,9 @@ based on original demo.cpp
#include <string.h>
#include <unistd.h>
//cpp 11X
#include <regex>
#define PROCESS_CENTER_VERSION_MAJOR 2
#define PROCESS_CENTER_VERSION_MINOR 0
......@@ -46,6 +48,9 @@ bool cmdOptionExists(char** begin, char** end, const std::string& option);
std::vector<char> copyDataInBuffer(struct archive *aw);
//! we convert our actual jpg file number to framenumber
int toFrameNumber(std::string filename);
int main(int argc, char * argv[])
{
signal(SIGUSR1, my_handler);
......@@ -55,12 +60,12 @@ int main(int argc, char * argv[])
//!** parse programm input****************/
if(cmdOptionExists(argv, argv+argc, "-h"))
{
cout <<" error: please use command as\n./bgs_demo -i pathToInputDir -a amountOfJpgFiles -c exactCenterConfFile.xml -o outPutPath -p camparameterFile.xml"<<endl;
cout <<" error: please use command as\n./bgs_demo -i inputTarFile -a amountOfJpgFiles -c exactCenterConfFile.xml -o outPutPath -p camparameterFile.xml"<<endl;
return EXIT_FAILURE;
}
if(!cmdOptionExists(argv, argv+argc, "-i")||!cmdOptionExists(argv, argv+argc, "-a")||!cmdOptionExists(argv, argv+argc, "-o") ||!cmdOptionExists(argv, argv+argc, "-p"))
{
cout <<" error: please use command as\n./bgs_demo -i pathToInputDir -a amountOfJpgFiles -c exactCenterConfFile.xml -o outPutPath -p camparameterFile.xml"<<endl;
cout <<" error: please use command as\n./bgs_demo -i inputTarFile -a amountOfJpgFiles -c exactCenterConfFile.xml -o outPutPath -p camparameterFile.xml"<<endl;
return EXIT_FAILURE;
}
......@@ -246,6 +251,7 @@ int main(int argc, char * argv[])
int everyPic= 60*5;
//std::string fileName;
int frameCounter=0;
int frameCounterOld = -1;
vector<string> myFileErrorList;//list for pure io error
vector<string> myFileListNoContour; //list for no contours found;
vector<string> myFileListAfterContourSelection; //list for no contours found after selection;
......@@ -276,8 +282,17 @@ int main(int argc, char * argv[])
const char *fileNamePtr = archive_entry_pathname(entry);
std::string filename(fileNamePtr,strlen(fileNamePtr) );
//cout << "fileName: "<< filename <<endl;
//we convert it to a framenumber
frameCounter = toFrameNumber(filename);
if(frameCounterOld>frameCounter)
{
cerr <<" error during read in the file number, we do have non montonic order, will abort";
exit(1);
}
frameCounterOld = frameCounter;
//TODO we should test what file we have, this filenumber n = n - 1 ??
r = archive_write_header(ext, entry);
if (r != ARCHIVE_OK)
{
......@@ -300,8 +315,6 @@ int main(int argc, char * argv[])
//we read the image buffer as a jpg picture and decode it
Mat img_input = imdecode(Mat(vec), 1);
// //we define the type better to prevent error
// fileName = std::string(inputFile + TToolBox::getFileName(frameCounter));
// cv::String fileNameCV(fileName);
......@@ -561,6 +574,8 @@ int main(int argc, char * argv[])
if(g_badSignalFlagAbort)
frameCounter = amountFiles; //we abort
if(frameCounter>10)exit(0); //the test abort function
}//end for ever loop
//finishing time
......@@ -675,3 +690,20 @@ bool cmdOptionExists(char** begin, char** end, const std::string& option)
{
return std::find(begin, end, option) != end;
}
int toFrameNumber(std::string filename)
{
int retVal = -1;
//we cut out all non needed substrings
filename = regex_replace(filename, regex("/"), "");
filename = regex_replace(filename, regex("data_sized"), "");
filename = regex_replace(filename, regex("jpg"), "");
filename = regex_replace(filename, regex("\\."), "");
retVal = std::stoi( filename );
//cout <<"filename out:" << filename << " number: "<< retVal << endl;
return retVal;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment