#include #include "./src/coord_interface.h" #include "src/con_target.h" #include "./src/math_util.h" int main() { std::cout << "Hello, World!" << std::endl; // float Ax = 30.0f, Ay = 110.0f, Bx = 326.36f, By = 64.45f; // const char* config_str = "{\"leftCam\":{ \"A1x\": 30.0, \"A1y\":110.0 ,\"A2x\": 120.0,\"A2y\":200.0, ,\"A3x\": 80.0,\"A3y\":400.0, ,\"A4x\": 20.0,\"A4y\":287.0}," // "rightCam\":{ \"B1x\": 30.0, \"B1y\":110.0 ,\"B2x\": 120.0,\"B2y\":200.0, ,\"B3x\": 80.0,\"B3y\":400.0, ,\"B4x\": 20.0,\"B4y\":287.0}" // "}"; // CoordManager CM(config_str); // ---- 初始化赋值 --- CamVec *CV_Reg = (CamVec*)malloc(sizeof(CamVec)); CV_Reg->count = 3; //表示有3个摄像机相互关联 int reg_point_size = 4; // 关联区域的坐标点数 CV_Reg->regInfo = (RegInfo*)malloc(sizeof(RegInfo)*CV_Reg->count); SPoint2f *regA_point = (SPoint2f*)malloc(sizeof(SPoint2f)*reg_point_size); regA_point[0] = SPoint2f(100.0f, 100.0f); regA_point[1] = SPoint2f(120.0f, 200.0f); regA_point[2] = SPoint2f(80.0f, 400.0f); regA_point[3] = SPoint2f(20.0f, 287.0f); CV_Reg->regInfo[0].count = reg_point_size; CV_Reg->regInfo[0].point = regA_point; SPoint2f* regB_point = (SPoint2f*)malloc(sizeof(SPoint2f)*reg_point_size); regB_point[0] = SPoint2f(326.36f, 64.45f); regB_point[1] = SPoint2f(339.16f, 128.24f); regB_point[2] = SPoint2f(313.73f, 255.86f); regB_point[3] = SPoint2f(275.41f, 183.80f); CV_Reg->regInfo[1].count = reg_point_size; CV_Reg->regInfo[1].point = regB_point; SPoint2f* regC_point = (SPoint2f*)malloc(sizeof(SPoint2f)*reg_point_size); regC_point[0] = SPoint2f(326.36f, 64.45f); regC_point[1] = SPoint2f(339.16f, 128.24f); regC_point[2] = SPoint2f(313.73f, 255.86f); regC_point[3] = SPoint2f(275.41f, 183.80f); CV_Reg->regInfo[2].count = reg_point_size; CV_Reg->regInfo[2].point = regC_point; CoordManager CM(CV_Reg); //初始化区域信息 // 获取待匹配的点信息 MulCam* mulCam = (MulCam*)malloc(sizeof(MulCam)); mulCam->cam_count = CV_Reg->count; mulCam->matchHuman = (MatchHuman*)malloc(sizeof(MatchHuman)*mulCam->cam_count); // MatchHuman * A_Human = (MatchHuman*)malloc(sizeof(MatchHuman)); int A_hcount = 3; mulCam->matchHuman[0].humanInfo = (HumanInfo*)malloc(sizeof(HumanInfo)*A_hcount); mulCam->matchHuman[0].humanInfo[0].human_id = 10000; mulCam->matchHuman[0].humanInfo[0].point = SPoint2f(100.0f, 100.0f); mulCam->matchHuman[0].humanInfo[1].human_id = 1002; mulCam->matchHuman[0].humanInfo[1].point = SPoint2f(30.0f, 110.0f); mulCam->matchHuman[0].humanInfo[2].human_id = 1003; mulCam->matchHuman[0].humanInfo[2].point = SPoint2f(35.0f, 100.0f); mulCam->matchHuman[0].count = A_hcount; // mulCam->matchHuman[0].humanInfo = A_Human; // MatchHuman * B_Human = (MatchHuman*)malloc(sizeof(MatchHuman)); int B_hcount = 2; mulCam->matchHuman[1].humanInfo = (HumanInfo*)malloc(sizeof(HumanInfo)*B_hcount); mulCam->matchHuman[1].humanInfo[0].human_id = 2001; mulCam->matchHuman[1].humanInfo[0].point = SPoint2f(326.36f, 64.45f); mulCam->matchHuman[1].humanInfo[1].human_id = 2003; mulCam->matchHuman[1].humanInfo[1].point = SPoint2f(280.9f, 60.49f); mulCam->matchHuman[1].count = B_hcount; // mulCam->matchHuman[1] = B_Human; // MatchHuman * C_Human = (MatchHuman*)malloc(sizeof(MatchHuman)); int C_hcount = 1; mulCam->matchHuman[2].humanInfo = (HumanInfo*)malloc(sizeof(HumanInfo)*B_hcount); mulCam->matchHuman[2].humanInfo[0].human_id = 30001; mulCam->matchHuman[2].humanInfo[0].point = SPoint2f(284.9f, 64.49f); mulCam->matchHuman[2].count = C_hcount; // mulCam->matchHuman[2] = C_Human; MulCam* lastmulCam = (MulCam*)malloc(sizeof(MulCam)); lastmulCam->cam_count = CV_Reg->count; lastmulCam->matchHuman = (MatchHuman*)malloc(sizeof(MatchHuman)*mulCam->cam_count); // MatchHuman * A_Human = (MatchHuman*)malloc(sizeof(MatchHuman)); int lA_hcount = 3; lastmulCam->matchHuman[0].humanInfo = (HumanInfo*)malloc(sizeof(HumanInfo)*A_hcount); lastmulCam->matchHuman[0].humanInfo[0].human_id = 1; lastmulCam->matchHuman[0].humanInfo[0].point = SPoint2f(100.0f, 100.0f); lastmulCam->matchHuman[0].humanInfo[1].human_id = 2; lastmulCam->matchHuman[0].humanInfo[1].point = SPoint2f(30.0f, 110.0f); lastmulCam->matchHuman[0].humanInfo[2].human_id = 3; lastmulCam->matchHuman[0].humanInfo[2].point = SPoint2f(35.0f, 100.0f); lastmulCam->matchHuman[0].count = lA_hcount; // mulCam->matchHuman[0].humanInfo = A_Human; // MatchHuman * B_Human = (MatchHuman*)malloc(sizeof(MatchHuman)); int lB_hcount = 2; lastmulCam->matchHuman[1].humanInfo = (HumanInfo*)malloc(sizeof(HumanInfo)*B_hcount); lastmulCam->matchHuman[1].humanInfo[0].human_id = 3; lastmulCam->matchHuman[1].humanInfo[0].point = SPoint2f(326.36f, 64.45f); lastmulCam->matchHuman[1].humanInfo[1].human_id = 5; lastmulCam->matchHuman[1].humanInfo[1].point = SPoint2f(284.9f, 64.49f); lastmulCam->matchHuman[1].count = lB_hcount; // mulCam->matchHuman[1] = B_Human; // MatchHuman * C_Human = (MatchHuman*)malloc(sizeof(MatchHuman)); int lC_hcount = 1; lastmulCam->matchHuman[2].humanInfo = (HumanInfo*)malloc(sizeof(HumanInfo)*B_hcount); lastmulCam->matchHuman[2].humanInfo[1].human_id = 5; lastmulCam->matchHuman[2].humanInfo[1].point = SPoint2f(284.9f, 64.49f); lastmulCam->matchHuman[2].count = lC_hcount; char * result=""; result = CM.get_result(mulCam, lastmulCam);// 批量匹配区域中的人 std::cout<< " ---------- " << std::endl; std::cout<< result << std::endl; // //遍历结果 // for (int i = 0; i < mulCam->cam_count-1; ++i) { // map::iterator iter; // for (iter=target->camResult[i].confidence_map.begin() ;iter!=target->camResult[i].confidence_map.end();iter++) { // std::cout<< iter->first << " confidence " << iter->second << std::endl; // } // } // // std::cout<< " ---------- " << std::endl; // map::iterator direction_iter; // for (direction_iter=target->direction_map.begin();direction_iter!=target->direction_map.end();direction_iter++) { // std::cout<< direction_iter->first << " direction " << direction_iter->second << std::endl; // } // map::iterator iter; // for (iter=confidence_map.begin() ;iter!=confidence_map.end();iter++) { // std::cout<< iter->first << " confidence " << iter->second << std::endl; // } std::cout << "--over" << std::endl; return 0; }