Files
2024-12-13 23:33:37 +08:00

85 lines
1.5 KiB
C++

/*************************************************************************
*
* DeepCam CONFIDENTIAL
* FILE: dtracker.h
*
* [2018] - [2019] DeepCam, LLC and DeepCam
NOTICE:
* All information contained herein is, and remains the property of DeepCam LLC.
* The intellectual and technical concepts contained herein are proprietary to DeepCam
* and may be covered by U.S. and Foreign Patents,patents in process, and are protected by
* trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* DeepCam, LLC.
*
*
* Written: Delong Qi
* Date: 17/12/2018
* Mail: delong.qi@deepcam.com
*/
#ifndef __DTRACKER_H
#define __DTRACKER_H
#include <deque>
#include <vector>
#include <iostream>
#include <opencv2/opencv.hpp>
#include "yoloV5-face.h"
struct TrackerBox
{
int ID;
int age;
int quality;
int confidence;
int frameCount;
cv::Rect tbox;
std::vector<cv::Point2f> lmks;
};
class DTracker
{
public:
int init(std::string face_model);
std::vector<TrackerBox> track(cv::Mat &image,float scale = 0.33);
int destroy();
private:
float IoU(const cv::Rect &boxA, const cv::Rect &boxB);
int check_status();
bool check_edge(cv::Mat &image, cv::Rect &bbox, float ratio = 6.0);
int detect(cv::Mat &image,float scale);
private:
int trackerAge;
float scale = 1.0f;
int num_threads = 3;
unsigned int frameCount;
unsigned int currFaceID;
cv::Mat detect_img;
int trackerBufferLen = 4;
std::vector<TrackerBox> faceTrackers;
};
#endif