-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathface.h
37 lines (32 loc) · 954 Bytes
/
face.h
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
#ifndef FACE_H
#define FACE_H
#include <float.h>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include "net.h"
struct Object
{
cv::Rect_<float> rect;
int label;
float score;
std::vector<cv::Point2f> pts;
cv::Mat trans_inv;
};
class Face
{
public:
Face();
~Face();
int load(const std::string& param_path, const std::string& model_path);
int detect(const cv::Mat& rgb, std::vector<Object>& objects, int target_size = 640, float prob_threshold = 0.25f, float nms_threshold = 0.3f);
int align_warp_face(cv::Mat& img, const std::vector<Object>& objects, std::vector<cv::Mat>& trans_matrix_inv, std::vector<cv::Mat>& trans_img);
void draw_objects(const cv::Mat& bgr, const std::vector<Object>& objects);
private:
ncnn::Net net;
};
#endif // FACE_H