private void BtnCapture1_Click(object sender, EventArgs e) { Byte[] fp_image = new Byte[m_ImageWidth * m_ImageHeight]; Int32 error = (Int32)SGFPMError.ERROR_NONE; Int32 img_qlty = 0; Int32 info; if (m_DeviceOpened) { error = m_FPM.GetImage(fp_image); } else { error = GetImageFromFile(fp_image); } if (error == (Int32)SGFPMError.ERROR_NONE) { m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty); progressBar_R1.Value = img_qlty; DrawImage(fp_image, pictureBoxR1); SGFPMFingerInfo finger_info = new SGFPMFingerInfo(); // finger_info.FingerNumber = (SGFPMFingerPosition)comboBoxSelFinger.SelectedIndex; finger_info.ImageQuality = (Int16)img_qlty; finger_info.ImpressionType = (Int16)SGFPMImpressionType.IMPTYPE_LP; finger_info.ViewNumber = 1; // CreateTemplate info = m_FPM.CreateTemplate(finger_info, fp_image, m_RegMin1); if (error == (Int32)SGFPMError.ERROR_NONE) { StatusBar.Text = "Image is captured"; } else { StatusBar.Text = "GetMinutiae() Error : " + error; } } else { StatusBar.Text = "GetImage() Error . Try again: " + error; } }
private void button3_Click(object sender, EventArgs e) { if (textBox1.Text != "") { Int32 iError; Byte[] fp_image; Int32 img_qlty; fp_image = new Byte[m_ImageWidth * m_ImageHeight]; img_qlty = 0; iError = m_FPM.GetImage(fp_image); m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty); if (iError == (Int32)SGFPMError.ERROR_NONE) { DrawImage(fp_image, pictureBox3); iError = m_FPM.CreateTemplate(fp_image, m_RegMin1); if (iError == (Int32)SGFPMError.ERROR_NONE) { pictureBox3.Image.Save(@"Finger\" + textBox1.Text + ".jpg"); SqlCommand cmd = new SqlCommand("Insert into Voter (UserId,Name,Mobile,Address,Image,Template) Values ('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + @"Image\" + textBox1.Text + ".jpg" + "',@data)", con); con.Open(); cmd.Parameters.AddWithValue("@data", fp_image); cmd.ExecuteNonQuery(); con.Close(); DialogResult d = MessageBox.Show("Voter Registred Successfully", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Information); if (d == DialogResult.OK) { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; pictureBox2.Image = null; pictureBox3.Image = null; } } else { DisplayError("CreateTemplate()", iError); } } else { MessageBox.Show("Finger Capturing Failed", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("please Enter User Id", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnR1_Click(object sender, EventArgs e) { try { Int32 iError; Byte[] fp_image; Int32 img_qlty; m_RegMin1 = new Byte[400]; fp_image = new Byte[m_ImageWidth * m_ImageHeight]; img_qlty = 0; iError = m_FPM.GetImage(fp_image); m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty); prgR1.Value = img_qlty; if (iError == (Int32)SGFPMError.ERROR_NONE) { DrawImage(fp_image, picR1); iError = m_FPM.CreateTemplate(fp_image, m_RegMin1); if (iError == (Int32)SGFPMError.ERROR_NONE) { StatusBars.Text = "First image is captured"; } else { DisplayError("CreateTemplate()", iError); } } else { DisplayError("GetImage()", iError); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public FingerPrintInfo Capture(int fingerPosition, out string err, bool populateImagebytes = false) { InitializeDevice(); err = ""; var fp_image = new Byte[m_ImageWidth * m_ImageHeight]; var m_fingerprinttemplate = new Byte[max_template_size]; var error = (int)SGFPMError.ERROR_NONE; var img_qlty = 0; if (m_DeviceOpened) { error = m_FPM.GetImage(fp_image); } if (error == (int)SGFPMError.ERROR_NONE) { m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty); var finger_info = new SGFPMFingerInfo { FingerNumber = (SGFPMFingerPosition)fingerPosition, ImageQuality = (short)img_qlty, ImpressionType = (short)SGFPMImpressionType.IMPTYPE_LP, ViewNumber = 1 }; // CreateTemplate error = m_FPM.CreateTemplate(finger_info, fp_image, m_fingerprinttemplate); if (error == (int)SGFPMError.ERROR_NONE) { return(new FingerPrintInfo { Manufacturer = "", Model = "", SerialNumber = "", ImageWidth = m_ImageWidth, ImageHeight = m_ImageHeight, ImageDPI = m_Dpi, ImageQuality = img_qlty, Image = ToBase64String(fp_image, ImageFormat.Bmp), ImageByte = populateImagebytes ? fp_image : null, Template = Convert.ToBase64String(m_fingerprinttemplate), FingerPositions = (FingerPositions)fingerPosition }); } } err = DisplayError(error); return(null); }
public FingerPrintInfo Capture(int fingerPosition, out string err, bool populateImagebytes = false) { InitializeDevice(); err = ""; Byte[] fp_image = new Byte[m_ImageWidth * m_ImageHeight]; Byte[] m_fingerprinttemplate = new Byte[max_template_size]; Int32 error = (Int32)SGFPMError.ERROR_NONE; Int32 img_qlty = 0; if (m_DeviceOpened) { error = m_FPM.GetImage(fp_image); } if (error == (Int32)SGFPMError.ERROR_NONE) { m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty); SGFPMFingerInfo finger_info = new SGFPMFingerInfo(); finger_info.FingerNumber = (SGFPMFingerPosition)fingerPosition; finger_info.ImageQuality = (Int16)img_qlty; finger_info.ImpressionType = (Int16)SGFPMImpressionType.IMPTYPE_LP; finger_info.ViewNumber = 1; // CreateTemplate error = m_FPM.CreateTemplate(finger_info, fp_image, m_fingerprinttemplate); if (error == (Int32)SGFPMError.ERROR_NONE) { return(new FingerPrintInfo { Manufacturer = "", Model = "", SerialNumber = "", ImageWidth = m_ImageWidth, ImageHeight = m_ImageHeight, ImageDPI = m_Dpi, ImageQuality = img_qlty, Image = ToBase64String(fp_image, ImageFormat.Bmp), ImageByte = populateImagebytes ? fp_image : null, Template = Convert.ToBase64String(m_fingerprinttemplate), FingerPositions = (FingerPositions)fingerPosition }); } } err = "Error : " + ((SGFPMError)error).ToString(); return(null); // throw new ApplicationException("Error : " + ((SGFPMError)error).ToString()); }
private void btnScan_Click(object sender, EventArgs e) { Status.Text = ""; Int32 iError; Byte[] fp_image; Int32 img_qlty; fp_image = new Byte[_mImageWidth * _mImageHeight]; img_qlty = 0; iError = _mFpm.GetImage(fp_image); _mFpm.GetImageQuality(_mImageWidth, _mImageHeight, fp_image, ref img_qlty); if (iError == (int)SGFPMError.ERROR_NONE) { DrawImage(fp_image, pictureBox1); iError = _mFpm.CreateTemplate(fp_image, _mRegMin1); if (iError == (int)SGFPMError.ERROR_NONE) { var voters = Verify(_mRegMin1, _mRegMin1, _mRegMin1); if (voters.VoterPin != null) { lblName.Text = voters.Firstname + @" " + voters.Lastname; lblVoterPin.Text = voters.VoterPin; picImage.Image = voters.VoterImg; radioButton4.Checked = false; radioButton3.Checked = false; radioButton2.Checked = false; radioButton1.Checked = false; btnCastVote.Enabled = false; metroPanel3.Visible = true; } else { MetroMessageBox.Show(this, @"Your record not found in the database", @"eVoting System", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } else { Status.Text = _error.DisplayError("CreateTemplate()", iError); } } else { Status.Text = _error.DisplayError("CreateTemplate()", iError); } }
private void btnCaptureR1_Click(object sender, EventArgs e) { Int32 iError; Byte[] fpImage; Int32 imgQlty; _mRegMin1 = new Byte[400]; fpImage = new Byte[_mImageWidth * _mImageHeight]; imgQlty = 0; iError = _mFpm.GetImage(fpImage); _mFpm.GetImageQuality(_mImageWidth, _mImageHeight, fpImage, ref imgQlty); pgbR1.Value = imgQlty; if (iError == (Int32)SGFPMError.ERROR_NONE) { DrawImage(fpImage, imgR1); iError = _mFpm.CreateTemplate(fpImage, _mRegMin1); if (iError == (Int32)SGFPMError.ERROR_NONE) { statusBar.Text = @"First image is captured"; } else { statusBar.Text = _error.DisplayError("CreateTemplate()", iError); } } else { statusBar.Text = _error.DisplayError("GetImage()", iError); } }
private void button3_Click(object sender, EventArgs e) { fp_image = new Byte[m_ImageWidth * m_ImageHeight]; Int32 error = (Int32)SGFPMError.ERROR_NONE; Int32 img_qlty = 0; if (m_DeviceOpened) { error = m_FPM.GetImage(fp_image); } else { error = GetImageFromFile(fp_image); } if (error == (Int32)SGFPMError.ERROR_NONE) { m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty); progressBar1.Value = img_qlty; DrawImage(fp_image, pictureBox1); SGFPMFingerInfo finger_info = new SGFPMFingerInfo(); finger_info.FingerNumber = (SGFPMFingerPosition)1; finger_info.ImageQuality = (Int16)img_qlty; finger_info.ImpressionType = (Int16)SGFPMImpressionType.IMPTYPE_LP; finger_info.ViewNumber = 1; // CreateTemplate error = m_FPM.CreateTemplate(finger_info, fp_image, m_RegMin1); if (error == (Int32)SGFPMError.ERROR_NONE) { label1.Text = "First image is captured"; } else { label1.Text = "GetMinutiae() Error : " + error; } } else { label1.Text = "GetImage() Error : " + error; } }
public FingerTemplate Extract(FingerImage image) { var imageSG = image as FingerImageSG; if (imageSG == null) { return(null); } int quality = 0; TemplateSG tmpl = new TemplateSG(_BSPCode); tmpl.Bytes = new byte[maxTemplateSize]; tmpl.info = FingerInfoTemplate; m_FPM.GetImageQuality(imageSG.Width, imageSG.Height, imageSG.RawData, ref quality); tmpl.info.ImageQuality = (short)quality; m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ANSI378); m_FPM.CreateTemplate(tmpl.info, imageSG.RawData, tmpl.Bytes); m_FPM.GetTemplateSize(tmpl.Bytes, ref tmpl.size); return(tmpl); }
private void button3_Click(object sender, EventArgs e) { SqlDataAdapter da = new SqlDataAdapter("Select UserID,Name,Image,Template from Voter", con); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count <= 0) { con.Close(); MessageBox.Show("No Data Present", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Int32 iError; Byte[] fp_image; Int32 img_qlty; string id = ""; fp_image = new Byte[m_ImageWidth * m_ImageHeight]; img_qlty = 0; iError = m_FPM.GetImage(fp_image); m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty); if (iError == (Int32)SGFPMError.ERROR_NONE) { DrawImage(fp_image, pictureBox3); iError = m_FPM.CreateTemplate(fp_image, m_RegMin1); if (iError == (Int32)SGFPMError.ERROR_NONE) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { fp_image = (byte[])(ds.Tables[0].Rows[i][3]); iError = m_FPM.CreateTemplate(fp_image, m_VrfMin); MemoryStream ms = new MemoryStream(); bool matched1 = false; SGFPMSecurityLevel secu_level; secu_level = (SGFPMSecurityLevel)5; iError = m_FPM.MatchTemplate(m_RegMin1, m_VrfMin, secu_level, ref matched1); if (iError == (Int32)SGFPMError.ERROR_NONE) { if (matched1) { id = ds.Tables[0].Rows[i][0].ToString(); } } else { DisplayError("MatchTemplate()", iError); } } } } if (id != "") { SqlCommand cmd = new SqlCommand("Select Name,Image from Voter where UserId='" + id + "'", con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); textBox1.Text = id; textBox2.Text = dr[0].ToString(); pictureBox2.ImageLocation = dr[1].ToString(); con.Close(); panel4.Enabled = false; groupBox1.Enabled = true; } else { MessageBox.Show("Sorry No Match Found Please Re-Scan the Finger", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } /* * if (textBox1.Text != "") * { * SqlCommand cmd = new SqlCommand("Select Name,Image,Template from Voter where UserId='" + textBox1.Text + "'", con); * con.Open(); * SqlDataReader dr = cmd.ExecuteReader(); * if (!dr.HasRows) * { * con.Close(); * MessageBox.Show("invalid User ID", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); * } * else * { * dr.Read(); * textBox2.Text = dr[0].ToString(); * con.Close(); * Int32 iError; * Byte[] fp_image; * Int32 img_qlty; * * fp_image = new Byte[m_ImageWidth * m_ImageHeight]; * img_qlty = 0; * * iError = m_FPM.GetImage(fp_image); * * m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty); * * * if (iError == (Int32)SGFPMError.ERROR_NONE) * { * DrawImage(fp_image, pictureBox3); * iError = m_FPM.CreateTemplate(fp_image, m_RegMin1); * * if (iError == (Int32)SGFPMError.ERROR_NONE) * { * cmd = new SqlCommand("Select Image,Template from Voter where UserId='" + textBox1.Text + "'", con); * con.Open(); * dr = cmd.ExecuteReader(); * if (dr.HasRows) * { * dr.Read(); * string s = dr[0].ToString(); * * fp_image = (byte[])(dr[1]); * * iError = m_FPM.CreateTemplate(fp_image, m_VrfMin); * * pictureBox2.ImageLocation = s; * con.Close(); * * * MemoryStream ms = new MemoryStream(); * //pictureBox4.Image.Save(ms, pictureBox4.Image.RawFormat); * //ms.Position = 0; * //byte[] m_VrfMin = ms.ToArray(); * * bool matched1 = false; * SGFPMSecurityLevel secu_level; * * secu_level = (SGFPMSecurityLevel)5; * * iError = m_FPM.MatchTemplate(m_RegMin1, m_VrfMin, secu_level, ref matched1); * * if (iError == (Int32)SGFPMError.ERROR_NONE) * { * if (matched1) * { * panel4.Enabled = false; * groupBox1.Enabled = true; * } * else * { * MessageBox.Show("Login Failed", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); * } * } * else * DisplayError("MatchTemplate()", iError); * } * else * { * con.Close(); * MessageBox.Show("Invalid UserId", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); * } * } * else * DisplayError("CreateTemplate()", iError); * } * else * { * MessageBox.Show("Finger Capturing Failed", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); * } * } * } * else * { * MessageBox.Show("Please Enter User ID/Pin", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); * } */ }
private void button2_Click(object sender, EventArgs e) { SqlDataAdapter da = new SqlDataAdapter("Select Name,Bal,Temp,BankAC,BankName,Pin from Reg where BankName = '" + comboBox1.Text + "' AND Pin = '" + textBox6.Text + "'", con); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count <= 0) { con.Close(); MessageBox.Show("No Data Present", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Int32 iError; Byte[] fp_image; Int32 img_qlty; fp_image = new Byte[m_ImageWidth * m_ImageHeight]; img_qlty = 0; iError = m_FPM.GetImage(fp_image); m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty); if (iError == (Int32)SGFPMError.ERROR_NONE) { DrawImage(fp_image, pictureBox1); iError = m_FPM.CreateTemplate(fp_image, m_RegMin1); if (iError == (Int32)SGFPMError.ERROR_NONE) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { fp_image = (byte[])(ds.Tables[0].Rows[i][2]); iError = m_FPM.CreateTemplate(fp_image, m_VrfMin); MemoryStream ms = new MemoryStream(); bool matched1 = false; SGFPMSecurityLevel secu_level; secu_level = (SGFPMSecurityLevel)5; iError = m_FPM.MatchTemplate(m_RegMin1, m_VrfMin, secu_level, ref matched1); if (iError == (Int32)SGFPMError.ERROR_NONE) { if (matched1) { Name1 = ds.Tables[0].Rows[i][0].ToString(); Bal = ds.Tables[0].Rows[i][1].ToString(); BankAC = ds.Tables[0].Rows[i][3].ToString(); BankName = ds.Tables[0].Rows[i][4].ToString(); Pin = ds.Tables[0].Rows[i][5].ToString(); } } else { DisplayError("MatchTemplate()", iError); } } } } if (Name1 != "") { comboBox1.Enabled = false; textBox6.Enabled = false; button2.Enabled = false; panel1.Visible = true; } else { comboBox1.Enabled = true; textBox6.Enabled = true; button2.Enabled = true; panel1.Visible = false; MessageBox.Show("Sorry No Match Found Please Re-Scan the Finger", "Error !!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button1_Click(object sender, EventArgs e) { Byte[] fp_image = new Byte[m_ImageWidth * m_ImageHeight]; Int32 error = (Int32)SGFPMError.ERROR_NONE; Int32 img_qlty = 0; Int32 info; if (m_DeviceOpened) { error = m_FPM.GetImage(fp_image); } if (error == (Int32)SGFPMError.ERROR_NONE) { m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty); progressBar1.Value = img_qlty; DrawImage(fp_image, pictureBox1); SGFPMFingerInfo finger_info = new SGFPMFingerInfo(); // finger_info.FingerNumber = (SGFPMFingerPosition)comboBoxSelFinger.SelectedIndex; finger_info.ImageQuality = (Int16)img_qlty; finger_info.ImpressionType = (Int16)SGFPMImpressionType.IMPTYPE_LP; finger_info.ViewNumber = 1; // CreateTemplate info = m_FPM.CreateTemplate(finger_info, fp_image, m_RegMin1); Image myImage = pictureBox1.Image; using (MemoryStream ms = new MemoryStream()) { myImage.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); data = ms.ToArray(); } try { string sql = string.Empty; string con = string.Empty; // byte[] id1 = (byte[])(m_RegMin2); con = "Server=127.0.0.1; port=3306; Uid=root; Database=students; Password="******"SELECT f_id,f_id2,RegistrationNumber,Fullnames,YearOfStudy,PhoneNumber,Course, Photo,Department, fingerprint FROM users"; using (MySqlConnection sqlcon = new MySqlConnection(con)) { sqlcon.Open(); string[] sub_Item = new string[7]; using (MySqlCommand com = new MySqlCommand(sql, sqlcon)) { using (MySqlDataReader read = com.ExecuteReader()) { if (read.HasRows) { while (read.Read()) { byte[] f_id = (byte[])(read["fingerprint"]); byte[] id = (byte[])(read["f_id"]); byte[] id2 = (byte[])(read["f_id2"]); bool matched = false; Int32 err = 0; err = m_FPM.MatchTemplate(id, m_RegMin1, m_SecurityLevel, ref matched); if (matched) { sub_Item[0] = read["RegistrationNumber"].ToString(); sub_Item[1] = read["Fullnames"].ToString(); sub_Item[2] = read["YearOfStudy"].ToString(); sub_Item[3] = read["PhoneNumber"].ToString(); sub_Item[4] = read["Course"].ToString(); sub_Item[5] = read["Department"].ToString(); byte[] img = (byte[])(read["Photo"]); MemoryStream ms = new MemoryStream(img); pictureBox2.Image = new Bitmap(ms); pictureBox2.Image = Image.FromStream(ms); MemoryStream ms1 = new MemoryStream(img); pictureBox2.Image = Image.FromStream(ms1); // photo.Image ms.Dispose(); //populate the text boxes textBox1.Text = sub_Item[0]; textBox2.Text = sub_Item[1]; textBox3.Text = sub_Item[4]; textBox4.Text = sub_Item[2]; listUnits(); } else { bool matched1 = false; Int32 err2 = 0; err2 = m_FPM.MatchTemplate(id2, m_RegMin1, m_SecurityLevel, ref matched1); if (matched1) { sub_Item[0] = read["RegistrationNumber"].ToString(); sub_Item[1] = read["Fullnames"].ToString(); sub_Item[2] = read["YearOfStudy"].ToString(); sub_Item[3] = read["PhoneNumber"].ToString(); sub_Item[4] = read["Course"].ToString(); sub_Item[5] = read["Department"].ToString(); byte[] img = (byte[])(read["Photo"]); MemoryStream ms = new MemoryStream(img); pictureBox2.Image = new Bitmap(ms); pictureBox2.Image = Image.FromStream(ms); MemoryStream ms1 = new MemoryStream(img); pictureBox2.Image = Image.FromStream(ms1); // photo.Image ms.Dispose(); //populate the text boxes textBox1.Text = sub_Item[0]; textBox2.Text = sub_Item[1]; textBox3.Text = sub_Item[4]; textBox4.Text = sub_Item[2]; listUnits(); } else { // textBox5.Text = "No fingerprint match found"; } } } } else { MessageBox.Show("No data found"); } } } sqlcon.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } if (error == (Int32)SGFPMError.ERROR_NONE) { textBox5.Text = "Fingerprint Image captured"; } else { textBox5.Text = "GetMinutiae() Error : " + error; } } else { textBox5.Text = "GetImage() Error : " + error; } }
private void button4_Click(object sender, EventArgs e) { bool matched = false; Int32 err = 0; err = m_FPM.MatchTemplate(m_RegMin1, m_RegMin2, m_SecurityLevel, ref matched); if ((err == (Int32)SGFPMError.ERROR_NONE)) { if (matched) { // Save template after merging two template - m_FetBuf1, m_FetBuf2 Byte[] merged_template; Int32 buf_size = 0; m_FPM.GetTemplateSizeAfterMerge(m_RegMin1, m_RegMin2, ref buf_size); merged_template = new Byte[buf_size]; m_FPM.MergeAnsiTemplate(m_RegMin1, m_RegMin2, merged_template); if (m_StoredTemplate == null) { m_StoredTemplate = new Byte[buf_size]; merged_template.CopyTo(m_StoredTemplate, 0); } else { Int32 new_size = 0; err = m_FPM.GetTemplateSizeAfterMerge(m_StoredTemplate, merged_template, ref new_size); Byte[] new_enroll_template = new Byte[new_size]; err = m_FPM.MergeAnsiTemplate(merged_template, m_StoredTemplate, new_enroll_template); m_StoredTemplate = new Byte[new_size]; new_enroll_template.CopyTo(m_StoredTemplate, 0); } StatusBar.Text = "Template registration success"; //////////////////////////////////// PictureBox picturebox3 = new PictureBox(); string appPath2 = Path.GetDirectoryName(Application.ExecutablePath); ///create the connection string string connString = @"Data Source= " + appPath2 + @"\DBUC.s3db ;Version=3;"; //create the database query string query = "SELECT * FROM Usuarios where Usuario = '" + textBox1.Text + "'"; //create an OleDbDataAdapter to execute the query System.Data.SQLite.SQLiteDataAdapter dAdapter = new System.Data.SQLite.SQLiteDataAdapter(query, connString); //create a command builder System.Data.SQLite.SQLiteCommandBuilder cBuilder = new System.Data.SQLite.SQLiteCommandBuilder(dAdapter); //create a DataTable to hold the query results DataTable dTable = new DataTable(); //fill the DataTable dAdapter.Fill(dTable); dAdapter.Update(dTable); if (dTable.Rows.Count >= 1) { DataRow Row = dTable.Rows[0]; if (Row["Huella"] != null) { System.Byte[] fp_image = (System.Byte[])Row["Huella"]; /////////////////////////////////////////////////// Int32 error = (Int32)SGFPMError.ERROR_NONE; Int32 img_qlty = 0; m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty); if (error == (Int32)SGFPMError.ERROR_NONE) { DrawImage(fp_image, picturebox3); SGFPMFingerInfo finger_info = new SGFPMFingerInfo(); finger_info.FingerNumber = (SGFPMFingerPosition)1; finger_info.ImageQuality = (Int16)img_qlty; finger_info.ImpressionType = (Int16)SGFPMImpressionType.IMPTYPE_LP; finger_info.ViewNumber = 1; // Create template error = m_FPM.CreateTemplate(finger_info, fp_image, m_VrfMin); if (error == (Int32)SGFPMError.ERROR_NONE) { StatusBar.Text = "Verification image is captured"; if (m_StoredTemplate == null) { StatusBar.Text = "No data to verify"; return; } string[] fingerpos_str = new string[] { "Unknown finger", "Right thumb", "Right index finger", "Right middle finger", "Right ring finger", "Right little finger", "Left thumb", "Left index finger", "Left middle finger", "Left ring finger", "Left little finger" }; SGFPMFingerPosition finger_pos = SGFPMFingerPosition.FINGPOS_UK; bool finger_found = false; SGFPMANSITemplateInfo sample_info = new SGFPMANSITemplateInfo(); err = m_FPM.GetAnsiTemplateInfo(m_StoredTemplate, sample_info); for (int i = 0; i < sample_info.TotalSamples; i++) { matched = false; err = m_FPM.MatchAnsiTemplate(m_StoredTemplate, i, m_VrfMin, 0, m_SecurityLevel, ref matched); if (matched) { finger_found = true; finger_pos = (SGFPMFingerPosition)sample_info.SampleInfo[i].FingerNumber; break; } } if (err == (Int32)SGFPMError.ERROR_NONE) { if (finger_found) { StatusBar.Text = "The matched data found. Finger position: " + fingerpos_str[(Int32)finger_pos]; textBox2.Text = Row["Contrasena"].ToString(); button1.Enabled = true; button1.PerformClick(); } else { StatusBar.Text = "Cannot find a matched data"; } } else { StatusBar.Text = "MatchAnsiTemplate() Error : " + err; } } else { StatusBar.Text = "GetMinutiae() Error : " + error; } } else { StatusBar.Text = "GetImage() Error : " + error; } } else { MessageBox.Show("No hay huella con la cual comparar"); } //////////////////////////////////////////////// } else { MessageBox.Show("El usuario no existe U olvido colocarlo"); } } else { StatusBar.Text = "Template registration failed"; } } else { StatusBar.Text = "MatchTemplate() Error: " + err; } }