File size: 1,411 Bytes
901e379
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import platform
import ctypes, ctypes.util
from ctypes import *
from numpy.ctypeslib import ndpointer
import sys
import os

if platform.uname()[0] == 'Windows':
    dll_path = os.path.abspath(os.path.dirname(__file__)) + '/C/face_util.dll'
elif platform.uname()[0] == 'Linux':
    dll_path = os.path.abspath(os.path.dirname(__file__)) + '/C/libFaceUtil.so'
else:
    print("Invalid OS")
    sys.exit(1)

face_util_engine = cdll.LoadLibrary(dll_path)

align_vertical = face_util_engine.align_vertical
align_vertical.argtypes = [ndpointer(ctypes.c_ubyte, flags='C_CONTIGUOUS'), ctypes.c_int32, ctypes.c_int32, ndpointer(ctypes.c_ubyte, flags='C_CONTIGUOUS'), ctypes.c_int32, ctypes.c_int32, ctypes.c_int32, ctypes.POINTER(ctypes.c_float), ctypes.c_float, ctypes.c_float, ctypes.c_float]
align_vertical.restype = ctypes.c_int32

getPose = face_util_engine.getPose
getPose.argtypes = [ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.POINTER(ctypes.c_float), ctypes.c_int32, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)]
getPose.restype = ctypes.c_int32

getPose68 = face_util_engine.getPose68
getPose68.argtypes = [ctypes.c_float, ctypes.c_float, ctypes.c_float, ctypes.POINTER(ctypes.c_float), ctypes.c_int32, ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_float)]
getPose68.restype = ctypes.c_int32