| | |
| | |
|
| | | string m_staticStruct::model_path = "path";
|
| | | int m_staticStruct::type = 1;
|
| | | bool m_staticStruct::isTrack= true;
|
| | | int m_staticStruct::max_cam_num = 0;
|
| | | int m_staticStruct::wander_time = 0;
|
| | | float m_staticStruct::mv_velocity = 0;
|
| | | float m_staticStruct::fall_rate = 0;
|
| | |
|
| | | // 创建
|
| | |
|
| | | API void* create(const char *conf, int *max_chan)
|
| | | {
|
| | | // CLog::Initialize("/opt/vasystem/bin/models/baseDetector/log.properties");
|
| | | CLog::Initialize("../config/log4cplus.properties");
|
| | | ReadJsonFromFile(conf);
|
| | | AriManager *handle = new AriManager();
|
| | | *max_chan = m_staticStruct::max_cam_num;
|
| | | for (int i = 1; i <= m_staticStruct::max_cam_num; ++i)
|
| | | {
|
| | | handle->add_cam(i);
|
| | | }
|
| | | Timer::getInstance()->reset();
|
| | | return handle;
|
| | | }
|
| | |
|
| | | // 原查找结果接口
|
| | | API void* get_result(void *handle, const void *img, const int chan)
|
| | | {
|
| | | AriManager *h = (AriManager*)handle;
|
| | | TResult *t_result = (TResult*)malloc(sizeof(TResult));
|
| | | init_TResult(t_result);
|
| | | h->single_SDK(chan, img, *t_result);
|
| | |
|
| | | Timer::getInstance()->out("eveTime before yolo");
|
| | | // h->single_SDK(chan, img, *t_result);
|
| | | Timer::getInstance()->out("eveTime runing yolo");
|
| | | return t_result;
|
| | | }
|
| | |
|
| | |
|
| | | API void* get_result2(void *handle, const void *img, const int chan, const char* timestamp, const char* mode)
|
| | | {
|
| | | DEBUG("-----------------------begin------------ ");
|
| | | AriManager *h = (AriManager*)handle;
|
| | | TResult *t_result = (TResult*)malloc(sizeof(TResult));
|
| | | init_TResult(t_result);
|
| | |
|
| | | if(!m_staticStruct::isTrack)
|
| | | {
|
| | | Timer::getInstance()->out("get_result2 before yolo");
|
| | | h->single_SDK(chan, img, t_result);
|
| | | Timer::getInstance()->out("get_result2 runing yolo");
|
| | | return t_result;
|
| | | }
|
| | |
|
| | | h->single_SDK(chan, img, t_result, const_cast<char*>(timestamp), mode);
|
| | | DEBUG("--cam id:" + to_string(chan) + " image human_count:" + to_string(t_result->count));
|
| | | for (int i = 0; i < t_result->count; ++i)
|
| | | {
|
| | | if(mode == "video"){
|
| | | DEBUG("--human_id:" + to_string(t_result->targets[i].id)+" human_confidence:" + to_string(t_result->targets[i].confidence) + " human_attribute:" + std::string(t_result->targets[i].attribute) + " human_top:" + to_string(t_result->targets[i].rect.top)+" human_left:" + to_string(t_result->targets[i].rect.left) + " human_right:" + to_string(t_result->targets[i].rect.right)+ " human_bottom:" + to_string(t_result->targets[i].rect.bottom));
|
| | | }
|
| | | else{
|
| | | DEBUG("human_confidence:" + to_string(t_result->targets[i].confidence) + " human_top:" + to_string(t_result->targets[i].rect.top)+" human_left:" + to_string(t_result->targets[i].rect.left) + " human_right:" + to_string(t_result->targets[i].rect.right)+ " human_bottom:" + to_string(t_result->targets[i].rect.bottom));
|
| | | }
|
| | | }
|
| | | DEBUG("---------------------end over------------------------\n\n");
|
| | | return t_result;
|
| | | }
|
| | |
|
| | |
| | | h = NULL;
|
| | | }
|
| | |
|
| | | // 读取Json文件
|
| | | void ReadJsonFromFile(const char* filename)
|
| | | {
|
| | | Json::Reader reader;
|
| | |
| | | {
|
| | | std::string model_path = root["param"]["model_path"].asString();
|
| | | int type = root["param"]["type"].asInt();
|
| | | bool isTrack = root["param"]["isTrack"].asBool();
|
| | | int max_cam_num = root["param"]["max_cam_num"].asInt();
|
| | | int wander_time = root["param"]["wander_time"].asInt();
|
| | | int mv_velocity = root["param"]["mv_velocity"].asFloat();
|
| | | int fall_rate = root["param"]["fall_rate"].asFloat();
|
| | | m_staticStruct::model_path = model_path;
|
| | | m_staticStruct::type = type;
|
| | | m_staticStruct::isTrack = isTrack;
|
| | | m_staticStruct::max_cam_num = max_cam_num;
|
| | | m_staticStruct::wander_time = wander_time;
|
| | | m_staticStruct::mv_velocity = mv_velocity;
|
| | | m_staticStruct::fall_rate = fall_rate;
|
| | |
|
| | | }
|
| | | in.close();
|
| | | }
|
| | |
| | | t->count = 0;
|
| | | t->targets = nullptr;
|
| | | }
|
| | |
|