config/config.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
config/gat1400.yaml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
repository/captureRepo.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
util/imageTool.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
vo/common.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
config/config.go
@@ -47,14 +47,12 @@ ReportServer string `mapstructure:"report-server"` ReportInterval int `mapstructure:"report-interval"` RetryInterval int `mapstructure:"retry-interval"` Enable bool `mapstructure:"enable"` Enable bool `mapstructure:"enable"` } type image struct { CutFaceImage bool `mapstructure:"cut-face-image"` OriginWidth float64 `mapstructure:"origin-width"` OriginHeight float64 `mapstructure:"origin-height"` CutFaceImage bool `mapstructure:"cut-face-image"` Enlarge int `mapstructure:"enlarge"` } // 梯控设备 @@ -128,5 +126,9 @@ ClientConf.Proto = "http" } if ImageConf.Enlarge == 0 { ImageConf.Enlarge = 100 } logger.SetLogLevel(LogConf.Level) } config/gat1400.yaml
@@ -9,6 +9,7 @@ password: "Aa123456" realm: "Basic Realm" role: "cascade" client: enable: true device-id: "12312312315031200003" @@ -21,6 +22,8 @@ channel-number: "12312312315031200003" heartbeat-interval: 30 heartbeat-count: 3 add-floor-faceId: false nvcs: model: "" port : "" @@ -35,6 +38,11 @@ sync-server: "http://192.168.20.119:9696/api-a/device/alarm" report-server: "http://192.168.20.119:8007/data/api-v/device/inputData" report-interval: 30 retry-interval: 10 image: cut-face-image: false enlarge: 100 # 令牌桶限流配置 rate-limit: repository/captureRepo.go
@@ -3,12 +3,12 @@ import ( "encoding/base64" "encoding/json" "gat1400Exchange/pkg" "time" "gat1400Exchange/client" "gat1400Exchange/config" "gat1400Exchange/models" "gat1400Exchange/pkg" "gat1400Exchange/pkg/logger" "gat1400Exchange/util" "gat1400Exchange/vo" @@ -37,7 +37,6 @@ var deviceId = face.DeviceID var faceId = face.FaceID var bgImageStr string var bgImageWidth, bgImageHeight int var bgImageBytes, faceImageBytes []byte = nil, nil // 获取大图, 目前海康的小图分辨率太低 @@ -46,8 +45,6 @@ continue } bgImageWidth = image.Width bgImageHeight = image.Height if len(image.Data) > 0 { if len(image.Data) > len(bgImageStr) { bgImageStr = image.Data @@ -72,17 +69,15 @@ } // 判断图片类型是否为场景图, 根据人脸坐标切小图. if config.ImageConf.CutFaceImage { scaleX := float64(bgImageWidth) / config.ImageConf.OriginWidth scaleY := float64(bgImageHeight) / config.ImageConf.OriginHeight faceRect := &vo.Rect{ Left: int(float64(face.LeftTopX) * scaleX), Top: int(float64(face.LeftTopY) * scaleY), Right: int(float64(face.RightBtmX) * scaleX), Bottom: int(float64(face.RightBtmY) * scaleY), if config.ImageConf.CutFaceImage && face.LeftTopX != 0 { faceRect := &pkg.Rect{ Left: face.LeftTopX, Top: face.LeftTopY, Right: face.RightBtmX, Bottom: face.RightBtmY, } faceImageBytes, err = util.SubCutImg(bgImageBytes, faceRect, 90) faceImageBytes, err = pkg.SubCutImage(bgImageBytes, faceRect, config.ImageConf.Enlarge) if err != nil { logger.Warn("Cut face image failure, %s", err.Error()) } @@ -118,7 +113,7 @@ c.CacheData(cacheItem, "basic") logger.Warn("The data forwarding failed, adding to local cache.") } else { logger.Debug("The data forwarding successful. deviceId:%s", deviceId) logger.Debug("The data forwarding successful. deviceId:%s, picId:", deviceId, face.FaceID) } } } util/imageTool.go
File was deleted vo/common.go
File was deleted