| | |
| | | targetInfos = append(targetInfos, *target) |
| | | |
| | | sdkname := "" |
| | | id := face.Uuid |
| | | switch key { |
| | | case "face": |
| | | sdkname = "人脸" |
| | |
| | | sdkname = "车牌识别" |
| | | case "track": |
| | | sdkname = "跟踪" |
| | | logger.Info("数据到了此处") |
| | | if len(face.Liker) == 1{ |
| | | id = face.Liker[0].TargetId |
| | | } |
| | | } |
| | | //logger.Info("人脸目标target:",targetInfos) |
| | | |
| | | |
| | | if key == "track" && len(face.Liker) == 1{ |
| | | pervideo1 := LinkInfo{ |
| | | id, |
| | | face.Liker[0].TargetId, |
| | | msg.Cid, |
| | | msg.Push.Cam.Addr, |
| | | msg.Push.Cam.Name, |
| | |
| | | ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: face.Uuid, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, VideoUrl: msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{"-1"}, Type: 1}) |
| | | } |
| | | } else { |
| | | id := face.Uuid |
| | | if id == "" { |
| | | // 比到了相似的人但在此摄像机下已经出现过,最后不能插入数据库 |
| | | return |
| | | } |
| | | pervideo := PerVideoPicture{LinkInfo{ |
| | | id, |
| | | msg.Cid, |
| | |
| | | ) |
| | | |
| | | var sender chan []byte = make(chan []byte) |
| | | var receiver chan string = make(chan string) |
| | | var receiver chan map[string]interface{} = make(chan map[string]interface{}) |
| | | |
| | | var sock mangos.Socket |
| | | func Init() { |
| | |
| | | if err != nil { |
| | | logger.Error("json序列化错误", err) |
| | | } |
| | | dataId := getCompareMsg(b) |
| | | if esId == dataId || dataId == ""{ // 说明没比到相似的人 |
| | | result := getCompareMsg(b) |
| | | if esId == result["esId"].(string) || result["esId"].(string) == ""{ // 说明没比到相似的人,是新人 |
| | | logger.Info("没比到人") |
| | | arg.Uuid = esId |
| | | } else { |
| | | logger.Info("比对出来的dataId:",dataId) |
| | | base := structure.BaseInfo{TargetId:dataId} |
| | | } else if result["esId"].(string) != esId && result["compare"].(bool){ // 比到了相似的人且在此摄像机下已经出现过,最后不能插入数据库 |
| | | logger.Info("比对出来的dataId:",result["esId"].(string)) |
| | | arg.Uuid = "" |
| | | } else if result["esId"].(string) != esId && !result["compare"].(bool) { // 比到了相似的人但在此摄像机下未出现过,要插入数据库 |
| | | base := structure.BaseInfo{TargetId:result["esId"].(string)} |
| | | arg.Liker = append(arg.Liker, &base) |
| | | } |
| | | } |
| | |
| | | logger.Error("接收响应失败: %s", err.Error()) |
| | | } |
| | | logger.Debug("数据推送成功!收到响应,数据长度为:",len(msg)) |
| | | receiver <- string(msg) |
| | | recive := make(map[string]interface{}) |
| | | _ = json.Unmarshal(msg,&recive) |
| | | receiver <- recive |
| | | default: |
| | | time.Sleep(time.Millisecond * 10) |
| | | } |
| | | } |
| | | } |
| | | |
| | | func getCompareMsg(data []byte) string{ |
| | | func getCompareMsg(data []byte) map[string]interface{}{ |
| | | sender <- data |
| | | return <- receiver |
| | | } |