From da61291c0c526b82c85a1be09234ee4302b098ed Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期一, 04 十一月 2019 13:39:16 +0800
Subject: [PATCH] ---

---
 util/simpleCV.go |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/util/simpleCV.go b/util/simpleCV.go
index 68200f3..a3ca1c3 100644
--- a/util/simpleCV.go
+++ b/util/simpleCV.go
@@ -164,7 +164,7 @@
 
 	yellow := color.RGBA{255, 255, 0, 0}
 	red := color.RGBA{255, 0, 0, 0}
-	scale := img.Width / 960 // 鐢诲浘姣斾緥
+	scale := float64(img.Width) / 960 // 鐢诲浘姣斾緥
 	logger.Info("width:",img.Width,"--鐢诲浘姣斾緥锛�",scale)
 	// 鍒嗗壊鍖哄煙id闆嗗悎骞舵牴鎹甶d鏌ヨ鍖哄煙鐒跺悗鐢绘
 	for _,result := range results  {
@@ -196,7 +196,7 @@
 	defer rook.Close()
 
 	yellow := color.RGBA{255, 255, 0, 0}
-	scale := img.Width / 960 // 鐢诲浘姣斾緥
+	scale := float64(img.Width) / 960 // 鐢诲浘姣斾緥
 	// 鍒嗗壊鍖哄煙id闆嗗悎骞舵牴鎹甶d鏌ヨ鍖哄煙鐒跺悗鐢绘
 	for _,result := range results  {
 		polygonIds := strings.Split(result.AlarmPolygon,",")
@@ -253,14 +253,13 @@
 	return protomsg.CameraPolygon{}
 }
 // 鍦ㄥ浘涓婄敾涓�涓
-func DrawAPolygon(rook *gocv.Mat,polygonString string, color color.RGBA,scale int32) {
+func DrawAPolygon(rook *gocv.Mat,polygonString string, color color.RGBA,scale float64) {
 	points := ruleserver.Json2points(polygonString)
-	logger.Info("int32杞负float64锛�",float64(scale))
 	for index := 0; index < len(points); index++ {
 		if index == len(points)-1 { // 闂悎鍥惧舰
-			gocv.Line(rook, image.Pt(int(points[index].X * float64(scale)), int(points[index].Y * float64(scale))), image.Pt(int(points[0].X * float64(scale)), int(points[0].Y * float64(scale))), color, 2)
+			gocv.Line(rook, image.Pt(int(points[index].X * scale), int(points[index].Y * scale)), image.Pt(int(points[0].X * scale), int(points[0].Y * scale)), color, 2)
 		} else {
-			gocv.Line(rook, image.Pt(int(points[index].X * float64(scale)), int(points[index].Y * float64(scale))), image.Pt(int(points[index+1].X * float64(scale)), int(points[index+1].Y * float64(scale))), color, 2)
+			gocv.Line(rook, image.Pt(int(points[index].X * scale), int(points[index].Y * scale)), image.Pt(int(points[index+1].X * scale), int(points[index+1].Y * scale)), color, 2)
 		}
 	}
 }

--
Gitblit v1.8.0