Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#SecuGen加载回指纹图像以进行验证_C# - Fatal编程技术网

C#SecuGen加载回指纹图像以进行验证

C#SecuGen加载回指纹图像以进行验证,c#,C#,我目前正在使用名为“SecuGen仓鼠”的生物识别设备,我能够捕获指纹图像并将图像保存到本地pc中 但是,我如何才能加载图像并进行验证,因为验证是在指纹捕获过程中实时完成的 以下是我用来捕获和保存指纹图像的代码: private void BtnCapture1_Click(object sender, System.EventArgs e) { Int32 iError; Byte[] fp_image; Int32 img_qlt

我目前正在使用名为“SecuGen仓鼠”的生物识别设备,我能够捕获指纹图像并将图像保存到本地pc中

但是,我如何才能加载图像并进行验证,因为验证是在指纹捕获过程中实时完成的

以下是我用来捕获和保存指纹图像的代码:

   private void BtnCapture1_Click(object sender, System.EventArgs e)
    {
        Int32 iError;
        Byte[] fp_image;
        Int32 img_qlty;

        fp_image = new Byte[m_ImageWidth * m_ImageHeight];
        img_qlty = 0;

        iError = m_FPM.GetImage(fp_image);

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

        if (iError == (Int32)SGFPMError.ERROR_NONE)
        {
            DrawImage(fp_image, pictureBoxR1);
            pictureBoxR1.Image.Save(@"D:\TEMP\LeftThumb.jpeg", ImageFormat.Jpeg);

            iError = m_FPM.CreateTemplate(fp_image, m_RegMin1);

            if (iError == (Int32)SGFPMError.ERROR_NONE)
                StatusBar.Text = "First image is captured";
            else
                DisplayError("CreateTemplate()", iError);
        }
        else
            DisplayError("GetImage()", iError);
    }
以下是它如何验证:

        /// MatchTemplate(), GetMatchingScore()
        private void BtnVerify_Click(object sender, System.EventArgs e)
        {
            Int32 iError;
            bool matched1 = false;
            bool matched2 = false;
            SGFPMSecurityLevel secu_level;

            secu_level = (SGFPMSecurityLevel)comboBoxSecuLevel_V.SelectedIndex;

            iError = m_FPM.MatchTemplate(m_RegMin1, m_VrfMin, secu_level, ref matched1);
            iError = m_FPM.MatchTemplate(m_RegMin2, m_VrfMin, secu_level, ref matched2);

            if (iError == (Int32)SGFPMError.ERROR_NONE)
            {
                if(radioButton1.Checked == true){

                    if (matched1) //left
                        StatusBar.Text = "Left Thumb Verification Success";
                    else
                        StatusBar.Text = "Verification Failed";
                }
                else if (radioButton2.Checked == true)
                {             
                    if (matched2) //right
                        StatusBar.Text = "Right Thumb Verification Success";
                    else
                        StatusBar.Text = "Verification Failed";
                }

            }
            else
                DisplayError("MatchTemplate()", iError);
        }
我的意思是,当我浏览指纹图像时,它能否将jpeg文件转换为字节,然后进行验证


谢谢

我没有访问SDK文档的权限,但指纹匹配的常见模式是捕获图像,然后提取模板(图像中有用的功能),然后将它们存储在磁盘(而不是图像)上,稍后使用它们进行匹配


看看您的代码示例,您实际上想要保存的信息是m_RegMin1,我想,很可能已经有一个字节[]。因此,在第一个块中执行File.SaveAllBytes(“foo.bin”,m_RegMin1)。在第二个块中,使用File.ReadAllBytes还原它。我认为secugen会生成ISO模板,使用十六进制编辑器检查保存的文件,前3个字节应该是“F”、“M”和“R”。

FPM.GetImage返回的字节数组只有原始像素数据,没有BMP头,这就是为什么不能将数组复制到picturebox并显示图像

请参阅中的BMP格式

仓鼠专业版(我有)的扫描分辨率为400x300,灰度信息为8位/像素。这意味着原始像素数据应产生12000字节的数组。它是此方法返回的实际数组。要显示图像,还应该有一个1078字节的头,如果没有这个头,就会出现“Invalid parameter”错误

若要将此调用返回的原始像素数组转换为正确的BMP对象,请参阅以了解如何完成

保存时看到的文件大小应为12000+1078字节。对吗

为了回答您的问题,CreateTemplate方法使用GetImage返回的数组来创建模板,而不是完整的BMP格式


您的错误是使用PictureBox.Image.Save方法保存BMP格式,并试图将其与原始数组进行比较。相反,使用Base64对注册时返回的数组进行编码并保存。检查时,请加载保存的阵列,而不是读取BMP文件。

您是如何让SecureGen仓鼠为.NET Framework 4.0工作的?@E-Bat提供SDK和Visual Studio:)