Exemplo n.º 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);
        }
Exemplo n.º 2
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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }