-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpicture.cpp
67 lines (63 loc) · 1.66 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "PCN.h"
#include "mropencv.h"
int main0()
{
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(false);
for (int i = 1; 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.DetectFace(img);
tm.stop();
std::cout << "Image: " << i << std::endl;
std::cout << "Time Cost: "<<
tm.getTimeMilli() << " ms" << std::endl;
for (int i = 0; i < faces.size(); i++)
{
DrawFace(img, faces[i]);
}
cv::imshow("PCN", img);
cv::waitKey();
}
cv::destroyAllWindows();
return 0;
}
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(false);
cv::VideoCapture capture(0);
cv::Mat img;
while (true)
{
capture >> img;
if (img.empty())
break;
cv::TickMeter tm;
tm.reset();
tm.start();
std::vector<Window> faces = detector.DetectFace(img);
tm.stop();
std::cout << "Time Cost: " <<
tm.getTimeMilli() << " ms" << std::endl;
for (int i = 0; i < faces.size(); i++)
{
DrawFace(img, faces[i]);
}
cv::imshow("PCN", img);
cv::waitKey(1);
}
return 0;
}