示例#1
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);
        }
示例#2
0
        int IFaceCompare.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 = 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];
                        }
                        faceModel = FaceUnit.FaceModelV4ToFaceModel(array2);
                    }
                    else
                    {
                        faceModel = new FaceModel[0];
                    }
                    result = num;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
示例#3
0
        float IFaceCompare.Compare2Image(string imgFile1, string imgFile2)
        {
            float result;

            try
            {
                object obj = this._obj;
                lock (obj)
                {
                    result = FaceCompareV4._Compare2Image(this._faceEngne, imgFile1, imgFile2);
                }
            }
            catch (Exception arg_2B_0)
            {
                throw arg_2B_0;
            }
            return(result);
        }
示例#4
0
        float IFaceCompare.Compare2Feature(byte[] ptFeature1, byte[] ptFeature2)
        {
            float result;

            try
            {
                object obj = this._obj;
                lock (obj)
                {
                    result = FaceCompareV4._Compare2Feature(this._faceEngne, ptFeature1, ptFeature2);
                }
            }
            catch (Exception)
            {
                result = -1f;
            }
            return(result);
        }
示例#5
0
        int IFaceCompare.DetectFaces4Image(byte[] bgr24, int width, int height, int widthstep, out FaceModel[] faceModel)
        {
            int result;

            try
            {
                object obj = this._obj;
                lock (obj)
                {
                    FaceModelRectV4[] array = new FaceModelRectV4[10];
                    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 arg_BB_0)
            {
                throw arg_BB_0;
            }
            return(result);
        }
示例#6
0
        public void CreateDetectFaceEngine()
        {
            object obj = this._obj;

            lock (obj)
            {
                if (this._faceEngne == IntPtr.Zero)
                {
                    if (IntPtr.Size == 4)
                    {
                        this._faceEngne = FaceCompareV4._CreateFaceEngne();
                    }
                    else
                    {
                        if (IntPtr.Size == 8)
                        {
                            this._faceEngne = FaceCompareV4._CreateFaceEngne(1);
                        }
                    }
                    Console.WriteLine(this._faceEngne);
                }
            }
        }
示例#7
0
        public void CreateFaceEngne()
        {
            object obj = this._obj;

            lock (obj)
            {
                if (this._faceEngne == IntPtr.Zero)
                {
                    if (IntPtr.Size == 4)
                    {
                        this._faceEngne = FaceCompareV4._CreateFaceEngne();
                        Console.WriteLine("CreateFaceEngne 32-bit :" + this._faceEngne.ToString());
                    }
                    else
                    {
                        if (IntPtr.Size == 8)
                        {
                            this._faceEngne = FaceCompareV4._CreateFaceEngne(0);
                            Console.WriteLine("CreateFaceEngne 64-bit :" + this._faceEngne.ToString());
                        }
                    }
                }
            }
        }
示例#8
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);
        }
示例#9
0
 void IFaceCompare.Dispose()
 {
     FaceCompareV4._Dispose(this._faceEngne);
 }