做服务外包项目需要是用虹软的人脸对比SDK,项目使用Python进行开发,但是网上以及官方社区没有基于Python的3.0版本项目,所以自己根据社区里大佬1.1和2.0的Demo修改套了一下
face_class
from ctypes import *
# 人脸框
class MRECT(Structure):
_fields_ = [(u'left1', c_int32), (u'top1', c_int32),
(u'right1', c_int32), (u'bottom1', c_int32)]
# 版本信息 版本号,构建日期,版权说明
class ASF_VERSION(Structure):
_fields_ = [('Version', c_char_p), ('BuildDate',
c_char_p), ('CopyRight', c_char_p)]
# 单人人脸信息 人脸狂,人脸角度
class ASF_SingleFaceInfo(Structure):
_fields_ = [('faceRect', MRECT), ('faceOrient', c_int32)]
# 多人人脸信息 人脸框数组,人脸角度数组,人脸数
class ASF_MultiFaceInfo(Structure):
# _fields_=[('faceRect',POINTER(MRECT)),('faceOrient',POINTER( c_int32)),('faceNum',c_int32)]
_fields_ = [(u'faceRect', POINTER(MRECT)), (u'faceOrient',
POINTER(c_int32)), (u'faceNum', c_int32)]
# _fields_=[(u'faceRect',MRECT*50),(u'faceOrient',c_int32*50),(u'faceNum',c_int32)]
# 人脸特征 人脸特征,人脸特征长度
class ASF_FaceFeature(Structure):
_fields_ = [('feature', c_void_p), ('featureSize', c_int32)]
# 自定义图片类face_dll
class IM:
def __init__(self):
self.filepath = None
self.date = None
self.width = 0
self.height = 0
face_dll
wuyongdll = CDLL('/media/psf/Home/code/fwwb/face/so/libarcsoft_face.so')
dll = CDLL('/media/psf/Home/code/fwwb/face/so/libarcsoft_face_engine.so'