Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using ClassLibrary1;
  11. using System.IO;
  12. using MySql.Data.MySqlClient;
  13.  
  14. namespace Thesis_MainProgram
  15. {
  16. public partial class Verification : CaptureForm
  17. {
  18. Connection connect = new Connection();
  19. byte[] im;
  20. MySqlConnection conn = new MySqlConnection("datasource=localhost;port=3306;username=root;password=201531748");
  21.  
  22. public void Verify(DPFP.Template template)
  23. {
  24. Template = template;
  25. ShowDialog();
  26. }
  27.  
  28. protected override void Init()
  29. {
  30. base.Init();
  31. base.Text = "Fingerprint Verification";
  32. Verificator = new DPFP.Verification.Verification(); // Create a fingerprint template verificator
  33. UpdateStatus(0);
  34. }
  35.  
  36. protected override void Process(DPFP.Sample Sample)
  37. {
  38. base.Process(Sample);
  39.  
  40. // Process the sample and create a feature set for the enrollment purpose.
  41.  
  42. DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);
  43.  
  44. // Check quality of the sample and start verification if it's good
  45. // TODO: move to a separate task
  46. if (features != null)
  47. {
  48. conn.Open();
  49. MySqlCommand cmd = new MySqlCommand("SELECT Fingerprint FROM payroll_db.employee WHERE ID = 201531777", conn);
  50. MySqlDataReader dr = cmd.ExecuteReader();
  51.  
  52. while ((dr.Read()))
  53. {
  54. im = (byte[])(dr["Fingerprint"]);
  55. Stream stream = new MemoryStream(im);
  56. DPFP.Template Fingerprint = new DPFP.Template(stream);
  57.  
  58. // Compare the feature set with our template
  59. DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
  60. Verificator.Verify(features, Fingerprint, ref result);
  61. UpdateStatus(result.FARAchieved);
  62. if (result.Verified)
  63. MakeReport("The fingerprint was VERIFIED.");
  64. else
  65. MakeReport("The fingerprint was NOT VERIFIED.");
  66.  
  67. conn.Close();
  68. }
  69. }
  70. }
  71.  
  72. private void UpdateStatus(int FAR)
  73. {
  74. // Show "False accept rate" value
  75. SetStatus(String.Format("False Accept Rate (FAR) = {0}", FAR));
  76. }
  77.  
  78. private DPFP.Template Template;
  79. private DPFP.Verification.Verification Verificator;
  80.  
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement