public extern static bool QualityOfPoseEx(byte[] imgData, ref FaceImage img, FaceRect faceRect, FaceMarkPoint[] points, int pointsLength, ref int level, ref float score, float yawLow = 25, float yawHigh = 10, float pitchLow = 20, float pitchHigh = 10, float rollLow = 33.33f, float rollHigh = 16.67f);
public extern static bool QualityOfResolution(byte[] imgData, ref FaceImage img, FaceRect faceRect, FaceMarkPoint[] points, int pointsLength, ref int level, ref float score, float low = 80, float high = 120);
public extern static bool QualityOfIntegrity(byte[] imgData, ref FaceImage img, FaceRect faceRect, FaceMarkPoint[] points, int pointsLength, ref int level, ref float score, float low = 10f, float high = 1.5f);
public extern static bool QualityOfPose(byte[] imgData, ref FaceImage img, FaceRect faceRect, FaceMarkPoint[] points, int pointsLength, ref int level, ref float score);
public extern static int AntiSpoofingVideo(byte[] imgData, ref FaceImage img, FaceRect faceRect, FaceMarkPoint[] points, bool global);
public extern static bool QualityOfBrightness(byte[] imgData, ref FaceImage img, FaceRect faceRect, FaceMarkPoint[] points, int pointsLength, ref int level, ref float score, float v0 = 70, float v1 = 100, float v2 = 210, float v3 = 230);
/// <summary> /// 遮挡评估。 /// <para> /// 判断人脸部分的分辨率。 <br /> /// 需要模型 <see langword="face_landmarker_mask_pts5.csta"/> /// </para> /// </summary> /// <param name="imgData">图像 BGR 数据</param> /// <param name="img">图像宽高通道信息</param> /// <param name="faceRect">人脸位置信息</param> /// <param name="points">人脸关键点 数组</param> /// <param name="pointsLength">人脸关键点 数组长度</param> /// <param name="level">存储 等级</param> /// <param name="score">存储 分数</param> /// <returns></returns> public static bool QualityOfNoMask(byte[] imgData, ref FaceImage img, FaceRect faceRect, FaceMarkPoint[] points, int pointsLength, ref int level, ref float score) { return(ViewFacePlusNative.QualityOfNoMask(imgData, ref img, faceRect, points, pointsLength, ref level, ref score)); }
public extern static bool QualityOfClarityEx(byte[] imgData, ref FaceImage img, FaceRect faceRect, FaceMarkPoint[] points, int pointsLength, ref int level, ref float score, float blur_thresh = 0.8f);
/// <summary> /// 活体检测器 /// <para>视频帧</para> /// </summary> /// <param name="imgData"></param> /// <param name="img">图像宽高通道信息</param> /// <param name="faceRect">人脸位置信息</param> /// <param name="points"></param> /// <param name="global">是否启用全局检测</param> /// <returns> /// <para> /// 单帧识别返回值会是 <see cref="AntiSpoofingStatus.Real"/>、<see cref="AntiSpoofingStatus.Spoof"/>、<see cref="AntiSpoofingStatus.Fuzzy"/> 或 <see cref="AntiSpoofingStatus.Detecting"/><br /> /// 在视频识别输入帧数不满足需求的时候,返回状态就是 <see cref="AntiSpoofingStatus.Detecting"/> /// </para> /// </returns> public static int AntiSpoofingVideo(byte[] imgData, ref FaceImage img, FaceRect faceRect, FaceMarkPoint[] points, bool global) { return(ViewFacePlusNative.AntiSpoofingVideo(imgData, ref img, faceRect, points, global)); }
/// <summary> /// 亮度评估。 /// <para>亮度评估就是评估人脸区域内的亮度值是否均匀正常,存在部分或全部的过亮和过暗都会是评价为LOW。</para> /// <para> /// 评估器会将综合的亮度从灰度值映射到level,其映射关系为: <br /> /// • [0, v0), [v3, ~) => <see cref="QualityLevel.Low"/> <br /> /// • [v0, v1), [v2, v3) => <see cref="QualityLevel.Medium"/> <br /> /// • [v1, v2) => <see cref="QualityLevel.High"/> <br /> /// </para> <br /> /// <para><see langword="{v0, v1, v2, v3}"/> 的默认值为 <see langword="{70, 100, 210, 230}"/></para> /// </summary> /// <param name="imgData">图像 BGR 数据</param> /// <param name="img">图像宽高通道信息</param> /// <param name="faceRect">人脸位置信息</param> /// <param name="points">人脸关键点 数组</param> /// <param name="pointsLength">人脸关键点 数组长度</param> /// <param name="level">存储 等级</param> /// <param name="score">存储 分数</param> /// <param name="v0"></param> /// <param name="v1"></param> /// <param name="v2"></param> /// <param name="v3"></param> /// <returns></returns> public static bool QualityOfBrightness(byte[] imgData, ref FaceImage img, FaceRect faceRect, FaceMarkPoint[] points, int pointsLength, ref int level, ref float score, float v0 = 70, float v1 = 100, float v2 = 210, float v3 = 230) { return(ViewFacePlusNative.QualityOfBrightness(imgData, ref img, faceRect, points, pointsLength, ref level, ref score, v0, v1, v2, v3)); }
/// <summary> /// 获取人脸关键点 /// </summary> /// <param name="imgData">图像 BGR 数据</param> /// <param name="img">图像宽高通道信息</param> /// <param name="faceRect">人脸位置信息</param> /// <param name="pointX">存储关键点 x 坐标的 数组</param> /// <param name="pointY">存储关键点 y 坐标的 数组</param> /// <param name="type">模型类型。0:face_landmarker_pts68;1:face_landmarker_mask_pts5;2:face_landmarker_pts5。</param> /// <returns></returns> public static bool FaceMark(byte[] imgData, ref FaceImage img, FaceRect faceRect, double[] pointX, double[] pointY, int type = 0) { return(ViewFacePlusNative.FaceMark(imgData, ref img, faceRect, pointX, pointY, type)); }
/// <summary> /// 将MRECT转换为Rectangle /// </summary> /// <param name="self"></param> /// <returns></returns> public static Rectangle ToRectangle(this FaceRect self) { return(new Rectangle(self.left, self.top, self.right - self.left, self.bottom - self.top)); }
public static extern void DetectFace(ref FaceRect face);
public static extern bool GetFaceRect(ref FaceRect pRectFace);
public extern static bool FaceMark(byte[] imgData, ref FaceImage img, FaceRect faceRect, double[] pointX, double[] pointY, int type = 0);
private static extern bool GetFaceRectNative(ref FaceRect pRectFace);