zhangmeng
2019-12-19 9d644c2cef121b42a440a572ff6ebd311f1948be
work/sdk/humantrack.go
@@ -16,8 +16,8 @@
type imageWithID struct {
   img *gohumantrack.ImageHumanTracker
   fx  float32
   fy  float32
   fx  float64
   fy  float64
   id  string
}
@@ -130,13 +130,13 @@
   fx, fy := 1.0, 1.0
   if imgW != rw || imgH != rh {
      imgData = goconv.ResizeBGR(i.Data, imgW, imgH, rw, rh)
      fx = (float32)(rw)/(float32)imgW
      fy = (float32)(rh)/(float32)imgH
      fx = (float64)(rw)/(float64)(imgW)
      fy = (float64)(rh)/(float64)(imgH)
   }
   img := gohumantrack.ImageHumanTracker{
      Data:    i.Data,
      Width:   imgW,
      Height:  imgH,
      Data:    imgData,
      Width:   rw,
      Height:  rh,
      Channel: 3,
   }
@@ -250,21 +250,21 @@
   return res
}
func convert2ProtoHumanTrackResultWithScale(obj gohumantrack.FgResult, fx, fy float32) []*protomsg.HumanTrack {
func convert2ProtoHumanTrackResultWithScale(obj gohumantrack.FgResult, fx, fy float64) []*protomsg.HumanTrack {
   res := []*protomsg.HumanTrack{}
   for i := 0; i < int(obj.FgNum); i++ {
      r := obj.Fginfo[i]
      rect := protomsg.Rect{
         Left:   (int32)((float32)(r.Left)/fx),
         Right:  (int32)((float32)(r.Right)/fy),
         Top:    (int32)((float32)(r.Top)/fx),
         Bottom: (int32)((float32)(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)((float32)(r.X)/fx,
         Y:          (int32)((float32)(r.Y)/fy,
         X:          (int32)((float64)(r.X)/fx),
         Y:          (int32)((float64)(r.Y)/fy),
         Id:         r.ID,
         Feature:    r.Feature[:],
      }