| | |
| | | // 根据id从map中拿到区域 |
| | | var cameraPolygons []*protomsg.CameraPolygon |
| | | for _, item := range data { |
| | | log.Println("-----拿到的所有区域和摄像机id",data,"====",cameraId) |
| | | if item.CameraId == cameraId { |
| | | // 需要根据比例把前台画的区域的坐标转化为相应摄像机拍摄的图像的大小 x坐标分别*image.width/页面区域宽 y坐标分别*image.height/页面区域高 |
| | | // 前台宽高固定 |
| | | cameraPolygons = append(cameraPolygons, &item) |
| | | log.Println("--------------------------看看符合条件的区域",item) |
| | | if item.Type != "line" { |
| | | cameraPolygons = append(cameraPolygons, &item) |
| | | } |
| | | } |
| | | } |
| | | //log.Println("根据摄像机id查到的区域", cameraPolygons, "--区域数量为:", len(cameraPolygons)) |
| | |
| | | // cameraPolygons := GetPolygons(arg.CameraId) |
| | | // list := AreaMapList{} |
| | | for _, polygon := range cameraPolygons { |
| | | areaMap := AreaMap{cameraId: cameraId, areaId: polygon.Id, areaJson: polygon.Polygon, triggerLine: polygon.TriggerLine, directionLine: polygon.DirectionLine} |
| | | areaMap := &AreaMap{cameraId: cameraId, areaId: polygon.Id, areaJson: polygon.Polygon, triggerLine: polygon.TriggerLine, directionLine: polygon.DirectionLine} |
| | | // 为每个摄像机区域填充数据 |
| | | (&areaMap).CountAreaObjs(arg) |
| | | arg.AreaMapList = append(arg.AreaMapList, &areaMap) |
| | | areaMap.CountAreaObjs(arg) |
| | | arg.AreaMapList = append(arg.AreaMapList, 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) { |
| | | // 这步要备齐表达式里所需要的所有参数 |
| | | a.targetNum++ |
| | | arg1 := Arg{obj.Score, PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), obj.IsYolo, obj.Rects, obj.SdkName, obj.ThftRes, obj.Liker} |
| | | //log.Println("放进去的arg:-------", arg1) |
| | | log.Println("放进去的arg:-------", arg1) |
| | | a.args = append(a.args, arg1) |
| | | a.filterData = append(a.filterData, arg1) |
| | | } |