From aa25f30d2d5dee9134ffb48885bbe9f3be6dc4ee Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期一, 13 一月 2020 12:21:23 +0800 Subject: [PATCH] debug --- goface.go | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/goface.go b/goface.go index 16b840a..938ff51 100644 --- a/goface.go +++ b/goface.go @@ -8,7 +8,7 @@ #cgo LDFLAGS: -lTHFaceImage -lTHFeature -lTHFaceProperty -lTHFaceTracking #cgo LDFLAGS: -lcudart -lcublas -lcurand -lrt -ldl -lpthread #include <stdlib.h> -#include "csdk.h" +#include "cface.h" */ import "C" import ( @@ -103,7 +103,7 @@ func (s *SDKFace) Tracker(w, h, maxFaces, interval, sampleSize, threadMax, gpu int) bool { if s.tracker { - return s.tracker + return true } ret := C.c_api_face_tracker_init(C.int(threadMax), C.int(gpu), C.int(w), C.int(h), C.int(maxFaces), C.int(interval), C.int(sampleSize)) if ret <= 0 { @@ -155,10 +155,12 @@ pos := (*C.cFacePos)(unsafe.Pointer(&fpos)) p := C.c_api_face_extract(&featLen, pos, (*C.uchar)(unsafe.Pointer(&data[0])), C.int(w), C.int(h), C.int(ch)) - defer C.free(unsafe.Pointer(p)) - b := C.GoBytes(unsafe.Pointer(p), featLen) - s.printLog("->face--> Extract Nothing, Ret: ", len(b)) - return b + if p != nil { + defer C.free(unsafe.Pointer(p)) + return C.GoBytes(unsafe.Pointer(p), featLen) + } + s.printLog("->face--> Extract Nothing") + return nil } // Compare face compare -- Gitblit v1.8.0