using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; using System; namespace DemoUI.SDK { /// /// 人脸检测 /// public class NativeCWFaceAttribute { private const string CloudWalkSDKDll = "CWFaceSDK.dll"; /// /// 创建属性句柄 /// /// 模型参数配置文件 /// 授权码 /// 如果创建成功,返回Attribute句柄,否则返回空 [DllImport(CloudWalkSDKDll, EntryPoint = "cwCreateAttributeHandle", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr cwCreateAttributeHandle(out cw_errcode_t errCode, string pConfigFile, string pLicence); /// /// 释放属性句柄 /// /// [DllImport(CloudWalkSDKDll, EntryPoint = "cwReleaseAttributeHandle", CallingConvention = CallingConvention.Cdecl)] public static extern void cwReleaseAttributeHandle(IntPtr pAttributeHandle); /// /// 年龄段估计 /// /// /// 对齐人脸 /// 年龄段估计值,0 小孩 1 成年人 2 老人 /// 置信分数 0-1之间的一个值,置信度越高 /// [DllImport(CloudWalkSDKDll, EntryPoint = "cwGetAgeEval", CallingConvention = CallingConvention.Cdecl)] public static extern cw_errcode_t cwGetAgeEval(IntPtr pAttributeHandle, ref cw_aligned_face_t alignedFace, out int pAge); /// /// 性别估计 /// /// /// 对齐人脸 /// 性别估计值,0 女性, 1 男性 /// [DllImport(CloudWalkSDKDll, EntryPoint = "cwGetGenderEval", CallingConvention = CallingConvention.Cdecl)] public static extern cw_errcode_t cwGetGenderEval(IntPtr pAttributeHandle, ref cw_aligned_face_t alignedFace, out int pGender, out float confidence); /// /// 人种估计 /// /// /// 对齐人脸 /// 人种估计值,0 黑人 1 白人 2 黄人 /// [DllImport(CloudWalkSDKDll, EntryPoint = "cwGetRaceEval", CallingConvention = CallingConvention.Cdecl)] public static extern cw_errcode_t cwGetRaceEval(IntPtr pAttributeHandle, ref cw_aligned_face_t alignedFace, out int pRace, out float confidence); } }