Video Analysis底层库拆分,sdk的go封装
zhangzengfei
2019-11-14 6c5479bec34af351eebf956adf993975ab12e2ae
gosdk.go
@@ -1,11 +1,11 @@
package gosdk
/*
#cgo CFLAGS: -I. -I./sdk/face/include -I./sdk/darknet/include -I/usr/local/cuda/include -w -g
#cgo CXXFLAGS: -I. -I./sdk/face/include -I./sdk/darknet/include -I/usr/local/cuda/include -w -g -std=c++11
#cgo LDFLAGS: -L/usr/local/cuda/lib64 -L${SRCDIR}/sdk/face/lib/gpu -L${SRCDIR}/sdk/darknet/lib
#cgo CFLAGS: -I. -I./sdk/face/include -I./sdk/darknet/include -I/usr/local/cuda/include -I./sdk/plate/include -w -g
#cgo CXXFLAGS: -I. -I./sdk/face/include -I./sdk/darknet/include -I/usr/local/cuda/include -I./sdk/plate/include -w -g -std=c++11
#cgo LDFLAGS: -L/usr/local/cuda/lib64 -L${SRCDIR}/sdk/face/lib/gpu -L${SRCDIR}/sdk/darknet/lib -L${SRCDIR}/sdk/plate/lib
#cgo LDFLAGS: -Wl,-rpath,${SRCDIR}/sdk/face/lib/gpu:${SRCDIR}/sdk/darknet/lib
#cgo LDFLAGS: -ldarknet -lTHFaceImage -lTHFeature -lTHFaceProperty -lTHFaceTracking -lcudart -lcublas -lcurand -lrt -ldl -lpthread
#cgo LDFLAGS: -ldarknet -lTHFaceImage -lTHFeature -lTHFaceProperty -lTHFaceTracking -lcudart -lcublas -lcurand -lrt -ldl -lpthread -lthplateid
#include <stdlib.h>
#include "csdk.h"
*/
@@ -410,3 +410,27 @@
   *LastTrackID = id
   return allObjs, newObjs
}
// InitPlateIDDetector init plateid detector
func InitPlateIDDetector(width, height int, soPath []byte) {
   C.c_api_plate_id_init(C.int(width), C.int(height), (*C.char)(unsafe.Pointer(&soPath[0])))
}
// PlateIDDetect plateid detect
func PlateIDDetect(img SDKImage) []CPlateIDResult {
   data := img.Data
   w := img.Width
   h := img.Height
   var count C.int
   cppos := C.c_api_plate_id_detect(&count, (*C.uchar)(unsafe.Pointer(&data[0])), C.int(w), C.int(h))
   if cppos != nil {
      defer C.free(unsafe.Pointer(cppos))
      return CPlateIDPosArrayToGoArray(unsafe.Pointer(cppos), int(count))
   }
   return nil
}
func FreePlateIdDetector() int{
   return int(C.c_api_plate_id_free())
}