liuxiaolong
2020-06-02 1e2ef48df6ec8542f82edcdf796759bfeca4bf09
util.go rm gocv
1个文件已修改
16 ■■■■ 已修改文件
extend/util/util.go 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
extend/util/util.go
@@ -8,7 +8,6 @@
    "crypto/tls"
    "encoding/hex"
    "encoding/json"
    "image"
    "io"
    "io/ioutil"
    "net"
@@ -20,12 +19,10 @@
    "webserver/extend/code"
    "basic.com/pubsub/protomsg.git"
    "github.com/gin-gonic/gin"
    "github.com/pierrec/lz4"
    "gocv.io/x/gocv"
    "crypto/rand"
    "fmt"
    "github.com/gin-gonic/gin"
    "github.com/pierrec/lz4"
    "reflect"
    "strings"
)
@@ -96,15 +93,6 @@
        return nil, err
    }
    return pix, nil
}
// 按尺寸去切图
func SubImg(i protomsg.Image, x0, y0, x1, y1 int) []byte {
    img, _ := gocv.NewMatFromBytes(int(i.Height), int(i.Width), gocv.MatTypeCV8UC3, i.Data)
    rect := image.Rect(EnlargeSize(x0, y0, x1, y1, i))
    region := img.Region(rect)
    bytes, _ := gocv.IMEncode(".jpg", region)
    return bytes
}
// 长宽变为一比一,每边各扩百分之20