From a7817b91bc678223fe4224bbba813b1097715748 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期一, 02 十二月 2019 16:19:21 +0800
Subject: [PATCH] update

---
 gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so            |    0 
 runtime/libnvinfer.so.5                                      |    0 
 gohumantrack/sdk/c_include/c_human_tracker.h                 |   89 ++++++++++++++
 runtime/libopencv_video.so.2.4.13                            |    0 
 runtime/libopencv_video.so.2.4                               |    0 
 go.mod                                                       |    2 
 gohumantrack/opencv-2.4.13/lib/libopencv_video.so.2.4        |    0 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so         |    0 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so.5.1.2 |    0 
 gohumantrack/opencv-2.4.13/lib/libopencv_video.so            |    0 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so.0.1.0   |    0 
 gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so          |    0 
 gohumantrack/sdk/libs/libmidHumanTrack.so                    |    0 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so              |    0 
 gohumantrack/opencv-2.4.13/lib/libopencv_core.so             |    0 
 gohumantrack/gohumantrack.go                                 |   95 +++++++++------
 runtime/libcffmpeg.so                                        |    0 
 runtime/libnvparsers.so.5.1.2                                |    0 
 gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so.2.4.13   |    0 
 runtime/libnvcaffe_parser.so                                 |    0 
 runtime/libnvonnxparser.so                                   |    0 
 runtime/libopencv_highgui.so.2.4                             |    0 
 gohumantrack/opencv-2.4.13/lib/libopencv_core.so.2.4         |    0 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so.5          |    0 
 runtime/libnvinfer.so.5.1.2                                  |    0 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so.5            |    0 
 gohumantrack/sdk/cpp_include/sy_human_tracker.h              |   49 +------
 runtime/libnvparsers.so.5                                    |    0 
 runtime/libopencv_imgproc.so                                 |    0 
 go.sum                                                       |    4 
 main.go                                                      |   94 +++++++++------
 gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so.5.1.2        |    0 
 runtime/libnvinfer_plugin.so                                 |    0 
 runtime/libutools.so                                         |    0 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so.5.1.2 |    0 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so.5.1.2      |    0 
 .gitignore                                                   |    2 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so       |    0 
 gohumantrack/sdk/libs/libutools.so                           |    0 
 runtime/libnvinfer_plugin.so.5.1.2                           |    0 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so       |    0 
 runtime/libnvinfer.so                                        |    0 
 runtime/libopencv_video.so                                   |    0 
 runtime/libopencv_core.so.2.4.13                             |    0 
 runtime/libopencv_imgproc.so.2.4                             |    0 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so.5     |    0 
 gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so          |    0 
 runtime/libopencv_core.so                                    |    0 
 runtime/libHumanTracker.so                                   |    0 
 runtime/libnvonnxparser.so.0.1.0                             |    0 
 runtime/libopencv_imgproc.so.2.4.13                          |    0 
 gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so.2.4.13   |    0 
 runtime/libopencv_highgui.so.2.4.13                          |    0 
 runtime/librtspclient.so                                     |    0 
 gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so.2.4      |    0 
 runtime/libnvcaffe_parser.so.5                               |    0 
 runtime/libopencv_core.so.2.4                                |    0 
 gohumantrack/opencv-2.4.13/lib/libopencv_video.so.2.4.13     |    0 
 gohumantrack/opencv-2.4.13/lib/libopencv_core.so.2.4.13      |    0 
 runtime/libnvinfer_plugin.so.5                               |    0 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so.0       |    0 
 /dev/null                                                    |    1 
 gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so.2.4      |    0 
 runtime/libutools.so.1.1.0                                   |    0 
 runtime/libnvonnxparser.so.0                                 |    0 
 runtime/libopencv_highgui.so                                 |    0 
 gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so.5     |    0 
 runtime/libnvparsers.so                                      |    0 
 runtime/libStreamParse.so                                    |    0 
 runtime/libmidHumanTrack.so                                  |    0 
 runtime/libnvcaffe_parser.so.5.1.2                           |    0 
 71 files changed, 213 insertions(+), 123 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..553d97f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.avi
+track
diff --git a/go.mod b/go.mod
index 8470ffa..5af2311 100644
--- a/go.mod
+++ b/go.mod
@@ -2,4 +2,4 @@
 
 go 1.12
 
