| | |
| | | } |
| | | |
| | | // Free free |
| | | func (y *YoloHandle) Free() { |
| | | func Free(y *YoloHandle) { |
| | | if y != nil { |
| | | if y.handle != nil { |
| | | C.release(y.handle) |
| | |
| | | } |
| | | |
| | | // YoloDetect yolo detect |
| | | func (y *YoloHandle) YoloDetect(data []byte, w, h, c int, thrsh float32, umns int) []CObjInfo { |
| | | func YoloDetect(y *YoloHandle, data []byte, w, h, c int, thrsh float32, umns int) []CObjInfo { |
| | | |
| | | var count C.int |
| | | var cobjinfo unsafe.Pointer |
| | |
| | | } |
| | | |
| | | // YoloObjName obj name by type |
| | | func (y *YoloHandle) YoloObjName(typ int) string { |
| | | func YoloObjName(y *YoloHandle, typ int) string { |
| | | p := C.obj_name_by_type(y.handle, C.int(typ)) |
| | | |
| | | return C.GoString(p) |
| | |
| | | } |
| | | |
| | | // YoloDetectTrack2 yolo detect (只识别人) |
| | | func (y *YoloHandle) YoloDetectTrack2(LastYoloObjs []CObjTrackInfo, LastTrackID *uint64, data []byte, w, h, c int, thrsh float32, umns int) (allObjs []CObjTrackInfo, newObjs []CObjTrackInfo) { |
| | | func YoloDetectTrack2(y *YoloHandle, LastYoloObjs []CObjTrackInfo, LastTrackID *uint64, data []byte, w, h, c int, thrsh float32, umns int) (allObjs []CObjTrackInfo, newObjs []CObjTrackInfo) { |
| | | |
| | | var tmp CObjTrackInfo |
| | | //LastYoloObjs |
| | | detectObjs := y.YoloDetect(data, w, h, c, thrsh, umns) |
| | | detectObjs := YoloDetect(y, data, w, h, c, thrsh, umns) |
| | | |
| | | for _, vLast := range LastYoloObjs { |
| | | for i := 0; i < len(detectObjs); i++ { |
| | |
| | | } |
| | | |
| | | // YoloDetectTrack yolo detect (只识别人) |
| | | func (y *YoloHandle) YoloDetectTrack(id string, data []byte, w, h, c int, thrsh float32, umns int) ([]byte, []byte) { |
| | | func YoloDetectTrack(y *YoloHandle, id string, data []byte, w, h, c int, thrsh float32, umns int) ([]byte, []byte) { |
| | | |
| | | v, ok := y.tracker[id] |
| | | if !ok { |
| | |
| | | y.tracker[id] = i |
| | | v = i |
| | | } |
| | | whole, recent := y.YoloDetectTrack2(v.lastTrackObjs, &v.lastTrackID, data, w, h, c, thrsh, umns) |
| | | whole, recent := YoloDetectTrack2(y, v.lastTrackObjs, &v.lastTrackID, data, w, h, c, thrsh, umns) |
| | | y.tracker[id].lastTrackObjs = whole |
| | | y.tracker[id].lastTrackID = v.lastTrackID |
| | | |