-
Notifications
You must be signed in to change notification settings - Fork 300
/
Copy pathpicture.cpp
42 lines (38 loc) · 1.17 KB
/
picture.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
#include "PCN.h"
int main()
{
PCN detector("model/PCN.caffemodel",
"model/PCN-1.prototxt", "model/PCN-2.prototxt", "model/PCN-3.prototxt",
"model/PCN-Tracking.caffemodel",
"model/PCN-Tracking.prototxt");
/// detection
detector.SetMinFaceSize(20);
detector.SetImagePyramidScaleFactor(1.414);
detector.SetDetectionThresh(0.37, 0.43, 0.97);
/// tracking
detector.SetTrackingPeriod(30);
detector.SetTrackingThresh(0.9);
detector.SetVideoSmooth(false);
for (int i = 0; i <= 26; i++)
{
cv::Mat img =
cv::imread("imgs/" + std::to_string(i) + ".jpg");
cv::TickMeter tm;
tm.reset();
tm.start();
std::vector<Window> faces = detector.Detect(img);
tm.stop();
std::cout << "Image: " << i << std::endl;
std::cout << "Time Cost: "<<
tm.getTimeMilli() << " ms" << std::endl;
for (int j = 0; j < faces.size(); j++)
{
DrawFace(img, faces[j]);
DrawPoints(img, faces[j]);
}
cv::imshow("PCN", img);
cv::waitKey();
}
cv::destroyAllWindows();
return 0;
}