panlei
2019-07-05 4749d09f155ccffeff8e473aa1a9d021be7dfcba
util/simpleCV.go
@@ -161,7 +161,7 @@
   }
}
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)
@@ -183,7 +183,11 @@
      }
   }
   // 把目标框出来
   //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)