-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebcamtest.cpp
More file actions
38 lines (33 loc) · 1.12 KB
/
webcamtest.cpp
File metadata and controls
38 lines (33 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <opencv2/highgui/highgui.hpp>
#include "WebcamCapture.h"
#include "ProcessingThread.h"
#include "TSDataHandler.h"
int main(int argc, char* argv[])
{
// инициализация очереди на обработку изображения
TSDataHandler<Mat>* cap2proc = new TSDataHandler<Mat>();
// инициализация очереди для вывода
TSDataHandler<Point2f>* proc2out = new TSDataHandler<Point2f>();
TSDataHandler<Mat>* dbg_outputImage = new TSDataHandler<Mat>();
cv::Mat img;
// инициализация и старт потоков считывания и обработки данных
WebcamCapture capThread(cap2proc, 0);
ProcessingThread procThread(cap2proc, proc2out, dbg_outputImage);
capThread.start();
procThread.start();
// цикл вывода обработанных изображений
forever
{
Point2f out;
if (proc2out->Read(out) && dbg_outputImage->Read(img))
{
cout << out << endl;
imshow("OUTPUT", img);
waitKey(1);
}
}
// закрытие потоков
capThread.exit();
procThread.exit();
return 0;
}