X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FTuto_OpenCV%2Fsrc%2Fcpp%2Fmain.cpp;fp=WCudaMSE%2FTuto_OpenCV%2Fsrc%2Fcpp%2Fmain.cpp;h=10cb1f765551fdd498cc14eeb8d82bd8491a9985;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/Tuto_OpenCV/src/cpp/main.cpp b/WCudaMSE/Tuto_OpenCV/src/cpp/main.cpp new file mode 100755 index 0000000..10cb1f7 --- /dev/null +++ b/WCudaMSE/Tuto_OpenCV/src/cpp/main.cpp @@ -0,0 +1,129 @@ +#include + +#include "CaptureVideo.h" +#include "CaptureCamera.h" +#include "Capture_A.h" +#include "SequenceViewerCV.h" + +using std::cout; +using std::cin; +using std::cerr; +using std::endl; +using std::string; + +/*----------------------------------------------------------------------*\ + |* Declaration *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Imported *| + \*-------------------------------------*/ + +extern int tuto(string nameVideo); + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +static int useVideo(void); +static int useCamera(void); +static int show(Capture_A* ptrCaptureur); +static string getVideoName(void); + +/*----------------------------------------------------------------------*\ + |* Implementation *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +int main(void) + { + cout << "main" << endl; + + //return tuto(getVideoName()); // debug + + bool isUseVideo = true; + if (isUseVideo) + { + tuto(getVideoName()); // debug + return useVideo(); + } + else + { + return useCamera(); + } + } + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +int useVideo(void) + { + cout << "use video" << endl; + + string title = "Tuto Video"; + string videoName = getVideoName(); + CaptureVideo captureur(getVideoName(), title); + + if (captureur.isOpened()) + { + return show(&captureur); // bloquant + } + else + { + cerr << "\n[CBI] : Failed to open : " << videoName << endl; + return EXIT_FAILURE; + } + } + +string getVideoName(void) + { +#ifdef _WIN32 + // Work + // string nameVideo ="Q:\\neilPryde.avi"; + // string nameVideo = "C:\\Users\\cedric.bilat\\Desktop\\neilPryde.avi"; // ok + string nameVideo="C:\\Users\\cedric.bilat\\Desktop\\nasaFHD_short.avi"; //ok + + // Home + // string nameVideo = "C:\\Users\\bilat\\Desktop\\neilPryde.avi"; // ok + //string nameVideo="C:\\Users\\bilat\\Desktop\\nasaFHD_short.avi";// ok +#else + //string nameVideo = "/media/Data/Video//neilPryde.avi"; // ok + string nameVideo = "/media/Data/Video/nasaFHD_short.avi"; // ok +#endif + + return nameVideo; + } + +int useCamera(void) + { + int idCamera = 0; + string title = "Tuto Camera"; + + // CaptureCamera captureur(idCamera, title,320,160); + CaptureCamera captureur(idCamera, title); + + if (captureur.isOpened()) + { + return show(&captureur); + } + else + { + return EXIT_FAILURE; + } + } + +int show(Capture_A* ptrCaptureur) + { + SequenceVieverCV sequenceViever(ptrCaptureur); + sequenceViever.run(); // bloquant + return EXIT_SUCCESS; + } + +/*----------------------------------------------------------------------*\ + |* End *| + \*---------------------------------------------------------------------*/ +