-require gocv.io/x/gocv v0.21.0
+require basic.com/valib/goffmpeg.git v0.0.0-20191129092141-7363d175bd62
diff --git a/go.sum b/go.sum
index 631f4be..4bb58e5 100644
--- a/go.sum
+++ b/go.sum
@@ -1,2 +1,2 @@
-gocv.io/x/gocv v0.21.0 h1:dVjagrupZrfCRY0qPEaYWgoNMRpBel6GYDH4mvQOK8Y=
-gocv.io/x/gocv v0.21.0/go.mod h1:Rar2PS6DV+T4FL+PM535EImD/h13hGVaHhnCu1xarBs=
+basic.com/valib/goffmpeg.git v0.0.0-20191129092141-7363d175bd62 h1:KzkPzJE76RkHeYBgAMfSiz1vzJaQRKkRDCXnw2XmxqA=
+basic.com/valib/goffmpeg.git v0.0.0-20191129092141-7363d175bd62/go.mod h1:1x75Hawh/BjgPsQtuJ24px89gzk3uAslD8e0Xs6Z7GQ=
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so b/gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so
new file mode 100755
index 0000000..58c43f7
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so.5 b/gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so.5
new file mode 100755
index 0000000..58c43f7
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so.5
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so.5.1.2 b/gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so.5.1.2
new file mode 100755
index 0000000..58c43f7
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so.5.1.2
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so b/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so
new file mode 100755
index 0000000..3c98d5d
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so.5 b/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so.5
new file mode 100755
index 0000000..3c98d5d
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so.5
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so.5.1.2 b/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so.5.1.2
new file mode 100755
index 0000000..3c98d5d
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so.5.1.2
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so b/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so
new file mode 100755
index 0000000..849d3d2
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so.5 b/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so.5
new file mode 100755
index 0000000..849d3d2
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so.5
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so.5.1.2 b/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so.5.1.2
new file mode 100755
index 0000000..849d3d2
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so.5.1.2
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so b/gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so
new file mode 100644
index 0000000..8078dc2
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so.0 b/gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so.0
new file mode 100644
index 0000000..8078dc2
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so.0
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so.0.1.0 b/gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so.0.1.0
new file mode 100644
index 0000000..8078dc2
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so.0.1.0
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so b/gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so
new file mode 100755
index 0000000..58c43f7
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so.5 b/gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so.5
new file mode 100755
index 0000000..58c43f7
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so.5
Binary files differ
diff --git a/gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so.5.1.2 b/gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so.5.1.2
new file mode 100755
index 0000000..58c43f7
--- /dev/null
+++ b/gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so.5.1.2
Binary files differ
diff --git a/gohumantrack/gohumantrack.go b/gohumantrack/gohumantrack.go
index 791b3bc..b0a8198 100644
--- a/gohumantrack/gohumantrack.go
+++ b/gohumantrack/gohumantrack.go
@@ -1,39 +1,45 @@
 package gohumantrack
 
 /*
-#cgo CFLAGS: -I${SRCDIR}/sdk/include -I/usr/local/cuda/include -w -g
+#cgo CFLAGS: -I${SRCDIR}/sdk -w -g
 #cgo LDFLAGS: -L/usr/local/cuda/lib64 -L${SRCDIR}/sdk/libs
-#cgo LDFLAGS: -Wl,-rpath,${SRCDIR}/sdk/libs
-#cgo LDFLAGS: -lHumanTracker -lutools -ldl -lpthread -lm
+#cgo LDFLAGS: -L${SRCDIR}/opencv-2.4.13/lib -L${SRCDIR}/TensorRT-5.1.2.2/lib
+#cgo LDFLAGS: -Wl,-rpath,${SRCDIR}/sdk/libs:${SRCDIR}/TensorRT-5.1.2.2:${SRCDIR}/opencv-2.4.13
+#cgo LDFLAGS: -lmidHumanTrack -lHumanTracker -lutools
+#cgo LDFLAGS: -lcudart -lcublas -lcurand -lcusolver -lcudnn
+#cgo LDFLAGS: -lnppc -lnppicom
+#cgo LDFLAGS: -lnvrtc -lnvinfer -lnvinfer_plugin -lnvparsers -lnvonnxparser
+#cgo LDFLAGS: -lopencv_video -lopencv_highgui
+#cgo LDFLAGS: -ldl -lpthread -lm
 
 #include <stdlib.h>
-#include "sy_human_tracker.h"
-
-typedef void* hdl_human_tracker;
+#include "c_include/c_human_tracker.h"
 
 void *create_batch_image(const int size){
-	sy_img *imgs = (sy_img*)malloc(size * sizeof(sy_img));
+	c_img *imgs = (c_img*)malloc(size * sizeof(c_img));
 	return imgs;
 }
 int fill_images(void *imgs, const int size, const int index, void *data, const int w, const int h, const int c){
 	if(!imgs || !data || size <= index) return -1;
-	sy_img *images = (sy_img*)imgs;
+	c_img *images = (c_img*)imgs;
 	images[index].data_ = data;
 	images[index].w_ = w;
 	images[index].h_ = h;
 	images[index].c_ = c;
 	return index;
 }
+
 void *init_fgres(const int size){
-	fgRet *ret = (fgRet*)malloc(size * sizeof(fgRet));
+	c_fgRet *ret = (c_fgRet*)malloc(size * sizeof(c_fgRet));
 	for(int i = 0; i < size; i++){
 		ret[i].fgNum = 0;
 	}
+	return ret;
 }
 void *process(void *handle, void *imgs, const int size){
-	sy_img *images = (sy_img*)imgs;
-	fgRet *res = init_fgres(size);
-	int ret = human_tracker_process(handle, images, size, res);
+	c_img *images = (c_img*)imgs;
+	c_fgRet *res = init_fgres(size);
+	int ret = c_human_tracker_process(handle, images, size, res);
 	if (ret != 0)
 		return NULL;
 	return res;
@@ -64,21 +70,17 @@
 // int ID;//琛屼汉璺熻釜ID
 // float feature[FEATURESIZE];//琛屼汉涓撳睘鐗瑰緛锛屽彲鐢ㄦ潵鍋歊eID
 
-const (
-	MAX_BG_NUM  = 2000
-	FEATURESIZE = 128
-)
-
 // FgInfo info
 type FgInfo struct {
-	Left       int
-	Right      int
-	Top        int
-	Bottom     int
+	Left       int32
+	Right      int32
+	Top        int32
+	Bottom     int32
 	Confidence float32
-	CenterX    int
-	CenterY    int
-	Feature    [FEATURESIZE]float32
+	X          int32
+	Y          int32
+	ID         int32
+	Feature    [128]float32
 }
 
 // fgInfo fginfo[MAX_BG_NUM];//涓婅堪缁撴瀯浣擄紝浠h〃涓�骞呭浘涓墍鏈夌殑妗嗭紝鏈�澶ф敮鎸�2000涓锛屾殏涓嶅彲淇敼
@@ -86,13 +88,13 @@
 
 // FgResult result
 type FgResult struct {
-	Infos [MAX_BG_NUM]FgInfo
-	FgNum int
+	Fginfo [2000]FgInfo
+	FgNum  int32
 }
 
 // HumanTracker struct
 type HumanTracker struct {
-	handle    C.hdl_human_tracker
+	handle    unsafe.Pointer
 	batchSize int
 }
 
@@ -101,7 +103,7 @@
 	if gpu == -1 {
 		return nil
 	}
-	p := C.human_tracker_create(C.int(gpu), C.int())
+	p := C.c_human_tracker_create(C.int(gpu), C.int(batchSize), C.int(flag))
 	if p != nil {
 		return &HumanTracker{p, batchSize}
 	}
@@ -111,7 +113,7 @@
 // Free free
 func (h *HumanTracker) Free() {
 	if h.handle != nil {
-		C.human_tracker_release(&h.handle)
+		C.c_human_tracker_release(&h.handle)
 	}
 }
 
@@ -120,11 +122,11 @@
 	if h.handle == nil {
 		return "human tracker handle null"
 	}
-	ver := C.getVersion()
+	ver := C.c_getVersion()
 	if ver == nil {
 		return "get version string null"
 	}
-	return C.CString(ver)
+	return C.GoString(ver)
 }
 
 // Process process
@@ -132,40 +134,40 @@
 	if len(imgs) != h.batchSize {
 		return nil, errors.New("input images count doesn't equalize to batchsize")
 	}
-	cImgs := C.create_batch_image(h.batchSize)
+	cImgs := C.create_batch_image(C.int(h.batchSize))
 	if cImgs == nil {
 		return nil, errors.New("create C images error")
 	}
 	defer C.free(cImgs)
 	for k, v := range imgs {
-		ret := C.fill_images(cImgs, h.batchSize, k, unsafe.Pointer(&v.Data[0]), C.int(v.Width), C.int(v.Height), C.int(v.Channel))
-		if ret != k {
+		ret := 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))
+		if int(ret) != k {
 			return nil, errors.New("fill C images error")
 		}
 	}
 
-	cRet := C.process(h.handle, cImgs, h.batchSize)
+	cRet := C.process(h.handle, cImgs, C.int(h.batchSize))
 	if cRet == nil {
 		return nil, errors.New("create C results error")
 	}
-	defer C.free(cRet)
+	defer C.free(unsafe.Pointer(cRet))
 
 	var result []FgResult
 	p := uintptr(cRet)
 	for i := 0; i < h.batchSize; i++ {
 		j := *(*FgResult)(unsafe.Pointer(p))
-		FgResult = append(FgResult, j)
+		result = append(result, j)
 		p += unsafe.Sizeof(j)
 	}
-	return
+	return result, nil
 }
 
 // FFSimilarity similarity
-func FFSimilarity(feaA, feaB [FEATURESIZE]float32) float64 {
+func FFSimilarity(feaA, feaB [128]float32) float64 {
 	var norm1, norm2 float64
 	var score float64
 
-	for i := 0; i < FEATURESIZE; i++ {
+	for i := 0; i < 128; i++ {
 		norm1 += float64(feaA[i]) * float64(feaA[i])
 		norm2 += float64(feaB[i]) * float64(feaB[i])
 		score += float64(feaA[i]) * float64(feaB[i])
@@ -182,3 +184,16 @@
 	return score
 
 }
+
+// CFFSimilarity use c code
+func CFFSimilarity(feaA, feaB []float32) (float64, error) {
+	if len(feaA) != len(feaB) {
+		return 0, errors.New("Must be same length")
+	}
+	if len(feaA) != 128 || len(feaB) != 128 {
+		return 0, errors.New("Must be 128 size")
+	}
+
+	s := C.c_FF_Similarity((*C.float)(&feaA[0]), (*C.float)(&feaB[0]))
+	return float64(s), nil
+}
diff --git a/gohumantrack/opencv-2.4.13/lib/libopencv_core.so b/gohumantrack/opencv-2.4.13/lib/libopencv_core.so
new file mode 100755
index 0000000..3ed279e
--- /dev/null
+++ b/gohumantrack/opencv-2.4.13/lib/libopencv_core.so
Binary files differ
diff --git a/gohumantrack/opencv-2.4.13/lib/libopencv_core.so.2.4 b/gohumantrack/opencv-2.4.13/lib/libopencv_core.so.2.4
new file mode 100755
index 0000000..3ed279e
--- /dev/null
+++ b/gohumantrack/opencv-2.4.13/lib/libopencv_core.so.2.4
Binary files differ
diff --git a/gohumantrack/opencv-2.4.13/lib/libopencv_core.so.2.4.13 b/gohumantrack/opencv-2.4.13/lib/libopencv_core.so.2.4.13
new file mode 100755
index 0000000..3ed279e
--- /dev/null
+++ b/gohumantrack/opencv-2.4.13/lib/libopencv_core.so.2.4.13
Binary files differ
diff --git a/gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so b/gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so
new file mode 100755
index 0000000..1efd1d1
--- /dev/null
+++ b/gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so
Binary files differ
diff --git a/gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so.2.4 b/gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so.2.4
new file mode 100755
index 0000000..1efd1d1
--- /dev/null
+++ b/gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so.2.4
Binary files differ
diff --git a/gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so.2.4.13 b/gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so.2.4.13
new file mode 100755
index 0000000..1efd1d1
--- /dev/null
+++ b/gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so.2.4.13
Binary files differ
diff --git a/gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so b/gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so
new file mode 100755
index 0000000..adb79cd
--- /dev/null
+++ b/gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so
Binary files differ
diff --git a/gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so.2.4 b/gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so.2.4
new file mode 100755
index 0000000..adb79cd
--- /dev/null
+++ b/gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so.2.4
Binary files differ
diff --git a/gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so.2.4.13 b/gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so.2.4.13
new file mode 100755
index 0000000..adb79cd
--- /dev/null
+++ b/gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so.2.4.13
Binary files differ
diff --git a/gohumantrack/opencv-2.4.13/lib/libopencv_video.so b/gohumantrack/opencv-2.4.13/lib/libopencv_video.so
new file mode 100755
index 0000000..769ca07
--- /dev/null
+++ b/gohumantrack/opencv-2.4.13/lib/libopencv_video.so
Binary files differ
diff --git a/gohumantrack/opencv-2.4.13/lib/libopencv_video.so.2.4 b/gohumantrack/opencv-2.4.13/lib/libopencv_video.so.2.4
new file mode 100755
index 0000000..769ca07
--- /dev/null
+++ b/gohumantrack/opencv-2.4.13/lib/libopencv_video.so.2.4
Binary files differ
diff --git a/gohumantrack/opencv-2.4.13/lib/libopencv_video.so.2.4.13 b/gohumantrack/opencv-2.4.13/lib/libopencv_video.so.2.4.13
new file mode 100755
index 0000000..769ca07
--- /dev/null
+++ b/gohumantrack/opencv-2.4.13/lib/libopencv_video.so.2.4.13
Binary files differ
diff --git a/gohumantrack/sdk/c_include/c_human_tracker.h b/gohumantrack/sdk/c_include/c_human_tracker.h
new file mode 100755
index 0000000..3fdeacb
--- /dev/null
+++ b/gohumantrack/sdk/c_include/c_human_tracker.h
@@ -0,0 +1,89 @@
+#ifndef C_HUMAN_TRACKER
+#define C_HUMAN_TRACKER
+
+#include <string.h>
+#define MAX_BG_NUM 2000
+#define FEATURESIZE 128
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//ImgData
+#ifndef __C_IMG__
+#define __C_IMG__
+typedef struct c_img
+{
+	unsigned char * data_;//鎸塷pencv Mat鏍煎紡瀛樺偍鐨勫浘鍍忔暟鎹�(bgrbgrbgr鈥�)
+	int w_;//鍥惧儚瀹藉害
+	int h_;//鍥惧儚楂樺害
+	int c_;//鍥惧儚閫氶亾鏁帮紝鐩墠浠呮敮鎸�3閫氶亾
+} c_img;
+
+void set_data(c_img img, int m_w, int m_h, int m_c, unsigned char * m_data);
+
+#endif
+
+typedef struct c_fgInfo {
+    int left;//琛屼汉鍖呭洿妗嗗乏涓婅妯潗鏍�
+    int right;//琛屼汉鍖呭洿妗嗗彸涓嬭妯潗鏍�
+    int top;//琛屼汉鍖呭洿妗嗗乏涓婅绾靛潗鏍�
+    int bottom;//琛屼汉鍖呭洿妗嗗彸涓嬭绾靛潗鏍�
+    float confidence;//琛屼汉妫�娴嬫缃俊搴﹀緱鍒�
+    int center_x;//琛屼汉鍖呭洿妗嗕腑蹇冪偣x
+    int center_y;//琛屼汉鍖呭洿妗嗕腑蹇冪偣y
+    int ID;//琛屼汉璺熻釜ID
+    float feature[FEATURESIZE];//琛屼汉涓撳睘鐗瑰緛锛屽彲鐢ㄦ潵鍋歊eID
+}c_fgInfo;
+
+typedef struct c_fgRet {
+    c_fgInfo fginfo[MAX_BG_NUM];//涓婅堪缁撴瀯浣擄紝浠h〃涓�骞呭浘涓墍鏈夌殑妗嗭紝鏈�澶ф敮鎸�2000涓锛屾殏涓嶅彲淇敼
+    int fgNum;//涓�骞呭浘涓鐨勬暟閲忥紙fginfo涓殑鏈夋晥妗嗘暟锛�
+}c_fgRet;
+
+
+/*鍔熻兘:鏁翠釜妫�娴嬭窡韪▼搴忓垵濮嬪寲锛屽垱寤哄彞鏌�
+鍙傛暟:
+Gpuid: 鏄惧崱ID锛�
+batch_size: 鎵瑰鐞嗘暟閲忥紝鍙互璁剧疆涓鸿棰戣矾鏁�
+wh_flag: 瑙嗛甯х殑鍥惧儚瀹藉ぇ浜庨珮鏃讹紝璁剧疆涓�0锛屽惁鍒欒缃负1銆�
+杩斿洖鍊�:鍙ユ焺
+*/
+void * c_human_tracker_create( int gpuid, int batch_size, int wh_flag);
+
+/*
+鍔熻兘:璧勬簮閲婃斁
+鍙傛暟:鍙ユ焺鐨勫湴鍧�
+杩斿洖鍊�:void
+*/
+void c_human_tracker_release(void **handle);
+
+/*
+鍔熻兘:瀵瑰寮犲浘鍍忚繘琛屾娴嬭窡韪�
+鍙傛暟:
+handle锛氬彞鏌�
+batch_mat: sy_img绫诲瀷鐨勬暟缁勶紝瀛樻斁澶氬紶鍥惧儚銆�
+batch_img_length锛氬浘鍍忔暟閲�
+trackresult: 姣忓紶鍥惧儚鐨勬娴嬪拰璺熻釜缁撴灉锛屾彁鍓嶅0鏄庡ソ鐨勬暟缁勶紝鏁伴噺涓哄浘鍍忔暟锛屼互fgRet绫诲瀷瀛樺偍銆�
+杩斿洖鍊�:-1 澶辫触鎴栧叾浠栭敊璇爜 0 鎴愬姛
+*/
+int c_human_tracker_process(void * handle,   c_img  batch_mat[], int batch_img_length, c_fgRet trackresult[]);
+
+/*
+鍔熻兘:鑾峰緱鐗堟湰淇℃伅
+鍙傛暟:void
+杩斿洖鍊�:鐗堟湰淇℃伅char*
+*/
+const char* c_getVersion();
+
+
+/*
+鍔熻兘:鐗瑰緛鍊兼瘮瀵�
+鍙傛暟:鐗瑰緛鍊�1鍜岀壒寰佸��2
+杩斿洖鍊�:寰楀垎
+*/
+double c_FF_Similarity(float * feaA, float * feaB);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/gohumantrack/sdk/include/sy_human_tracker.h b/gohumantrack/sdk/cpp_include/sy_human_tracker.h
similarity index 72%
rename from gohumantrack/sdk/include/sy_human_tracker.h
rename to gohumantrack/sdk/cpp_include/sy_human_tracker.h
index 7a0ecd0..00ef0c3 100755
--- a/gohumantrack/sdk/include/sy_human_tracker.h
+++ b/gohumantrack/sdk/cpp_include/sy_human_tracker.h
@@ -1,10 +1,7 @@
 #ifndef SY_HUMAN_TRACKER
 #define SY_HUMAN_TRACKER
