| | |
| | | |
| | | func Entrance(rule *protomsg.Rule, am *structure.AreaMap,lable *structure.Others,args *structure.SdkDatas,message *protomsg.SdkMessage) structure.LittleRuleResult { |
| | | if rule.PolygonId == am.AreaId { // 首先这条规则得是这个算法的规则,其次规则所对应的区域id要跟区域数据的id对的上 |
| | | logger.Debug("---------走了人员异常算法", rule.Id, rule.SdkArgAlias, rule.Operator, rule.SdkArgValue, am.AreaId) |
| | | logger.Debug("---------走了个体静止算法", rule.Id, rule.SdkArgAlias, rule.Operator, rule.SdkArgValue, am.AreaId) |
| | | if rule.SdkArgAlias == "score" || rule.SdkArgAlias == "proportion" || rule.SdkArgAlias == "size" || rule.SdkArgAlias == "" { // 判断的是相似值,占比,尺寸等过滤条件,如果再有,还可以再加 |
| | | return filterRule(rule, am) |
| | | } else if rule.SdkArgAlias == "duration" { |
| | |
| | | } |
| | | // 判断一个区域内有没有静止的目标 |
| | | func CompareAndSave(rule *protomsg.Rule, am *structure.AreaMap,lable *structure.Others,args *structure.SdkDatas,message *protomsg.SdkMessage) structure.LittleRuleResult { |
| | | initN := 60 |
| | | if rule.SdkId == "个体静止" && rule.SdkArgAlias == "duration" { |
| | | initN := 5 |
| | | if rule.SdkId == "812b674b-2375-4589-919a-5c1c3278a977" && rule.SdkArgAlias == "duration" { |
| | | if init,err := strconv.Atoi(rule.SdkArgValue); err != nil { |
| | | logger.Debug("个体静止算法读取持续时间失败",err) |
| | | } else { |
| | |
| | | if singleResult { |
| | | flag = "true" |
| | | tars = append(tars,arg) |
| | | logger.Info("静止的目标:",arg.Id,arg.Location,arg.Score) |
| | | } |
| | | } |
| | | |
| | | // 把满足条件的目标放进areaMap中 |
| | | am.AlarmObj = tars |
| | | // 更新数据,把新来的数据写入缓存 |