123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #ifndef DETECT_TURNSTILE_H
- #define DETECT_TURNSTILE_H
- #include "Hungarian.h"
- #include "KalmanTracker.h"
- namespace od{
- const int COLOR_MAP[2][3]={{0, 0, 255},{255, 0, 0}};
- const int max_age = 3;
- const int min_hits = 3;
- const double iouThreshold = 0.5;
- struct bbox_t {
- unsigned int x, y, w, h; // (x,y) - top-left corner, (w, h) - width & height of bounded box
- float prob; // confidence - probability that the object was found correctly
- unsigned int obj_id; // class of object - from range [0, classes-1]
- unsigned int track_id; // tracking id for video (0 - untracked, 1 - inf - tracked object)
- unsigned int frames_counter; // counter of frames on which the object was detected
- float x_3d, y_3d, z_3d; // center of object (in Meters) if ZED 3D Camera is used
- };
- typedef struct TrackingBox
- {
- int frame;
- int id;
- int class_id;
- float prob;
- Rect_<float> box;
- vector<int> class_history;
- }TrackingBox;
- //yolo data o DetectBox
- typedef struct DetectBox
- {
- int class_id;
- float prob;
- Rect_<float> box;
- }DetectBox;
- //Computes IOU between two bounding boxes
- double GetIOU(Rect_<float> bb_test, Rect_<float> bb_gt);
- //画出检测框和相关信息
- void DrawBoxes(Mat &frame, vector<string> classes, int classId, int turnstileId,float conf, int left, int top, int right, int bottom);
- //画出检测结果,image
- void Drawer(Mat &frame, vector<bbox_t> outs, vector<string> classes);
- //画出检测结果,video
- void Drawer(Mat &frame, vector<od::TrackingBox> &track_result, vector<string> &classes);
- //tracking obstacle
- bool TrackObstacle(int frame_count,vector<KalmanTracker> &trackers,vector<bbox_t> &outs,vector<od::TrackingBox> &track_result);
- }
- #endif // DETECT_TURNSTILE_H
|