| | |
| | | "ruleprocess/cache" |
| | | "ruleprocess/logger" |
| | | "ruleprocess/ruleserver" |
| | | "ruleprocess/structure" |
| | | "strings" |
| | | ) |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | func DrawPolygonOnImage(cameraId string, img protomsg.Image, results []ruleserver.Result,url string) (maps map[string]interface{}, err0 error) { |
| | | func DrawPolygonOnImage(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) |
| | |
| | | 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) |
| | | } |
| | | } |
| | | } |