public virtual int DetectFaces4Image_only(byte[] bgr24, int width, int height, int widthstep, out FaceModel[] faceModel, int maxFaceCount) { int result; try { object obj = this._obj; lock (obj) { FaceModelRectV4[] array = new FaceModelRectV4[10]; int num = FaceDetectV4._FacesDetects(this._faceEngne, bgr24, width, height, widthstep, array, 10); if (num > 0) { FaceModelV4[] array2 = new FaceModelV4[num]; for (int i = 0; i < num; i++) { array2[i].FaceRect = array[i]; } faceModel = FaceUnit.FaceModelV4ToFaceModel(array2); } else { faceModel = new FaceModel[0]; } result = num; } } catch (Exception) { throw; } return(result); }
int IFaceCompare.ExtractFeature(byte[] bgr24, int width, int height, int widthstep, ref FaceModel faceModel) { int result; try { object obj = this._obj; lock (obj) { FaceModelRectV4 facerRect = faceModel.FaceRect.ToFaceModelRectV4(); byte[] feature = new byte[512]; int expr_3C = FaceCompareV4._ExtractFeature(this._faceEngne, bgr24, width, height, widthstep, facerRect, feature); if (expr_3C == 0) { faceModel.Feature = feature; } result = expr_3C; } } catch (Exception) { throw; } return(result); }
public static FaceModelRect FaceModelRectV3ToFaceModelRect(FaceModelRectV4 faceModelRectV4) { return(new FaceModelRect { Bottom = faceModelRectV4.Bottom, Left = faceModelRectV4.Left, Top = faceModelRectV4.Top, Right = faceModelRectV4.Right, fConf = faceModelRectV4.fConf, fRotAngle = faceModelRectV4.fRotAngle }); }
int IFaceCompare.DetectFaces4Image(byte[] bgr24, int width, int height, int widthstep, out FaceModel[] faceModel, int maxFaceCount) { int result; try { object obj = this._obj; lock (obj) { FaceModelRectV4[] array = new FaceModelRectV4[maxFaceCount]; int num = FaceCompareV4._FacesDetects(this._faceEngne, bgr24, width, height, widthstep, array, 10); if (num > 0) { FaceModelV4[] array2 = new FaceModelV4[num]; for (int i = 0; i < num; i++) { array2[i].FaceRect = array[i]; byte[] feature = new byte[512]; if (FaceCompareV4._ExtractFeature(this._faceEngne, bgr24, width, height, widthstep, array[i], feature) == 0) { array2[i].Feature = feature; } } faceModel = FaceUnit.FaceModelV4ToFaceModel(array2); } else { faceModel = new FaceModel[0]; } result = num; } } catch (Exception) { throw; } return(result); }
private static extern int _ExtractFeature(IntPtr engine, byte[] imgRgb24, int width, int height, int pith, FaceModelRectV4 facerRect, [MarshalAs(UnmanagedType.LPArray)][Out] byte[] feature);