| | |
| | | cameraPolygons := GetPolygons(args.CameraId) |
| | | // 把所有的sdk提取的数据都按所属摄像机的区域归置 |
| | | logger.Debug("当前摄像机id为:",message.Cid,"当前摄像机执行的任务是:",message.Tasklab.Taskname,"--任务id为:",message.Tasklab.Taskid) |
| | | for _, arg := range args.Sdkdata { |
| | | SdkDataFormat(args.CameraId, arg, cameraPolygons) |
| | | } |
| | | CallReadyData(args,cameraPolygons) |
| | | // 跑本摄像机的所有规则组 一组一组跑 |
| | | taskGroup := GetRuleGroup(args.CameraId, args.TaskId) // 本摄像机本任务下所有规则组 |
| | | //logger.Println("看下摄像机下的任务组:",taskRuleList) |
| | |
| | | } |
| | | a,b,c := f.(func(args *structure.SdkDatas,rule protomsg.GroupRule,label *structure.Others,message *protomsg.SdkMessage)(bool,string, string))(args,rule,lable,message) |
| | | return a,b,c |
| | | } |
| | | |
| | | func CallReadyData(args *structure.SdkDatas,cameraPolygons []protomsg.CameraPolygon) { |
| | | p,err := plugin.Open("./algorithm/middleware.so") |
| | | if err != nil { |
| | | panic(err) |
| | | } |
| | | f,err1 := p.Lookup("ReadyData") |
| | | if err1 != nil { |
| | | panic("没有找到中间件入口函数") |
| | | } |
| | | f.(func(args *structure.SdkDatas,cameraPolygons []protomsg.CameraPolygon)())(args,cameraPolygons) |
| | | } |
| | | |
| | | func RunRule(args *structure.SdkDatas, groupRule *protomsg.GroupRule, taskId string, message *protomsg.SdkMessage, label structure.Others) (bool,[]int) { |
| | |
| | | // 处理目标定时数据 |
| | | targets := []*structure.Arg{} |
| | | for _, sdkData := range args.Sdkdata { |
| | | if sdkData.IpcId == "02D54B61-0F16-C604-8567-FC4BE493C523" && sdkNames != "" { // 把yolo数据的各个目标的坐标输出方便后面画框 |
| | | if sdkData.IpcId == "02D54B61-0F16-C604-8567-FC4BE493C523" && sdkNames != "" { // 输出目标数据 |
| | | for _, areaMap := range sdkData.AreaMapList { |
| | | if areaMap.IsEffective { |
| | | targets = append(targets, putTargetsToResult(areaMap)...) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // 车辆目标统计 |
| | | cars := []*structure.Arg{} |
| | | for _, sdkData := range args.Sdkdata { |
| | | if sdkData.IpcId == "91d923ef-6200-4549-ab1b-8e773e85d729" && sdkNames != "" { // 把yolo数据的各个目标的坐标输出方便后面画框 |
| | | for _, areaMap := range sdkData.AreaMapList { |
| | | if areaMap.IsEffective { |
| | | cars = append(cars, putYolosToResult(areaMap)...) |
| | | } |
| | | } |
| | | } |
| | |
| | | logger.Info("-------------------目标持续结果标签", len(args.RuleResult["target"].([]structure.Result))) |
| | | //labelTypes = append(labelTypes,2) |
| | | } |
| | | if len(cars) > 0 { |
| | | args.RuleResult["car"] = append(args.RuleResult["car"].([]structure.Result), structure.Result{taskId, sdkNames, groupRule.GroupId, groupRule.DefenceState, groupRule.AlarmLevel, groupRule.GroupText, cars, polygonId, islink,label}) |
| | | logger.Info("-------------------目标持续结果标签", len(args.RuleResult["target"].([]structure.Result))) |
| | | //labelTypes = append(labelTypes,2) |
| | | } |
| | | // 给持续时间的第一张赋予缓存数据(遍历复制) |
| | | if cacheId != "" { // 有这帧数据的缓存 |
| | | tempMap := make(map[string]interface{}) |