zhangmeng
2019-12-02 a7817b91bc678223fe4224bbba813b1097715748
update
1个文件已删除
65个文件已添加
1 文件已重命名
4个文件已修改
336 ■■■■■ 已修改文件
.gitignore 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
go.mod 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
go.sum 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so.5 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so.5.1.2 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so.5 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so.5.1.2 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so.5 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so.5.1.2 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so.0 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so.0.1.0 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so.5 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so.5.1.2 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/gohumantrack.go 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/opencv-2.4.13/lib/libopencv_core.so 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/opencv-2.4.13/lib/libopencv_core.so.2.4 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/opencv-2.4.13/lib/libopencv_core.so.2.4.13 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so.2.4 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so.2.4.13 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so.2.4 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so.2.4.13 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/opencv-2.4.13/lib/libopencv_video.so 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/opencv-2.4.13/lib/libopencv_video.so.2.4 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/opencv-2.4.13/lib/libopencv_video.so.2.4.13 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/sdk/c_include/c_human_tracker.h 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/sdk/cpp_include/sy_human_tracker.h 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/sdk/libs/libmidHumanTrack.so 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/sdk/libs/libutools.so 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gohumantrack/sdk/libs/libutools.so 补丁 | 查看 | 原始文档 | blame | 历史
main.go 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libHumanTracker.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libStreamParse.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libcffmpeg.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libmidHumanTrack.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvcaffe_parser.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvcaffe_parser.so.5 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvcaffe_parser.so.5.1.2 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvinfer.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvinfer.so.5 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvinfer.so.5.1.2 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvinfer_plugin.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvinfer_plugin.so.5 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvinfer_plugin.so.5.1.2 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvonnxparser.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvonnxparser.so.0 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvonnxparser.so.0.1.0 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvparsers.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvparsers.so.5 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libnvparsers.so.5.1.2 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libopencv_core.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libopencv_core.so.2.4 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libopencv_core.so.2.4.13 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libopencv_highgui.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libopencv_highgui.so.2.4 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libopencv_highgui.so.2.4.13 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libopencv_imgproc.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libopencv_imgproc.so.2.4 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libopencv_imgproc.so.2.4.13 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libopencv_video.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libopencv_video.so.2.4 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libopencv_video.so.2.4.13 补丁 | 查看 | 原始文档 | blame | 历史
runtime/librtspclient.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libutools.so 补丁 | 查看 | 原始文档 | blame | 历史
runtime/libutools.so.1.1.0 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
New file
@@ -0,0 +1,2 @@
*.avi
track
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
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=
gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so.5
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvcaffe_parser.so.5.1.2
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so.5
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer.so.5.1.2
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so.5
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvinfer_plugin.so.5.1.2
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so.0
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvonnxparser.so.0.1.0
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so.5
Binary files differ
gohumantrack/TensorRT-5.1.2.2/lib/libnvparsers.so.5.1.2
Binary files differ
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];//行人专属特征,可用来做ReID
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];//上述结构体,代表一幅图中所有的框,最大支持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
}
gohumantrack/opencv-2.4.13/lib/libopencv_core.so
Binary files differ
gohumantrack/opencv-2.4.13/lib/libopencv_core.so.2.4
Binary files differ
gohumantrack/opencv-2.4.13/lib/libopencv_core.so.2.4.13
Binary files differ
gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so
Binary files differ
gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so.2.4
Binary files differ
gohumantrack/opencv-2.4.13/lib/libopencv_highgui.so.2.4.13
Binary files differ
gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so
Binary files differ
gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so.2.4
Binary files differ
gohumantrack/opencv-2.4.13/lib/libopencv_imgproc.so.2.4.13
Binary files differ
gohumantrack/opencv-2.4.13/lib/libopencv_video.so
Binary files differ
gohumantrack/opencv-2.4.13/lib/libopencv_video.so.2.4
Binary files differ
gohumantrack/opencv-2.4.13/lib/libopencv_video.so.2.4.13
Binary files differ
gohumantrack/sdk/c_include/c_human_tracker.h
New file
@@ -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_;//按opencv 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];//行人专属特征,可用来做ReID
}c_fgInfo;
typedef struct c_fgRet {
    c_fgInfo fginfo[MAX_BG_NUM];//上述结构体,代表一幅图中所有的框,最大支持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: 每张图像的检测和跟踪结果,提前声明好的数组,数量为图像数,以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
gohumantrack/sdk/cpp_include/sy_human_tracker.h
File was renamed from gohumantrack/sdk/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];//行人专属特征,可用来做ReID
    float feature[128];//行人专属特征,可用来做ReID
}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
gohumantrack/sdk/libs/libmidHumanTrack.so
Binary files differ
gohumantrack/sdk/libs/libutools.so
File was deleted
gohumantrack/sdk/libs/libutools.so
Binary files differ
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()
}
runtime/libHumanTracker.so
Binary files differ
runtime/libStreamParse.so
Binary files differ
runtime/libcffmpeg.so
Binary files differ
runtime/libmidHumanTrack.so
Binary files differ
runtime/libnvcaffe_parser.so
Binary files differ
runtime/libnvcaffe_parser.so.5
Binary files differ
runtime/libnvcaffe_parser.so.5.1.2
Binary files differ
runtime/libnvinfer.so
Binary files differ
runtime/libnvinfer.so.5
Binary files differ
runtime/libnvinfer.so.5.1.2
Binary files differ
runtime/libnvinfer_plugin.so
Binary files differ
runtime/libnvinfer_plugin.so.5
Binary files differ
runtime/libnvinfer_plugin.so.5.1.2
Binary files differ
runtime/libnvonnxparser.so
Binary files differ
runtime/libnvonnxparser.so.0
Binary files differ
runtime/libnvonnxparser.so.0.1.0
Binary files differ
runtime/libnvparsers.so
Binary files differ
runtime/libnvparsers.so.5
Binary files differ
runtime/libnvparsers.so.5.1.2
Binary files differ
runtime/libopencv_core.so
Binary files differ
runtime/libopencv_core.so.2.4
Binary files differ
runtime/libopencv_core.so.2.4.13
Binary files differ
runtime/libopencv_highgui.so
Binary files differ
runtime/libopencv_highgui.so.2.4
Binary files differ
runtime/libopencv_highgui.so.2.4.13
Binary files differ
runtime/libopencv_imgproc.so
Binary files differ
runtime/libopencv_imgproc.so.2.4
Binary files differ
runtime/libopencv_imgproc.so.2.4.13
Binary files differ
runtime/libopencv_video.so
Binary files differ
runtime/libopencv_video.so.2.4
Binary files differ
runtime/libopencv_video.so.2.4.13
Binary files differ
runtime/librtspclient.so
Binary files differ
runtime/libutools.so
Binary files differ
runtime/libutools.so.1.1.0
Binary files differ