private void Form1_Load(object sender, EventArgs e) { EnableButtons(false); // Init Button m_RadioButton = new RadioButton[11]; m_SecurityLevel = SGFPMSecurityLevel.NORMAL; m_StoredTemplate = null; m_ImageWidth = 260; m_ImageHeight = 300; m_Dpi = 500; m_FPM = new SGFingerPrintManager(); Int32 iError; string enum_device; comboBox1.Items.Clear(); // Enumerate Device iError = m_FPM.EnumerateDevice(); // Get enumeration info into SGFPMDeviceList m_DevList = new SGFPMDeviceList[m_FPM.NumberOfDevice]; for (int i = 0; i < m_FPM.NumberOfDevice; i++) { m_DevList[i] = new SGFPMDeviceList(); m_FPM.GetEnumDeviceInfo(i, m_DevList[i]); enum_device = m_DevList[i].DevName.ToString() + " : " + m_DevList[i].DevID; comboBox1.Items.Add(enum_device); } if (comboBox1.Items.Count > 0) { // Add Auto Selection enum_device = "Auto Selection"; comboBox1.Items.Add(enum_device); comboBox1.SelectedIndex = 0; //First selected one } StatusBar.Text = "Click Init Button"; if (m_useAnsiTemplate) { StatusBar.Text = "Format used: ANSI 378 Format"; } else { StatusBar.Text = "Format used: ISO 19794-2 Format"; } }
private void InitializeDevice() { m_FPM = new SGFingerPrintManager(); Int32 error; SGFPMDeviceName device_name = SGFPMDeviceName.DEV_AUTO; Int32 device_id = (Int32)SGFPMPortAddr.USB_AUTO_DETECT; m_SecurityLevel = SGFPMSecurityLevel.NORMAL; m_DeviceOpened = false; error = m_FPM.Init(device_name); if (error != (Int32)SGFPMError.ERROR_NONE) { error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi); } if (error == (Int32)SGFPMError.ERROR_NONE) { m_FPM.CloseDevice(); error = m_FPM.OpenDevice(device_id); } else { throw new ApplicationException("Unable to initialize scanner. Kindly check the connection"); } if (error == (Int32)SGFPMError.ERROR_NONE) { SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam(); m_FPM.GetDeviceInfo(pInfo); m_ImageWidth = pInfo.ImageWidth; m_ImageHeight = pInfo.ImageHeight; m_Dpi = pInfo.ImageDPI; serialNo = pInfo.DeviceID; } error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ISO19794); error = m_FPM.GetMaxTemplateSize(ref max_template_size); if (device_name != SGFPMDeviceName.DEV_UNKNOWN) { error = m_FPM.OpenDevice(device_id); if (error == (Int32)SGFPMError.ERROR_NONE) { m_DeviceOpened = true; } } }
public MatcherInitResult Initialize() { MatcherInitResult result = new MatcherInitResult(); m_SecurityLevel = SGFPMSecurityLevel.NORMAL; sourceMatch = null; m_ImageWidth = 260; m_ImageHeight = 300; m_Dpi = 500; fingerprintManager = new SGFingerPrintManager(); //SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN; int error = fingerprintManager.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi); if (error == (Int32)SGFPMError.ERROR_NONE) { result.Message = "Initialization Success"; result.Success = true; } else { result.Message = "Init() Error " + error; return(result); } if (m_useAnsiTemplate) { // Set template format to ANSI 378 error = fingerprintManager.SetTemplateFormat(SGFPMTemplateFormat.ANSI378); } else { // Set template format to ISO 19794-2 error = fingerprintManager.SetTemplateFormat(SGFPMTemplateFormat.ISO19794); } Int32 max_template_size = 0; error = fingerprintManager.GetMaxTemplateSize(ref max_template_size); //m_RegMin1 = new Byte[max_template_size]; //m_RegMin2 = new Byte[max_template_size]; //m_VrfMin = new Byte[max_template_size]; _isInitialized = true; return(result); }
private void Attendance_Load(object sender, EventArgs e) { m_LedOn = false; m_SecurityLevel = SGFPMSecurityLevel.NORMAL; m_StoredTemplate = null; m_ImageWidth = 260; m_ImageHeight = 300; m_Dpi = 500; EnableButtons(false); m_FPM = new SGFingerPrintManager(); Int32 iError; string enum_device; comboBox2.Items.Clear(); // Enumerate Device iError = m_FPM.EnumerateDevice(); // Get enumeration info into SGFPMDeviceList m_DevList = new SGFPMDeviceList[m_FPM.NumberOfDevice]; for (int i = 0; i < m_FPM.NumberOfDevice; i++) { m_DevList[i] = new SGFPMDeviceList(); m_FPM.GetEnumDeviceInfo(i, m_DevList[i]); enum_device = m_DevList[i].DevName.ToString() + " : " + m_DevList[i].DevID; comboBox2.Items.Add(enum_device); } if (comboBox2.Items.Count > 0) { // Add Auto Selection enum_device = "Auto Selection"; comboBox2.Items.Add(enum_device); comboBox2.SelectedIndex = 0; //First selected one } }
public int verify(Byte[] image1, Byte[] image2, Byte[] image3) { string select = "SELECT PID, Finger1, Finger2, Finger3 FROM PatientRegistration"; using (cmd = new SqlCommand(select, cnn)) { using (dr = cmd.ExecuteReader()) { Int32 iError; bool matched1 = false; bool matched2 = false; bool matched3 = false; SGFPMSecurityLevel secu_level = SGFPMSecurityLevel.NORMAL; int id = -1; while (dr.Read()) { matched1 = false; matched2 = false; matched3 = false; iError = m_FPM.MatchTemplate((Byte[])dr[1], image1, secu_level, ref matched1); iError = m_FPM.MatchTemplate((Byte[])dr[2], image2, secu_level, ref matched2); iError = m_FPM.MatchTemplate((Byte[])dr[3], image3, secu_level, ref matched3); if (iError == (Int32)SGFPMError.ERROR_NONE) { if (matched1 & matched2 & matched3) { id = int.Parse(dr[0].ToString()); break; } } else { DisplayError("MatchTemplate()", iError); break; } } return(id); } } }
///////////////////////////////////// private void Form1_Load(object sender, System.EventArgs e) { EnableButtons(false); // Init Button m_RadioButton = new RadioButton[11]; m_RadioButton[0] = FPPosUnknown; m_RadioButton[1] = FPPosRightThumb; m_RadioButton[2] = FPPosRightIndex; m_RadioButton[3] = FPPosRightMiddle; m_RadioButton[4] = FPPosRightRing; m_RadioButton[5] = FPPosRightLittle; m_RadioButton[6] = FPPosLeftThumb; m_RadioButton[7] = FPPosLeftIndex; m_RadioButton[8] = FPPosLeftMiddle; m_RadioButton[9] = FPPosLeftRing; m_RadioButton[10] = FPPosLeftLittle; comboBoxDeviceName.SelectedIndex = 0; comboBoxSelFinger.SelectedIndex = 0; m_SecurityLevel = SGFPMSecurityLevel.NORMAL; m_StoredTemplate = null; m_ImageWidth = 260; m_ImageHeight = 300; m_Dpi = 500; m_FPM = new SGFingerPrintManager(); StatusBar.Text = "Click Init Button"; if (m_useAnsiTemplate) { this.Text = "Matching Test: ANSI 378 Format"; } else { this.Text = "Matching Test: ISO 19794-2 Format"; } }
private void button5_Click(object sender, EventArgs e) { m_SecurityLevel = SGFPMSecurityLevel.NORMAL; m_StoredTemplate = null; m_ImageWidth = 260; m_ImageHeight = 300; m_Dpi = 500; m_FPM = new SGFingerPrintManager(); Int32 error; SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN; Int32 device_id = (Int32)SGFPMPortAddr.USB_AUTO_DETECT; device_name = SGFPMDeviceName.DEV_AUTO; m_DeviceOpened = false; if (device_name != SGFPMDeviceName.DEV_UNKNOWN) { error = m_FPM.Init(device_name); } else { error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi); } if (error == (Int32)SGFPMError.ERROR_NONE) { SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam(); m_FPM.GetDeviceInfo(pInfo); m_ImageWidth = pInfo.ImageWidth; m_ImageHeight = pInfo.ImageHeight; StatusBar.Text = "Initialization Success"; this.Height = 453; this.Width = 820; pictureBox1.Enabled = true; pictureBox2.Enabled = true; PB1.Enabled = true; PB2.Enabled = true; button3.Enabled = true; button4.Enabled = true; button1.Enabled = false; textBox2.Enabled = false; button5.Enabled = false; button5.Visible = false; button6.Visible = true; button6.Enabled = true; } else { StatusBar.Text = "Init() Error " + error; return; } // Set template format to ANSI 378 error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ANSI378); // Get Max template size Int32 max_template_size = 0; error = m_FPM.GetMaxTemplateSize(ref max_template_size); m_RegMin1 = new Byte[max_template_size]; m_RegMin2 = new Byte[max_template_size]; m_VrfMin = new Byte[max_template_size]; // OpenDevice if device is selected if (device_name != SGFPMDeviceName.DEV_UNKNOWN) { error = m_FPM.OpenDevice(device_id); if (error == (Int32)SGFPMError.ERROR_NONE) { m_DeviceOpened = true; } else { StatusBar.Text = "OpenDevice() Error : " + error; } } }
private void button5_Click(object sender, EventArgs e) { m_SecurityLevel = SGFPMSecurityLevel.NORMAL; m_StoredTemplate = null; m_ImageWidth = 260; m_ImageHeight = 300; m_Dpi = 500; m_FPM = new SGFingerPrintManager(); Int32 error; SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN; Int32 device_id = (Int32)SGFPMPortAddr.USB_AUTO_DETECT; device_name = SGFPMDeviceName.DEV_AUTO; m_DeviceOpened = false; if (device_name != SGFPMDeviceName.DEV_UNKNOWN) error = m_FPM.Init(device_name); else error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi); if (error == (Int32)SGFPMError.ERROR_NONE) { SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam(); m_FPM.GetDeviceInfo(pInfo); m_ImageWidth = pInfo.ImageWidth; m_ImageHeight = pInfo.ImageHeight; StatusBar.Text = "Initialization Success"; this.Height = 453; this.Width = 820; pictureBox1.Enabled = true; pictureBox2.Enabled = true; PB1.Enabled = true; PB2.Enabled = true; button3.Enabled = true; button4.Enabled = true; button1.Enabled = false; textBox2.Enabled = false; button5.Enabled = false; button5.Visible = false; button6.Visible = true; button6.Enabled = true; } else { StatusBar.Text = "Init() Error " + error; return; } // Set template format to ANSI 378 error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ANSI378); // Get Max template size Int32 max_template_size = 0; error = m_FPM.GetMaxTemplateSize(ref max_template_size); m_RegMin1 = new Byte[max_template_size]; m_RegMin2 = new Byte[max_template_size]; m_VrfMin = new Byte[max_template_size]; // OpenDevice if device is selected if (device_name != SGFPMDeviceName.DEV_UNKNOWN) { error = m_FPM.OpenDevice(device_id); if (error == (Int32)SGFPMError.ERROR_NONE) { m_DeviceOpened = true; } else { StatusBar.Text = "OpenDevice() Error : " + error; } } }