-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfacesdk.py
More file actions
32 lines (24 loc) · 1.05 KB
/
facesdk.py
File metadata and controls
32 lines (24 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
from ctypes import *
from numpy.ctypeslib import ndpointer
from face_util import ResultBox
libPath = os.path.abspath(os.path.dirname(__file__)) + '/libfacesdk.so'
facesdk = cdll.LoadLibrary(libPath)
getMachineCode = facesdk.Faceplugin_get_hardware_id
getMachineCode.argtypes = []
getMachineCode.restype = c_char_p
initSDK = facesdk.Faceplugin_init
initSDK.argtypes = [c_char_p]
initSDK.restype = c_int32
setActivation = facesdk.Faceplugin_activate
setActivation.argtypes = [c_char_p]
setActivation.restype = c_int32
faceDetection = facesdk.Faceplugin_detect
faceDetection.argtypes = [ndpointer(c_ubyte, flags='C_CONTIGUOUS'), c_int32, c_int32, c_int32, POINTER(ResultBox), c_int32]
faceDetection.restype = c_int32
faceRecognition = facesdk.Faceplugin_extract
faceRecognition.argtypes = [ndpointer(c_ubyte, flags='C_CONTIGUOUS'), c_int32, c_int32, c_int32, ResultBox, POINTER(c_float)]
faceRecognition.restype = c_int32
faceSimilarity = facesdk.Faceplugin_similarity
faceSimilarity.argtypes = [POINTER(c_float), POINTER(c_float)]
faceSimilarity.restype = c_float