| | |
| | | "nanomsg.org/go-mangos/transport/tcp" |
| | | "net" |
| | | "ruleprocess/cache" |
| | | "basic.com/valib/logger.git" |
| | | "ruleprocess/logger" |
| | | "ruleprocess/structure" |
| | | "strconv" |
| | | "time" |
| | |
| | | taskGroup = task |
| | | } |
| | | } |
| | | logger.Debug("当前数据帧要匹配的规则组:-------------------------","摄像机id:",cameraId,"任务id",taskId) |
| | | //logger.Debug("当前数据帧要匹配的规则组:-------------------------","摄像机id:",cameraId,"任务id",taskId) |
| | | if taskGroup == nil { |
| | | return nil |
| | | } else { |
| | |
| | | func GetPolygons(cameraId string) []protomsg.CameraPolygon { |
| | | var cameraPolygons []protomsg.CameraPolygon |
| | | cameraPolygons = cache.GetPolygonsByCameraId(cameraId) |
| | | logger.Debug("------=======查看下全部区域:",cameraPolygons) |
| | | //logger.Debug("------=======查看下全部区域:",cameraPolygons) |
| | | return cameraPolygons |
| | | } |
| | | |
| | |
| | | } |
| | | func Decimal(value float32) float64 { |
| | | value1, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", float64(value)), 64) |
| | | logger.Info("初步保留两位成str:",value1) |
| | | //logger.Info("初步保留两位成str:",value1) |
| | | n10 := math.Pow10(4) |
| | | value2 := math.Trunc((value1+0.5/n10)*n10) / n10 |
| | | logger.Info("初步保留两位成str::::",value2) |
| | | //logger.Info("初步保留两位成str::::",value2) |
| | | return value2 |
| | | } |
| | | // 取出某个时间规则的第几天的规则段集合 |
| | |
| | | size := 0.0 // 尺寸 |
| | | |
| | | areaPoints := Json2points(a.AreaJson) |
| | | widthScale := float64(arg.ImageWidth / 960) |
| | | heigthScale := float64(arg.ImageHeight / 540) |
| | | logger.Info("看看图片的width和height:",arg.ImageWidth,arg.ImageHeight) |
| | | widthScale := float64(arg.ImageWidth) / 960 |
| | | heigthScale := float64(arg.ImageHeight) / 540 |
| | | for _, obj := range arg.Photo { |
| | | //logger.Info("------------------看看sdkData:", arg.SdkName, "的Photo数据----------------", obj, "----顺便看看占比-----:", PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale)) |
| | | if threshold <= obj.Score && size <= float64(obj.Rects.Width*obj.Rects.Height) && intersectionper <= PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale) { |
| | | if obj.Score >= threshold && float64(obj.Rects.Width*obj.Rects.Height) >= size && PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale) >= intersectionper { |
| | | // 这步要备齐表达式里所需要的所有参数 |
| | | a.TargetNum++ |
| | | arg1 := structure.Arg{obj.Id,obj.Score, PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), obj.IsYolo, obj.Rects, obj.Feature, obj.ThftRes, []*structure.BaseInfo{}} |
| | |
| | | } |
| | | } |
| | | logger.Info("区域是:",areaPoints,"区域内目标数量为:",a.TargetNum,"---",len(a.FilterData)) |
| | | for _,tar := range a.FilterData { |
| | | logger.Info("具体目标的坐标为",tar.Location) |
| | | } |
| | | //for _,tar := range a.FilterData { |
| | | // logger.Info("具体目标的坐标为",tar.Id,tar.Location) |
| | | //} |
| | | a.Time = time.Unix(time.Now().Unix(), 0).String()[11:16] |
| | | a.KeepRight = arg.KeepRight |
| | | a.IsStatic = arg.IsStatic |