From aa25f30d2d5dee9134ffb48885bbe9f3be6dc4ee Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期一, 13 一月 2020 12:21:23 +0800
Subject: [PATCH] debug

---
 csrc/base.hpp      |    0 
 csrc/extractor.cpp |    2 +-
 cface.h            |    2 +-
 csrc/extractor.h   |    2 +-
 csrc/all.hpp       |    8 ++++----
 csrc/property.h    |    2 +-
 csrc/tracker.cpp   |    0 
 csrc/struct.h      |    0 
 cface.cpp          |    2 +-
 csrc/tracker.h     |    2 +-
 csrc/detector.h    |    2 +-
 csrc/detector.cpp  |    2 +-
 csrc/property.cpp  |    2 +-
 goface.go          |   14 ++++++++------
 14 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/csdk.cpp b/cface.cpp
similarity index 98%
rename from csdk.cpp
rename to cface.cpp
index bd11087..fc20813 100644
--- a/csdk.cpp
+++ b/cface.cpp
@@ -2,7 +2,7 @@
 extern "C"{
 #endif
 
-#include "csdk.h"
+#include "cface.h"
 
 #ifdef __cplusplus
 }
diff --git a/csdk.h b/cface.h
similarity index 97%
rename from csdk.h
rename to cface.h
index c1d0076..41a2788 100644
--- a/csdk.h
+++ b/cface.h
@@ -5,7 +5,7 @@
 extern "C"{
 #endif
 
-#include "csdk_struct.h"
+#include "csrc/struct.h"
 
 #ifndef uchar 
 typedef unsigned char uchar;
diff --git a/csrc/all.hpp b/csrc/all.hpp
index bbe31af..301e046 100644
--- a/csrc/all.hpp
+++ b/csrc/all.hpp
@@ -1,9 +1,9 @@
 #ifndef _c_wrapper_face_detector_all_hpp_
 #define _c_wrapper_face_detector_all_hpp_
 
-#include "buz/face/detector.cpp"
-#include "buz/face/extractor.cpp"
-#include "buz/face/property.cpp"
-#include "buz/face/tracker.cpp"
+#include "detector.cpp"
+#include "extractor.cpp"
+#include "property.cpp"
+#include "tracker.cpp"
 
 #endif
\ No newline at end of file
diff --git a/csrc/buz/base.hpp b/csrc/base.hpp
similarity index 100%
rename from csrc/buz/base.hpp
rename to csrc/base.hpp
diff --git a/csrc/buz/face/detector.cpp b/csrc/detector.cpp
similarity index 98%
rename from csrc/buz/face/detector.cpp
rename to csrc/detector.cpp
index e191ea8..201c3b4 100644
--- a/csrc/buz/face/detector.cpp
+++ b/csrc/detector.cpp
@@ -6,7 +6,7 @@
 
 #include "THFaceImage_i.h"
 
-#include "csdk_struct.h"
+#include "struct.h"
 
 namespace csdk_wrap
 {
diff --git a/csrc/buz/face/detector.h b/csrc/detector.h
similarity index 93%
rename from csrc/buz/face/detector.h
rename to csrc/detector.h
index 8a4497d..fbd5418 100644
--- a/csrc/buz/face/detector.h
+++ b/csrc/detector.h
@@ -1,7 +1,7 @@
 #ifndef _c_wrapper_face_detector_hpp_
 #define _c_wrapper_face_detector_hpp_
 
-#include "../base.hpp"
+#include "base.hpp"
 
 
 struct _cFacePos;
diff --git a/csrc/buz/face/extractor.cpp b/csrc/extractor.cpp
similarity index 97%
rename from csrc/buz/face/extractor.cpp
rename to csrc/extractor.cpp
index 594eb1f..b50a68f 100644
--- a/csrc/buz/face/extractor.cpp
+++ b/csrc/extractor.cpp
@@ -1,7 +1,7 @@
 #include "extractor.h"
 
 #include "THFeature_i.h"
-#include "csdk_struct.h"
+#include "struct.h"
 
 namespace csdk_wrap{
 
diff --git a/csrc/buz/face/extractor.h b/csrc/extractor.h
similarity index 94%
rename from csrc/buz/face/extractor.h
rename to csrc/extractor.h
index 31bb712..eb7a016 100644
--- a/csrc/buz/face/extractor.h
+++ b/csrc/extractor.h
@@ -1,7 +1,7 @@
 #ifndef _c_wrapper_face_extractor_h_
 #define _c_wrapper_face_extractor_h_
 
-#include "../base.hpp"
+#include "base.hpp"
 
 struct _cFacePos;
 struct _cIMAGE;
diff --git a/csrc/buz/face/property.cpp b/csrc/property.cpp
similarity index 97%
rename from csrc/buz/face/property.cpp
rename to csrc/property.cpp
index 74d4774..ee13a17 100644
--- a/csrc/buz/face/property.cpp
+++ b/csrc/property.cpp
@@ -1,7 +1,7 @@
 #include "property.h"
 
 #include "THFaceProperty_i.h"
-#include "csdk_struct.h"
+#include "struct.h"
 
 namespace csdk_wrap{
 
diff --git a/csrc/buz/face/property.h b/csrc/property.h
similarity index 92%
rename from csrc/buz/face/property.h
rename to csrc/property.h
index 39d3976..23f2ed7 100644
--- a/csrc/buz/face/property.h
+++ b/csrc/property.h
@@ -1,7 +1,7 @@
 #ifndef _c_wrapper_face_property_h_
 #define _c_wrapper_face_property_h_
 
-#include "../base.hpp"
+#include "base.hpp"
 
 struct _cThftResult;
 struct _cFacePos;
diff --git a/csdk_struct.h b/csrc/struct.h
similarity index 100%
rename from csdk_struct.h
rename to csrc/struct.h
diff --git a/csrc/buz/face/tracker.cpp b/csrc/tracker.cpp
similarity index 100%
rename from csrc/buz/face/tracker.cpp
rename to csrc/tracker.cpp
diff --git a/csrc/buz/face/tracker.h b/csrc/tracker.h
similarity index 96%
rename from csrc/buz/face/tracker.h
rename to csrc/tracker.h
index 6498bc9..362d201 100644
--- a/csrc/buz/face/tracker.h
+++ b/csrc/tracker.h
@@ -1,7 +1,7 @@
 #ifndef _c_wrapper_face_tracker_h_
 #define _c_wrapper_face_tracker_h_
 
-#include "../base.hpp"
+#include "base.hpp"
 
 struct _cRECT;
 struct _cFaceInfo;
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