| | |
| | | package main |
| | | |
| | | import ( |
| | | "encoding/base64" |
| | | "encoding/json" |
| | | "errors" |
| | | "net" |
| | |
| | | "strconv" |
| | | "time" |
| | | |
| | | "basic.com/valib/logger.git" |
| | | "github.com/golang/protobuf/proto" |
| | | "github.com/satori/go.uuid" |
| | | "basic.com/valib/logger.git" |
| | | |
| | | "ruleprocess/cache" |
| | | "ruleprocess/structure" |
| | | "basic.com/pubsub/protomsg.git" |
| | | "basic.com/pubsub/esutil.git" |
| | | "basic.com/pubsub/protomsg.git" |
| | | "ruleprocess/cache" |
| | | "ruleprocess/ruleserver" |
| | | "ruleprocess/structure" |
| | | "ruleprocess/util" |
| | | ) |
| | | |
| | |
| | | target.TargetId = face.Id |
| | | target.TargetScore = face.Score |
| | | target.TargetType = face.Type |
| | | target.Feature = base64.StdEncoding.EncodeToString(face.Feature) |
| | | target.Feature = face.Feature |
| | | target.PicSmUrl = resp["fileUrl"].(string) |
| | | 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}} |
| | | target.AttachTarget = SourceTarget{face.AttachArg.Id,face.AttachArg.Score,face.AttachArg.Type,base64.StdEncoding.EncodeToString(face.AttachArg.Feature),"",Points{TopLeft: Point{face.AttachArg.Location.X, face.AttachArg.Location.Y}, BottomRight: Point{face.AttachArg.Location.X + face.AttachArg.Location.Width, face.AttachArg.Location.Y + face.AttachArg.Location.Height}}} |
| | | target.AttachTarget = SourceTarget{face.AttachArg.Id,face.AttachArg.Score,face.AttachArg.Type,face.AttachArg.Feature,"",Points{TopLeft: Point{face.AttachArg.Location.X, face.AttachArg.Location.Y}, BottomRight: Point{face.AttachArg.Location.X + face.AttachArg.Location.Width, face.AttachArg.Location.Y + face.AttachArg.Location.Height}}} |
| | | var targetInfos []Target |
| | | targetInfos = append(targetInfos, *target) |
| | | |
| | |
| | | import ( |
| | | "basic.com/pubsub/protomsg.git" |
| | | "basic.com/valib/logger.git" |
| | | "encoding/base64" |
| | | "encoding/json" |
| | | "github.com/golang/protobuf/proto" |
| | | uuid "github.com/satori/go.uuid" |
| | | "ruleprocess/ruleserver" |
| | |
| | | // 这步要备齐表达式里所需要的所有参数 |
| | | a.TargetNum++ |
| | | uuid := uuid.NewV4().String() |
| | | arg1 := structure.Arg{structure.SourceArg{obj.Id,uuid,obj.Score, ruleserver.PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), a.AreaJson,obj.Type, obj.Rects, obj.Car,obj.Feature,obj.BodyFeature,obj.ThftRes, []*structure.BaseInfo{},"",structure.ResultMsg{}},structure.SourceArg{}} |
| | | arg1 := structure.Arg{structure.SourceArg{obj.Id,uuid,obj.Score, ruleserver.PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), a.AreaJson,obj.Type, obj.Rects, obj.Car,obj.Feature,obj.ThftRes, []*structure.BaseInfo{},"",structure.ResultMsg{}},structure.SourceArg{}} |
| | | //logger.Println("放进去的arg:-------", arg1) |
| | | a.Args = append(a.Args, &arg1) |
| | | a.FilterData = append(a.FilterData, &arg1) |
| | |
| | | } |
| | | for _, polygon := range cameraPolygons { |
| | | //logger.Println("++++++在这儿看一下区域啊:", polygon.Polygon) |
| | | areaMap := structure.AreaMap{CameraId: cameraId, AreaId: polygon.Id, AreaJson: polygon.Polygon, TriggerLine: polygon.TriggerLine, DirectionLine: polygon.DirectionLine} |
| | | areaMap := structure.AreaMap{CameraId: cameraId, AreaId: polygon.Id,AreaJson: polygon.Polygon, TriggerLine: polygon.TriggerLine, DirectionLine: polygon.DirectionLine} |
| | | // 为每个摄像机区域填充数据 |
| | | CountAreaObjs(&areaMap,arg) |
| | | arg.AreaMapList = append(arg.AreaMapList, &areaMap) |
| | |
| | | logger.Info("--------------追踪之后人脸的个数:", len(faceParam.Faces)) |
| | | for _, info := range faceParam.Faces { |
| | | //logger.Info("_______________________________________________第一次看相似值:",info.Pos.FAngle.Confidence*100) |
| | | photoMap := structure.PhotoMap{structure.SourcePhoto{Id: strconv.Itoa(int(info.Pos.FaceID)) , Rects: rectFormat(info.Pos.RcFace), Score: float64(info.Pos.FAngle.Confidence * 100), Type: "face", ThftRes: *(info.Result), Feature: info.Feats},structure.SourcePhoto{}} |
| | | photoMap := structure.PhotoMap{structure.SourcePhoto{Id: strconv.Itoa(int(info.Pos.FaceID)) , Rects: rectFormat(info.Pos.RcFace), Score: float64(info.Pos.FAngle.Confidence * 100), Type: "face", ThftRes: *(info.Result), Feature: base64.StdEncoding.EncodeToString(info.Feats)},structure.SourcePhoto{}} |
| | | arg.Photo = append(arg.Photo, photoMap) |
| | | } |
| | | args.Sdkdata = append(args.Sdkdata, &arg) |
| | |
| | | } |
| | | for _, info := range Track.Result { |
| | | logger.Info("接收跟踪数据:",info.Id,info.Confidence,info.Feature) |
| | | photoMap := structure.PhotoMap{structure.SourcePhoto{Id: strconv.Itoa(int(info.Id)),Score: float64(info.Confidence)*100,Rects: rectFormat(info.RcHuman), Type: "track",BodyFeature: info.Feature},structure.SourcePhoto{}} |
| | | b,_ := json.Marshal(info.Feature) |
| | | photoMap := structure.PhotoMap{structure.SourcePhoto{Id: strconv.Itoa(int(info.Id)),Score: float64(info.Confidence)*100,Rects: rectFormat(info.RcHuman), Type: "track",Feature: base64.StdEncoding.EncodeToString(b)},structure.SourcePhoto{}} |
| | | arg.Photo = append(arg.Photo, photoMap) |
| | | } |
| | | args.Sdkdata = append(args.Sdkdata, &arg) |
| | |
| | | for _, info := range faceParam.Faces { |
| | | percent := ruleserver.PgsInterPercent(Rect2Point(photomap.Rects),rectFormat(info.Pos.RcFace), 1, 1) |
| | | if percent > 99 { |
| | | photomap.AttachObj = structure.SourcePhoto{Id:strconv.Itoa(int(info.Pos.FaceID)),Rects: rectFormat(info.Pos.RcFace),Score: float64(info.Pos.FAngle.Confidence * 100), Type: "face", ThftRes: *(info.Result), Feature: info.Feats} |
| | | photomap.AttachObj = structure.SourcePhoto{Id:strconv.Itoa(int(info.Pos.FaceID)),Rects: rectFormat(info.Pos.RcFace),Score: float64(info.Pos.FAngle.Confidence * 100), Type: "face", ThftRes: *(info.Result), Feature: base64.StdEncoding.EncodeToString(info.Feats)} |
| | | } |
| | | } |
| | | } |
| | |
| | | package main |
| | | |
| | | import ( |
| | | "encoding/base64" |
| | | "encoding/json" |
| | | "errors" |
| | | uuid "github.com/satori/go.uuid" |
| | |
| | | "strconv" |
| | | "time" |
| | | |
| | | "basic.com/valib/logger.git" |
| | | "github.com/knetic/govaluate" |
| | | "nanomsg.org/go-mangos" |
| | | "nanomsg.org/go-mangos/protocol/req" |
| | | "nanomsg.org/go-mangos/transport/tcp" |
| | | "github.com/knetic/govaluate" |
| | | "basic.com/valib/logger.git" |
| | | |
| | | "basic.com/pubsub/protomsg.git" |
| | | "ruleprocess/structure" |
| | |
| | | trackArg["esId"] = esId |
| | | trackArg["threshold"] = compareThreshold |
| | | trackArg["cameraId"] = am.CameraId |
| | | trackArg["bodyFeature"] = arg.BodyFeature |
| | | trackArg["faceFeature"] = base64.StdEncoding.EncodeToString(arg.AttachArg.Feature) |
| | | trackArg["bodyFeature"] = arg.Feature |
| | | trackArg["faceFeature"] = arg.AttachArg.Feature |
| | | logger.Info("请求张增飞比对数据参数:",trackArg) |
| | | b,err := json.Marshal(trackArg) |
| | | if err != nil { |
| | |
| | | Type string // 记载数据类型 |
| | | Location Rect // 记下每个目标的位置参数,最后给结果装配目标数据的时候用的到 |
| | | Car *protomsg.PlateIDVehicle // 车辆参数 |
| | | Feature []byte |
| | | BodyFeature []float32 |
| | | Feature string |
| | | ThftRes protomsg.ThftResult |
| | | Liker []*BaseInfo |
| | | TimeLable string |
| | |
| | | Score float64 // 相似度得分(有多大程度像一个目标。人脸,人体或车等等) |
| | | Type string // 记载数据类型 |
| | | ThftRes protomsg.ThftResult |
| | | Feature []byte |
| | | BodyFeature []float32 |
| | | Feature string |
| | | Car *protomsg.PlateIDVehicle |
| | | } |
| | | |