forked from amintronic/opticalFlowLK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
capture_webcam.cpp
49 lines (33 loc) · 890 Bytes
/
capture_webcam.cpp
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
39
40
41
42
43
44
45
46
47
48
#include "capture_webcam.h"
capture_webcam::capture_webcam(QObject *parent) : QObject(parent)
{
cap.open(_DEV_VIDEO);
if( cap.isOpened() )
{
cap.set(CV_CAP_PROP_FPS, _VIDEO_FPS);
cap.set(CV_CAP_PROP_FRAME_WIDTH, _FRAME_WIDTH);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, _FRAME_HEIGTH);
cap >> frame;
frame.copyTo(first_frame);
frame.copyTo(second_frame);
first_image_ready = false;
second_image_ready = false;
first_image_permission = true;
main_timer = new QTimer(this);
connect(main_timer,SIGNAL(timeout()),this,SLOT(timerEvent()));
main_timer->start(2);
}
else
{
qDebug() << "Couldn't open the camera, exit.";
exit(0);
}
}
void capture_webcam::timerEvent()
{
cap >> frame;
}
capture_webcam::~capture_webcam()
{
delete main_timer;
}