From ed6ad87a6c92435481de9280dc773c23659fbe2d Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期四, 10 十月 2019 10:36:06 +0800
Subject: [PATCH] sdkNames逗号改成空格

---
 util/simpleCV.go |   33 ++++++++++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/util/simpleCV.go b/util/simpleCV.go
index 6ce97a2..9e48691 100644
--- a/util/simpleCV.go
+++ b/util/simpleCV.go
@@ -9,8 +9,9 @@
 	"image/color"
 	"os"
 	"ruleprocess/cache"
-	"ruleprocess/logger"
+	"basic.com/valib/logger.git"
 	"ruleprocess/ruleserver"
+	"ruleprocess/structure"
 	"strings"
 )
 
@@ -155,7 +156,7 @@
 	}
 }
 
-func DrawPolygonOnImage(cameraId string, img protomsg.Image, results []ruleserver.Result,url string) (maps map[string]interface{}, err0 error) {
+func DrawPolygonOnImageForYolo(cameraId string, img protomsg.Image, results []structure.Result,url string) (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)
@@ -170,7 +171,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)
 			}
 		}
@@ -186,6 +188,31 @@
 	return
 }
 
+func DrawPolygonOnImageForFace(cameraId string, img protomsg.Image, results []structure.FaceResult,url string) (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)
+	defer rook.Close()
+
+	yellow := color.RGBA{255, 255, 0, 0}
+
+	// 鍒嗗壊鍖哄煙id闆嗗悎骞舵牴鎹甶d鏌ヨ鍖哄煙鐒跺悗鐢绘
+	for _,result := range results  {
+		polygonIds := strings.Split(result.AlarmPolygon,",")
+		logger.Info("-----------------------鐪嬬湅鎶ヨ鍖哄煙id锛�",polygonIds)
+		for i := 0; i < len(polygonIds)-1; i++ {
+			polygon := getPolygonById(polygonIds[i],cameraId)
+			if polygon.Polygon != "[]" && polygon.Polygon != ""{
+				logger.Debug("鎵�鐢诲尯鍩燂細",polygon.Polygon)
+				DrawAPolygon(&rook,polygon.Polygon,yellow)
+			}
+		}
+	}
+	//return nil,nil
+	maps,err0 = UploadFromMat(url,rook)
+	return
+}
+
 // 鎶婂浘鐗囪浆鎴愪簩杩涘埗娴�
 func RetrieveROM(filename string) ([]byte, error) {
 	file, err := os.Open(filename)

--
Gitblit v1.8.0