| | |
| | | "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") |
| | |
| | | ruleserver.Judge(&arg, &m) // 把sdkMessage传进去,方便缓存数据时拼出一个resultMag |
| | | // 把arg里的打的标签拿出来给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) |
| | | // 将打完标签的数据插入到ES |
| | | insertdata.InsertToEs(resultMsg) |
| | | logger.Debug("插入完Es所用时间:", time.Since(start)) |
| | | esEnd := time.Since(start) |
| | | logger.Debug("插入完Es所用时间:", esEnd) |
| | | //事件推送 |
| | | go labelFilter.PushSomthing(resultMsg) |
| | | labelFilter.PushSomthing(resultMsg) |
| | | //}(msg) |
| | | } |
| | | } |
| | |
| | | arg.TaskId = m.Tasklab.Taskid |
| | | arg.IpcId = sdkinfo.Ipcid |
| | | arg.IsYolo = true |
| | | //bdata, err := util.UnCompress(m.Data) |
| | | //if err != nil { |
| | | // panic("解压缩图片时出现错误") |
| | | //} |
| | | //i := protomsg.Image{} |
| | | //err = proto.Unmarshal(bdata, &i) |
| | | arg.ImageWidth = int(i.Width) |
| | | arg.ImageHeight = int(i.Height) |
| | | // 暂时写死,sdk还没有这俩算法 |
| | | arg.KeepRight = false |
| | | arg.IsStatic = false |
| | | logger.Info("-----追踪之后sdkinfo.Sdkdata的长度为:----", len(sdkinfo.Sdkdata)) |
| | | if len(sdkinfo.Sdkdata) > 1 { |
| | | // 大于1才有数据 |
| | |
| | | arg.TaskId = m.Tasklab.Taskid |
| | | arg.IpcId = sdkinfo.Ipcid |
| | | arg.IsYolo = false |
| | | //bdata, err := util.UnCompress(m.Data) |
| | | //if err != nil { |
| | | // panic("解压缩图片时出现错误") |
| | | //} |
| | | //i := protomsg.Image{} |
| | | //err = proto.Unmarshal(bdata, &i) |
| | | arg.ImageWidth = int(i.Width) |
| | | arg.ImageHeight = int(i.Height) |
| | | // 暂时写死,sdk还没有这俩算法 |
| | | arg.KeepRight = false |
| | | arg.IsStatic = false |
| | | if len(sdkinfo.Sdkdata) > 1 { |
| | | faceParam := protomsg.ParamFacePos{} |
| | | err = proto.Unmarshal(sdkinfo.Sdkdata, &faceParam) |
| | |
| | | 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("解析车牌数据时出现错误", 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 |
| | | } |