diff --git a/Demo.cpp b/Demo.cpp index bda103b06bef73448f5a46112fe1b69d11b790b1..0e9f2e3634264e02268bc99dc078ff9cda8a93cc 100644 --- a/Demo.cpp +++ b/Demo.cpp @@ -14,7 +14,7 @@ based on original demo.cpp #define PROCESS_CENTER_VERSION_MAJOR 0 -#define PROCESS_CENTER_VERSION_MINOR 2 +#define PROCESS_CENTER_VERSION_MINOR 6 //opencv #include <opencv2/opencv.hpp> @@ -187,8 +187,6 @@ int main(int argc, char * argv[]) int i= 0; cv::Mat img_input; - //int begin = 0; - int steps = amountFiles; //init the random number generator srand (time(NULL)); @@ -221,27 +219,25 @@ int main(int argc, char * argv[]) cout <<"circleRadius: "<< circleRadius<<endl; fsCen.release(); - // //first the static pic********** - // //std::string fileName = getFileName(begin); - // std::string staticFile = inputDir+"/bk.jpg"; - // cout <<"a) load first static background pic :"<< staticFile<<endl; - // img_input = imread(staticFile.c_str(), CV_LOAD_IMAGE_COLOR); - // if(img_input.data ) - // { - // //we cut out a smaller ROI - // img_input = TToolBox::cropImageCircle(img_input,circleCenterX,circleCenterY,circleRadius); - - // cv::Mat img_mask; - // cv::Mat img_bkgmodel; - // bgs->process(img_input, img_mask, img_bkgmodel); - + //first the static pic********** + //std::string fileName = getFileName(begin); + std::string staticFile = inputDir+"/bk.jpg"; + cout <<"a) load first static background pic :"<< staticFile<<endl; + img_input = imread(staticFile.c_str(), CV_LOAD_IMAGE_COLOR); + if(img_input.data ) + { + //we cut out a smaller ROI + img_input = TToolBox::cropImageCircle(img_input,circleCenterX,circleCenterY,circleRadius); - // } - // else - // { - // cout<<"error loading file: "<< staticFile<<", will abort"<<endl; - // return EXIT_FAILURE; - // } + cv::Mat img_mask; + cv::Mat img_bkgmodel; + bgs->process(img_input, img_mask, img_bkgmodel); + } + else + { + cout<<"error loading file: "<< staticFile<<", will abort"<<endl; + return EXIT_FAILURE; + } std::string fileName; @@ -307,7 +303,7 @@ int main(int argc, char * argv[]) cout <<"c) we produce train the background with random choosen files"<< fileName<<endl; - int everyPic=60; + int everyPic=60*5; int frameCounter=0; for(frameCounter=0;i<amountFiles;frameCounter++) @@ -574,8 +570,7 @@ int main(int argc, char * argv[]) clock_t endAll = clock(); double elapsed = double(endAll - beginAll) / CLOCKS_PER_SEC; cout <<"process : "<<amountFiles<<" files took:\t"<<(int)(elapsed/60)<<" min -\t"<<(int)(elapsed/60/60)<<" h \n in total"<<endl; - //we write the random file list - //format output file + //we write the random file list to a file std::string nameOutRandomFile = outputDir + "randlist.yml"; FileStorage fs(nameOutRandomFile.c_str(), FileStorage::WRITE);