diff --git a/dataset/video.avi.tgz b/dataset/video.avi.tgz new file mode 100644 index 0000000000000000000000000000000000000000..db47b3dbe45fa70a18f56c2e2899e50fd307343c Binary files /dev/null and b/dataset/video.avi.tgz differ diff --git a/dataset/video.tar b/dataset/video.tar new file mode 100644 index 0000000000000000000000000000000000000000..06315001198e1fef642531f224ddc930123bb668 Binary files /dev/null and b/dataset/video.tar differ diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index b3575735c96a25e2ce1f83fe20388d7bf642d507..00c6ac4173bc7397cb728404dee8d18bec0a3b89 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -175,5 +175,3 @@ install(TARGETS libbgs bgslibrary PUBLIC_HEADER DESTINATION include/../algorithms COMPONENT dev FRAMEWORK DESTINATION "/Library/Frameworks" ) - -#15:34 last sudo diff --git a/examples/Demo.cpp b/examples/Demo.cpp index 1db0e7dcac599f159057ffa16f0490600accff99..bcb6c31c81388aa213d952cda3ada324c0e16f98 100644 --- a/examples/Demo.cpp +++ b/examples/Demo.cpp @@ -53,14 +53,14 @@ int main(int argc, char * argv[]) std::cout << "using processcenter " << PROCESS_CENTER_VERSION_MAJOR <<"."<< PROCESS_CENTER_VERSION_MINOR<<"."<<PROCESS_CENTER_VERSION_MINOR_FIXES<< 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")) - { - 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")) + + if(cmdOptionExists(argv, argv+argc, "-h") + || !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 inputTarFile -a amountOfJpgFiles -c exactCenterConfFile.xml -o outPutPath -p camparameterFile.xml"<<endl; + cout <<" Usage:\n" << argv[0] << " -i inputTarFile -a amountOfJpgFiles -c exactCenterConfFile.xml -o outPutPath -p camparameterFile.xml"<< endl; return EXIT_FAILURE; } @@ -71,6 +71,7 @@ int main(int argc, char * argv[]) //test dir exists inputFile = string(testFile); } + int amountFiles = -1; char *testFileAmount = getCmdOption(argv, argv + argc, "-a"); if (testFileAmount) @@ -106,7 +107,7 @@ int main(int argc, char * argv[]) } - cout <<"args: -i "<<inputFile<<" -a "<<amountFiles << " -c" << centerFileString<<" -o " << outputDir <<" -p " << cameraParameterFile ; + cout <<"args: -i "<<inputFile<<" -a "<<amountFiles << " -c" << centerFileString<<" -o " << outputDir <<" -p " << cameraParameterFile << endl; //!**** end parse input***********/ //libarchive things @@ -135,28 +136,29 @@ int main(int argc, char * argv[]) exit(1); } - /* - Codebook is new! - Tapter is TBoy! + /* #### Background Subtraction Methods ##### + + Codebook is new! + Tapter is TBoy! + List of all algorithms: - (Note that some of these algorithms are available only for a specific version of OpenCV, see algorithms.h) AdaptiveBackgroundLearning,AdaptiveSelectiveBackgroundLearning,CodeBook,DPAdaptiveMedian,DPEigenbackground, DPGrimsonGMM,DPMean,DPPratiMediod,DPTexture,DPWrenGA,DPZivkovicAGMM,FrameDifference,FuzzyChoquetIntegral, FuzzySugenoIntegral,GMG,IndependentMultimodal,KDE,KNN,LBAdaptiveSOM,LBFuzzyAdaptiveSOM,LBFuzzyGaussian, LBMixtureOfGaussians,LBP_MRF,LBSimpleGaussian,LOBSTER,MixtureOfGaussianV2,MixtureOfGaussianV1,MultiCue, MultiLayer,PAWCS,PixelBasedAdaptiveSegmenter,SigmaDelta,StaticFrameDifference,SuBSENSE,T2FGMM_UM,T2FGMM_UV, T2FMRF_UM,T2FMRF_UV,TwoPoints,ViBe,VuMeter,WeightedMovingMean,WeightedMovingVariance - */ - /* Background Subtraction Methods */ - IBGS *bgs; - bgs = new PixelBasedAdaptiveSegmenter; + (Note that some of these algorithms are available only for a specific version of OpenCV, see algorithms.h) + */ + IBGS *bgs = new FrameDifference; + // IBGS *bgs = new PixelBasedAdaptiveSegmenter; // TODO //see paper https://dl.acm.org/citation.cfm?id=2321600 //https://ieeexplore.ieee.org/document/4527178/ //was in benchmark on top https://www.researchgate.net/publication/259340906_A_comprehensive_review_of_background_subtraction_algorithms_evaluated_with_synthetic_and_real_videos - //my own adapter to use the model + //my own adapter to use the model (tapter?) //init the random number generator srand (time(NULL)); @@ -171,31 +173,31 @@ int main(int argc, char * argv[]) int circleRadius = 700; cv::String configFileNameCenter(centerFileString); //read the config - cout << "parameter of centerConfigFile.xml"<<endl; + cout << "parameter of centerConfigFile.xml" << endl; FileStorage fsCen; fsCen.open(configFileNameCenter, FileStorage::READ); if (!fsCen.isOpened()) { - cout << "error during open " <<centerFileString << " will abort\n "; + cout << "error during open " << centerFileString << " will abort" << endl; return EXIT_FAILURE; } circleCenterX = (int) fsCen["circleCenterX"]; - cout <<"circleCenterX: "<< circleCenterX<<endl; + cout <<"circleCenterX: "<< circleCenterX << endl; circleCenterY = (int) fsCen["circleCenterY"]; - cout <<"circleCenterY: "<< circleCenterY<<endl; + cout <<"circleCenterY: "<< circleCenterY << endl; circleRadius = (int) fsCen["circleRadius"]; - cout <<"circleRadius: "<< circleRadius<<endl; + cout <<"circleRadius: "<< circleRadius << endl; fsCen.release(); - //we open the camera config file + //open camera config file cv::String camParam (cameraParameterFile); Mat intrinsicsCameraMatrix, distortionCoeff; { - cout << "read cam parameter of: "<< cameraParameterFile ; + cout << "read cam parameter of: "<< cameraParameterFile << endl; FileStorage fs; fs.open(camParam, FileStorage::READ); if (!fs.isOpened()) @@ -203,10 +205,12 @@ int main(int argc, char * argv[]) cerr << "error during open " << cameraParameterFile << " will abort\n "; return -1; } + fs["camera_matrix"] >> intrinsicsCameraMatrix; - std::cout << "camera_matrix = "<< intrinsicsCameraMatrix<<endl; + std::cout << "camera_matrix = "<< intrinsicsCameraMatrix << endl; + fs["distortion_coefficients"] >> distortionCoeff; - std::cout << "distortion_coefficients"<< distortionCoeff<<endl; + std::cout << "distortion_coefficients"<< distortionCoeff << endl; } @@ -234,7 +238,7 @@ int main(int argc, char * argv[]) std::vector<char> vec; //we read the next header - r = archive_read_next_header(archive, &entry); + r = corruption(archive, &entry); if (r == ARCHIVE_EOF) break; if (r != ARCHIVE_OK) diff --git a/examples/run_demo.sh b/examples/run_demo.sh index 61373c73e4238907f333b3f912923787003632fa..7f3481135b5d575f91b87b66b6e3a33605c79f71 100755 --- a/examples/run_demo.sh +++ b/examples/run_demo.sh @@ -1,2 +1,16 @@ #!/bin/bash -./build/bgs_demo ../dataset/video.avi +# ./build/bgs_demo ../dataset/video.avi + ./build/bgs_demo -i ../dataset/video.tar -a 40 -p ../config/camParam.xml -o ../output -c ../config/centerConfigFile.xml + + # -i data_sized.tar + #multiple tar'ed videos? + + # -c exactCenter + #HOW? + # circleCenterX + # circleCenterY + # circleRadius + +# -p camParam +# camera_matrix +# distortion_coefficients