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
        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);
        }