panlei
2019-11-16 9c8bcb851f82123660c7b05b00a526c4283ba4cf
main.go
@@ -16,8 +16,6 @@
   "flag"
   "fmt"
   "github.com/golang/protobuf/proto"
   "github.com/spf13/viper"
   "basic.com/valib/logger.git"
   "ruleprocess/cache"
   "ruleprocess/ruleserver"
@@ -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("解压缩图片时出现错误")
         //}
         //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才有数据
@@ -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("解压缩图片时出现错误")
         //}
         //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)
@@ -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("解析车牌数据时出现错误", 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
}