Example #1
0
        private void FaceCapture_Load(object sender, EventArgs e)
        {   // 设定初始视频设备
            comboBoxVideoDevices.DataSource    = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            comboBoxVideoDevices.DisplayMember = "Name";
            if (comboBoxVideoDevices.Items.Count > 0)
            {
                comboBoxVideoDevices.SelectedIndex = 0;
                if (comboBoxVideoDevices.Items.Count == 1)
                {
                    comboBoxVideoDevices.Enabled = false;
                }
            }
            else
            {
                button_Play.Enabled    = false;
                button_Capture.Enabled = false;
            }

            // 设置图片框初始图像
            for (Int32 i = 1; i <= 4; i++)
            {
                FingerPictureBox box = (FingerPictureBox)this.Controls["fingerPictureBox" + i];
                box.InitialImage = Properties.Resources.noimage;
            }
        }
Example #2
0
 private void button_Capture_Click(object sender, EventArgs e)
 {
     // 判断视频设备是否开启
     if (vsp.IsRunning)
     {   // 进行拍照
         for (Int32 i = 1; i <= 4; i++)
         {
             FingerPictureBox box = (FingerPictureBox)this.Controls["fingerPictureBox" + i];
             if (box.ActiveImage == box.InitialImage)
             {   // 更新图像
                 box.ActiveImage = vsp.GetCurrentVideoFrame();
                 break;
             }
         }
     }
 }