Пример #1
0
        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);
        }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
0
        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);
        }
Пример #5
0
 private static extern int _ExtractFeature(IntPtr engine, byte[] imgRgb24, int width, int height, int pith, ref FaceModelV2 faceModel);