Пример #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(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);
        }