-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtestCase.cpp
61 lines (49 loc) · 1.04 KB
/
testCase.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
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <opencv2/opencv.hpp>
#include "anchor.h"
#include "faceMask_ssd.h"
using namespace std;
using namespace cv;
void SSD_FaceMask()
{
face_ssd::det_ssd *pD = new face_ssd::det_ssd();
pD->InitialParam("..\\models");
//ÈËÏñMASK
cv::VideoCapture cap;
bool is_op = cap.open(0);
int iCount = 0;
while (is_op)
{
cv::Mat srcMat2;
cap >> srcMat2;
if (srcMat2.empty()){
continue;
}
std::vector<face_ssd::ObjInfo> vReList;
pD->SSD_FaceMask(srcMat2, vReList);
for (int i = 0; i < vReList.size(); ++i)
{
if (vReList[i]._faceCla == 0){
rectangle(srcMat2, cv::Rect(vReList[i]._faceLoc), \
cv::Scalar(0, 255, 0), 2);
}
else{
rectangle(srcMat2, cv::Rect(vReList[i]._faceLoc), \
cv::Scalar(255, 0, 0), 2);
}
}
cv::namedWindow("re", 0);
cv::imshow("re", srcMat2);
cvWaitKey(10);
}
}
int main()
{
SSD_FaceMask();
system("Pause");
return 0;
}