| | |
| | | #cgo LDFLAGS: -L/usr/local/cuda/lib64 -L${SRCDIR}/sdk/face/lib/gpu -L${SRCDIR}/sdk/darknet/lib |
| | | #cgo LDFLAGS: -L${SRCDIR}/sdk/plate/eparking/lib -L${SRCDIR}/sdk/plate/cloud/lib -L${SRCDIR}/sdk/plate/vehicle/lib |
| | | #cgo LDFLAGS: -Wl,-rpath,${SRCDIR}/sdk/face/lib/gpu:${SRCDIR}/sdk/darknet/lib:${SRCDIR}/sdk/plate/cloud/lib:${SRCDIR}/sdk/plate/vehicle/lib |
| | | #cgo LDFLAGS: -ldarknet -lTHFaceImage -lTHFeature -lTHFaceProperty -lTHFaceTracking -lcudart -lcublas -lcurand -lrt -ldl -lpthread -lthplateid -lLPRecognition |
| | | #cgo LDFLAGS: -ldarknet -lTHFaceImage -lTHFaceQuality -lTHFeature -lTHFaceProperty -lTHFaceTracking -lcudart -lcublas -lcurand -lrt -ldl -lpthread -lthplateid -lLPRecognition |
| | | #cgo LDFLAGS: -lVehicleTypeRecognition -lFeatureExtraction |
| | | #include <stdlib.h> |
| | | #include "csdk.h" |
| | |
| | | C.c_api_face_tracker_init(C.int(tm), C.int(gi), C.int(w), C.int(h), C.int(maxFaces), C.int(interval), C.int(sample)) |
| | | } |
| | | |
| | | // InitFaceQuality init face quality |
| | | func InitFaceQuality(tm int) { |
| | | |
| | | C.c_api_face_quality_init(C.int(tm)) |
| | | } |
| | | |
| | | // SetFaceQualityParams set face quality params |
| | | func SetFaceQualityParams(min, max int) { |
| | | |
| | | C.c_api_set_quality_params(C.int(min), C.int(max)) |
| | | } |
| | | |
| | | // ResizeFaceTracker init face tracker |
| | | func ResizeFaceTracker(ch, w, h int) int { |
| | | |
| | |
| | | return b |
| | | } |
| | | |
| | | |
| | | // FaceQuality face check quality |
| | | func FaceQuality(fpos CFacePos, img SDKImage, ch int) CThfqResult { |
| | | |
| | | data := img.Data |
| | | w := img.Width |
| | | h := img.Height |
| | | |
| | | pos := (*C.cFacePos)(unsafe.Pointer(&fpos)) |
| | | result := C.c_api_face_check_quality(pos, (*C.uchar)(unsafe.Pointer(&data[0])), C.int(w), C.int(h), C.int(ch)) |
| | | |
| | | return *((*CThfqResult)(unsafe.Pointer(&result))) |
| | | } |
| | | |
| | | // FaceQuality face check quality |
| | | func FaceQualityBrightness(fpos CFacePos, img SDKImage, ch int) int { |
| | | |
| | | data := img.Data |
| | | w := img.Width |
| | | h := img.Height |
| | | |
| | | var brightness, ret C.int |
| | | pos := (*C.cFacePos)(unsafe.Pointer(&fpos)) |
| | | |
| | | ret = C.c_api_face_check_quality_brightness(pos, (*C.uchar)(unsafe.Pointer(&data[0])), C.int(w), C.int(h), C.int(ch), &brightness) |
| | | if ret == -1 { |
| | | return -1 |
| | | } |
| | | |
| | | return int(brightness) |
| | | } |
| | | |
| | | // FaceQuality face check quality |
| | | func FaceQualityOcclusion(fpos CFacePos, img SDKImage, ch int) int { |
| | | |
| | | data := img.Data |
| | | w := img.Width |
| | | h := img.Height |
| | | |
| | | var occlusion, ret C.int |
| | | pos := (*C.cFacePos)(unsafe.Pointer(&fpos)) |
| | | |
| | | ret = C.c_api_face_check_quality_occlusion(pos, (*C.uchar)(unsafe.Pointer(&data[0])), C.int(w), C.int(h), C.int(ch), &occlusion) |
| | | if ret == -1 { |
| | | return -1 |
| | | } |
| | | |
| | | return int(occlusion) |
| | | } |
| | | |
| | | // FaceQuality face check quality |
| | | func FaceQualityHat(fpos CFacePos, img SDKImage, ch int) int { |
| | | |
| | | data := img.Data |
| | | w := img.Width |
| | | h := img.Height |
| | | |
| | | var hat, ret C.int |
| | | pos := (*C.cFacePos)(unsafe.Pointer(&fpos)) |
| | | |
| | | ret = C.c_api_face_check_quality_hat(pos, (*C.uchar)(unsafe.Pointer(&data[0])), C.int(w), C.int(h), C.int(ch), &hat) |
| | | if ret == -1 { |
| | | return -1 |
| | | } |
| | | |
| | | return int(hat) |
| | | } |
| | | |
| | | // FaceQuality face check quality |
| | | func FaceQualityBlurGlass(fpos CFacePos, img SDKImage, ch int) (int, int) { |
| | | |
| | | data := img.Data |
| | | w := img.Width |
| | | h := img.Height |
| | | |
| | | var blur, glass, ret C.int |
| | | pos := (*C.cFacePos)(unsafe.Pointer(&fpos)) |
| | | |
| | | ret = C.c_api_face_check_quality_blur_glass(pos, (*C.uchar)(unsafe.Pointer(&data[0])), C.int(w), C.int(h), C.int(ch), &blur, &glass) |
| | | if ret == -1 { |
| | | return -1, -1 |
| | | } |
| | | |
| | | return int(blur), int(glass) |
| | | } |
| | | |
| | | // FaceCompare face compare |
| | | func FaceCompare(feat1 []byte, feat2 []byte) float32 { |
| | | res := C.c_api_face_compare((*C.uchar)(unsafe.Pointer(&feat1[0])), (*C.uchar)(unsafe.Pointer(&feat2[0]))) |