int IFaceCompare.DetectFaces4Image(byte[] bgr24, int width, int height, int widthstep, out FaceModel[] faceModel) { int result; try { object obj = FaceCompareV2._obj; lock (obj) { FaceModelV2[] array = new FaceModelV2[20]; int num = FaceCompareV2._FacesDetect(FaceCompareV2._faceEngne, bgr24, width, height, widthstep, array, 20); if (num > 0) { for (int i = 0; i < num; i++) { FaceCompareV2._ExtractFeature(FaceCompareV2._faceEngne, bgr24, width, height, widthstep, ref array[i]); } } faceModel = FaceUnit.FaceModelV2ToFaceModel(array.Take(num).ToArray <FaceModelV2>()); result = num; } } catch (Exception arg_7A_0) { throw arg_7A_0; } return(result); }
public static FaceModel FaceModelV2ToFaceModel(FaceModelV2 faceModelV2) { //return new FaceModel //{ // FaceRect = FaceUnit.FaceModelRectV3ToFaceModelRect(faceModelV2.FaceRect), // Feature = faceModelV2.Feature, // LeftEyeFacePoint = FaceUnit.ToFaceModelPoint(faceModelV2.LeftEyeFacePointInt), // LeftMouthFacePoint = FaceUnit.ToFaceModelPoint(faceModelV2.LeftMouthFacePointInt), // Nose = FaceUnit.ToFaceModelPoint(faceModelV2.Nose), // RightEyeFacePoint = FaceUnit.ToFaceModelPoint(faceModelV2.RightEyeFacePointInt), // RightMouthFacePoint = FaceUnit.ToFaceModelPoint(faceModelV2.RightMouthFacePointInt), // FaceRect.fConf = faceModelV2.Conf, // FaceRect.fRotAngle = faceModelV2.Angle // //FaceRect = // //{ // // fConf = faceModelV2.Conf, // // fRotAngle = faceModelV2.Angle // //} // //FaceRect.fConf = faceModelV2.Conf; // //FaceRect.fRotAngle = faceModelV2.Angle; // // = // //{ // // fConf = faceModelV2.Conf, // // fRotAngle = faceModelV2.Angle // //} //}; FaceModel x = new FaceModel { FaceRect = FaceUnit.FaceModelRectV3ToFaceModelRect(faceModelV2.FaceRect), Feature = faceModelV2.Feature, LeftEyeFacePoint = FaceUnit.ToFaceModelPoint(faceModelV2.LeftEyeFacePointInt), LeftMouthFacePoint = FaceUnit.ToFaceModelPoint(faceModelV2.LeftMouthFacePointInt), Nose = FaceUnit.ToFaceModelPoint(faceModelV2.Nose), RightEyeFacePoint = FaceUnit.ToFaceModelPoint(faceModelV2.RightEyeFacePointInt), RightMouthFacePoint = FaceUnit.ToFaceModelPoint(faceModelV2.RightMouthFacePointInt) //FaceRect.fConf = faceModelV2.Conf, //FaceRect.fRotAngle = faceModelV2.Angle //FaceRect = //{ // fConf = faceModelV2.Conf, // fRotAngle = faceModelV2.Angle //} //FaceRect.fConf = faceModelV2.Conf; //FaceRect.fRotAngle = faceModelV2.Angle; // = //{ // fConf = faceModelV2.Conf, // fRotAngle = faceModelV2.Angle //} }; x.FaceRect.fConf = faceModelV2.Conf; x.FaceRect.fRotAngle = faceModelV2.Angle; return(x); }
int IFaceCompare.ExtractFeature(byte[] bgr24, int width, int height, int widthstep, ref FaceModel faceModel) { int result; try { object obj = FaceCompareV2._obj; lock (obj) { FaceModelV2 faceModelV = faceModel.ToFaceModelV2(); int arg_33_0 = FaceCompareV2._ExtractFeature(FaceCompareV2._faceEngne, bgr24, width, height, widthstep, ref faceModelV); faceModel = FaceUnit.FaceModelV2ToFaceModel(faceModelV); result = arg_33_0; } } catch (Exception) { throw; } return(result); }
int IFaceCompare.DetectFaces4Image_only(byte[] bgr24, int width, int height, int widthstep, out FaceModel[] faceModel, int maxFaceCount) { int result; try { object obj = FaceCompareV2._obj; lock (obj) { FaceModelV2[] array = new FaceModelV2[maxFaceCount]; int num = FaceCompareV2._FacesDetect(FaceCompareV2._faceEngne, bgr24, width, height, widthstep, array, maxFaceCount); faceModel = FaceUnit.FaceModelV2ToFaceModel(array.Take(num).ToArray <FaceModelV2>()); result = num; } } catch (Exception) { throw; } return(result); }
private static extern int _ExtractFeature(IntPtr engine, byte[] imgRgb24, int width, int height, int pith, ref FaceModelV2 faceModel);