移动端的qt版本人脸流程
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//
// Created by basic on 19-8-14.
//
 
#ifndef FACEDETECT_DETECT_H
#define FACEDETECT_DETECT_H
 
#include <cstdio>
#include <map>
#include <vector>
 
#include "opencv2/opencv.hpp"
#include "THFaceTracking_i.h"
#include "common.h"
 
#include <QObject>
 
class faceTracking : public QObject
{
    Q_OBJECT
 
public:
    faceTracking(int devId, int chan = 1, int maxFaceNum = 3,
                 int minWidth = 50, int yaw = 45, int pitch = 45, int roll = 30,
                 int confidence = 60, int sampSize = 640, int interval = 5);
 
    ~faceTracking();
 
    int detect(int chan, BYTE *imgData, THFT_FaceInfo *outObjs);
    void run(int chan);
 
    void setThresVal(int confidence = 60, int width = 50, int yaw = 45, int pitch = 45, int roll = 30);
 
    int resetWH(int w, int h, int chan=0);
 
    void setnSampleSize(int size){
        nSampleSize = size;
    }
 
private:
    int initTrack(void);
    int initDecode(int devId);
    bool sendFacesToExtract(int chan, THFT_FaceInfo *faces, int num, BYTE *imgData, int width, int height);
    void showImage(cv::Mat &frame);
private:
    int nChannel = 1;
    int nMaxFaceNum = 10;
    int nSampleSize = 640;
    int treshYaw = 45;//angle of yaw,from -90 to +90,left is negative,right is postive
    int treshPitch = 45;//angle of pitch,from -90 to +90,up is negative,down is postive
    int treshRoll = 30;//angle of roll,from -90 to +90,left is negative,right is postive
    float treshConfidence = 0.8;//confidence of face pose(from 0 to 1,0.6 is suggested threshold)
    int treshMinWidth = 50;//RECT.width threshold
    int nDetectionIntervalFrame = 5;//interval frame number of face detection for face tracking
    float confidenceInc = 0.05;
 
    double interval = 3000;//500ms  send
 
    cv::VideoCapture vc;
    int nWidth;
    int nHeight;
 
    std::map<int, std::map<long, float>> recChanFaces;
 
    std::map<long, double> mIDTime;
 
signals:
 
    void drawImage(ImgToShow image);
 
    void signalTips(std::string str);
 
    void signalAdvertise(bool value);
private:
    double screenSaveTime_ms = 3000;
    void drawFaceRect(cv::Mat& frame, RECT rcFace);
};
 
 
 
#endif //FACEDETECT_DETECT_H