| | |
| | | IsStatic bool // 是否静止 |
| | | ImageWidth int // 摄像机拍摄的图像宽 像素 |
| | | ImageHeight int // 摄像机拍摄的图像高 像素 |
| | | AreaMapList []*AreaMap // 本sdk提取的数据按照区域划分后的数据集合 |
| | | AreaMapList []AreaMap // 本sdk提取的数据按照区域划分后的数据集合 |
| | | } |
| | | |
| | | // 从算法模块儿拿来的对一帧图像各个算法提取的数据集合 |
| | |
| | | } |
| | | |
| | | // 根据摄像机id拿到摄像机所有区域 |
| | | func GetPolygons(cameraId string) []*protomsg.CameraPolygon { |
| | | func GetPolygons(cameraId string) []protomsg.CameraPolygon { |
| | | var api dbapi.CameraApi |
| | | data := api.FindAllPolygons() |
| | | //fmt.Println("查到的所有区域:", data) |
| | | // 根据id从map中拿到区域 |
| | | var cameraPolygons []*protomsg.CameraPolygon |
| | | var cameraPolygons []protomsg.CameraPolygon |
| | | for _, item := range data { |
| | | if item.CameraId == cameraId && item.Type != "line" { |
| | | // 需要根据比例把前台画的区域的坐标转化为相应摄像机拍摄的图像的大小 x坐标分别*image.width/页面区域宽 y坐标分别*image.height/页面区域高 |
| | | // 前台宽高固定 |
| | | log.Println("------------符合条件的区域:",item) |
| | | cameraPolygons = append(cameraPolygons, &item) |
| | | //log.Println("------------符合条件的区域:",item) |
| | | cameraPolygons = append(cameraPolygons, item) |
| | | } |
| | | } |
| | | //log.Println("根据摄像机id查到的区域", cameraPolygons, "--区域数量为:", len(cameraPolygons)) |
| | |
| | | } |
| | | |
| | | // 把sdk从数据帧上提取的按照区域分类归置 |
| | | func SdkDataFormat(cameraId string, arg *SdkData, cameraPolygons []*protomsg.CameraPolygon) { |
| | | // cameraPolygons := GetPolygons(arg.CameraId) |
| | | // list := AreaMapList{} |
| | | func SdkDataFormat(cameraId string, arg *SdkData, cameraPolygons []protomsg.CameraPolygon) { |
| | | for _, polygon := range cameraPolygons { |
| | | log.Println("++++++在这儿看一下区域啊", polygon) |
| | | areaMap := &AreaMap{cameraId: cameraId, areaId: polygon.Id, areaJson: polygon.Polygon, triggerLine: polygon.TriggerLine, directionLine: polygon.DirectionLine} |
| | | //log.Println("++++++在这儿看一下区域啊", polygon) |
| | | areaMap := AreaMap{cameraId: cameraId, areaId: polygon.Id, areaJson: polygon.Polygon, triggerLine: polygon.TriggerLine, directionLine: polygon.DirectionLine} |
| | | // 为每个摄像机区域填充数据 |
| | | areaMap.CountAreaObjs(arg) |
| | | log.Println("-------areaMap的内容",areaMap) |
| | | arg.AreaMapList = append(arg.AreaMapList, areaMap) |
| | | log.Println("-------AreaMapList的内容",arg.AreaMapList) |
| | | } |
| | | } |
| | | |
| | |
| | | log.Println("入侵的算法数据", sdkData) |
| | | } |
| | | for _, areaMap := range sdkData.AreaMapList { |
| | | ruleResult := filterRule(groupRule.Rules[j], areaMap) |
| | | ruleResult := filterRule(groupRule.Rules[j], &areaMap) |
| | | if ruleResult.Result != "" { |
| | | log.Println("条件规则结果:", ruleResult.Result) |
| | | resultSplice = append(resultSplice, &ruleResult) |
| | |
| | | for _, sdkData := range args.Sdkdata { |
| | | for _, areaMap := range sdkData.AreaMapList { |
| | | for j := 0; j < len(groupRule.Rules); j++ { |
| | | putFaceToResult(groupRule.Rules[j], areaMap, faces) |
| | | putFaceToResult(groupRule.Rules[j], &areaMap, faces) |
| | | } |
| | | } |
| | | } |
| | |
| | | for j := 0; j < len(groupRule.Rules); j++ { |
| | | for _, sdkData := range args.Sdkdata { |
| | | for _, areaMap := range sdkData.AreaMapList { |
| | | ruleResult := transferParameters(groupRule.Rules[j], areaMap) |
| | | ruleResult := transferParameters(groupRule.Rules[j], &areaMap) |
| | | if ruleResult.Result != "" { |
| | | log.Println("数量规则结果:", ruleResult.Result) |
| | | resultSplice = append(resultSplice, &ruleResult) |
| | |
| | | for j := 0; j < len(groupRule.Rules); j++ { |
| | | for _, sdkData := range args.Sdkdata { |
| | | for _, areaMap := range sdkData.AreaMapList { |
| | | ruleResult := timeRuleResult(groupRule.Rules[j], areaMap) |
| | | ruleResult := timeRuleResult(groupRule.Rules[j], &areaMap) |
| | | if ruleResult.Result != "" { |
| | | log.Println("时间规则结果:", ruleResult.Result) |
| | | resultSplice = append(resultSplice, &ruleResult) |
| | |
| | | for j := 0; j < len(groupRule.Rules); j++ { |
| | | for _, sdkData := range args.Sdkdata { |
| | | for _, areaMap := range sdkData.AreaMapList { |
| | | duration(groupRule.Rules[j], areaMap) |
| | | duration(groupRule.Rules[j], &areaMap) |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | // } |
| | | for _, obj := range arg.Photo { |
| | | log.Println("-------------------看看areajson-------------", a.areaJson) |
| | | log.Println("------------------看看sdkData的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) { |
| | | // 这步要备齐表达式里所需要的所有参数 |