| | |
| | | import ( |
| | | "encoding/base64" |
| | | "encoding/json" |
| | | "gat1400Exchange/client" |
| | | "time" |
| | | |
| | | "gat1400Exchange/client" |
| | | "gat1400Exchange/config" |
| | | "gat1400Exchange/models" |
| | | "gat1400Exchange/pkg/logger" |
| | |
| | | |
| | | // 获取大图, 目前海康的小图分辨率太低 |
| | | for _, image := range face.SubImageList.SubImageInfoObject { |
| | | if imageType != "14" { |
| | | continue |
| | | } |
| | | |
| | | if len(image.Data) > 0 { |
| | | if len(image.Data) > len(bgImageStr) { |
| | | bgImageStr = image.Data |
| | | imageType = image.Type |
| | | } |
| | | } else if image.StoragePath != "" { |
| | | imgData, err := util.ImageDownload(image.StoragePath, nil) |
| | | if err != nil { |
| | | logger.Warn("Image download failure, %s", err.Error()) |
| | | } else { |
| | | bgImageBytes = imgData |
| | | bgImageStr = "///" |
| | | } |
| | | } |
| | | } |
| | | |
| | | if bgImageBytes == nil { |
| | | bgImageBytes, err = base64.StdEncoding.DecodeString(bgImageStr) |
| | | if err != nil { |
| | | logger.Warn("Decode Image Base64 String failure, %s", err.Error()) |
| | | continue |
| | | } |
| | | } |
| | | |
| | | // 判断图片类型是否为场景图, 根据人脸坐标切小图. |
| | |
| | | } |
| | | |
| | | // 转发图像 |
| | | logger.Debug("Prepare forward image, deviceId:%s, image len:%d, server:%s", deviceId, len(bgImageStr), config.ForwardConf.SyncServer) |
| | | logger.Debug("Prepare forward image, deviceId:%s, image len:%d, server:%s", deviceId, len(bgImageBytes), config.ForwardConf.SyncServer) |
| | | if deviceId != "" && bgImageStr != "" && config.ForwardConf.SyncServer != "" { |
| | | pd := c.PackPushDataV2(deviceId, faceId, face.FaceAppearTime, bgImageBytes, faceImageBytes) |
| | | if pd == nil { |
| | | return |
| | | } |
| | | |
| | | // 部署在服务端的1400代理, 仅接收1400信息, 楼层信息暂存在oherFeature字段 |
| | | if config.ServeConf.Role == "proxy" { |
| | | // 处理梯控填写的楼层信息 暂时使用oherFeature字段 |
| | | if face.OtherFeature != "" { |
| | | pd.CameraFloor = face.OtherFeature |
| | | } |
| | | } |
| | | |
| | | payload, err := json.Marshal(pd) |