Example #1
0
        /// <summary>
        /// 证件照特征提取
        /// </summary>
        /// <param name="hFICEngine">FIC 引擎Handle</param>
        /// <param name="isVideo">人脸数据类型 1-视频 0-静态图片</param>
        /// <param name="bitmap">人脸图像原始数据</param>
        /// <returns>人脸特征提取结果</returns>
        public static int IdCardDataFeatureExtraction(IntPtr hFICEngine, Image image)
        {
            lock (locks)
            {
                if (image.Width % 4 != 0)
                {
                    image = ImageUtil.ScaleImage(image, image.Width - (image.Width % 4), image.Height);
                }
                //Bitmap bitmap = new Bitmap(image);
                ASVLOFFSCREEN offInput = ImageUtil.ReadBmp(image);

                IntPtr offInputPtr = MemoryUtil.Malloc(MemoryUtil.SizeOf <ASVLOFFSCREEN>());
                MemoryUtil.StructureToPtr(offInput, offInputPtr);

                IntPtr faceResPtr = MemoryUtil.Malloc(MemoryUtil.SizeOf <AFIC_FSDK_FACERES>());
                int    result     = ASIDCardFunctions.ArcSoft_FIC_IdCardDataFeatureExtraction(hFICEngine, offInputPtr);
                MemoryUtil.Free(offInput.ppu8Plane[0]);
                MemoryUtil.Free(offInputPtr);
                MemoryUtil.Free(faceResPtr);
                return(result);
            }
        }
Example #2
0
        /// <summary>
        /// 人脸特征提取
        /// </summary>
        /// <param name="hFICEngine">FIC 引擎Handle</param>
        /// <param name="isVideo">人脸数据类型 1-视频 0-静态图片</param>
        /// <param name="bitmap">人脸图像原始数据</param>
        /// <returns>人脸检测结果</returns>
        public static int FaceDataFeatureExtraction(IntPtr hFICEngine, bool isVideo, Bitmap bitmap, ref AFIC_FSDK_FACERES faceRes)
        {
            lock (locks)
            {
                int result = -1;
                if (bitmap != null)
                {
                    ASVLOFFSCREEN offInput = ImageUtil.ReadBmp(bitmap);

                    IntPtr offInputPtr = MemoryUtil.Malloc(MemoryUtil.SizeOf <ASVLOFFSCREEN>());
                    MemoryUtil.StructureToPtr(offInput, offInputPtr);

                    IntPtr faceResPtr = MemoryUtil.Malloc(MemoryUtil.SizeOf <AFIC_FSDK_FACERES>());
                    result  = ASIDCardFunctions.ArcSoft_FIC_FaceDataFeatureExtraction(hFICEngine, isVideo, offInputPtr, faceResPtr);
                    faceRes = MemoryUtil.PtrToStructure <AFIC_FSDK_FACERES>(faceResPtr);
                    MemoryUtil.Free(offInput.ppu8Plane[0]);
                    MemoryUtil.Free(offInputPtr);
                    MemoryUtil.Free(faceResPtr);
                }
                return(result);
            }
        }