// // Created by ps on 19-4-9. // #ifndef QIAOJIASYSTEM_VPTDETECTWRAPPER_H #define QIAOJIASYSTEM_VPTDETECTWRAPPER_H #include #include #include #include #include "mainAssist.h" //分类结果结构体 //struct ClassfyObjRes { // int res_index; //分类结果 // float res_prob; //分类结构体 //}; struct PersonDetectRes { // std::string head; // std::string head_color; // std::string eye; // std::string mouth; // std::string up; // std::string up_color; // std::string clothing_text; // std::string down; // std::string down_color; // std::string bao; // std::string sex; // std::string age; // std::string viewpoint; // std::string dasan; // std::string child; // std::string personstate; classfy_boj_res res_objs[HP_FIR_INDEX_SIZE]; //分类结果 }; struct PerRideCarDetectRes { // std::string hcp_up; // std::string hcp_up_color; // std::string hcp_down; // std::string hcp_down_color; // std::string bao; // std::string hcp_bag_color; // std::string hcp_head; // std::string hcp_clothing_text; // std::string hcp_sex; // std::string hcp_figure; // std::string hcp_nationality; // std::string hcp_age; // std::string hcp_eye; // std::string hcp_mouth; // std::string hcp_weibo; // std::string hcp_carColor; // std::string hcp_orient; // std::string hcp_drivenum; // std::string hcp_dasan; // std::string hcp_take; classfy_boj_res res_objs[HCP_FIR_INDEX_SIZE]; //分类结果 }; struct CarDetectRes { //车型识别结果 std::string vehicle_brand; //车辆品牌 std::string vehicle_subbrand; //车辆子品牌 std::string vehicle_issue_year; //车辆年款 std::string vehicle_type; //车辆类型 std::string freight_ton; //货车吨级 float vehicle_score; //车型识别置信度 //车颜色识别结果 ColorLabel colorLabel; //车颜色 float colorLabelProb; //车颜色置信度 //车牌检测结果 BskRect carPlateRect; //车牌区域 float carPlateRectScore; //车牌区域置信度 std::string carPlate; //车牌 float carPlateScore; //车牌置信度 int carPlatetype; }; union VPTDetectRes { struct TestVPTDetectRes { int i; }; VPTDetectRes() : testVPTDetectRes(TestVPTDetectRes()) { } ~VPTDetectRes() { } TestVPTDetectRes testVPTDetectRes; PersonDetectRes personDetectRes; PerRideCarDetectRes perRideCarDetectRes; CarDetectRes carDetectRes; }; enum class SDKDetectType { test = -1, person = 0, // PersonDetectRes bike, // PerRideCarDetectRes motor, // PerRideCarDetectRes tricycle, // car, // CarDetectRes bigbus, // CarDetectRes lorry, // CarDetectRes tractor, // midibus // CarDetectRes }; struct VptDetectResults { public: VptDetectResults() {} virtual ~VptDetectResults() {} VptDetectResults(const VptDetectResults &src) { this->sdkDetectType = src.sdkDetectType; this->bskRect = src.bskRect; switch (src.sdkDetectType) { case SDKDetectType::person : this->vptDetectRes.personDetectRes = src.vptDetectRes.personDetectRes; break; case SDKDetectType::bike: case SDKDetectType::motor : this->vptDetectRes.perRideCarDetectRes = src.vptDetectRes.perRideCarDetectRes; break; case SDKDetectType::car : case SDKDetectType::bigbus : case SDKDetectType::lorry : case SDKDetectType::midibus : this->vptDetectRes.carDetectRes = src.vptDetectRes.carDetectRes; break; } } SDKDetectType sdkDetectType; VPTDetectRes vptDetectRes; BskRect bskRect; }; class VptDetectWrapper { public: VptDetectWrapper(); VptDetectWrapper(int _gpuIdx, string _dbFilePath); virtual ~VptDetectWrapper(); void process_image(cv::Mat &_img); private: void init(); VptDetectResults changeAnalysisRes(int index, void *result); private: list m_results; void *m_handle; vptpic_param m_param; int m_gpuIdx{0}; std::string m_dbFilePath{"CarBodyFeature.db"}; }; #endif //QIAOJIASYSTEM_VPTDETECTWRAPPER_H