Ejemplo 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);
        }
Ejemplo n.º 2
0
        float IFaceCompare.Compare2Image(string imgFile1, string imgFile2)
        {
            object obj = FaceCompareV2._obj;
            float  result;

            lock (obj)
            {
                result = FaceCompareV2._Compare2Image(FaceCompareV2._faceEngne, imgFile1, imgFile2);
            }
            return(result);
        }
Ejemplo n.º 3
0
 void IFaceCompare.CreateFaceEngne()
 {
     try
     {
         if (FaceCompareV2._faceEngne == IntPtr.Zero)
         {
             FaceCompareV2._faceEngne = FaceCompareV2._CreateFaceEngne();
         }
     }
     catch (Exception message)
     {
         this._log.Error(message);
     }
 }
Ejemplo n.º 4
0
        float IFaceCompare.Compare2Feature(byte[] ptFeature1, byte[] ptFeature2)
        {
            float result;

            try
            {
                object obj = FaceCompareV2._obj;
                lock (obj)
                {
                    result = FaceCompareV2._Compare2Feature(FaceCompareV2._faceEngne, ptFeature1, ptFeature2);
                }
            }
            catch (Exception)
            {
                result = -1f;
            }
            return(result);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        public static IFaceCompare Create(FaceCompareType faceCompareType)
        {
            IFaceCompare result = null;

            switch (faceCompareType)
            {
            case FaceCompareType.FaceCompareBase:
                result = new FaceCompareBase();
                break;

            case FaceCompareType.FaceComparePro:
                result = new FaceComparePro();
                break;

            case FaceCompareType.FaceCompareV4:
                result = new FaceCompareV4();
                break;

            case FaceCompareType.FaceCompareV2:
                result = new FaceCompareV2();
                break;
            }
            return(result);
        }
Ejemplo n.º 8
0
 void IFaceCompare.Dispose()
 {
     FaceCompareV2._FreeEngine(FaceCompareV2._faceEngne);
 }