保存指纹并将其提取到数据库

本文关键字:提取 数据库 指纹 保存 | 更新日期: 2023-09-27 18:33:11

我正在使用数字角色U.are.U 5100指纹读取器。我面临的问题是,注册只会暂时保存。如何将其保存到数据库?

/// <summary>
/// Handler for when a fingerprint is captured.
/// </summary>
/// <param name="captureResult">contains info and data on the fingerprint capture</param>
private void OnCaptured(CaptureResult captureResult)
{
    try
    {
        // Check capture quality and throw an error if bad.
        if (!_sender.CheckCaptureResult(captureResult)) return;
        count++;
        DataResult<Fmd> resultConversion =  
        FeatureExtraction.CreateFmdFromFid(captureResult.Data, 
                                           Constants.Formats.Fmd.ANSI);
        SendMessage(Action.SendMessage, "A finger was captured.   
                    'r'nCount:  " + (count));
        if (resultConversion.ResultCode !=  
            Constants.ResultCode.DP_SUCCESS)
        {
            _sender.Reset = true;
            throw new Exception(resultConversion.ResultCode.ToString());
        }
        preenrollmentFmds.Add(resultConversion.Data);
        if (count >= 4)
        {
            DataResult<Fmd> resultEnrollment =  
            DPUruNet.Enrollment.CreateEnrollmentFmd(Constants.Formats.
                                                    Fmd.ANSI,  
                                                    preenrollmentFmds);
            if (resultEnrollment.ResultCode == 
                Constants.ResultCode.DP_SUCCESS)
            {
                SendMessage(Action.SendMessage, "An enrollment FMD was 
                            successfully created.");
                SendMessage(Action.SendMessage, "Place a finger on the 
                            reader.");
                preenrollmentFmds.Clear();
                count = 0;
                return;
            }
            else if (resultEnrollment.ResultCode == 
                     Constants.ResultCode.DP_ENROLLMENT_INVALID_SET)
            {
                SendMessage(Action.SendMessage, "Enrollment was 
                unsuccessful.  Please try again.");
                SendMessage(Action.SendMessage, "Place a finger on the  
                reader.");
                preenrollmentFmds.Clear();
                count = 0;
                return;
            }
        }
        SendMessage(Action.SendMessage, "Now place the same finger on the            
        reader.");
    }
    catch (Exception ex)
    {
           // Send error message, then close form
            SendMessage(Action.SendMessage, "Error:  " + ex.Message);                
    }  
}

保存指纹并将其提取到数据库

我知道

这是一个古老的线程。但我最近才想出如何使用数字角色来做到这一点。

尝试使用

Fmd.SerializeXml(fmd);

它返回字符串,因此您可以直接将其保存为数据库中的字符串并按原样检索。

然后在解码时尝试使用

Fmd.DeserializeXml(*retrieved string from database*);

它返回 fmd,因此您现在可以将其与当前输入进行比较。