-
-#include <math.h>
-
+#include<vector>
 #define MAX_BG_NUM 2000
-#define FEATURESIZE 128
 //ImgData
 #ifndef __SY_IMG__	
 #define __SY_IMG__
@@ -14,13 +11,13 @@
 	int w_;//鍥惧儚瀹藉害
 	int h_;//鍥惧儚楂樺害
 	int c_;//鍥惧儚閫氶亾鏁帮紝鐩墠浠呮敮鎸�3閫氶亾
-	// void set_data(int m_w, int m_h, int m_c, unsigned char * m_data)
-	// {
-	// 	w_ = m_w;
-	// 	h_ = m_h;
-	// 	c_ = m_c;
-	// 	data_ = m_data;	//Shallow copy
-	// }
+	void set_data(int m_w, int m_h, int m_c, unsigned char * m_data)
+	{
+		w_ = m_w;
+		h_ = m_h;
+		c_ = m_c;
+		data_ = m_data;	//Shallow copy
+	}
 } sy_img;
 #endif
 
@@ -33,7 +30,7 @@
     int center_x;//琛屼汉鍖呭洿妗嗕腑蹇冪偣x
     int center_y;//琛屼汉鍖呭洿妗嗕腑蹇冪偣y
     int ID;//琛屼汉璺熻釜ID
