From 40548939ef77b6971adafc5e2a1db7e571f31139 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期四, 19 十二月 2019 16:07:29 +0800 Subject: [PATCH] update --- work/sdk/humantrack.go | 18 +++++++++--------- gohumantrack/gohumantrack.go | 5 +++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/gohumantrack/gohumantrack.go b/gohumantrack/gohumantrack.go index 23855ad..76d3d5c 100644 --- a/gohumantrack/gohumantrack.go +++ b/gohumantrack/gohumantrack.go @@ -172,7 +172,7 @@ } // ProcessImagePointer process -func (h *HumanTracker) ProcessImagePointer(imgs []*ImageHumanTracker) ([]FgResult, error) { +func (h *HumanTracker) ProcessImagePointer(imgs []*ImageHumanTracker, w, h, c int) ([]FgResult, error) { if len(imgs) != h.batchSize { return nil, errors.New("input images count doesn't equalize to batchsize") } @@ -184,7 +184,8 @@ for k, v := range imgs { logo.Infoln("batch~~~~~~", k, " image: ", v) if v == nil { - C.fill_images(cImgs, C.int(h.batchSize), C.int(k), nil, 0, 0, 0) + fake := make([]byte, w*h*c) + C.fill_images(cImgs, C.int(h.batchSize), C.int(k), unsafe.Pointer(&fake[0]), C.int(w), C.int(h), C.int(c)) } else { C.fill_images(cImgs, C.int(h.batchSize), C.int(k), unsafe.Pointer(&v.Data[0]), C.int(v.Width), C.int(v.Height), C.int(v.Channel)) } diff --git a/work/sdk/humantrack.go b/work/sdk/humantrack.go index 3fe8bc9..46ad033 100644 --- a/work/sdk/humantrack.go +++ b/work/sdk/humantrack.go @@ -130,8 +130,8 @@ fx, fy := 1.0, 1.0 if imgW != rw || imgH != rh { imgData = goconv.ResizeBGR(i.Data, imgW, imgH, rw, rh) - fx = (float64)(rw)/(float64)(imgW) - fy = (float64)(rh)/(float64)(imgH) + fx = (float64)(rw) / (float64)(imgW) + fy = (float64)(rh) / (float64)(imgH) } img := gohumantrack.ImageHumanTracker{ Data: imgData, @@ -176,7 +176,7 @@ } } - res, err := t.tracker.ProcessImagePointer(pimg) + res, err := t.tracker.ProcessImagePointer(pimg, rw, rh, 3) t.recvImageCount = 0 if err != nil { @@ -255,16 +255,16 @@ for i := 0; i < int(obj.FgNum); i++ { r := obj.Fginfo[i] rect := protomsg.Rect{ - Left: (int32)((float64)(r.Left)/fx), - Right: (int32)((float64)(r.Right)/fy), - Top: (int32)((float64)(r.Top)/fx), - Bottom: (int32)((float64)(r.Bottom)/fy), + Left: (int32)((float64)(r.Left) / fx), + Right: (int32)((float64)(r.Right) / fy), + Top: (int32)((float64)(r.Top) / fx), + Bottom: (int32)((float64)(r.Bottom) / fy), } pr := &protomsg.HumanTrack{ RcHuman: &rect, Confidence: r.Confidence, - X: (int32)((float64)(r.X)/fx), - Y: (int32)((float64)(r.Y)/fy), + X: (int32)((float64)(r.X) / fx), + Y: (int32)((float64)(r.Y) / fy), Id: r.ID, Feature: r.Feature[:], } -- Gitblit v1.8.0