| | |
| | | */ |
| | | import "C" |
| | | import ( |
| | | "fmt" |
| | | "unsafe" |
| | | ) |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | 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 { |
| | | |