Video Analysis底层库拆分,sdk的go封装
chenshijun
2019-07-11 a549152747fee2085cafb8bdca4aac05fe738e36
gosdk.go
@@ -11,6 +11,7 @@
*/
import "C"
import (
   "fmt"
   "unsafe"
)
@@ -216,6 +217,43 @@
   }
}
func FaceInfo2FacePos(face CFaceInfo) (fPos CFacePos){
   fPos.RcFace = face.RcFace
   fPos.PtLeftEye = face.PtLeftEye
   fPos.PtRightEye = face.PtRightEye
   fPos.PtNose = face.PtNose
   fPos.PtMouth = face.PtMouth
   fPos.FAngle.Yaw = face.FAngle.Yaw
   fPos.FAngle.Pitch = face.FAngle.Pitch
   fPos.FAngle.Roll = face.FAngle.Roll
   fPos.FAngle.Confidence = face.FAngle.Confidence
   copy(fPos.PFacialData[:], face.PFacialData[:512])
   return fPos
}
// FaceTrack face tracking info
func FaceTrackSimple(img SDKImage, ch int) (faces []CFaceInfo) {
   data := img.Data
   w := img.Width
   h := img.Height
   var fCount C.int
   cFinfo := C.c_api_face_track(&fCount, (*C.uchar)(unsafe.Pointer(&data[0])), C.int(w), C.int(h), C.int(ch))
   fmt.Println("cFinfo detected:",cFinfo)
   if cFinfo == nil {
      return faces
   }
   defer C.free(unsafe.Pointer(cFinfo))
   faces = CFaceInfoArrayToGoArray(unsafe.Pointer(cFinfo), int(fCount))
   //if len(faces) > 0{
      fmt.Println("faces detected:",len(faces))
   //}
   return faces
}
// YoloDetect yolo detect
func YoloDetect(handle *YoloHandle, img SDKImage, thrsh float32, umns int) []CObjInfo {