From 8added81d3fa7aa2616711a80e3a3edf71840f6a Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期二, 02 七月 2019 20:23:01 +0800
Subject: [PATCH] ---

---
 util/image.go |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/util/image.go b/util/image.go
index 2673449..bb30a89 100644
--- a/util/image.go
+++ b/util/image.go
@@ -3,6 +3,7 @@
 import (
 	"gocv.io/x/gocv"
 	"image"
+	"log"
 )
 // 鎸夊昂瀵稿幓鍒囧浘
 func Subimg(dbyte []byte,x0,y0,x1,y1 int,) []byte{
@@ -24,9 +25,10 @@
 	//f, _ := os.Create("./test.jpg")     			  //鍒涘缓鏂囦欢
 	//defer f.Close()                   					  //鍏抽棴鏂囦欢
 	//jpeg.Encode(f, subImg, nil)       				  //鍐欏叆鏂囦欢
-
-	img,_ := gocv.NewMatFromBytes(int(y1-y0),int(x1-x0),gocv.MatTypeCV8UC3,dbyte)
-	region := img.Region(image.Rectangle{image.Point{x0,y0},image.Point{x1,y1}})
+	log.Println("--------------------------鍥涘ぇ閲戝垰锛�",x0,y0,x1,y1)
+	img,_ := gocv.NewMatFromBytes(50,50,gocv.MatTypeCV8UC3,dbyte)
+	rect := image.Rect(x0,y0,x0+50,y0+50)
+	region := img.Region(rect)
 	bytes, _ := gocv.IMEncode(".jpg", region)
 	return bytes
-}
\ No newline at end of file
+}

--
Gitblit v1.8.0