panlei
2019-09-27 4146578720878b47a3d9d9d2833f1893ae80a032
util/simpleCV.go
@@ -9,7 +9,7 @@
   "image/color"
   "os"
   "ruleprocess/cache"
   "ruleprocess/logger"
   "basic.com/valib/logger.git"
   "ruleprocess/ruleserver"
   "strings"
)
@@ -170,7 +170,8 @@
      logger.Info("-----------------------看看报警区域id:",polygonIds)
      for i := 0; i < len(polygonIds)-1; i++ {
         polygon := getPolygonById(polygonIds[i],cameraId)
         if polygon.Polygon != "[]" {
         if polygon.Polygon != "[]" && polygon.Polygon != ""{
            logger.Debug("所画区域:",polygon.Polygon)
            DrawAPolygon(&rook,polygon.Polygon,yellow)
         }
      }
@@ -225,9 +226,9 @@
   points := ruleserver.Json2points(polygonString)
   for index := 0; index < len(points); index++ {
      if index == len(points)-1 { // 闭合图形
         gocv.Line(rook, image.Pt(int(points[index].X), int(points[index].Y)), image.Pt(int(points[0].X), int(points[0].Y)), color, 2)
         gocv.Line(rook, image.Pt(int(points[index].X*1.33), int(points[index].Y*1.33)), image.Pt(int(points[0].X*1.33), int(points[0].Y*1.33)), color, 2)
      } else {
         gocv.Line(rook, image.Pt(int(points[index].X), int(points[index].Y)), image.Pt(int(points[index+1].X), int(points[index+1].Y)), color, 2)
         gocv.Line(rook, image.Pt(int(points[index].X*1.33), int(points[index].Y*1.33)), image.Pt(int(points[index+1].X*1.33), int(points[index+1].Y*1.33)), color, 2)
      }
   }
}