-    float feature[FEATURESIZE];//琛屼汉涓撳睘鐗瑰緛锛屽彲鐢ㄦ潵鍋歊eID
+    float feature[128];//琛屼汉涓撳睘鐗瑰緛锛屽彲鐢ㄦ潵鍋歊eID
 }fgInfo;
 
 typedef struct fgRet {
@@ -75,33 +72,5 @@
 杩斿洖鍊�:鐗堟湰淇℃伅char*
 */
 const char* getVersion();
-
-
-/*
-鍔熻兘:鐗瑰緛鍊兼瘮瀵�
-鍙傛暟:鐗瑰緛鍊�1鍜岀壒寰佸��2
-杩斿洖鍊�:寰楀垎
-*/
-double FF_Similarity(float * feaA, float * feaB)
-{
-	double norm1 = 0, norm2 = 0;
-	int i = 0;
-	double score = 0;
-	for (i = 0; i < FEATURESIZE; i++)
-	{
-		norm1 += feaA[i] * feaA[i];
-		norm2 += feaB[i] * feaB[i];
-		score += feaA[i] * feaB[i];
-	}
-
-	norm1 = sqrt(norm1);
-	norm2 = sqrt(norm2);
-
-	score = score / (norm1 * norm2);
-
-	if (score < 0) // 鍒跺幓闄ゅ皬鏁伴儴鍒�
-		score = 0;
-	return score;
-}
 
 #endif
diff --git a/gohumantrack/sdk/libs/libmidHumanTrack.so b/gohumantrack/sdk/libs/libmidHumanTrack.so
new file mode 100755
index 0000000..860d34e
--- /dev/null
+++ b/gohumantrack/sdk/libs/libmidHumanTrack.so
Binary files differ
diff --git a/gohumantrack/sdk/libs/libutools.so b/gohumantrack/sdk/libs/libutools.so
deleted file mode 120000
index 5423e07..0000000
--- a/gohumantrack/sdk/libs/libutools.so
+++ /dev/null
@@ -1 +0,0 @@
-libutools.so.1.1.0
\ No newline at end of file
diff --git a/gohumantrack/sdk/libs/libutools.so b/gohumantrack/sdk/libs/libutools.so
new file mode 100755
index 0000000..8ed189a
--- /dev/null
+++ b/gohumantrack/sdk/libs/libutools.so
Binary files differ
diff --git a/main.go b/main.go
index cdbf57b..25db310 100644
--- a/main.go
+++ b/main.go
@@ -7,7 +7,7 @@
 
 	"track/gohumantrack"
 
-	"gocv.io/x/gocv"
+	"basic.com/valib/goffmpeg.git"
 )
 
 var (
@@ -20,55 +20,71 @@
 	flag.StringVar(&url2, "cam2", "", "url")
 }
 func main() {
+	flag.Parse()
+	fmt.Println("url1: ", url1, " url2: ", url2)
 	if len(url1) == 0 || len(url2) == 0 {
 		fmt.Println("url null")
 	}
 
-	cam1, err := gocv.OpenVideoCapture(url1)
-	if err != nil {
-		fmt.Println("cv open url1 error: ", err)
-		return
-	}
-	cam2, err := gocv.OpenVideoCapture(url2)
-	if err != nil {
-		fmt.Println("cv open url2 error: ", err)
-		return
-	}
+	goffmpeg.InitFFmpeg("./runtime/libcffmpeg.so")
 
-	img1 := gocv.NewMat()
-	defer img1.Close()
-	img2 := gocv.NewMat()
-	defer img2.Close()
+	cam1 := goffmpeg.New(false, false)
+	cam1.Run(url1)
+	cam1.BuildDecoder()
+	cam1.CloseStream()
+
+	cam2 := goffmpeg.New(false, false)
+	cam2.Run(url2)
+	cam2.BuildDecoder()
+	cam2.CloseStream()
 
 	tracker := gohumantrack.NewHumanTracker(0, 2, 0)
+	fmt.Println("version: ", tracker.GetVersion())
 	for {
-		if ok := cam1.Read(&img1); !ok || img1.Empty() {
-			fmt.Println("read url1 image error")
-			time.Sleep(40 * time.Millisecond)
-			continue
-		}
-		if ok := cam2.Read(&img2); !ok || img2.Empty() {
-			fmt.Println("read url2 image error")
-			time.Sleep(40 * time.Millisecond)
-			continue
-		}
+		data1, ow1, oh1, _ := cam1.GetYUV()
+		data2, ow2, oh2, _ := cam2.GetYUV()
+		if ow1 > 0 && oh1 > 0 && ow2 > 0 && oh2 > 0 {
 
-		var images []gohumantrack.ImageHumanTracker
-		img := gohumantrack.ImageHumanTracker{
-			Data:    img1.ToBytes(),
-			Width:   img1.Cols,
-			Height:  img1.Rows,
-			Channel: img1.Channels,
+			var images []gohumantrack.ImageHumanTracker
+			img := gohumantrack.ImageHumanTracker{
+				Data:    data1,
+				Width:   ow1,
+				Height:  oh1,
+				Channel: 3,
+			}
+			images = append(images, img)
+			img = gohumantrack.ImageHumanTracker{
+				Data:    data2,
+				Width:   ow2,
+				Height:  oh2,
+				Channel: 3,
+			}
+			images = append(images, img)
+			res, err := tracker.Process(images)
+			if err == nil {
+				for _, v := range res {
+					fmt.Printf("result size: %d\n", v.FgNum)
+					for i := 0; i < int(v.FgNum); i++ {
+						r := v.Fginfo[i]
+						if r.Confidence > 0 {
+							fmt.Printf(" Index %d Rect: %dx%dx%dx%d", i, r.Left, r.Top, r.Right, r.Bottom)
+							fmt.Printf(" Confidence: %f", r.Confidence*100)
+							fmt.Printf(" Center: %dx%d", r.X, r.Y)
+							fmt.Printf(" ID: %d\n", r.ID)
+						}
+					}
+
+				}
+			} else {
+				fmt.Println("process error: ", err)
+			}
+		} else {
+			//			fmt.Println("cam1 size: ", ow1, "x", oh1, " cam2 size: ", ow2, "x", oh2)
+			time.Sleep(38 * time.Millisecond)
 		}
-		images = append(images, img)
-		img = gohumantrack.ImageHumanTracker{
-			Data:    img2.ToBytes(),
-			Width:   img2.Cols,
-			Height:  img2.Rows,
-			Channel: img2.Channels,
-		}
-		images = append(images, img)
 
 	}
 	tracker.Free()
+
+	goffmpeg.FreeFFmpeg()
 }
diff --git a/runtime/libHumanTracker.so b/runtime/libHumanTracker.so
new file mode 100755
index 0000000..36b8262
--- /dev/null
+++ b/runtime/libHumanTracker.so
Binary files differ
diff --git a/runtime/libStreamParse.so b/runtime/libStreamParse.so
new file mode 100755
index 0000000..76b92b9
--- /dev/null
+++ b/runtime/libStreamParse.so
Binary files differ
diff --git a/runtime/libcffmpeg.so b/runtime/libcffmpeg.so
new file mode 100755
index 0000000..707acbb
--- /dev/null
+++ b/runtime/libcffmpeg.so
Binary files differ
diff --git a/runtime/libmidHumanTrack.so b/runtime/libmidHumanTrack.so
new file mode 100755
index 0000000..860d34e
--- /dev/null
+++ b/runtime/libmidHumanTrack.so
Binary files differ
diff --git a/runtime/libnvcaffe_parser.so b/runtime/libnvcaffe_parser.so
new file mode 100755
index 0000000..58c43f7
--- /dev/null
+++ b/runtime/libnvcaffe_parser.so
Binary files differ
diff --git a/runtime/libnvcaffe_parser.so.5 b/runtime/libnvcaffe_parser.so.5
new file mode 100755
index 0000000..58c43f7
--- /dev/null
+++ b/runtime/libnvcaffe_parser.so.5
Binary files differ
diff --git a/runtime/libnvcaffe_parser.so.5.1.2 b/runtime/libnvcaffe_parser.so.5.1.2
new file mode 100755
index 0000000..58c43f7
--- /dev/null
+++ b/runtime/libnvcaffe_parser.so.5.1.2
Binary files differ
diff --git a/runtime/libnvinfer.so b/runtime/libnvinfer.so
new file mode 100755
index 0000000..3c98d5d
--- /dev/null
+++ b/runtime/libnvinfer.so
Binary files differ
diff --git a/runtime/libnvinfer.so.5 b/runtime/libnvinfer.so.5
new file mode 100755
index 0000000..3c98d5d
--- /dev/null
+++ b/runtime/libnvinfer.so.5
Binary files differ
diff --git a/runtime/libnvinfer.so.5.1.2 b/runtime/libnvinfer.so.5.1.2
new file mode 100755
index 0000000..3c98d5d
--- /dev/null
+++ b/runtime/libnvinfer.so.5.1.2
Binary files differ
diff --git a/runtime/libnvinfer_plugin.so b/runtime/libnvinfer_plugin.so
new file mode 100755
index 0000000..849d3d2
--- /dev/null
+++ b/runtime/libnvinfer_plugin.so
Binary files differ
diff --git a/runtime/libnvinfer_plugin.so.5 b/runtime/libnvinfer_plugin.so.5
new file mode 100755
index 0000000..849d3d2
--- /dev/null
+++ b/runtime/libnvinfer_plugin.so.5
Binary files differ
diff --git a/runtime/libnvinfer_plugin.so.5.1.2 b/runtime/libnvinfer_plugin.so.5.1.2
new file mode 100755
index 0000000..849d3d2
--- /dev/null
+++ b/runtime/libnvinfer_plugin.so.5.1.2
Binary files differ
diff --git a/runtime/libnvonnxparser.so b/runtime/libnvonnxparser.so
new file mode 100644
index 0000000..8078dc2
--- /dev/null
+++ b/runtime/libnvonnxparser.so
Binary files differ
diff --git a/runtime/libnvonnxparser.so.0 b/runtime/libnvonnxparser.so.0
new file mode 100644
index 0000000..8078dc2
--- /dev/null
+++ b/runtime/libnvonnxparser.so.0
Binary files differ
diff --git a/runtime/libnvonnxparser.so.0.1.0 b/runtime/libnvonnxparser.so.0.1.0
new file mode 100644
index 0000000..8078dc2
--- /dev/null
+++ b/runtime/libnvonnxparser.so.0.1.0
Binary files differ
diff --git a/runtime/libnvparsers.so b/runtime/libnvparsers.so
new file mode 100755
index 0000000..58c43f7
--- /dev/null
+++ b/runtime/libnvparsers.so
Binary files differ
diff --git a/runtime/libnvparsers.so.5 b/runtime/libnvparsers.so.5
new file mode 100755
index 0000000..58c43f7
--- /dev/null
+++ b/runtime/libnvparsers.so.5
Binary files differ
diff --git a/runtime/libnvparsers.so.5.1.2 b/runtime/libnvparsers.so.5.1.2
new file mode 100755
index 0000000..58c43f7
--- /dev/null
+++ b/runtime/libnvparsers.so.5.1.2
Binary files differ
diff --git a/runtime/libopencv_core.so b/runtime/libopencv_core.so
new file mode 100755
index 0000000..3ed279e
--- /dev/null
+++ b/runtime/libopencv_core.so
Binary files differ
diff --git a/runtime/libopencv_core.so.2.4 b/runtime/libopencv_core.so.2.4
new file mode 100755
index 0000000..3ed279e
--- /dev/null
+++ b/runtime/libopencv_core.so.2.4
Binary files differ
diff --git a/runtime/libopencv_core.so.2.4.13 b/runtime/libopencv_core.so.2.4.13
new file mode 100755
index 0000000..3ed279e
--- /dev/null
+++ b/runtime/libopencv_core.so.2.4.13
Binary files differ
diff --git a/runtime/libopencv_highgui.so b/runtime/libopencv_highgui.so
new file mode 100755
index 0000000..1efd1d1
--- /dev/null
+++ b/runtime/libopencv_highgui.so
Binary files differ
diff --git a/runtime/libopencv_highgui.so.2.4 b/runtime/libopencv_highgui.so.2.4
new file mode 100755
index 0000000..1efd1d1
--- /dev/null
+++ b/runtime/libopencv_highgui.so.2.4
Binary files differ
diff --git a/runtime/libopencv_highgui.so.2.4.13 b/runtime/libopencv_highgui.so.2.4.13
new file mode 100755
index 0000000..1efd1d1
--- /dev/null
+++ b/runtime/libopencv_highgui.so.2.4.13
Binary files differ
diff --git a/runtime/libopencv_imgproc.so b/runtime/libopencv_imgproc.so
new file mode 100755
index 0000000..adb79cd
--- /dev/null
+++ b/runtime/libopencv_imgproc.so
Binary files differ
diff --git a/runtime/libopencv_imgproc.so.2.4 b/runtime/libopencv_imgproc.so.2.4
new file mode 100755
index 0000000..adb79cd
--- /dev/null
+++ b/runtime/libopencv_imgproc.so.2.4
Binary files differ
diff --git a/runtime/libopencv_imgproc.so.2.4.13 b/runtime/libopencv_imgproc.so.2.4.13
new file mode 100755
index 0000000..adb79cd
--- /dev/null
+++ b/runtime/libopencv_imgproc.so.2.4.13
Binary files differ
diff --git a/runtime/libopencv_video.so b/runtime/libopencv_video.so
new file mode 100755
index 0000000..769ca07
--- /dev/null
+++ b/runtime/libopencv_video.so
Binary files differ
diff --git a/runtime/libopencv_video.so.2.4 b/runtime/libopencv_video.so.2.4
new file mode 100755
index 0000000..769ca07
--- /dev/null
+++ b/runtime/libopencv_video.so.2.4
Binary files differ
diff --git a/runtime/libopencv_video.so.2.4.13 b/runtime/libopencv_video.so.2.4.13
new file mode 100755
index 0000000..769ca07
--- /dev/null
+++ b/runtime/libopencv_video.so.2.4.13
Binary files differ
diff --git a/runtime/librtspclient.so b/runtime/librtspclient.so
new file mode 100755
index 0000000..e8642e5
--- /dev/null
+++ b/runtime/librtspclient.so
Binary files differ
diff --git a/runtime/libutools.so b/runtime/libutools.so
new file mode 100755
index 0000000..8ed189a
--- /dev/null
+++ b/runtime/libutools.so
Binary files differ
diff --git a/runtime/libutools.so.1.1.0 b/runtime/libutools.so.1.1.0
new file mode 100755
index 0000000..8ed189a
--- /dev/null
+++ b/runtime/libutools.so.1.1.0
Binary files differ

--
Gitblit v1.8.0