| | |
| | | IsAckAlarm int `json:"isAckAlarm"` |
| | | IsCollect int `json:"isCollect"` |
| | | IsDelete int `json:"isDelete"` |
| | | TargetInfo []Target |
| | | } |
| | | |
| | | type AlarmRule struct { |
| | |
| | | videoPersonUrl = "http://" + localConfig1.AlarmIp + ":" + strconv.Itoa(int(localConfig1.AlarmPort)) + "/" + EsInfo.EsIndex.VideoPersons.IndexName + "/" + EsInfo.EsIndex.VideoPersons.IndexType |
| | | personAction = "http://" + localConfig1.AlarmIp + ":" + strconv.Itoa(int(localConfig1.AlarmPort)) + "/" + EsInfo.EsIndex.Personaction.IndexName + "/" + EsInfo.EsIndex.Personaction.IndexType |
| | | InsertFace(msg, "") |
| | | // 如果标签中含有持续时间首次报警的timeLabel的话则不需要过人体追踪,不然就没的插入了 |
| | | fk := ruleserver.TrackOrNot(msg.RuleResult) |
| | | if fk { |
| | | InsertYolo(msg, "") |
| | | //if msg.Cid == "61de081a-7ed9-4970-8432-41d642c35456" { |
| | | // logger.Warn("捕捉188摄像机的持续时间任务.....") |
| | | // os.Exit(1) |
| | | //} |
| | | } else { |
| | | flag := ruleserver.BodyIsSame(msg.SdkMessage) |
| | | if !flag { |
| | | InsertYolo(msg, "") |
| | | } |
| | | } |
| | | InsertYolo(msg, "") |
| | | } |
| | | |
| | | // 往es中插入人脸数据 |
| | |
| | | } |
| | | i := protomsg.Image{} |
| | | err = proto.Unmarshal(bdata, &i) |
| | | // 先传小图,再传大图,防止脸上有线 |
| | | bytes := util.SubImg(i, int(face.Location.X), int(face.Location.Y), int(face.Location.X+face.Location.Width), int(face.Location.Y+face.Location.Height)) |
| | | resp, err := util.PostFormBufferData1(weedfsUrl, bytes, uuid.NewV4().String()) |
| | | if err != nil { |
| | | logger.Error("上传小图出错") |
| | | } |
| | | // 上传大图 |
| | | if imgMaxUrl == "" { |
| | | bigPhotoUrl := make(map[string]interface{}) |
| | | bigPhotoUrl, err = util.DrawPolygonOnImageForFace(msg.Cid, i, msg.RuleResult["face"].([]structure.FaceResult), weedfsUrl) |
| | |
| | | if err != nil { |
| | | logger.Error("查询摄像机信息失败") |
| | | } |
| | | bytes := util.SubImg(i, int(face.Location.X), int(face.Location.Y), int(face.Location.X+face.Location.Width), int(face.Location.Y+face.Location.Height)) |
| | | resp, err := util.PostFormBufferData1(weedfsUrl, bytes, uuid.NewV4().String()) |
| | | if err != nil { |
| | | logger.Error("上传小图出错") |
| | | } |
| | | |
| | | //logger.Info("================小图地址:", resp["fileUrl"].(string)) |
| | | sex := "" |
| | | logger.Info(sex) |
| | |
| | | target.TargetScore = face.Score |
| | | target.TargetLocation = Points{TopLeft:Point{face.Location.X,face.Location.Y},BottomRight:Point{face.Location.X+face.Location.Width,face.Location.Y+face.Location.Height}} |
| | | //logger.Info("人脸的id:",strconv.FormatUint(face.Id, 10)) |
| | | //logger.Info("人脸的分值:",face.Score) |
| | | logger.Info("%%%%%%%%%%%%%%%%%%%%%目标信息:",*target) |
| | | pervideo := PerVideoPicture{ |
| | | esDataId, |
| | | msg.Cid, |
| | |
| | | logger.Info("往ES插yolo数据") |
| | | var sdkNames string = "" |
| | | alarmRules := []AlarmRule{} |
| | | var targetInfos []Target |
| | | url := []string{} |
| | | for _, yoloResult := range msg.RuleResult["yolo"].([]structure.Result) { |
| | | if yoloResult.Others.TimeLabel == "01" || yoloResult.Others.TimeLabel == "10" { |
| | |
| | | if resp1["fileUrl"] != nil { |
| | | url = append(url, resp1["fileUrl"].(string)) |
| | | } |
| | | } |
| | | } |
| | | // 装配目标信息数据 |
| | | for _,target := range yoloResult.Location { |
| | | // 去重添加 |
| | | logger.Info("装配前的原始数据是:",target) |
| | | var flag = true |
| | | for _,selectTarget := range targetInfos { |
| | | if strconv.FormatUint(target.TargetId, 10) == selectTarget.TargetId { |
| | | flag = false |
| | | break |
| | | } |
| | | } |
| | | if flag { |
| | | var target1 = new(Target) |
| | | target1.TargetId = strconv.FormatUint(target.TargetId, 10) |
| | | target1.TargetScore = target.TargetScore |
| | | target1.TargetLocation = Points{TopLeft:Point{target.X,target.Y},BottomRight:Point{target.X+target.Width,target.Y+target.Height}} |
| | | targetInfos = append(targetInfos,*target1) |
| | | } |
| | | } |
| | | } |
| | |
| | | if err != nil { |
| | | logger.Error("查询摄像机信息失败") |
| | | } |
| | | logger.Info("摄像机信息:",camera) |
| | | serverIp, err := GetLocalIP() |
| | | logger.Info("%%%%%%%%%%%%%%%%%yolo的target信息:",targetInfos) |
| | | if resp["fileUrl"] != nil { |
| | | url = append(url, resp["fileUrl"].(string)) |
| | | esDataId := uuid.NewV4().String() |
| | |
| | | 0, |
| | | 0, |
| | | 0, |
| | | targetInfos, |
| | | } |
| | | requstbody, err := json.Marshal(peraction) |
| | | |