| | |
| | | |
| | | import ( |
| | | "basic.com/pubsub/protomsg.git" |
| | | "basic.com/valib/logger.git" |
| | | "github.com/gogo/protobuf/proto" |
| | | "github.com/pkg/errors" |
| | | "gocv.io/x/gocv" |
| | | "image" |
| | | "time" |
| | | "basic.com/valib/logger.git" |
| | | ) |
| | | |
| | | type FaceSdkService struct { |
| | |
| | | return nil,err |
| | | } |
| | | logger.Debug("picMat.Data.len:", len(picMat.ToBytes())) |
| | | newMat := gocv.NewMat() |
| | | size := 1024 |
| | | if picMat.Rows() > size || picMat.Cols() > size { |
| | | fx := float64(size)/float64(picMat.Rows()) |
| | | fy := float64(size)/float64(picMat.Cols()) |
| | | ff := fx |
| | | if fx > fy{ |
| | | ff = fy |
| | | } |
| | | gocv.Resize(picMat,&newMat, image.Pt(0,0), ff, ff, gocv.InterpolationDefault) |
| | | picMat = newMat |
| | | } |
| | | |
| | | //图片缩小分辨率 |
| | | //newMat := gocv.NewMat() |
| | | //size := 1024 |
| | | //if picMat.Rows() > size || picMat.Cols() > size { |
| | | // fx := float64(size)/float64(picMat.Rows()) |
| | | // fy := float64(size)/float64(picMat.Cols()) |
| | | // ff := fx |
| | | // if fx > fy{ |
| | | // ff = fy |
| | | // } |
| | | // gocv.Resize(picMat,&newMat, image.Pt(0,0), ff, ff, gocv.InterpolationDefault) |
| | | // picMat = newMat |
| | | //} |
| | | |
| | | defer picMat.Close() |
| | | |