| | |
| | | i := protomsg.Image{} |
| | | err = proto.Unmarshal(bdata, &i) |
| | | //resp, err = util.PostFormBufferData(weedfsUrl, i, uuid.NewV4().String()) |
| | | resp, err = util.DrawPolygonOnImage(msg.Cid, i) |
| | | resp, err = util.DrawPolygonOnImage(msg.Cid, i,msg.RuleResult["yolo"].([]ruleserver.Result)) |
| | | if err != nil { |
| | | log.Println("画框或上传图片服务器出错", err) |
| | | } else { |
| | |
| | | continue |
| | | } |
| | | } |
| | | if sdkinfo.Sdktype == "FaceCompare" { |
| | | faceParam := protomsg.ParamFaceFeature{} |
| | | for _,faceExtCom := range faceParam.ExtComp { |
| | | binfos := protomsg.Binfos{} |
| | | err := proto.Unmarshal(faceExtCom.Comp, &binfos) |
| | | if err != nil { |
| | | fmt.Println("解析人脸比对数据时出现错误", err) |
| | | continue |
| | | } |
| | | log.Println("_________________________________________________________________解析出的人脸的相似的底库数据",binfos) |
| | | } |
| | | } |
| | | |
| | | } |
| | | return m |
| | |
| | | } |
| | | } |
| | | |
| | | func DrawPolygonOnImage(cameraId string, img protomsg.Image) (maps map[string]interface{}, err0 error) { |
| | | func DrawPolygonOnImage(cameraId string, img protomsg.Image, results []ruleserver.Result) (maps map[string]interface{}, err0 error) { |
| | | |
| | | rook, _ := gocv.NewMatFromBytes(int(img.Height), int(img.Width), gocv.MatTypeCV8UC3, img.Data) |
| | | //rook := gocv.IMRead("/home/user/workspace/ruleprocess/util/105.jpg",gocv.IMReadColor) |
| | |
| | | } |
| | | } |
| | | // 把目标框出来 |
| | | //gocv.Rectangle() |
| | | for _,result := range results { |
| | | for _,rect := range result.Location { |
| | | gocv.Rectangle(&rook, image.Rect(int(rect.X), int(rect.Y), int(rect.X+rect.Width), int(rect.Y+rect.Height)), red, 1) |
| | | } |
| | | } |
| | | //return nil,nil |
| | | // 上传 |
| | | fdata, _ := gocv.IMEncode(".jpg", rook) |