コード例 #1
0
        private void CompareTest(string sfzImg, string paiZhaoImg)
        {
            Bitmap Bitmap = new Bitmap(paiZhaoImg);

            int res = IDCardUtil.IdCardDataFeatureExtraction(pEngine, Image.FromFile(sfzImg));

            if (res == 0)
            {
                AFIC_FSDK_FACERES faceInfo = new AFIC_FSDK_FACERES();
                int result2 = IDCardUtil.FaceDataFeatureExtraction(pEngine, false, Bitmap, ref faceInfo);
                if (result2 == 0 && faceInfo.nFace > 0)
                {
                    float pSimilarScore = 0;
                    int   pResult       = 0;
                    float threshold     = 0.82f;
                    int   result3       = IDCardUtil.FaceIdCardCompare(ref pSimilarScore, ref pResult, pEngine, threshold);
                    if (result3 == 0)
                    {
                        Console.WriteLine("相似度:" + pSimilarScore);
                        if (pSimilarScore >= GetFaceThreshold())
                        {
                            timer.Close();
                            MessageBox.Show("活体,相似度" + pSimilarScore + ",人脸验证通过!");
                            App.Current.Dispatcher.Invoke((Action)(() =>
                            {
                                this.Close();
                                CameraHelper.CloseDevice();
                                Console.WriteLine("关闭摄像头");
                                int retCode = ASIDCardFunctions.ArcSoft_FIC_UninitialEngine(pEngine);
                                Console.WriteLine("UninitEngine Result:" + retCode);
                                Window_Closed();
                            }));
                        }
                        else
                        {
                            MessageBox.Show("相似度" + pSimilarScore + ",人脸验证未通过!");
                            timer.Start();
                        }
                    }
                    else
                    {
                        MessageBox.Show("识别失败,请重试!");
                        timer.Start();
                    }
                }
                else
                {
                    MessageBox.Show("未检测到人脸,请重试!");
                    timer.Start();
                }
            }
            else
            {
                MessageBox.Show("1" + Convert.ToString(res));
            }
        }
コード例 #2
0
        /// <summary>
        /// 窗体关闭事件
        /// </summary>
        private void ArcfaceIDCard_FormClosed(object sender, FormClosedEventArgs e)
        {
            //销毁引擎
            int retCode = ASIDCardFunctions.ArcSoft_FIC_UninitialEngine(pEngine);

            //ReadIDCardFunctuions.CVR_CloseComm();
            videoSource.SignalToStop();
            //关闭定时器
            timerRead.Stop();
            Console.WriteLine("UninitEngine Result:" + retCode);
        }
コード例 #3
0
        public HttpResponseMessage PostImageVerficationReturn(JObject JsonRequest)
        {
            int    status  = 1;
            string picPath = JsonRequest["picPath"].ToString();

            InitEngines();
            status = ReadImage(picPath);
            String returnValue = JsonConvert.SerializeObject(new
            {
                status = status.ToString()
            });
            int retCode = ASIDCardFunctions.ArcSoft_FIC_UninitialEngine(pEngine);

            return(ResultToJson.toJson(returnValue));
        }