4461ed9bd57fb5526c00e1396cf100309a9cfada
1 #include "SequenceViewerCV.h"
2 #include "ImageViewerCV.h"
9 /*----------------------------------------------------------------------*\
11 \*---------------------------------------------------------------------*/
13 /*--------------------------------------*\
15 \*-------------------------------------*/
17 /*--------------------------------------*\
19 \*-------------------------------------*/
21 /*----------------------------------------------------------------------*\
23 \*---------------------------------------------------------------------*/
25 /*--------------------------------------*\
27 \*-------------------------------------*/
29 SequenceVieverCV::SequenceVieverCV(Capture_A
* ptrCaptureur
)
31 cout
<<"[SequenceViever] : SequenceViever"<<endl
;
32 this->ptrCaptureur
= ptrCaptureur
;
33 this->isStart
= false;
36 SequenceVieverCV::~SequenceVieverCV(void)
41 void SequenceVieverCV::run()
43 cout
<<"[SequenceViever] : run"<<endl
;
49 Mat image
= ptrCaptureur
->capturer();
50 ptrCaptureur
->printInfo();
52 string titleFrame
= ptrCaptureur
->getTitle() + "[q to quit]";
53 ImageVieverCV
imageViever(titleFrame
);
56 char key
= 'a'; //disons
59 imageViever
.show(&image
);
60 image
= ptrCaptureur
->capturer();
62 int timetoWaitYetMS
= timeToWaitMS(&chrono
); // FIXME
63 key
= cvWaitKey(max(1, timetoWaitYetMS
)); // attention 1 min, pour respecter cadence original
65 if (ptrCaptureur
->nbCapture() % 60 == 0) //disons
67 cout
<< "[SequenceViewer] : fps = " << ptrCaptureur
->fpsCapture() << endl
;
68 // ptrCaptureur->printInfo();
76 int SequenceVieverCV::fps()
78 return ptrCaptureur
->fpsCapture();
81 /*--------------------------------------*\
83 \*-------------------------------------*/
85 int SequenceVieverCV::timeToWaitMS(Chronos
* ptrChrono
) // TODO BUG play trop vite why?
87 double timeElapseS
= ptrChrono
->stop();
90 int timeElapseMS
= (int) (timeElapseS
* 1000);
91 int timeToWaitTheoriqueMS
= ptrCaptureur
->dtOriginalMS();
93 int timetoWaitYetMS
= timeToWaitTheoriqueMS
- timeElapseMS
;
94 timetoWaitYetMS
= max(0, timetoWaitYetMS
); // 0 si negatif
99 // cout << "timeToWaitTheorique (MS) = " << timeToWaitTheoriqueMS << endl;
100 // cout << "timeElapse (MS) = " << timeElapseMS << endl;
101 // cout << "timetoWaitYet (MS) = " << timetoWaitYetMS << endl;
105 return timetoWaitYetMS
;
108 /*----------------------------------------------------------------------*\
110 \*---------------------------------------------------------------------*/