//
|
// 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
|