-
Notifications
You must be signed in to change notification settings - Fork 8
/
video.cpp
40 lines (36 loc) · 1.01 KB
/
video.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
#include "PCN.h"
int main()
{
PCN detector("model/PCN.caffemodel",
"model/PCN-1.prototxt", "model/PCN-2.prototxt", "model/PCN-3.prototxt");
detector.SetMinFaceSize(45);
detector.SetScoreThresh(0.37, 0.43, 0.95);
detector.SetImagePyramidScaleFactor(1.414);
detector.SetVideoSmooth(true);
cv::VideoCapture capture(0);
cv::Mat img;
cv::TickMeter tm;
while (1)
{
capture >> img;
tm.reset();
tm.start();
std::vector<Window> faces = detector.DetectFace(img);
tm.stop();
int fps = 1000.0 / tm.getTimeMilli();
std::stringstream ss;
ss << fps;
cv::putText(img, ss.str() + "FPS",
cv::Point(20, 45), 4, 1, cv::Scalar(0, 0, 125));
for (int i = 0; i < faces.size(); i++)
{
DrawFace(img, faces[i]);
}
cv::imshow("PCN", img);
if (cv::waitKey(1) == 'q')
break;
}
capture.release();
cv::destroyAllWindows();
return 0;
}