-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcaptureimages.cpp
More file actions
60 lines (51 loc) · 1.11 KB
/
captureimages.cpp
File metadata and controls
60 lines (51 loc) · 1.11 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "captureimages.h"
#include <QTimer>
#include <QtCore>
#include <iostream>
#include<stdio.h>
#include "opencv2/opencv.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/video/video.hpp"
#include "opencv2/objdetect/objdetect.hpp"
using namespace std;
using namespace cv;
VideoCapture cap;
vector<Mat>faces;
const int imageCount = 10;
template <typename T> string toString(T t)
{
ostringstream out;
out << t;
return out.str();
}
bool done;
captureImages::captureImages()
{
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(captureImage()));
}
void captureImages::startTimer(int interval, VideoCapture& capture, vector<Mat>& userFaces)
{
if (!done){
cap = capture;
faces= userFaces;
count = 0;
timer->start(interval);
}else{
userFaces = faces;
done = false;
}
}
void captureImages::captureImage()
{
Mat face;
if(count < imageCount){
cap >> face;
faces.push_back(face);
}else{
done = true;
timer->stop();
}
count++;
}