Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / BilatTools_OpenCV / src / core / capture / cpp / CaptureCamera.cpp
1 #include <iostream>
2 #include "CaptureCamera.h"
3
4 using std::cerr;
5 using std::cout;
6 using std::endl;
7
8 /*----------------------------------------------------------------------*\
9 |* Declaration *|
10 \*---------------------------------------------------------------------*/
11
12 /*--------------------------------------*\
13 |* Public *|
14 \*-------------------------------------*/
15
16 /*--------------------------------------*\
17 |* Private *|
18 \*-------------------------------------*/
19
20 /*----------------------------------------------------------------------*\
21 |* Implementation *|
22 \*---------------------------------------------------------------------*/
23
24 /*--------------------------------------*\
25 |* Public *|
26 \*-------------------------------------*/
27
28 /*------------------*\
29 |* Constructeur *|
30 \*-----------------*/
31
32 /**
33 * see doc of Capture_A constructor for cuda use (ptrHostMemory)
34 */
35 CaptureCamera::CaptureCamera(int idCamera, const string& title, int wAsk, int hAsk,uchar4* ptrHostMemory) :
36 Capture_A(createStream(idCamera), title,ptrHostMemory)
37
38 {
39 this->idCamera = idCamera;
40 this->wAsk = wAsk;
41 this->hAsk = hAsk;
42
43 configure();
44 }
45
46 CaptureCamera::~CaptureCamera(void)
47 {
48 // rien
49 // delete ptrCaptureStream; in constructor
50 }
51
52 /*------------------*\
53 |* Methode *|
54 \*-----------------*/
55
56 void CaptureCamera::printInfo(void)
57 {
58 Capture_A::printInfo();
59
60 cout << "\t(w,h) asked = (" << wAsk << "," << hAsk << ") " << endl;
61
62 cout << endl;
63 }
64
65 void CaptureCamera::readStream(VideoCapture* ptrCaptureStream, Mat* ptrMatCaptureSrc)
66 {
67 (*ptrCaptureStream) >> (*ptrMatCaptureSrc);
68 }
69
70 /*------------------*\
71 |* get *|
72 \*-----------------*/
73
74 int CaptureCamera::getIdCamera()
75 {
76 return idCamera;
77 }
78
79 int CaptureCamera::dtOriginalMS()
80 {
81 return 0; // On doit attendre sur le port usb, mieux?
82 }
83
84 /*--------------------------------------*\
85 |* Private *|
86 \*-------------------------------------*/
87
88 VideoCapture* CaptureCamera::createStream(int idCamera)
89 {
90 return new VideoCapture(idCamera);
91 }
92
93 void CaptureCamera::configure()
94 {
95 // VideoCapture* ptrCaptureStream = getVideoCapture();
96
97 // cout << "(w,h) asked = (" << wAsk << "," << hAsk << ") asked" << endl;
98
99 if (wAsk != -1)
100 {
101 ptrCaptureStream->set(CV_CAP_PROP_FRAME_WIDTH, wAsk);
102 }
103
104 if (hAsk != -1)
105 {
106 ptrCaptureStream->set(CV_CAP_PROP_FRAME_HEIGHT, hAsk);
107 }
108
109 }
110
111 /*----------------------------------------------------------------------*\
112 |* End *|
113 \*---------------------------------------------------------------------*/
114