Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using ClassLibrary1;
- using System.IO;
- using MySql.Data.MySqlClient;
- namespace Thesis_MainProgram
- {
- public partial class Verification : CaptureForm
- {
- Connection connect = new Connection();
- byte[] im;
- MySqlConnection conn = new MySqlConnection("datasource=localhost;port=3306;username=root;password=201531748");
- public void Verify(DPFP.Template template)
- {
- Template = template;
- ShowDialog();
- }
- protected override void Init()
- {
- base.Init();
- base.Text = "Fingerprint Verification";
- Verificator = new DPFP.Verification.Verification(); // Create a fingerprint template verificator
- UpdateStatus(0);
- }
- protected override void Process(DPFP.Sample Sample)
- {
- base.Process(Sample);
- // Process the sample and create a feature set for the enrollment purpose.
- DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);
- // Check quality of the sample and start verification if it's good
- // TODO: move to a separate task
- if (features != null)
- {
- conn.Open();
- MySqlCommand cmd = new MySqlCommand("SELECT Fingerprint FROM payroll_db.employee WHERE ID = 201531777", conn);
- MySqlDataReader dr = cmd.ExecuteReader();
- while ((dr.Read()))
- {
- im = (byte[])(dr["Fingerprint"]);
- Stream stream = new MemoryStream(im);
- DPFP.Template Fingerprint = new DPFP.Template(stream);
- // Compare the feature set with our template
- DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
- Verificator.Verify(features, Fingerprint, ref result);
- UpdateStatus(result.FARAchieved);
- if (result.Verified)
- MakeReport("The fingerprint was VERIFIED.");
- else
- MakeReport("The fingerprint was NOT VERIFIED.");
- conn.Close();
- }
- }
- }
- private void UpdateStatus(int FAR)
- {
- // Show "False accept rate" value
- SetStatus(String.Format("False Accept Rate (FAR) = {0}", FAR));
- }
- private DPFP.Template Template;
- private DPFP.Verification.Verification Verificator;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement