From 47565f95077f6fe38eb7fe6dbc3b150c7a66b287 Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期四, 14 十一月 2019 17:16:30 +0800 Subject: [PATCH] 联动任务录像信号 --- insertdata/insertDataToEs.go | 45 +++++++++++++++++++++++---------------------- 1 files changed, 23 insertions(+), 22 deletions(-) diff --git a/insertdata/insertDataToEs.go b/insertdata/insertDataToEs.go index b9b1974..82af1af 100644 --- a/insertdata/insertDataToEs.go +++ b/insertdata/insertDataToEs.go @@ -184,7 +184,7 @@ // 寰�es涓彃鍏ヤ汉鑴告暟鎹� func InsertFace(msg structure.ResultMsg) { - if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.FaceResult)) > 0 { + if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.Result)) > 0 { logger.Info("寰�ES鎻掍汉鑴告暟鎹�") faces := []*FaceAndRules{} faces = PutFace(faces, msg) @@ -216,7 +216,7 @@ // 涓婁紶澶у浘 if imgMaxUrl == "" { bigPhotoUrl := make(map[string]interface{}) - bigPhotoUrl, err = util.DrawPolygonOnImageForFace(msg.Cid, i, msg.RuleResult["face"].([]structure.FaceResult), weedfsUrl) + bigPhotoUrl, err = util.DrawPolygonOnImageForFace(msg.Cid, i, msg.RuleResult["face"].([]structure.Result), weedfsUrl) logger.Debug("========澶у浘璺緞锛�", bigPhotoUrl) imgMaxUrl = bigPhotoUrl["fileUrl"].(string) picTime = i.Timestamp @@ -295,8 +295,8 @@ // 褰掔疆浜鸿劯 func PutFace(faces []*FaceAndRules, msg structure.ResultMsg) []*FaceAndRules { - if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.FaceResult)) > 0 { - for _, faceResult := range msg.RuleResult["face"].([]structure.FaceResult) { + if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.Result)) > 0 { + for _, faceResult := range msg.RuleResult["face"].([]structure.Result) { faces = hebingFace(faces, faceResult) } return faces @@ -304,8 +304,8 @@ return nil } } -func hebingFace(faces []*FaceAndRules, faceResult structure.FaceResult) []*FaceAndRules { - for _, arg := range faceResult.Args { +func hebingFace(faces []*FaceAndRules, faceResult structure.Result) []*FaceAndRules { + for _, arg := range faceResult.AlarmObj { // 鎷垮埌姣忎竴寮犱汉鑴� //logger.Info("褰掔疆浜鸿劯鏃剁浉浼艰�呯殑鏁伴噺锛�", len(arg.Liker)) flag := false @@ -315,7 +315,7 @@ //} if arg.Id == face.Id { flag = true - face.rules = append(face.rules, faceResult.Result) + face.rules = append(face.rules, faceResult) // 鐩镐技鑰呭幓閲嶅綊骞� for _, liker := range arg.Liker { flag1 := true @@ -332,7 +332,7 @@ } } if !flag { - faces = append(faces, &FaceAndRules{arg, []structure.Result{faceResult.Result}}) + faces = append(faces, &FaceAndRules{*arg, []structure.Result{faceResult}}) } } return faces @@ -391,20 +391,20 @@ } } // 瑁呴厤鐩爣淇℃伅鏁版嵁 - for _, target := range yoloResult.Location { + for _, target := range yoloResult.AlarmObj { // 鍘婚噸娣诲姞 var flag = true for _, selectTarget := range targetInfos { - if strconv.FormatUint(target.TargetId, 10) == selectTarget.TargetId { + if strconv.FormatUint(target.Id, 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}} + target1.TargetId = strconv.FormatUint(target.Id, 10) + target1.TargetScore = target.Score + target1.TargetLocation = Points{TopLeft: Point{target.Location.X, target.Location.Y}, BottomRight: Point{target.Location.X + target.Location.Width, target.Location.Y + target.Location.Height}} targetInfos = append(targetInfos, *target1) } } @@ -479,9 +479,6 @@ linkTagInfos, } requstbody, err := json.Marshal(peraction) - var m map[string]interface{} - json.Unmarshal(requstbody, &m) - logger.Info("涓婁紶鍙傛暟json:",m) if len(linkTagInfos)>0 { logger.Info("鑱斿姩浠诲姟1111") @@ -496,7 +493,11 @@ } else { logger.Debug("鎻掑叆es杩斿洖鐨勬暟鎹俊鎭槸锛坹olo锛夛細", resp1) // 鍙戝嚭褰曞儚淇″彿 - ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: msg.Push.PushId, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, VideoUrl: msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{}, Type: 2}) + ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: msg.Push.PushId, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, VideoUrl: msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{"-1"}, Type: 2}) + for index,link := range linkTagInfos { + logger.Info("鑱斿姩浠诲姟鐨勫綍鍍忎俊鍙凤細",index) + ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: msg.Push.PushId, CameraId: link.CameraId, TaskId: msg.Tasklab.Taskid, VideoUrl: msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{strconv.Itoa(index)}, Type: 2}) + } logger.Warn("__________________________________________寰�ES鎻掑叆yolo鏁版嵁鎴愬姛") //os.Exit(1) } @@ -642,20 +643,20 @@ } } // 瑁呴厤鐩爣淇℃伅鏁版嵁 - for _, target := range yoloResult.Location { + for _, target := range yoloResult.AlarmObj { // 鍘婚噸娣诲姞 var flag = true for _, selectTarget := range targetInfos { - if strconv.FormatUint(target.TargetId, 10) == selectTarget.TargetId { + if strconv.FormatUint(target.Id, 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}} + target1.TargetId = strconv.FormatUint(target.Id, 10) + target1.TargetScore = target.Score + target1.TargetLocation = Points{TopLeft: Point{target.Location.X, target.Location.Y}, BottomRight: Point{target.Location.X + target.Location.Width, target.Location.Y + target.Location.Height}} targetInfos = append(targetInfos, *target1) } } -- Gitblit v1.8.0