You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.4 KiB

/*
* @Author: turboLIU
* @Date: 2023-03-08 16:53:50
* @LastEditTime: 2024-07-08 13:46:55
* @Description: Do not edit
* @FilePath: /Cudayolo_track/objTracker.h
*/
#ifndef OBJTRACKER
#define OBJTRACKER
#include <vector>
#include "detection_type_api.h"
#include "AI_API.h"
#include "opencv2/opencv.hpp"
#include "environment.h"
using namespace AIGO;
#define IMGABUFFER_LEN 256 * 256 * 3
class OBJTRACK
{
private:
/* data */
public:
OBJTRACK(/* args */);
OBJTRACK(float x1, float y1, float x2, float y2, int cls, float score, int clsNum = 5, int length = 10, float fAZ=0, float fPT=0, ImgMat imgbuffer = { 0 });
OBJTRACK(objinfo det, int clsNum = 5, int length = 10, ImgMat imgbuffer = {0});
~OBJTRACK();
private:
int m_missCount = 0;
int m_MaxLength = 0;
std::vector<std::pair<float, float>> traces;
public:
float _x1 = 0;
float _y1 = 0;
float _x2 = 0;
float _y2 = 0;
float _score = 0;
int _cls = 2;
int _length = 0;
int _nExistCnt = 0;
int _clsNum = 0;
float last_x1 = 0;
float last_y1 = 0;
float last_x2 = 0;
float last_y2 = 0;
int _trackID = -1;
float m_vx=0;
float m_vy=0;
std::vector<int> clsCount;
std::vector<float> scores;
int m_delable = 0;
float _ymean = 0;
char* m_imgBuffer = NULL;
cv::Mat m_imgBufferCV;// = cv::Mat(256, 256, CV_8UC3);
std::vector<std::pair<float, float>> m_org_fAZ_PTs;
//double m_fAZ = 0;
//double m_fPT = 0;
public:
bool isFull();
void update();
void add(objinfo det, ImgMat pImgBuff = { 0});
void add(float x1, float x2, float y1, float y2, float score, int cls = -1,float fAZ=0, float fPT=0, ImgMat pImgBuff = { 0});
// objinfo toObjInfo(int &ret);
int toObjInfo(objinfo &det);
int toObjInfo_predict(objinfo &det);
void update_mean();
float calc_delta(double delta, double dResolution);
};
// std::vector<OBJTRACK> update_objtracker(std::vector<objinfo> dets, std::vector<OBJTRACK> objtrackers, float matchThr=0.2);
int update_objtracker(std::vector<objinfo> dets, std::vector<std::shared_ptr<OBJTRACK>> objold, std::vector<std::shared_ptr<OBJTRACK>>& objnew, float matchThr = 3.6, ImgMat copyimg = {0});
//int update_objtracker(std::vector<objinfo> dets, std::vector<OBJTRACK>& objtrackers, float matchThr = 0.2, ImgMat copyimg={0});
//int filter_objtrackers(std::vector<OBJTRACK> src_obj, std::vector<OBJTRACK> &dst_obj, float sigma=3);
#endif