From 1e24626fa58f488f7744ce94e88a650f05c7a749 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期四, 08 八月 2019 18:53:38 +0800 Subject: [PATCH] add log --- service/FaceSdkService.go | 27 +++++++++++++++++---------- 1 files changed, 17 insertions(+), 10 deletions(-) diff --git a/service/FaceSdkService.go b/service/FaceSdkService.go index 57ddf9f..ca7f185 100644 --- a/service/FaceSdkService.go +++ b/service/FaceSdkService.go @@ -43,14 +43,13 @@ logger.Debug("readFromUploadImg err:",err) return nil,err,i } - bc,_ := proto.Marshal(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 - //} + 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() @@ -97,9 +96,17 @@ 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) + 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 } -- Gitblit v1.8.0