From 51d372c3836b5f8b420bfb8104ce9ffbf2c4d786 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期二, 10 十二月 2019 11:37:37 +0800
Subject: [PATCH] update

---
 goyolo.go |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/goyolo.go b/goyolo.go
index 4d90dc0..76a7a94 100644
--- a/goyolo.go
+++ b/goyolo.go
@@ -68,14 +68,6 @@
 // RatioInterTrack 璺熻釜鍒ゆ柇閲嶅彔闃堝��
 const RatioInterTrack = 50 //璺熻釜鍒ゆ柇閲嶅彔闃堝��
 
-// SDKImage sdk image
-type SDKImage struct {
-	Data    []byte
-	Width   int
-	Height  int
-	Channel int
-}
-
 // NewYolo init yolo sdk
 func NewYolo(fc, fw, fn string, gi int) *YoloHandle {
 
@@ -254,6 +246,13 @@
 
 // YoloDetectTrack yolo detect   (鍙瘑鍒汉)
 func YoloDetectTrack(y *YoloHandle, id string, data []byte, w, h, c int, thrsh float32, umns int) ([]byte, []byte) {
+	if data == nil || w <= 0 || h <= 0 {
+		return nil, nil
+	}
+	channel := c
+	if channel == 0 {
+		channel = 3
+	}
 
 	v, ok := y.tracker[id]
 	if !ok {
@@ -261,7 +260,7 @@
 		y.tracker[id] = i
 		v = i
 	}
-	whole, recent := YoloDetectTrack2(y, v.lastTrackObjs, &v.lastTrackID, data, w, h, c, thrsh, umns)
+	whole, recent := YoloDetectTrack2(y, v.lastTrackObjs, &v.lastTrackID, data, w, h, channel, thrsh, umns)
 	y.tracker[id].lastTrackObjs = whole
 	y.tracker[id].lastTrackID = v.lastTrackID
 

--
Gitblit v1.8.0