/* * @Author: yangzilong * @Date: 2021-12-17 20:27:57 * @Last Modified by: yangzilong * @Email: yangzilong@objecteye.com * @Description: */ #pragma once #include "../ai_platform/det_obj_header.h" #include #include #include #include #include "../ai_platform/task_param_manager.h" #include "../ai_platform/header.h" #include "../util/vpc_util.h" // #define EXPANSION_PROPORTION 0.1 #define EXPANSION_PROPORTION 0.25 #define FACE_EXPANSION_PROPORTION 0.5 #define IMG_CHANNELS 3 using namespace std; class DeviceMemory; typedef struct multi_obj_data_t{ long long id; DeviceMemory *memPtr; std::vector objs; string task_id; } multi_obj_data_t; struct OBJ_VALUE { bool finishTracker; //轨迹结束可以保存了 int frameCount; bool isupdate; int lost; vpc_img_info snapShot; vpc_img_info snapShotLittle; sy_rect obj_pos; double confidence; // 置信度 float last_area; float max_area; OBJ_INDEX index; bitset< EDGESIZE > flags; //标志位,标记快照框应该如何判断,left:0 top:1 right:2 bottom:3 sy_point landmark_point[25];//人脸关键点位置信息 sy_rect position; //检测实际目标框 //-added by zsh 220719 人脸姿态角- float roll = 0.0; float yaw = 0.0; float pitch = 0.0; //------------------------------- }; struct OBJ_VALUES { OBJ_VALUE snapShots[3]; //缓存三张抓拍图 0-轨迹首张 1-轨迹最佳 2-轨迹末张 bool exists[3] = {false, false, false}; //标识对应抓拍图是否存在 }; class snapshot_reprocessing { public: //更新最优快照 snapshot_reprocessing(int devId); ~snapshot_reprocessing(); vector get_vehicle_snapshot(vector vec_devMem, vector& ol_det_result, int skip_frame); void screen_effective_snapshot(vector &_onelevel_det_result); void filter_vehicle(vector &_onelevel_det_result); void update_bestsnapshot(vector vec_devMem, vector &ol_det_result, vector>& delete_object_id); map get_total_snapshot_info(); int update_face_bestsnapshot(vector vec_devMem, vector &ol_det_result, vector>& delete_object_id); map get_total_face_snapshot_info(); void update_village_bestsnapshot(vector vec_devMem, vector &ol_det_result, vector>& delete_object_id); map get_total_village_snapshot_info(); void release_finished_locus_snapshot(const string taskid, const int objid = -1, bool bRelease = true); //-1为删除该路所有任务的快照图 void release_village_finished_locus_snapshot(const string taskid, const int objid = -1, bool bRelease = true); void release_finished_face_locus_snapshot(const string taskid, const int objid = -1, bool bRelease = true); private: bool best_snapshot_judge_algor(const OBJ_KEY& obj_key, const OBJ_VALUE& obj_value, int left, int top, int width, int height, int image_width, int image_height); bool best_face_snapshot_judge_algor_v2(const OBJ_KEY& obj_key, const OBJ_VALUE& obj_value, int left, int top, int width, int height, int image_width, int image_height, float roll, float yaw, float pitch); private: map total_snapshot_info; map total_face_snapshot_info; map total_village_snapshot_info; map> algor_index_table; task_param_manager *m_task_param_manager; };