diff --git a/labs/CameraCardDemo/CameraCardDemo.csproj b/labs/CameraCardDemo/CameraCardDemo.csproj
index 64ce2a8e..224ac7b5 100644
--- a/labs/CameraCardDemo/CameraCardDemo.csproj
+++ b/labs/CameraCardDemo/CameraCardDemo.csproj
@@ -78,6 +78,7 @@
+
Form
@@ -122,7 +123,6 @@
-
PreserveNewest
diff --git a/labs/CameraCardDemo/DirectShowLib-2005.dll b/labs/CameraCardDemo/DirectShowLib-2005.dll
deleted file mode 100644
index ba11a160..00000000
Binary files a/labs/CameraCardDemo/DirectShowLib-2005.dll and /dev/null differ
diff --git a/labs/CameraCardDemo/Infrastructure/IdcModel.cs b/labs/CameraCardDemo/Infrastructure/IdcModel.cs
new file mode 100644
index 00000000..77cdbd46
--- /dev/null
+++ b/labs/CameraCardDemo/Infrastructure/IdcModel.cs
@@ -0,0 +1,20 @@
+namespace CameraCardDemo.Infrastructure
+{
+ internal class IdcModel
+ {
+ public string Name { get; internal set; }
+ public string CnName { get; internal set; }
+ public string Sex { get; internal set; }
+ public string Nation { get; internal set; }
+ public string NationCode { get; internal set; }
+ public string Birthday { get; internal set; }
+ public string IdCardNo { get; internal set; }
+ public string Address { get; internal set; }
+ public string Department { get; internal set; }
+ public string ValidDateStart { get; internal set; }
+ public string ValidDateEnd { get; internal set; }
+ public string SamID { get; internal set; }
+ public string Type { get; internal set; }
+ public string Image { get; internal set; }
+ }
+}
\ No newline at end of file
diff --git a/labs/CameraCardDemo/MainForm.Designer.cs b/labs/CameraCardDemo/MainForm.Designer.cs
index 9ae27136..75201bf9 100644
--- a/labs/CameraCardDemo/MainForm.Designer.cs
+++ b/labs/CameraCardDemo/MainForm.Designer.cs
@@ -29,6 +29,39 @@
private void InitializeComponent()
{
System.Windows.Forms.TabPage tab1;
+ this.idcGroupBox = new System.Windows.Forms.GroupBox();
+ this.idcSamIDValue = new System.Windows.Forms.Label();
+ this.idcSamIDLabel = new System.Windows.Forms.Label();
+ this.idcValidDateValue = new System.Windows.Forms.Label();
+ this.idcValidDateLabel = new System.Windows.Forms.Label();
+ this.idcDepartmentValue = new System.Windows.Forms.Label();
+ this.idcDepartmentLabel = new System.Windows.Forms.Label();
+ this.idcIdCardNoValue = new System.Windows.Forms.Label();
+ this.idcIdCardNoLabel = new System.Windows.Forms.Label();
+ this.idcBirthdayValue = new System.Windows.Forms.Label();
+ this.idcBirthdayLabel = new System.Windows.Forms.Label();
+ this.idcNationCodeValue = new System.Windows.Forms.Label();
+ this.idcNationCodeLabel = new System.Windows.Forms.Label();
+ this.idcNationValue = new System.Windows.Forms.Label();
+ this.idcNationLabel = new System.Windows.Forms.Label();
+ this.idcSexValue = new System.Windows.Forms.Label();
+ this.idcSexLabel = new System.Windows.Forms.Label();
+ this.idcAddressValue = new System.Windows.Forms.Label();
+ this.idcAddressLabel = new System.Windows.Forms.Label();
+ this.idcCnNameValue = new System.Windows.Forms.Label();
+ this.idcCnNameLabel = new System.Windows.Forms.Label();
+ this.idcNameValue = new System.Windows.Forms.Label();
+ this.idcNameLable = new System.Windows.Forms.Label();
+ this.idcPicture = new System.Windows.Forms.PictureBox();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.shotBtn = new System.Windows.Forms.Button();
+ this.log = new System.Windows.Forms.RichTextBox();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.nameValue = new System.Windows.Forms.TextBox();
+ this.nameLabel = new System.Windows.Forms.Label();
+ this.classSecletor = new System.Windows.Forms.ComboBox();
+ this.classLabel = new System.Windows.Forms.Label();
this.cameraSelector = new System.Windows.Forms.ComboBox();
this.cameraRender = new System.Windows.Forms.PictureBox();
this.tabControl1 = new System.Windows.Forms.TabControl();
@@ -36,38 +69,376 @@
this.tab3 = new System.Windows.Forms.TabPage();
this.tab4 = new System.Windows.Forms.TabPage();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
- this.panel1 = new System.Windows.Forms.Panel();
- this.label1 = new System.Windows.Forms.Label();
- this.comboBox1 = new System.Windows.Forms.ComboBox();
- this.label2 = new System.Windows.Forms.Label();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.richTextBox1 = new System.Windows.Forms.RichTextBox();
- this.shotBtn = new System.Windows.Forms.Button();
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.numberValue = new System.Windows.Forms.TextBox();
+ this.numberLabel = new System.Windows.Forms.Label();
+ this.searchButton = new System.Windows.Forms.Button();
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.pullDataMenu = new System.Windows.Forms.ToolStripMenuItem();
+ this.exitMenu = new System.Windows.Forms.ToolStripMenuItem();
tab1 = new System.Windows.Forms.TabPage();
tab1.SuspendLayout();
+ this.idcGroupBox.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.idcPicture)).BeginInit();
+ this.groupBox1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cameraRender)).BeginInit();
this.tabControl1.SuspendLayout();
- this.panel1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// tab1
//
- tab1.Controls.Add(this.pictureBox1);
+ tab1.Controls.Add(this.idcGroupBox);
+ tab1.Controls.Add(this.groupBox1);
tab1.Controls.Add(this.shotBtn);
- tab1.Controls.Add(this.richTextBox1);
+ tab1.Controls.Add(this.log);
tab1.Controls.Add(this.panel1);
tab1.Controls.Add(this.cameraSelector);
tab1.Controls.Add(this.cameraRender);
tab1.Location = new System.Drawing.Point(4, 22);
tab1.Name = "tab1";
tab1.Padding = new System.Windows.Forms.Padding(3);
- tab1.Size = new System.Drawing.Size(1000, 703);
+ tab1.Size = new System.Drawing.Size(1000, 679);
tab1.TabIndex = 0;
tab1.Text = "图像采集";
tab1.UseVisualStyleBackColor = true;
//
+ // idcGroupBox
+ //
+ this.idcGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.idcGroupBox.Controls.Add(this.idcSamIDValue);
+ this.idcGroupBox.Controls.Add(this.idcSamIDLabel);
+ this.idcGroupBox.Controls.Add(this.idcValidDateValue);
+ this.idcGroupBox.Controls.Add(this.idcValidDateLabel);
+ this.idcGroupBox.Controls.Add(this.idcDepartmentValue);
+ this.idcGroupBox.Controls.Add(this.idcDepartmentLabel);
+ this.idcGroupBox.Controls.Add(this.idcIdCardNoValue);
+ this.idcGroupBox.Controls.Add(this.idcIdCardNoLabel);
+ this.idcGroupBox.Controls.Add(this.idcBirthdayValue);
+ this.idcGroupBox.Controls.Add(this.idcBirthdayLabel);
+ this.idcGroupBox.Controls.Add(this.idcNationCodeValue);
+ this.idcGroupBox.Controls.Add(this.idcNationCodeLabel);
+ this.idcGroupBox.Controls.Add(this.idcNationValue);
+ this.idcGroupBox.Controls.Add(this.idcNationLabel);
+ this.idcGroupBox.Controls.Add(this.idcSexValue);
+ this.idcGroupBox.Controls.Add(this.idcSexLabel);
+ this.idcGroupBox.Controls.Add(this.idcAddressValue);
+ this.idcGroupBox.Controls.Add(this.idcAddressLabel);
+ this.idcGroupBox.Controls.Add(this.idcCnNameValue);
+ this.idcGroupBox.Controls.Add(this.idcCnNameLabel);
+ this.idcGroupBox.Controls.Add(this.idcNameValue);
+ this.idcGroupBox.Controls.Add(this.idcNameLable);
+ this.idcGroupBox.Controls.Add(this.idcPicture);
+ this.idcGroupBox.Location = new System.Drawing.Point(174, 274);
+ this.idcGroupBox.Name = "idcGroupBox";
+ this.idcGroupBox.Size = new System.Drawing.Size(425, 222);
+ this.idcGroupBox.TabIndex = 7;
+ this.idcGroupBox.TabStop = false;
+ this.idcGroupBox.Text = "身份证";
+ //
+ // idcSamIDValue
+ //
+ this.idcSamIDValue.AutoSize = true;
+ this.idcSamIDValue.Location = new System.Drawing.Point(82, 199);
+ this.idcSamIDValue.Name = "idcSamIDValue";
+ this.idcSamIDValue.Size = new System.Drawing.Size(41, 12);
+ this.idcSamIDValue.TabIndex = 28;
+ this.idcSamIDValue.Text = "label3";
+ //
+ // idcSamIDLabel
+ //
+ this.idcSamIDLabel.AutoSize = true;
+ this.idcSamIDLabel.Location = new System.Drawing.Point(8, 199);
+ this.idcSamIDLabel.Name = "idcSamIDLabel";
+ this.idcSamIDLabel.Size = new System.Drawing.Size(77, 12);
+ this.idcSamIDLabel.TabIndex = 27;
+ this.idcSamIDLabel.Text = "安全模块号:";
+ //
+ // idcValidDateValue
+ //
+ this.idcValidDateValue.AutoSize = true;
+ this.idcValidDateValue.Location = new System.Drawing.Point(76, 175);
+ this.idcValidDateValue.Name = "idcValidDateValue";
+ this.idcValidDateValue.Size = new System.Drawing.Size(41, 12);
+ this.idcValidDateValue.TabIndex = 26;
+ this.idcValidDateValue.Text = "label4";
+ //
+ // idcValidDateLabel
+ //
+ this.idcValidDateLabel.AutoSize = true;
+ this.idcValidDateLabel.Location = new System.Drawing.Point(8, 175);
+ this.idcValidDateLabel.Name = "idcValidDateLabel";
+ this.idcValidDateLabel.Size = new System.Drawing.Size(65, 12);
+ this.idcValidDateLabel.TabIndex = 25;
+ this.idcValidDateLabel.Text = "有效期限:";
+ //
+ // idcDepartmentValue
+ //
+ this.idcDepartmentValue.AutoSize = true;
+ this.idcDepartmentValue.Location = new System.Drawing.Point(74, 148);
+ this.idcDepartmentValue.Name = "idcDepartmentValue";
+ this.idcDepartmentValue.Size = new System.Drawing.Size(41, 12);
+ this.idcDepartmentValue.TabIndex = 24;
+ this.idcDepartmentValue.Text = "label3";
+ //
+ // idcDepartmentLabel
+ //
+ this.idcDepartmentLabel.AutoSize = true;
+ this.idcDepartmentLabel.Location = new System.Drawing.Point(7, 150);
+ this.idcDepartmentLabel.Name = "idcDepartmentLabel";
+ this.idcDepartmentLabel.Size = new System.Drawing.Size(65, 12);
+ this.idcDepartmentLabel.TabIndex = 23;
+ this.idcDepartmentLabel.Text = "签发机关:";
+ //
+ // idcIdCardNoValue
+ //
+ this.idcIdCardNoValue.AutoSize = true;
+ this.idcIdCardNoValue.Location = new System.Drawing.Point(74, 124);
+ this.idcIdCardNoValue.Name = "idcIdCardNoValue";
+ this.idcIdCardNoValue.Size = new System.Drawing.Size(41, 12);
+ this.idcIdCardNoValue.TabIndex = 22;
+ this.idcIdCardNoValue.Text = "label4";
+ //
+ // idcIdCardNoLabel
+ //
+ this.idcIdCardNoLabel.AutoSize = true;
+ this.idcIdCardNoLabel.Location = new System.Drawing.Point(7, 124);
+ this.idcIdCardNoLabel.Name = "idcIdCardNoLabel";
+ this.idcIdCardNoLabel.Size = new System.Drawing.Size(65, 12);
+ this.idcIdCardNoLabel.TabIndex = 21;
+ this.idcIdCardNoLabel.Text = "身份证号:";
+ //
+ // idcBirthdayValue
+ //
+ this.idcBirthdayValue.AutoSize = true;
+ this.idcBirthdayValue.Location = new System.Drawing.Point(49, 72);
+ this.idcBirthdayValue.Name = "idcBirthdayValue";
+ this.idcBirthdayValue.Size = new System.Drawing.Size(41, 12);
+ this.idcBirthdayValue.TabIndex = 20;
+ this.idcBirthdayValue.Text = "label3";
+ //
+ // idcBirthdayLabel
+ //
+ this.idcBirthdayLabel.AutoSize = true;
+ this.idcBirthdayLabel.Location = new System.Drawing.Point(7, 72);
+ this.idcBirthdayLabel.Name = "idcBirthdayLabel";
+ this.idcBirthdayLabel.Size = new System.Drawing.Size(41, 12);
+ this.idcBirthdayLabel.TabIndex = 19;
+ this.idcBirthdayLabel.Text = "出生:";
+ //
+ // idcNationCodeValue
+ //
+ this.idcNationCodeValue.AutoSize = true;
+ this.idcNationCodeValue.Location = new System.Drawing.Point(250, 48);
+ this.idcNationCodeValue.Name = "idcNationCodeValue";
+ this.idcNationCodeValue.Size = new System.Drawing.Size(41, 12);
+ this.idcNationCodeValue.TabIndex = 18;
+ this.idcNationCodeValue.Text = "label3";
+ //
+ // idcNationCodeLabel
+ //
+ this.idcNationCodeLabel.AutoSize = true;
+ this.idcNationCodeLabel.Location = new System.Drawing.Point(193, 48);
+ this.idcNationCodeLabel.Name = "idcNationCodeLabel";
+ this.idcNationCodeLabel.Size = new System.Drawing.Size(65, 12);
+ this.idcNationCodeLabel.TabIndex = 17;
+ this.idcNationCodeLabel.Text = "民族代码:";
+ //
+ // idcNationValue
+ //
+ this.idcNationValue.AutoSize = true;
+ this.idcNationValue.Location = new System.Drawing.Point(132, 48);
+ this.idcNationValue.Name = "idcNationValue";
+ this.idcNationValue.Size = new System.Drawing.Size(41, 12);
+ this.idcNationValue.TabIndex = 16;
+ this.idcNationValue.Text = "label4";
+ //
+ // idcNationLabel
+ //
+ this.idcNationLabel.AutoSize = true;
+ this.idcNationLabel.Location = new System.Drawing.Point(95, 49);
+ this.idcNationLabel.Name = "idcNationLabel";
+ this.idcNationLabel.Size = new System.Drawing.Size(41, 12);
+ this.idcNationLabel.TabIndex = 15;
+ this.idcNationLabel.Text = "民族:";
+ //
+ // idcSexValue
+ //
+ this.idcSexValue.AutoSize = true;
+ this.idcSexValue.Location = new System.Drawing.Point(47, 49);
+ this.idcSexValue.Name = "idcSexValue";
+ this.idcSexValue.Size = new System.Drawing.Size(41, 12);
+ this.idcSexValue.TabIndex = 14;
+ this.idcSexValue.Text = "label3";
+ //
+ // idcSexLabel
+ //
+ this.idcSexLabel.AutoSize = true;
+ this.idcSexLabel.Location = new System.Drawing.Point(7, 49);
+ this.idcSexLabel.Name = "idcSexLabel";
+ this.idcSexLabel.Size = new System.Drawing.Size(41, 12);
+ this.idcSexLabel.TabIndex = 13;
+ this.idcSexLabel.Text = "性别:";
+ //
+ // idcAddressValue
+ //
+ this.idcAddressValue.AutoSize = true;
+ this.idcAddressValue.Location = new System.Drawing.Point(49, 97);
+ this.idcAddressValue.Name = "idcAddressValue";
+ this.idcAddressValue.Size = new System.Drawing.Size(41, 12);
+ this.idcAddressValue.TabIndex = 12;
+ this.idcAddressValue.Text = "label3";
+ //
+ // idcAddressLabel
+ //
+ this.idcAddressLabel.AutoSize = true;
+ this.idcAddressLabel.Location = new System.Drawing.Point(7, 97);
+ this.idcAddressLabel.Name = "idcAddressLabel";
+ this.idcAddressLabel.Size = new System.Drawing.Size(41, 12);
+ this.idcAddressLabel.TabIndex = 11;
+ this.idcAddressLabel.Text = "地址:";
+ //
+ // idcCnNameValue
+ //
+ this.idcCnNameValue.AutoSize = true;
+ this.idcCnNameValue.Location = new System.Drawing.Point(219, 24);
+ this.idcCnNameValue.Name = "idcCnNameValue";
+ this.idcCnNameValue.Size = new System.Drawing.Size(41, 12);
+ this.idcCnNameValue.TabIndex = 10;
+ this.idcCnNameValue.Text = "label3";
+ //
+ // idcCnNameLabel
+ //
+ this.idcCnNameLabel.AutoSize = true;
+ this.idcCnNameLabel.Location = new System.Drawing.Point(156, 24);
+ this.idcCnNameLabel.Name = "idcCnNameLabel";
+ this.idcCnNameLabel.Size = new System.Drawing.Size(65, 12);
+ this.idcCnNameLabel.TabIndex = 9;
+ this.idcCnNameLabel.Text = "中文姓名:";
+ //
+ // idcNameValue
+ //
+ this.idcNameValue.AutoSize = true;
+ this.idcNameValue.Location = new System.Drawing.Point(45, 24);
+ this.idcNameValue.Name = "idcNameValue";
+ this.idcNameValue.Size = new System.Drawing.Size(41, 12);
+ this.idcNameValue.TabIndex = 8;
+ this.idcNameValue.Text = "label3";
+ //
+ // idcNameLable
+ //
+ this.idcNameLable.AutoSize = true;
+ this.idcNameLable.Location = new System.Drawing.Point(7, 23);
+ this.idcNameLable.Name = "idcNameLable";
+ this.idcNameLable.Size = new System.Drawing.Size(41, 12);
+ this.idcNameLable.TabIndex = 7;
+ this.idcNameLable.Text = "姓名:";
+ //
+ // idcPicture
+ //
+ this.idcPicture.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.idcPicture.Location = new System.Drawing.Point(299, 20);
+ this.idcPicture.Name = "idcPicture";
+ this.idcPicture.Size = new System.Drawing.Size(120, 147);
+ this.idcPicture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+ this.idcPicture.TabIndex = 6;
+ this.idcPicture.TabStop = false;
+ //
+ // groupBox1
+ //
+ this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupBox1.Controls.Add(this.pictureBox1);
+ this.groupBox1.Location = new System.Drawing.Point(173, 6);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(426, 252);
+ this.groupBox1.TabIndex = 6;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "学籍信息";
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.pictureBox1.Location = new System.Drawing.Point(300, 19);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(120, 147);
+ this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+ this.pictureBox1.TabIndex = 5;
+ this.pictureBox1.TabStop = false;
+ //
+ // shotBtn
+ //
+ this.shotBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.shotBtn.Location = new System.Drawing.Point(764, 462);
+ this.shotBtn.Name = "shotBtn";
+ this.shotBtn.Size = new System.Drawing.Size(75, 34);
+ this.shotBtn.TabIndex = 4;
+ this.shotBtn.Text = "拍照";
+ this.shotBtn.UseVisualStyleBackColor = true;
+ this.shotBtn.Click += new System.EventHandler(this.shotBtn_Click);
+ //
+ // log
+ //
+ this.log.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.log.Location = new System.Drawing.Point(173, 516);
+ this.log.Name = "log";
+ this.log.Size = new System.Drawing.Size(819, 142);
+ this.log.TabIndex = 3;
+ this.log.Text = "";
+ //
+ // panel1
+ //
+ this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)));
+ this.panel1.Controls.Add(this.searchButton);
+ this.panel1.Controls.Add(this.numberValue);
+ this.panel1.Controls.Add(this.numberLabel);
+ this.panel1.Controls.Add(this.nameValue);
+ this.panel1.Controls.Add(this.nameLabel);
+ this.panel1.Controls.Add(this.classSecletor);
+ this.panel1.Controls.Add(this.classLabel);
+ this.panel1.Location = new System.Drawing.Point(7, 6);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(160, 652);
+ this.panel1.TabIndex = 2;
+ //
+ // nameValue
+ //
+ this.nameValue.Location = new System.Drawing.Point(55, 44);
+ this.nameValue.Name = "nameValue";
+ this.nameValue.Size = new System.Drawing.Size(100, 21);
+ this.nameValue.TabIndex = 3;
+ //
+ // nameLabel
+ //
+ this.nameLabel.AutoSize = true;
+ this.nameLabel.Location = new System.Drawing.Point(8, 49);
+ this.nameLabel.Name = "nameLabel";
+ this.nameLabel.Size = new System.Drawing.Size(41, 12);
+ this.nameLabel.TabIndex = 2;
+ this.nameLabel.Text = "姓名:";
+ //
+ // classSecletor
+ //
+ this.classSecletor.FormattingEnabled = true;
+ this.classSecletor.Location = new System.Drawing.Point(55, 11);
+ this.classSecletor.Name = "classSecletor";
+ this.classSecletor.Size = new System.Drawing.Size(100, 20);
+ this.classSecletor.TabIndex = 1;
+ //
+ // classLabel
+ //
+ this.classLabel.AutoSize = true;
+ this.classLabel.Location = new System.Drawing.Point(7, 16);
+ this.classLabel.Name = "classLabel";
+ this.classLabel.Size = new System.Drawing.Size(41, 12);
+ this.classLabel.TabIndex = 0;
+ this.classLabel.Text = "班级:";
+ //
// cameraSelector
//
this.cameraSelector.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -96,11 +467,10 @@
this.tabControl1.Controls.Add(this.tab2);
this.tabControl1.Controls.Add(this.tab3);
this.tabControl1.Controls.Add(this.tab4);
- this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tabControl1.Location = new System.Drawing.Point(0, 0);
+ this.tabControl1.Location = new System.Drawing.Point(0, 24);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(1008, 729);
+ this.tabControl1.Size = new System.Drawing.Size(1008, 705);
this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.tabControl1.TabIndex = 2;
//
@@ -142,82 +512,53 @@
this.statusStrip1.TabIndex = 3;
this.statusStrip1.Text = "statusStrip1";
//
- // panel1
- //
- this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.panel1.Controls.Add(this.textBox1);
- this.panel1.Controls.Add(this.label2);
- this.panel1.Controls.Add(this.comboBox1);
- this.panel1.Controls.Add(this.label1);
- this.panel1.Location = new System.Drawing.Point(7, 6);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(160, 676);
- this.panel1.TabIndex = 2;
+ // numberValue
//
- // label1
+ this.numberValue.Location = new System.Drawing.Point(55, 80);
+ this.numberValue.Name = "numberValue";
+ this.numberValue.Size = new System.Drawing.Size(100, 21);
+ this.numberValue.TabIndex = 5;
//
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(5, 19);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(41, 12);
- this.label1.TabIndex = 0;
- this.label1.Text = "班级:";
+ // numberLabel
//
- // comboBox1
+ this.numberLabel.AutoSize = true;
+ this.numberLabel.Location = new System.Drawing.Point(8, 85);
+ this.numberLabel.Name = "numberLabel";
+ this.numberLabel.Size = new System.Drawing.Size(53, 12);
+ this.numberLabel.TabIndex = 4;
+ this.numberLabel.Text = "考籍号:";
//
- this.comboBox1.FormattingEnabled = true;
- this.comboBox1.Location = new System.Drawing.Point(55, 11);
- this.comboBox1.Name = "comboBox1";
- this.comboBox1.Size = new System.Drawing.Size(100, 20);
- this.comboBox1.TabIndex = 1;
+ // searchButton
//
- // label2
+ this.searchButton.Location = new System.Drawing.Point(9, 118);
+ this.searchButton.Name = "searchButton";
+ this.searchButton.Size = new System.Drawing.Size(146, 30);
+ this.searchButton.TabIndex = 6;
+ this.searchButton.Text = "检索";
+ this.searchButton.UseVisualStyleBackColor = true;
//
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(7, 54);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(41, 12);
- this.label2.TabIndex = 2;
- this.label2.Text = "姓名:";
+ // menuStrip1
//
- // textBox1
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.pullDataMenu,
+ this.exitMenu});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(1008, 25);
+ this.menuStrip1.TabIndex = 4;
+ this.menuStrip1.Text = "menuStrip1";
//
- this.textBox1.Location = new System.Drawing.Point(55, 44);
- this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(100, 21);
- this.textBox1.TabIndex = 3;
+ // pullDataMenu
//
- // richTextBox1
+ this.pullDataMenu.Name = "pullDataMenu";
+ this.pullDataMenu.Size = new System.Drawing.Size(68, 21);
+ this.pullDataMenu.Text = "更新数据";
//
- this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.richTextBox1.Location = new System.Drawing.Point(173, 516);
- this.richTextBox1.Name = "richTextBox1";
- this.richTextBox1.Size = new System.Drawing.Size(819, 166);
- this.richTextBox1.TabIndex = 3;
- this.richTextBox1.Text = "";
+ // exitMenu
//
- // shotBtn
- //
- this.shotBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.shotBtn.Location = new System.Drawing.Point(764, 473);
- this.shotBtn.Name = "shotBtn";
- this.shotBtn.Size = new System.Drawing.Size(75, 23);
- this.shotBtn.TabIndex = 4;
- this.shotBtn.Text = "拍照";
- this.shotBtn.UseVisualStyleBackColor = true;
- this.shotBtn.Click += new System.EventHandler(this.shotBtn_Click);
- //
- // pictureBox1
- //
- this.pictureBox1.Location = new System.Drawing.Point(251, 84);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(100, 50);
- this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
- this.pictureBox1.TabIndex = 5;
- this.pictureBox1.TabStop = false;
+ this.exitMenu.Name = "exitMenu";
+ this.exitMenu.Size = new System.Drawing.Size(44, 21);
+ this.exitMenu.Text = "退出";
//
// MainForm
//
@@ -225,6 +566,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1008, 729);
this.Controls.Add(this.statusStrip1);
+ this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.tabControl1);
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
@@ -232,12 +574,17 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.Load += new System.EventHandler(this.MainFrom_Load);
tab1.ResumeLayout(false);
- tab1.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.cameraRender)).EndInit();
- this.tabControl1.ResumeLayout(false);
+ this.idcGroupBox.ResumeLayout(false);
+ this.idcGroupBox.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.idcPicture)).EndInit();
+ this.groupBox1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.cameraRender)).EndInit();
+ this.tabControl1.ResumeLayout(false);
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -253,12 +600,43 @@
private System.Windows.Forms.TabPage tab4;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.TextBox textBox1;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.ComboBox comboBox1;
- private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox nameValue;
+ private System.Windows.Forms.Label nameLabel;
+ private System.Windows.Forms.ComboBox classSecletor;
+ private System.Windows.Forms.Label classLabel;
private System.Windows.Forms.Button shotBtn;
- private System.Windows.Forms.RichTextBox richTextBox1;
+ private System.Windows.Forms.RichTextBox log;
private System.Windows.Forms.PictureBox pictureBox1;
+ private System.Windows.Forms.GroupBox idcGroupBox;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.PictureBox idcPicture;
+ private System.Windows.Forms.Label idcNameValue;
+ private System.Windows.Forms.Label idcNameLable;
+ private System.Windows.Forms.Label idcCnNameValue;
+ private System.Windows.Forms.Label idcCnNameLabel;
+ private System.Windows.Forms.Label idcAddressValue;
+ private System.Windows.Forms.Label idcAddressLabel;
+ private System.Windows.Forms.Label idcSexValue;
+ private System.Windows.Forms.Label idcSexLabel;
+ private System.Windows.Forms.Label idcNationValue;
+ private System.Windows.Forms.Label idcNationLabel;
+ private System.Windows.Forms.Label idcNationCodeLabel;
+ private System.Windows.Forms.Label idcNationCodeValue;
+ private System.Windows.Forms.Label idcBirthdayValue;
+ private System.Windows.Forms.Label idcBirthdayLabel;
+ private System.Windows.Forms.Label idcIdCardNoValue;
+ private System.Windows.Forms.Label idcIdCardNoLabel;
+ private System.Windows.Forms.Label idcDepartmentValue;
+ private System.Windows.Forms.Label idcDepartmentLabel;
+ private System.Windows.Forms.Label idcValidDateValue;
+ private System.Windows.Forms.Label idcValidDateLabel;
+ private System.Windows.Forms.Label idcSamIDValue;
+ private System.Windows.Forms.Label idcSamIDLabel;
+ private System.Windows.Forms.Button searchButton;
+ private System.Windows.Forms.TextBox numberValue;
+ private System.Windows.Forms.Label numberLabel;
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem pullDataMenu;
+ private System.Windows.Forms.ToolStripMenuItem exitMenu;
}
}
\ No newline at end of file
diff --git a/labs/CameraCardDemo/MainForm.cs b/labs/CameraCardDemo/MainForm.cs
index b38a0763..03fcd68f 100644
--- a/labs/CameraCardDemo/MainForm.cs
+++ b/labs/CameraCardDemo/MainForm.cs
@@ -3,11 +3,13 @@ using OpenCvSharp;
using OpenCvSharp.Extensions;
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
+using System.Globalization;
+using System.IO;
using System.Linq;
+using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -16,12 +18,12 @@ namespace CameraCardDemo
{
public partial class MainForm : Form
{
- private CancellationTokenSource _cameraScanCts = new CancellationTokenSource();
+ private CancellationTokenSource _cts = new CancellationTokenSource();
private List _cameras = new List();
private VideoCapture _videoCapture;
- private CancellationToken cancellationToken = new CancellationToken();
private Rectangle _rect;
private Pen _pen;
+ private int _cvrStatus = 0;
public MainForm()
{
@@ -30,24 +32,62 @@ namespace CameraCardDemo
private void MainFrom_Load(object sender, EventArgs e)
{
+ foreach (Control item in this.idcGroupBox.Controls)
+ {
+ if (item is Label && item.Name.EndsWith("Value"))
+ {
+ (item as Label).Text = "";
+ }
+ }
this.CreateRect();
Task.Run(async () =>
{
- while (!this._cameraScanCts.IsCancellationRequested)
+ while (!this._cts.IsCancellationRequested)
{
this.ScanCameras();
await Task.Delay(1000);
}
});
- try
+ Task.Run(async () =>
{
- //读卡器
- InitCardReader();
- }
- catch (Exception ex)
+ while (!this._cts.IsCancellationRequested)
+ {
+ this.ScanCardReader();
+ await Task.Delay(1000);
+ }
+ });
+ Task.Run(() =>
{
- MessageBox.Show(ex.Message);
- }
+ while (!this._cts.IsCancellationRequested)
+ {
+ try
+ {
+ if (this._cvrStatus == 1 && CVRSDK.CVR_Authenticate() == 1 && CVRSDK.CVR_Read_FPContent() == 1)
+ {
+ var nameBytes = new byte[128];
+ var length = 128;
+ CVRSDK.GetPeopleName(ref nameBytes[0], ref length);
+ var name = System.Text.Encoding.GetEncoding("GB2312").GetString(nameBytes);
+ this.Invoke(new Action(() =>
+ {
+ this.FillData();
+ this.log.AppendText(name);
+ this.log.AppendText(Environment.NewLine);
+ }));
+ }
+ }
+ catch (Exception ex)
+ {
+ this.Invoke(new Action(() =>
+ {
+ this.log.AppendText(ex.Message);
+ this.log.AppendText(Environment.NewLine);
+ }));
+ }
+
+ Thread.Sleep(600);
+ }
+ });
}
private void CreateRect()
@@ -85,49 +125,183 @@ namespace CameraCardDemo
}));
}
- private void InitCardReader()
+ private void ScanCardReader()
{
- int iPort, iRetUSB = 0;
- for (iPort = 1001; iPort <= 1016; iPort++)
+ for (var usbPort = 1001; usbPort <= 1016; usbPort++)
{
- iRetUSB = CVRSDK.CVR_InitComm(iPort);
- if (iRetUSB == 1)
+ this._cvrStatus = CVRSDK.CVR_InitComm(usbPort);
+ if (this._cvrStatus == 1)
{
break;
}
}
+ if (this._cvrStatus != 1)
+ {
+ this.Invoke(new Action(() =>
+ {
+ this.idcGroupBox.Text = $"身份证(设备未连接)";
+ }));
+ }
+ else
+ {
+ this.Invoke(new Action(() =>
+ {
+ this.idcGroupBox.Text = $"身份证(设备已连接)";
+ }));
+ }
+ }
- if (iRetUSB == 1)
+ public void FillData()
+ {
+ try
{
- Debug.WriteLine("读卡器初始化成功");
- Task.Run(() =>
+ byte[] imgData = new byte[40960];
+ int length = 40960;
+ CVRSDK.GetBMPData(ref imgData[0], ref length);
+ using (var myStream = new MemoryStream())
{
- while (!this.cancellationToken.IsCancellationRequested)
+ for (int i = 0; i < length; i++)
{
- if (CVRSDK.CVR_Authenticate() == 1 && CVRSDK.CVR_Read_FPContent() == 1)
- {
- var name = new byte[128];
- var length = 128;
- CVRSDK.GetPeopleName(ref name[0], ref length);
- MessageBox.Show(System.Text.Encoding.GetEncoding("GB2312").GetString(name));
- }
- Thread.Sleep(600);
+ myStream.WriteByte(imgData[i]);
}
- });
+ Image myImage = Image.FromStream(myStream);
+ idcPicture.Image = myImage;
+ }
+
+ byte[] name = new byte[128];
+ length = 128;
+ CVRSDK.GetPeopleName(ref name[0], ref length);
+
+ byte[] cnName = new byte[128];
+ length = 128;
+ CVRSDK.GetPeopleChineseName(ref cnName[0], ref length);
+
+ byte[] number = new byte[128];
+ length = 128;
+ CVRSDK.GetPeopleIDCode(ref number[0], ref length);
+
+ byte[] peopleNation = new byte[128];
+ length = 128;
+ CVRSDK.GetPeopleNation(ref peopleNation[0], ref length);
+
+ byte[] peopleNationCode = new byte[128];
+ length = 128;
+ CVRSDK.GetNationCode(ref peopleNationCode[0], ref length);
+
+ byte[] validtermOfStart = new byte[128];
+ length = 128;
+ CVRSDK.GetStartDate(ref validtermOfStart[0], ref length);
+
+ byte[] birthday = new byte[128];
+ length = 128;
+ CVRSDK.GetPeopleBirthday(ref birthday[0], ref length);
+
+ byte[] address = new byte[128];
+ length = 128;
+ CVRSDK.GetPeopleAddress(ref address[0], ref length);
+
+ byte[] validtermOfEnd = new byte[128];
+ length = 128;
+ CVRSDK.GetEndDate(ref validtermOfEnd[0], ref length);
+
+ byte[] signdate = new byte[128];
+ length = 128;
+ CVRSDK.GetDepartment(ref signdate[0], ref length);
+
+ byte[] sex = new byte[128];
+ length = 128;
+ CVRSDK.GetPeopleSex(ref sex[0], ref length);
+
+ byte[] samid = new byte[128];
+ CVRSDK.CVR_GetSAMID(ref samid[0]);
+
+ bool bCivic = true;
+ byte[] certType = new byte[32];
+ length = 32;
+ CVRSDK.GetCertType(ref certType[0], ref length);
+
+ string strType = System.Text.Encoding.ASCII.GetString(certType);
+ int nStart = strType.IndexOf("I");
+ if (nStart != -1) bCivic = false;
+ var model = new IdcModel
+ {
+ Type = bCivic ? "居民身份证" : "外国人永居证",
+ Name = GetString(name),
+ CnName = bCivic ? "" : GetString(name),
+ Sex = GetString(sex),
+ Nation = GetString(peopleNation),
+ NationCode = GetString(peopleNationCode),
+ Birthday = GetDataString(GetString(birthday)),
+ IdCardNo = GetString(number),
+ Address = bCivic ? GetString(address) : "",
+ Department = GetString(signdate),
+ ValidDateStart = GetString(validtermOfStart),
+ ValidDateEnd = GetString(validtermOfEnd),
+ SamID = GetString(samid),
+ };
+ //using (var ms = new MemoryStream())
+ //{
+ // idcPicture.Image.Save(ms, ImageFormat.Bmp);
+ // model.Image = Convert.ToBase64String(ms.ToArray());
+ //}
+ if (bCivic)
+ {
+ this.idcAddressLabel.Visible = true;
+ this.idcAddressValue.Visible = true;
+ this.idcCnNameLabel.Visible = false;
+ this.idcCnNameValue.Visible = false;
+ this.idcAddressLabel.Visible = true;
+ this.idcAddressValue.Visible = true;
+ this.idcAddressValue.Text = model.Address;
+ this.idcNameLable.Text = "民族:";
+ this.idcNationCodeLabel.Text = "民族代码:";
+ this.idcIdCardNoLabel.Text = "身份证号";
+ }
+ else
+ {
+ this.idcAddressLabel.Visible = false;
+ this.idcAddressValue.Visible = false;
+ this.idcCnNameLabel.Visible = true;
+ this.idcCnNameValue.Visible = true;
+ this.idcAddressLabel.Visible = false;
+ this.idcAddressValue.Visible = false;
+ this.idcCnNameValue.Text = model.CnName;
+ this.idcNameLable.Text = "国籍:";
+ this.idcNationCodeLabel.Text = "国籍代码:";
+ this.idcIdCardNoLabel.Text = "证件号码";
+ }
+ this.idcNameValue.Text = model.Name;
+ this.idcSexValue.Text = model.Sex;
+ this.idcNationValue.Text = model.Nation;
+ this.idcNationCodeValue.Text = model.NationCode;
+ this.idcBirthdayValue.Text = model.Birthday;
+ this.idcIdCardNoValue.Text = model.IdCardNo;
+ this.idcDepartmentValue.Text = model.Department;
+ this.idcValidDateValue.Text = $"{ GetDataString(model.ValidDateStart, '.')}-{GetDataString(model.ValidDateEnd, '.')}";
+ this.idcSamIDValue.Text = model.SamID;
}
- else
+ catch (Exception ex)
{
- //MessageBox.Show("读卡器初始化失败");
+ MessageBox.Show(ex.ToString());
}
}
+ private string GetString(byte[] data)
+ {
+ return Encoding.GetEncoding("GB2312").GetString(data).Replace("\0", "").Trim();
+ }
+
+ private string GetDataString(string value, char sep = '-')
+ {
+ return DateTime.ParseExact(value, "yyyyMMdd", CultureInfo.InvariantCulture).ToString($"yyyy{sep}MM{sep}dd");
+ }
+
private void cameraSelector_SelectedIndexChanged(object sender, EventArgs e)
{
Release();
this._videoCapture = new VideoCapture((sender as ComboBox).SelectedIndex);
if (this._videoCapture.IsOpened())
{
- //this.ResizeCamera();
Task.Run(() =>
{
while (this._videoCapture.IsOpened())
@@ -140,7 +314,7 @@ namespace CameraCardDemo
this.cameraRender.Image = mat.ToBitmap();
}
}
- catch (Exception ex)
+ catch
{
this._videoCapture.Release();
break;
@@ -150,36 +324,13 @@ namespace CameraCardDemo
}
}
- private void Release()
- {
- if (this._videoCapture != null && _videoCapture.IsOpened())
- {
- this._videoCapture.Release();
- }
- }
-
- private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
- {
- this._cameraScanCts.Cancel();
- Release();
- this._pen.Dispose();
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- this._cameras.Add("14123");
- }
-
private void shotBtn_Click(object sender, EventArgs e)
{
- //剪裁
var bitmap = this.ClipImage();
-
- //缩放
bitmap = this.ResizeImage(bitmap);
pictureBox1.Image = bitmap;
var eps = new EncoderParameters(1);
- eps.Param[0] = new EncoderParameter(Encoder.Quality, 70L);
+ eps.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 70L);
bitmap.Save("temp.jpeg", ImageFormat.Jpeg);
}
@@ -216,5 +367,21 @@ namespace CameraCardDemo
{
e.Graphics.DrawRectangle(this._pen, _rect);
}
+
+ private void Release()
+ {
+ if (this._videoCapture != null && _videoCapture.IsOpened())
+ {
+ this._videoCapture.Release();
+ }
+ }
+
+ private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ this._cts.Cancel();
+ Release();
+ this._pen.Dispose();
+ CVRSDK.CVR_CloseComm();
+ }
}
}
\ No newline at end of file
diff --git a/labs/CameraCardDemo/MainForm.resx b/labs/CameraCardDemo/MainForm.resx
index 5be4ca86..0d95232e 100644
--- a/labs/CameraCardDemo/MainForm.resx
+++ b/labs/CameraCardDemo/MainForm.resx
@@ -123,6 +123,9 @@
17, 17
+
+ 138, 17
+
40