using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; using System; namespace DemoUI.SDK { /// /// 人脸检测 /// public class CWFaceNisLiveness { private const string CloudWalkSDKDll = "CWFaceSDK.dll"; /// /// 创建活体检测句柄 /// /// 红外活体检测器模型文件 /// 红外活体识别比对模型文件 /// 匹配文件路径 /// 肤色阈值(根据不同的前端版本设置) /// 授权码 /// 如果创建成功,返回Attribute句柄,否则返回空 [DllImport(CloudWalkSDKDll, EntryPoint = "cwCreateNirLivenessHandle", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr cwCreateNirLivenessHandle(out cw_nirliveness_err_t errCode, string pNirModelPath, string pRecogModelPath, string pPairFilePath, string pLogPath, float skinThresh, string pLicence); /// /// 释放活体检测句柄 /// /// 红外活体句柄 [DllImport(CloudWalkSDKDll, EntryPoint = "cwReleaseNirLivenessHandle", CallingConvention = CallingConvention.Cdecl)] public static extern void cwReleaseNirLivenessHandle(IntPtr pHandle); /// /// 红外活体检测接口 /// /// 人脸检测句柄 /// 红外活体句柄 /// 输入可见光图片数据 /// 输入红外光图片数据 /// 存放红外活体检测结果,需事先分配内存 /// [DllImport(CloudWalkSDKDll, EntryPoint = "cwFaceNirByImageData", CallingConvention = CallingConvention.Cdecl)] public static extern cw_nirliveness_err_t cwFaceNirByImageData(IntPtr pDetector, IntPtr pNirHandle, ref cw_img_t pImgVis, ref cw_img_t pImgNir, out cw_nirliv_res_t pNirLivRes); } }