Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / Tuto_OpenCV / src / cpp / main.cpp
1 #include <iostream>
2
3 #include "CaptureVideo.h"
4 #include "CaptureCamera.h"
5 #include "Capture_A.h"
6 #include "SequenceViewerCV.h"
7
8 using std::cout;
9 using std::cin;
10 using std::cerr;
11 using std::endl;
12 using std::string;
13
14 /*----------------------------------------------------------------------*\
15 |* Declaration *|
16 \*---------------------------------------------------------------------*/
17
18 /*--------------------------------------*\
19 |* Imported *|
20 \*-------------------------------------*/
21
22 extern int tuto(string nameVideo);
23
24 /*--------------------------------------*\
25 |* Private *|
26 \*-------------------------------------*/
27
28 static int useVideo(void);
29 static int useCamera(void);
30 static int show(Capture_A* ptrCaptureur);
31 static string getVideoName(void);
32
33 /*----------------------------------------------------------------------*\
34 |* Implementation *|
35 \*---------------------------------------------------------------------*/
36
37 /*--------------------------------------*\
38 |* Public *|
39 \*-------------------------------------*/
40
41 int main(void)
42 {
43 cout << "main" << endl;
44
45 //return tuto(getVideoName()); // debug
46
47 bool isUseVideo = true;
48 if (isUseVideo)
49 {
50 tuto(getVideoName()); // debug
51 return useVideo();
52 }
53 else
54 {
55 return useCamera();
56 }
57 }
58
59 /*--------------------------------------*\
60 |* Private *|
61 \*-------------------------------------*/
62
63 int useVideo(void)
64 {
65 cout << "use video" << endl;
66
67 string title = "Tuto Video";
68 string videoName = getVideoName();
69 CaptureVideo captureur(getVideoName(), title);
70
71 if (captureur.isOpened())
72 {
73 return show(&captureur); // bloquant
74 }
75 else
76 {
77 cerr << "\n[CBI] : Failed to open : " << videoName << endl;
78 return EXIT_FAILURE;
79 }
80 }
81
82 string getVideoName(void)
83 {
84 #ifdef _WIN32
85 // Work
86 // string nameVideo ="Q:\\neilPryde.avi";
87 // string nameVideo = "C:\\Users\\cedric.bilat\\Desktop\\neilPryde.avi"; // ok
88 string nameVideo="C:\\Users\\cedric.bilat\\Desktop\\nasaFHD_short.avi"; //ok
89
90 // Home
91 // string nameVideo = "C:\\Users\\bilat\\Desktop\\neilPryde.avi"; // ok
92 //string nameVideo="C:\\Users\\bilat\\Desktop\\nasaFHD_short.avi";// ok
93 #else
94 //string nameVideo = "/media/Data/Video//neilPryde.avi"; // ok
95 string nameVideo = "/media/Data/Video/nasaFHD_short.avi"; // ok
96 #endif
97
98 return nameVideo;
99 }
100
101 int useCamera(void)
102 {
103 int idCamera = 0;
104 string title = "Tuto Camera";
105
106 // CaptureCamera captureur(idCamera, title,320,160);
107 CaptureCamera captureur(idCamera, title);
108
109 if (captureur.isOpened())
110 {
111 return show(&captureur);
112 }
113 else
114 {
115 return EXIT_FAILURE;
116 }
117 }
118
119 int show(Capture_A* ptrCaptureur)
120 {
121 SequenceVieverCV sequenceViever(ptrCaptureur);
122 sequenceViever.run(); // bloquant
123 return EXIT_SUCCESS;
124 }
125
126 /*----------------------------------------------------------------------*\
127 |* End *|
128 \*---------------------------------------------------------------------*/
129