diff --git a/Demo.cpp b/Demo.cpp index 351d21fd3160e99797e0bb2a002c6bd30e1142c8..ae8e9c4e973a302a274e9ef407ca873e397c722d 100644 --- a/Demo.cpp +++ b/Demo.cpp @@ -12,6 +12,10 @@ based on original demo.cpp #include <time.h> /* time */ #include <ctime> + +#define PROCESS_CENTER_VERSION_MAJOR 0 +#define PROCESS_CENTER_VERSION_MINOR 1 + //opencv #include <opencv2/opencv.hpp> //bgslibrary @@ -51,8 +55,10 @@ bool cmdOptionExists(char** begin, char** end, const std::string& option) return std::find(begin, end, option) != end; } + int main(int argc, char * argv[]) { + std::cout << "using processcenter " <<PROCESS_CENTER_VERSION_MAJOR <<"."<< PROCESS_CENTER_VERSION_MINOR << endl; std::cout << "Using OpenCV " << CV_MAJOR_VERSION << "." << CV_MINOR_VERSION << "." << CV_SUBMINOR_VERSION << std::endl; //!** parse programm input****************/ if(cmdOptionExists(argv, argv+argc, "-h")) @@ -191,6 +197,8 @@ int main(int argc, char * argv[]) //init the random number generator srand (time(NULL)); + clock_t beginAll = clock(); + //first the static pic********** //std::string fileName = getFileName(begin); std::string staticFile = inputDir+"/bk.jpg"; @@ -210,10 +218,27 @@ int main(int argc, char * argv[]) std::string fileName; - //! we train with first 54 on random draws + //! we train with first x on random draws + int amountTrainingSteps = 200; + //we open the config file and readin + cv::String configFileName("./config/Tapter.xml"); + {//read the config + FileStorage fs; + fs.open(configFileName, FileStorage::READ); + if (!fs.isOpened()) + { + cout << "error during open " << configFileName << " will abort " <<endl; + return EXIT_FAILURE; + } + //param + amountTrainingSteps = (int) fs["trainingSteps"]; + //cout <<"amountTrainingSteps: "<< amountTrainingSteps<< endl; + fs.release(); + } + cout <<"b) we train the background with random choosen files"<< fileName<<endl; vector<string> myRandomTrainList; //we save all draws in a list which will save to the results - for(i=0;i<54;i++) //TODO make 54 as parameter + for(i=0;i<amountTrainingSteps;i++) { //random index int index = rand() % steps + begin; //TODO: double check no double draw ?? @@ -242,7 +267,7 @@ int main(int argc, char * argv[]) bgs->setFlagWrite(1); bgs->setFlagWriteDBGpic(1); - clock_t beginAll = clock(); + for(i=begin;i<begin+steps;i++) {