Пример #1
0
        int IFaceCompare.ExtractFeature(byte[] bgr24, int width, int height, int widthstep, ref FaceModel faceModel)
        {
            int result;

            try
            {
                object obj = FaceComparePro._obj;
                lock (obj)
                {
                    FaceModelV3[] array = new FaceModelV3[1];
                    int           num   = FaceComparePro._FacesDetect_AlphaPro(FaceComparePro.FaceEngne, bgr24, width, height, widthstep, array, 1);
                    if (num > 0)
                    {
                        faceModel = FaceUnit.FaceModelV3ToFaceModel(array.FirstOrDefault <FaceModelV3>());
                    }
                    else
                    {
                        faceModel = new FaceModel();
                        num       = -1;
                    }
                    result = num;
                }
            }
            catch (Exception arg_56_0)
            {
                throw arg_56_0;
            }
            return(result);
        }
Пример #2
0
        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);
        }
Пример #3
0
        public static FaceModel WisFaceToFaceModel(WisFace wisFace)
        {
            //return new FaceModel
            //{
            //	FaceRect = FaceUnit.WisRectToFaceModelRect(wisFace),
            //	LeftEyeFacePoint = FaceUnit.WisPointToFaceModelPoint(wisFace.ptLeftEye),
            //	RightEyeFacePoint = FaceUnit.WisPointToFaceModelPoint(wisFace.ptRightEye),
            //	LeftMouthFacePoint = FaceUnit.WisPointToFaceModelPoint(wisFace.ptMouthLeft),
            //	RightMouthFacePoint = FaceUnit.WisPointToFaceModelPoint(wisFace.ptMouthRight),
            //	Nose = FaceUnit.WisPointToFaceModelPoint(wisFace.ptNose),
            //	FaceRect =
            //	{
            //		fConf = wisFace.conf,
            //		Roll = wisFace.roll,
            //		Yaw = wisFace.yaw,
            //		Pitch = wisFace.pitch
            //	}
            //};

            FaceModel y = new FaceModel
            {
                FaceRect            = FaceUnit.WisRectToFaceModelRect(wisFace),
                LeftEyeFacePoint    = FaceUnit.WisPointToFaceModelPoint(wisFace.ptLeftEye),
                RightEyeFacePoint   = FaceUnit.WisPointToFaceModelPoint(wisFace.ptRightEye),
                LeftMouthFacePoint  = FaceUnit.WisPointToFaceModelPoint(wisFace.ptMouthLeft),
                RightMouthFacePoint = FaceUnit.WisPointToFaceModelPoint(wisFace.ptMouthRight),
                Nose = FaceUnit.WisPointToFaceModelPoint(wisFace.ptNose),
            };

            y.FaceRect.fConf = wisFace.conf;
            y.FaceRect.Roll  = wisFace.roll;
            y.FaceRect.Yaw   = wisFace.yaw;
            y.FaceRect.Pitch = wisFace.pitch;
            return(y);
        }
Пример #4
0
 public static FaceModelV4 ToFaceModelV4(FaceModel faceModel)
 {
     return(new FaceModelV4
     {
         FaceRect = faceModel.FaceRect.ToFaceModelRectV4(),
         Feature = faceModel.Feature
     });
 }
Пример #5
0
        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);
        }
Пример #6
0
 public static FaceModel[] FaceModelV4ToFaceModel(FaceModelV4[] faceModelV4)
 {
     FaceModel[] array = new FaceModel[faceModelV4.Length];
     for (int i = 0; i < faceModelV4.Length; i++)
     {
         array[i] = FaceUnit.FaceModelV4ToFaceModel(faceModelV4[i]);
     }
     return(array);
 }
Пример #7
0
 public static Point[] MC_GetFacePoints(FaceModel faceModel)
 {
     return(new Point[]
     {
         FaceHelper.GetPointByPoint(faceModel.LeftEyeFacePoint),
         FaceHelper.GetPointByPoint(faceModel.RightEyeFacePoint),
         FaceHelper.GetPointByPoint(faceModel.Nose),
         FaceHelper.GetPointByPoint(faceModel.LeftMouthFacePoint),
         FaceHelper.GetPointByPoint(faceModel.RightMouthFacePoint)
     });
 }
Пример #8
0
 public static FaceModel[] FaceModelV2ToFaceModel(FaceModelV2[] faceModelV2)
 {
     FaceModel[] array = new FaceModel[faceModelV2.Length];
     for (int i = 0; i < faceModelV2.Length; i++)
     {
         array[i] = FaceUnit.FaceModelV2ToFaceModel(faceModelV2[i]);
     }
     if (array.Length > 1)
     {
         IEnumerable <FaceModel> arg_4C_0 = array;
         Func <FaceModel, int>   arg_4C_1;
         if ((arg_4C_1 = FaceUnit.class_c.class_c_9__0_0) == null)
         {
             arg_4C_1 = (FaceUnit.class_c.class_c_9__0_0 = new Func <FaceModel, int>(FaceUnit.class_c.class_c_9._FaceModelV2ToFaceModel_b__0_0));
         }
         array = arg_4C_0.OrderByDescending(arg_4C_1).ToArray <FaceModel>();
     }
     return(array);
 }
Пример #9
0
        public static int MC_ExtractFeature(Image <Bgr, byte> image, ref FaceModel faceModel)
        {
            int result;

            try
            {
                object obj = FaceCompare._obj;
                lock (obj)
                {
                    FaceModelV3 faceModelV = faceModel.ToFaceModelV3();
                    int         arg_49_0   = FaceCompare._ExtractFeature(FaceCompare.FaceEngne, image.Bytes, image.Width, image.Height, image.MIplImage.Width, ref faceModelV);
                    faceModel = FaceUnit.FaceModelV3ToFaceModel(faceModelV);
                    result    = arg_49_0;
                }
            }
            catch (Exception arg_56_0)
            {
                throw arg_56_0;
            }
            return(result);
        }
Пример #10
0
        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);
        }
Пример #11
0
        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);
        }
Пример #12
0
 public static int MC_BetweenEyes(FaceModel faceModel)
 {
     return(faceModel.RightEyeFacePoint.X - faceModel.LeftEyeFacePoint.X);
 }
Пример #13
0
        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);
        }
Пример #14
0
 internal int _FaceModelV3ToFaceModel_b__2_0(FaceModel p)
 {
     return(p.FaceRect.Right - p.FaceRect.Left);
 }