From 9c8bcb851f82123660c7b05b00a526c4283ba4cf Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期六, 16 十一月 2019 14:28:28 +0800 Subject: [PATCH] 接收车牌数据,修改目标结构 --- main.go | 60 ++++++++++++++++++++++++++++++++---------------------------- 1 files changed, 32 insertions(+), 28 deletions(-) diff --git a/main.go b/main.go index 7f9a5d6..3038438 100644 --- a/main.go +++ b/main.go @@ -13,19 +13,14 @@ "time" "basic.com/valib/logger.git" - //"bufio" - //"bytes" "flag" "fmt" "github.com/golang/protobuf/proto" - "github.com/spf13/viper" - //"gocv.io/x/gocv" - //"image" - //"image/color" - //"os" + "ruleprocess/cache" "ruleprocess/ruleserver" "sync" + "github.com/spf13/viper" ) var dbIp = flag.String("dbIp", "127.0.0.1", "dbserver ip") @@ -103,12 +98,15 @@ ruleserver.Judge(&arg, &m) // 鎶妔dkMessage浼犺繘鍘伙紝鏂逛究缂撳瓨鏁版嵁鏃舵嫾鍑轰竴涓猺esultMag // 鎶奱rg閲岀殑鎵撶殑鏍囩鎷垮嚭鏉ョ粰m鍐嶅皝瑁呬竴灞� resultMsg := structure.ResultMsg{SdkMessage: &m, RuleResult: arg.RuleResult} - logger.Debug("瑙勫垯鍒ゆ柇瀹屾墍鐢ㄦ椂闂达細", time.Since(start)) + ruleserver.GetAttachInfo(resultMsg.SdkMessage) + ruleEnd := time.Since(start) + logger.Debug("瑙勫垯鍒ゆ柇瀹屾墍鐢ㄦ椂闂达細", ruleEnd) // 灏嗘墦瀹屾爣绛剧殑鏁版嵁鎻掑叆鍒癊S insertdata.InsertToEs(resultMsg) - logger.Debug("鎻掑叆瀹孍s鎵�鐢ㄦ椂闂达細", time.Since(start)) + esEnd := time.Since(start) + logger.Debug("鎻掑叆瀹孍s鎵�鐢ㄦ椂闂达細", esEnd) //浜嬩欢鎺ㄩ�� - go labelFilter.PushSomthing(resultMsg) + labelFilter.PushSomthing(resultMsg) //}(msg) } } @@ -161,17 +159,8 @@ arg.TaskId = m.Tasklab.Taskid arg.IpcId = sdkinfo.Ipcid arg.IsYolo = true - //bdata, err := util.UnCompress(m.Data) - //if err != nil { - // panic("瑙e帇缂╁浘鐗囨椂鍑虹幇閿欒") - //} - //i := protomsg.Image{} - //err = proto.Unmarshal(bdata, &i) arg.ImageWidth = int(i.Width) arg.ImageHeight = int(i.Height) - // 鏆傛椂鍐欐锛宻dk杩樻病鏈夎繖淇╃畻娉� - arg.KeepRight = false - arg.IsStatic = false logger.Info("-----杩借釜涔嬪悗sdkinfo.Sdkdata鐨勯暱搴︿负锛�----", len(sdkinfo.Sdkdata)) if len(sdkinfo.Sdkdata) > 1 { // 澶т簬1鎵嶆湁鏁版嵁 @@ -202,17 +191,8 @@ arg.TaskId = m.Tasklab.Taskid arg.IpcId = sdkinfo.Ipcid arg.IsYolo = false - //bdata, err := util.UnCompress(m.Data) - //if err != nil { - // panic("瑙e帇缂╁浘鐗囨椂鍑虹幇閿欒") - //} - //i := protomsg.Image{} - //err = proto.Unmarshal(bdata, &i) arg.ImageWidth = int(i.Width) arg.ImageHeight = int(i.Height) - // 鏆傛椂鍐欐锛宻dk杩樻病鏈夎繖淇╃畻娉� - arg.KeepRight = false - arg.IsStatic = false if len(sdkinfo.Sdkdata) > 1 { faceParam := protomsg.ParamFacePos{} err = proto.Unmarshal(sdkinfo.Sdkdata, &faceParam) @@ -231,6 +211,30 @@ continue } } + if sdkinfo.Sdktype == "Plate" { // 杞︾墝璇嗗埆 + arg := structure.SdkData{} + arg.TaskId = m.Tasklab.Taskid + arg.IpcId = sdkinfo.Ipcid + arg.IsYolo = false + arg.ImageWidth = int(i.Width) + arg.ImageHeight = int(i.Height) + if len(sdkinfo.Sdkdata) > 1 { + plateIDResult := protomsg.PlateIDResult {} + err = proto.Unmarshal(sdkinfo.Sdkdata, &plateIDResult ) + if err != nil { + logger.Info("瑙f瀽杞︾墝鏁版嵁鏃跺嚭鐜伴敊璇�", err) + continue + } + for _, info := range plateIDResult.Result { + logger.Info("鎺ユ敹杞︾墝鏁版嵁锛�",) + photoMap := structure.PhotoMap{Rects: rectFormat(info.RcLocation), IsYolo: false, Car:info} + arg.Photo = append(arg.Photo, photoMap) + } + args.Sdkdata = append(args.Sdkdata, &arg) + } else { + continue + } + } } return m } -- Gitblit v1.8.0