| | |
| | | */ |
| | | import "C" |
| | | import ( |
| | | "fmt" |
| | | "unsafe" |
| | | ) |
| | | |
| | |
| | | return fPos |
| | | } |
| | | |
| | | // FaceTrack face tracking info |
| | | // FaceTrackSimple face tracking info |
| | | func FaceTrackSimple(img SDKImage, ch int) (faces []CFaceInfo) { |
| | | data := img.Data |
| | | w := img.Width |
| | |
| | | |
| | | 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) |
| | | // 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)) |
| | | // fmt.Println("faces detected:", len(faces)) |
| | | //} |
| | | |
| | | return faces |