From 2f2078090cfd091bd718ecd63e078cb01b968c93 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期二, 06 八月 2019 15:15:09 +0800 Subject: [PATCH] add ImgCompress --- service/FaceSdkService.go | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/service/FaceSdkService.go b/service/FaceSdkService.go index 148375f..d140ff3 100644 --- a/service/FaceSdkService.go +++ b/service/FaceSdkService.go @@ -34,19 +34,27 @@ ) func GetFaceFeaFromSdk(fileBytes []byte,deadTime time.Duration) ([]*protomsg.ResultFaceDetect,error,*protomsg.Image){ + t1 := time.Now() s := NewFaceSdkService(fileBytes, deadTime) i, err := s.ReadFromUploadImg() + logger.Debug("ReadFromUploadImg鐢ㄦ椂:", time.Since(t1)) + t1 = time.Now() if err !=nil{ logger.Debug("readFromUploadImg err:",err) return nil,err,i } bc, err := ImgCompress(i) + logger.Debug("ImgCompress鐢ㄦ椂:", time.Since(t1)) + t1 = time.Now() if err !=nil { logger.Debug("ImgCompress err:",err) return nil,err,i } s.PushImgMsg(bc) + logger.Debug("PushImgMsg鐢ㄦ椂:", time.Since(t1)) + t1 = time.Now() s.GetFaceFea() + logger.Debug("GetFaceFea鐢ㄦ椂:", time.Since(t1)) if s.Result == nil{ return nil,errors.New("no fea"),i } else { @@ -88,6 +96,7 @@ logger.Debug("gocv.IMDecode err:",err) return nil,err } + logger.Debug("picMat.Data.len:", len(picMat.ToBytes())) newMat := gocv.NewMat() if picMat.Rows() > 1000 || picMat.Cols() > 1000 { gocv.Resize(picMat,&newMat, image.Pt(0,0), 0.5, 0.5, gocv.InterpolationDefault) @@ -95,7 +104,6 @@ } defer picMat.Close() - defer newMat.Close() if picMat.Empty() { logger.Debug("file not exist") @@ -263,7 +271,6 @@ } rMsg := protomsg.SdkMessage{} if err := proto.Unmarshal(resultBytes, &rMsg); err == nil { - logger.Debug("received MSG:", rMsg.Cid) i := protomsg.Image{} bdata, err := util.UnCompress(rMsg.Data) if err !=nil { -- Gitblit v1.8.0