| | |
| | | SdkDataFormat(args.CameraId, arg, cameraPolygons) |
| | | } |
| | | // 跑本摄像机的所有规则组 一组一组跑 |
| | | logger.Debug("当前摄像机执行的任务是:",message.Tasklab.Taskname) |
| | | taskGroup := GetRuleGroup(args.CameraId, args.TaskId) // 本摄像机下所有任务组 |
| | | //logger.Println("看下摄像机下的任务组:",taskRuleList) |
| | | // 得到属于该摄像机的若干组任务的完整规则(跟每一条完整规则比较之后得出本张图像对于某个规则是否报警的结果。放进map,比如本帧图像的id,所碰撞成功的规则id) |
| | | args.RuleResult = make(map[string]interface{}) |
| | | args.RuleResult["yolo"] = []Result{} |
| | | args.RuleResult["face"] = []Arg{} |
| | | if len(taskGroup.GroupRules) > 0 { |
| | | if taskGroup != nil && len(taskGroup.GroupRules) > 0 { |
| | | for _, group := range taskGroup.GroupRules { |
| | | //logger.Println("------------------------------任务规则:",taskRule) |
| | | taskId := taskGroup.TaskId |
| | |
| | | } |
| | | if completeFormula != "" { |
| | | logger.Info("结果公式-----------:", completeFormula) |
| | | expression, _ := govaluate.NewEvaluableExpression(completeFormula) |
| | | if strings.HasPrefix(completeFormula, "&&") || strings.HasPrefix(completeFormula, "||") { |
| | | expression, err := govaluate.NewEvaluableExpression(completeFormula) |
| | | if strings.HasPrefix(completeFormula, "&&") || strings.HasPrefix(completeFormula, "||") || err != nil{ |
| | | panic("规则有误,得到的数学公式不可解析") |
| | | } |
| | | result, _ := expression.Evaluate(nil) // 得到数学公式的结果 |