コード例 #1
0
        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);
        }
コード例 #2
0
        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());
        }
コード例 #3
0
ファイル: Main.cs プロジェクト: shadrackkip/Biometric_system
        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;
            }
        }
コード例 #4
0
        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;
            }
        }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
        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;
            }
        }
コード例 #7
0
        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;
        }
コード例 #8
0
        private void button3_Click(object sender, EventArgs e)
        {
            Byte[] 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);
                PB1.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)
                    StatusBar.Text = "First image is captured";
                else
                    StatusBar.Text = "GetMinutiae() Error : " + error;
            }
            else
                StatusBar.Text = "GetImage() Error : " + error;

            ///////////////////////////////////

            fp_image = new Byte[m_ImageWidth * m_ImageHeight];
            error = (Int32)SGFPMError.ERROR_NONE;
            img_qlty = 0;

            if (m_DeviceOpened)
                error = m_FPM.GetImage(fp_image);
            else
                error = GetImageFromFile(fp_image);

            m_FPM.GetImageQuality(m_ImageWidth, m_ImageHeight, fp_image, ref img_qlty);
            PB2.Value = img_qlty;

            if (error == (Int32)SGFPMError.ERROR_NONE)
            {
                DrawImage(fp_image, pictureBox2);

                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;

                error = m_FPM.CreateTemplate(finger_info, fp_image, m_RegMin2);

                if (error == (Int32)SGFPMError.ERROR_NONE)
                    StatusBar.Text = "Second image is captured";
                else
                    StatusBar.Text = "GetMinutiae() Error : " + error;
            }
            else
                StatusBar.Text = "GetImage() Error : " + error;
        }