// // 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 { CarDetectRes() : vehicle_brand(""), vehicle_subbrand(""), vehicle_issue_year(""), vehicle_type(""), freight_ton(""), vehicle_score(0), colorLabel(static_cast(-1)), colorLabelProb(0), carPlateRect(0, 0, 0, 0), carPlateRectScore(0), carPlate(""), carPlateScore(0), carPlatetype(-1) {} virtual ~CarDetectRes() { } CarDetectRes(const CarDetectRes &rhs) { this->vehicle_brand = rhs.vehicle_brand; //车辆品牌 this->vehicle_subbrand = rhs.vehicle_subbrand; //车辆子品牌 this->vehicle_issue_year = rhs.vehicle_issue_year; //车辆年款 this->vehicle_type = rhs.vehicle_type; //车辆类型 this->freight_ton = rhs.freight_ton; //货车吨级 this->vehicle_score = rhs.vehicle_score; //车型识别置信度 //车颜色识别结果 this->colorLabel = rhs.colorLabel; //车颜色 this->colorLabelProb = rhs.colorLabelProb; //车颜色置信度 //车牌检测结果 this->carPlateRect = rhs.carPlateRect; //车牌区域 this->carPlateRectScore = rhs.carPlateRectScore; //车牌区域置信度 this->carPlate = rhs.carPlate; //车牌 this->carPlateScore = rhs.carPlateScore; //车牌置信度 this->carPlatetype = rhs.carPlatetype; } // //车型识别结果 // std::string vehicle_brand; //车辆品牌 // std::string vehicle_subbrand; //车辆子品牌 // std::string vehicle_issue_year; //车辆年款 // std::string vehicle_type; //车辆类型 // std::string freight_ton; //货车吨级 //车型识别结果 char *vehicle_brand; //车辆品牌 char *vehicle_subbrand; //车辆子品牌 char *vehicle_issue_year; //车辆年款 char *vehicle_type; //车辆类型 char *freight_ton; //货车吨级 float vehicle_score; //车型识别置信度 //车颜色识别结果 ColorLabel colorLabel; //车颜色 float colorLabelProb; //车颜色置信度 //车牌检测结果 BskRect carPlateRect; //车牌区域 float carPlateRectScore; //车牌区域置信度 // std::string carPlate; //车牌 char *carPlate; //车牌 float carPlateScore; //车牌置信度 int carPlatetype; }; union VPTDetectRes { VPTDetectRes() { } VPTDetectRes(int i) { switch (i) { case 0 : personDetectRes.res_objs; break; case 1: case 2 : perRideCarDetectRes.res_objs; break; case 4 : case 5 : case 6 : case 8 : carDetectRes.carPlatetype = -1; break; } } ~VPTDetectRes() { } CarDetectRes carDetectRes; PersonDetectRes personDetectRes; PerRideCarDetectRes perRideCarDetectRes; }; 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() {} VptDetectResults(int _idx) : vptDetectRes(_idx) {} virtual ~VptDetectResults() {} VptDetectResults(const VptDetectResults &src) { this->sdkDetectType = src.sdkDetectType; this->bskRect = src.bskRect; this->obj_score = src.obj_score; 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; } } float obj_score; VPTDetectRes vptDetectRes; SDKDetectType sdkDetectType; BskRect bskRect; }; class VptDetectWrapper { public: VptDetectWrapper(); VptDetectWrapper(int _gpuIdx, string _dbFilePath); virtual ~VptDetectWrapper(); list 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