panlei
2019-10-11 6ed5521a978b330b990f2c4092e729207fca2412
ruleserver/readyDataForRule.go
@@ -3,6 +3,7 @@
import (
   "basic.com/dbapi.git"
   "basic.com/pubsub/protomsg.git"
   "basic.com/valib/logger.git"
   "encoding/json"
   "errors"
   "fmt"
@@ -15,7 +16,6 @@
   "nanomsg.org/go-mangos/transport/tcp"
   "net"
   "ruleprocess/cache"
   "ruleprocess/logger"
   "ruleprocess/structure"
   "strconv"
   "time"
@@ -81,10 +81,14 @@
      }
   }
   logger.Debug("当前数据帧要匹配的规则组:-------------------------","摄像机id:",cameraId,"任务id",taskId)
   for _,ruleGroup := range taskGroup.GroupRules{
      logger.Info(ruleGroup.GroupText)
   if taskGroup == nil  {
      return nil
   } else {
      for _,ruleGroup := range taskGroup.GroupRules{
         logger.Info(ruleGroup.GroupText)
      }
      return taskGroup
   }
   return taskGroup
}
// 根据摄像机id拿到摄像机所有区域
@@ -139,14 +143,14 @@
// 将字符串格式的坐标序列化为Point格式
func Json2points(areaPoints string) []structure.Point {
   var pts []structure.Point
func Json2points(areaPoints string) []Point {
   var pts []Point
   if areaPoints == "[]" || areaPoints == "" {
      logger.Error("=====================此区域为全部区域")
      pts = append(pts, structure.Point{0, 0})
      pts = append(pts, structure.Point{0, 540})
      pts = append(pts, structure.Point{960, 540})
      pts = append(pts, structure.Point{960, 0})
      pts = append(pts, Point{0, 0})
      pts = append(pts, Point{0, 540})
      pts = append(pts, Point{960, 540})
      pts = append(pts, Point{960, 0})
   } else {
      err := json.Unmarshal([]byte(areaPoints), &pts)
      if err != nil {
@@ -284,7 +288,7 @@
func CountAreaObjs(a *structure.AreaMap,arg *structure.SdkData) {
   a.TargetNum = 0
   threshold := 0.0       // 相似度
   threshold := 0.5       // 相似度
   intersectionper := 0.2 // 占比
   size := 0.0            // 尺寸