From 73e4d775a359b5490b5ebc1465f1b9d682a3bbe5 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期四, 07 十一月 2019 19:56:09 +0800
Subject: [PATCH] Merge branch 'module' of http://192.168.5.5:10010/r/ruleprocess into module

---
 ruleserver/readyDataForRule.go |   33 +++++++++++----------------------
 1 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/ruleserver/readyDataForRule.go b/ruleserver/readyDataForRule.go
index 66e2632..7aa9db4 100644
--- a/ruleserver/readyDataForRule.go
+++ b/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"
@@ -13,7 +14,6 @@
 	"nanomsg.org/go-mangos/transport/tcp"
 	"net"
 	"ruleprocess/cache"
-	"basic.com/valib/logger.git"
 	"ruleprocess/structure"
 	"strconv"
 	"time"
@@ -31,8 +31,6 @@
 }
 
 func Init() {
-	//logger.Debug("鏈満淇℃伅鍜宻erver淇℃伅锛�", localConfig, serverIp, serverPort)
-	//bigCache.Init(dbTablePersons, serverIp, serverPort, localConfig.ServerId)
 	go Push1()
 }
 
@@ -63,7 +61,6 @@
 			taskGroup = task
 		}
 	}
-	logger.Debug("褰撳墠鏁版嵁甯ц鍖归厤鐨勮鍒欑粍锛�-------------------------","鎽勫儚鏈篿d:",cameraId,"浠诲姟id",taskId)
 	if taskGroup == nil  {
 		return nil
 	} else {
@@ -78,7 +75,7 @@
 func GetPolygons(cameraId string) []protomsg.CameraPolygon {
 	var cameraPolygons []protomsg.CameraPolygon
 	cameraPolygons = cache.GetPolygonsByCameraId(cameraId)
-	logger.Debug("------=======鏌ョ湅涓嬪叏閮ㄥ尯鍩燂細",cameraPolygons)
+	//logger.Debug("------=======鏌ョ湅涓嬪叏閮ㄥ尯鍩燂細",cameraPolygons)
 	return cameraPolygons
 }
 
@@ -89,16 +86,16 @@
 }
 func Decimal(value float32) float64 {
 	value1, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", float64(value)), 64)
-	logger.Info("鍒濇淇濈暀涓や綅鎴恠tr:",value1)
+	//logger.Info("鍒濇淇濈暀涓や綅鎴恠tr:",value1)
 	n10 := math.Pow10(4)
 	value2 := math.Trunc((value1+0.5/n10)*n10) / n10
-	logger.Info("鍒濇淇濈暀涓や綅鎴恠tr::::",value2)
+	//logger.Info("鍒濇淇濈暀涓や綅鎴恠tr::::",value2)
 	return value2
 }
 // 鍙栧嚭鏌愪釜鏃堕棿瑙勫垯鐨勭鍑犲ぉ鐨勮鍒欐闆嗗悎
-func GetTimeById(id string, index int) []TimeRange {
+func GetTimeById(id string, index int) []structure.TimeRange {
 	_, cameraTimeRule := cache.GetTimeRuleById(id)
-	var timeRangeList []day
+	var timeRangeList []structure.Day
 	err := json.Unmarshal([]byte(cameraTimeRule.TimeRule), &timeRangeList)
 	if err != nil {
 		logger.Error("鍙栨椂闂磋鍒欐椂鍙嶅簭鍒楀寲閿欒锛�")
@@ -123,14 +120,7 @@
 	return 0
 }
 
-type TimeRange struct {
-	Start string `json:"start"`
-	End   string `json:"end"`
-}
-type day struct {
-	Day       int         `json:"day"`        // 鏍囩ず褰撳墠鏄熸湡鍑�
-	TimeRange []TimeRange `json:"time_range"` // 褰撳ぉ鐨勫嚑涓椂闂存
-}
+
 
 // 灏嗗瓧绗︿覆鏍煎紡鐨勫潗鏍囧簭鍒楀寲涓篜oint鏍煎紡
 func Json2points(areaPoints string) []Point {
@@ -162,7 +152,6 @@
 	}
 
 	bytes := getCompareMsg(comArg)
-	//bytes := []byte{}
 	var scResult protomsg.SdkCompareResult
 	err1 := proto.Unmarshal(bytes, &scResult)
 	if err1 != nil {
@@ -284,11 +273,12 @@
 	size := 0.0            // 灏哄
 
 	areaPoints := Json2points(a.AreaJson)
-	widthScale := float64(arg.ImageWidth / 960)
-	heigthScale := float64(arg.ImageHeight / 540)
+	logger.Info("鐪嬬湅鍥剧墖鐨剋idth鍜宧eight:",arg.ImageWidth,arg.ImageHeight)
+	widthScale := float64(arg.ImageWidth) / 960
+	heigthScale := float64(arg.ImageHeight) / 540
 	for _, obj := range arg.Photo {
 		//logger.Info("------------------鐪嬬湅sdkData:", arg.SdkName, "鐨凱hoto鏁版嵁----------------", obj, "----椤轰究鐪嬬湅鍗犳瘮-----锛�", PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale))
-		if threshold <= obj.Score && size <= float64(obj.Rects.Width*obj.Rects.Height) && intersectionper <= PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale) {
+		if  obj.Score >= threshold && float64(obj.Rects.Width*obj.Rects.Height) >= size && PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale) >= intersectionper {
 			// 杩欐瑕佸榻愯〃杈惧紡閲屾墍闇�瑕佺殑鎵�鏈夊弬鏁�
 			a.TargetNum++
 			arg1 := structure.Arg{obj.Id,obj.Score, PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), obj.IsYolo, obj.Rects, obj.Feature, obj.ThftRes, []*structure.BaseInfo{}}
@@ -358,7 +348,6 @@
 	logger.Debug("鏁版嵁鎺ㄩ�佹垚鍔燂紒鏀跺埌鍝嶅簲,鏁版嵁闀垮害涓猴細",len(msg))
 	return msg
 }
-
 
 func Push1(){
 	//var sock mangos.Socket

--
Gitblit v1.8.0