| | |
| | | |
| | | type AlarmRule struct { |
| | | GroupId string `json:"groupId"` |
| | | AlarmLevel `json:"alarmLevel"` |
| | | AlarmLevel string `json:"alarmLevel"` |
| | | RuleText string `json:"ruleText"` |
| | | } |
| | | |
| | |
| | | func InsertToEs(msg ruleserver.ResultMsg) { |
| | | |
| | | // 直接从规则的标签数据里拿符合规则的人脸结果 |
| | | if msg.RuleResult["faces"] != nil && len(msg.RuleResult["faces"].([]ruleserver.Arg)) > 0 { |
| | | if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]ruleserver.Arg)) > 0 { |
| | | log.Println("往ES插人脸数据") |
| | | for _, face := range msg.RuleResult["faces"].([]ruleserver.Arg) { |
| | | for _, face := range msg.RuleResult["face"].([]ruleserver.Arg) { |
| | | // 上传大图 |
| | | // 解压缩并上传图片 |
| | | bdata, err := util.UnCompress(msg.Data) |
| | |
| | | } |
| | | i := protomsg.Image{} |
| | | err = proto.Unmarshal(bdata, &i) |
| | | i1 := protomsg.Image{} |
| | | i1 = util.Subimg(i.Data, int(face.Location.X), int(face.Location.Y), int(face.Location.X+face.Location.Width), int(face.Location.Y+face.Location.Height)) |
| | | resp, err := util.PostFormBufferData(weedfsUrl, i1, uuid.NewV4().String()) |
| | | log.Println("======================================看看这个框:",face.Location) |
| | | bytes := util.Subimg(i.Data, int(face.Location.X), int(face.Location.Y), int(face.Location.X+face.Location.Width), int(face.Location.Y+face.Location.Height)) |
| | | resp, err := util.PostFormBufferData1(weedfsUrl, bytes, uuid.NewV4().String()) |
| | | if err != nil { |
| | | log.Println("上传小图出错") |
| | | } |