public int Image_Enroll_to_LST(bool save_img, PictureBox pb, RichTextBox status, RichTextBox log, Bitmap bmp) { byte reserved = 0; int rtn = 0; byte[] filename = new byte[512]; image_operation img_op = new image_operation(); //bmp = new Bitmap("fm220.bmp"); byte[] raw_buf = new byte[bmp.Width * bmp.Height]; byte[] raw_buf_to_dll = new byte[bmp.Width * bmp.Height]; raw_buf = img_op.get_bmp_raw(bmp); Array.Copy(raw_buf, raw_buf_to_dll, raw_buf_to_dll.Length); rtn = api.FP_ConvertImageToTemplate(m_hConnect, ref raw_buf_to_dll[0], bmp.Width, bmp.Height, ref minu_code2[0], variable.mode, variable.key); if (rtn == variable.OK) { filename = System.Text.Encoding.Default.GetBytes(variable.ist_filename); rtn = api.FP_SaveISOminutia(m_hConnect, ref filename[0], ref minu_code2[0]); ui.AddLog(log, "Local enroll Success!"); return(variable.OK); } else { ui.AddLog(log, "Local enroll Fail !"); ui.ShowStatus(status, "Enroll Fail!, return = " + rtn.ToString()); return(variable.FAIL); } }
public int Image_Match_to_LST(bool save_img, PictureBox pb, RichTextBox status, RichTextBox log, Bitmap bmp) { int rtn = 0; byte[] filename = new byte[512]; int[] score = new int[1]; try { //load template from enroll.ist or snap.ist filename = System.Text.Encoding.Default.GetBytes(variable.ist_filename); rtn = api.FP_LoadISOminutia(m_hConnect, ref filename[0], ref minu_code1[0]); if (rtn != 0) { ui.ShowStatus(status, "No fingerprint template file exist! \nPlease enroll or snap your fingerprint first!"); return(variable.FAIL); } else { byte[] raw_buf = new byte[bmp.Width * bmp.Height]; byte[] raw_buf_to_dll = new byte[bmp.Width * bmp.Height]; image_operation img_op = new image_operation(); raw_buf = img_op.get_bmp_raw(bmp); Array.Copy(raw_buf, raw_buf_to_dll, raw_buf_to_dll.Length); rtn = api.FP_ConvertImageToTemplate(m_hConnect, ref raw_buf_to_dll[0], bmp.Width, bmp.Height, ref minu_code2[0], variable.mode, variable.key); rtn = api.FP_CodeMatchEx(m_hConnect, ref minu_code1[0], ref minu_code2[0], 1, ref score[0]); ui.ShowStatus(status, "Matching score " + Convert.ToString(score[0])); ui.AddLog(log, "matching score " + Convert.ToString(score[0])); return(variable.OK); } } catch (Exception ex) { return(variable.FAIL); } }