private void ArcSoftFaceDemoX32_Load(object sender, EventArgs e)
        {
            DetectAndRecogition_Init();

            //初始化身份证
            int ret = IDR_D6_API.IDR_InitComm(1001);

            if (ret != 0x90)
            {
                MessageBox.Show("身份证检测失败,请确认身份证是否安装!");
                Console.WriteLine("身份证检测失败,请确认身份证是否安装!");
                this.Close();
            }
            else
            {
                Console.WriteLine("身份证检测成功!");
            }

            //检测摄像头是否安装
            if (!runflag)
            {
                capture = new VideoCapture(0);
                capture.QueryFrame();
                if (!capture.IsOpened)
                {
                    MessageBox.Show("摄像头检测失败,请确认摄像头是否安装!");
                    Console.WriteLine("摄像头检测失败,请确认摄像头是否安装!");
                    this.Close();
                }
                Application.Idle += new EventHandler(ImageGrabbedProcess);
                runflag           = true;
                timer1.Start();
            }
        }
        private void ReadPersonCard()
        {
            try
            {
                int ret = IDR_D6_API.IDR_Authenticate();
                if (ret != 0x90)
                {
                    Console.WriteLine("请用身份证刷卡!!!");
                    return;
                }
                else
                {
                    IDR_D6_API.IDR_Read_Content(1);
                    IDR_D6_API.stCardInfo info = new IDR_D6_API.stCardInfo();
                    ret = IDR_D6_API.IDR_GetIdCardTxtInfo(ref info, "head.bmp");
                    if (ret != 0x90)
                    {
                        Console.WriteLine("读取身份证信息失败!!!");
                        return;
                    }
                    else
                    {
                        Console.WriteLine("读取身份证信息成功!!!");

                        /*
                         * personname = info.Name.TrimEnd();
                         * textBox211.Text = info.Name.TrimEnd();
                         * textBox212.Text = info.Sex.Trim();
                         * textBox213.Text = info.Nation.Trim();
                         * textBox214.Text = info.Birthday.Trim();
                         * textBox215.Text = info.ID.Trim();
                         */
                        IDR_D6_API.IDR_SaveCardData2Bmp(ref info, "front.bmp", 1);
                        //IDR_D6_API.IDR_SaveCardData2Bmp(ref info, @".//PersonBmp//" + info.Name.TrimEnd() + "front.bmp", 1);
                        //IDR_D6_API.IDR_SaveCardData2Bmp(ref info, @".//PersonBmp//" + info.Name.TrimEnd() + "back.bmp", 2);
                        //IDR_D6_API.IDR_SaveCardData2Bmp(ref info, @".//PersonBmp//" + info.Name.TrimEnd() + "full.bmp", 3);

                        pictureBox3.Image = null;
                        Image image = Image.FromFile(@".//front.bmp");
                        pictureBox3.Image = new Bitmap(image);
                        image.Dispose();

                        //pictureBox3.ImageLocation = "front.bmp";
                        personFeature = detectAndExtractFeature(pictureBox3.Image, pictureBox4);
                        if (personFeature.Length > 0)
                        {
                            personflag = true;
                            timer1.Stop();
                        }
                        else
                        {
                            personflag = false;
                        }
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + ex.StackTrace);
                return;
            }
        }