Esempio n. 1
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);
        }
Esempio n. 2
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);
 }
Esempio n. 3
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);
        }