首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Delphi10,数字角色和MySQL

Delphi10,数字角色和MySQL
EN

Stack Overflow用户
提问于 2016-03-04 18:41:29
回答 1查看 2.9K关注 0票数 0

我现在束手无策。我到处寻找一种方法来验证我的MySQL数据库中捕获的指纹,使用Digital Persona SDK(One Touch)和Delphi10。我能够将指纹保存为数据库中的长块,但我无法从我的数据库中进行验证。希望这里有人能帮助我。读卡器是U.Are.U 4500。

下面是我用来保存指纹的代码,但是当我需要再次验证指纹时,我不知道如何查询数据库。

代码语言:javascript
运行
复制
procedure TForm1.FPCaptureComplete(ASender: TObject;
const ReaderSerNum: WideString; const pSample: IDispatch);
var
    l_interface : IDispatch;
    outFile : File;
    vt : integer ;
    vtByteBuf : PByteArray;   
    aryLow : integer;
    aryHigh : integer;
    rawDataSize: integer;
    loopIndex : integer;

begin

l_interface := FPGetImage.ConvertToPicture(pSample);
lblInfo.Caption:='Sample Captured';
SetOlePicture(pbPrint.Picture,IPictureDisp(l_interface));  //display print
if breginprogress=true then begin
if index > 4 then index:=1;     //reset index if beyond 4 presses

if index=1 then
begin
lbl1.Font.Color:=clGreen;
lbl2.Font.Color:=clYellow;
 end;

 if index=2 then
begin
lbl2.Font.Color:=clGreen;
lbl3.Font.Color:=clYellow;
 end;

  if index=3 then
begin
lbl3.Font.Color:=clGreen;
lbl4.Font.Color:=clYellow;
end;

if index=4 then lbl4.Font.Color:=clGreen;

index := index + 1;

//Create registration\enrollment featureset from sample captured
       try
 FPExtraction.CreateFeatureSet(pSample,DataPurposeEnrollment);
       except
            on E: Exception do  begin
            showmessage('Exception inside CreateFeatureSet');
            showmessage(E.Message);
            FPregister.Clear;
            ResetLabels;
            index:=1;
            exit;
             end;

       end;
if FPExtraction.FeatureSet <> nil then
 //Add features to registration object
 FPRegister.AddFeatures(FPExtraction.FeatureSet)
 else begin
 Showmessage('Could not create featureset, poor press');
 FPRegister.Clear;
 ResetLabels;
 index:=1;
 exit;  //return
 end;
 //If 4 successful features added, status should be 'Ready'
 if FPRegister.TemplateStatus=TemplateStatusTemplateReady then  begin
    lblResult.Caption:='User Enrolled - Press Finger for Verification';
    lbl1.Visible:=false; lbl2.Visible:=false; lbl3.Visible:=false;       lbl4.Visible:=false;
    FPTemplate:=FPRegister.Template as DPFPShrXLib_TLB.DPFPTemplate;
    breginprogress:=false;  //stop registration process, enable verification

    //Before saving data to database you will need to get the raw data    (variant)
    try
    vrnt:=FPTemplate.Serialize;  //raw data is now stored in this variant


    aryLow:=VarArrayLowBound(vrnt,1);
    aryHigh:=varArrayHighBound(vrnt,1);
    aryHigh:=aryHigh-aryLow;

    vtByteBuf:=VarArrayLock(vrnt);  //lock down the array

    for loopIndex := 0 to aryHigh - 1 do
           fpData[loopIndex]:=vtByteBuf[loopIndex];

    VarArrayUnlock(vrnt);
    //Save fpData to database here
    //Database logic is not provided here.  Plenty examples on web on
    //How to save a byte array (binary data) to database.
    SaveFP;
    except
    on E: Exception do showmessage('Trouble saving data');

    end;
end;
end;
end;

//This is the pysical save
procedure TForm1.SaveFP;
var
tptStream: TMemoryStream;
p: Pointer;
begin
MemberTbl.Insert;
MemberTbl.FieldByName('MemberName').AsString := NameEdit.Text;

tptStream := TMemoryStream.Create();
tptStream.Position := 0;
p := VarArrayLock(vrnt);
tptStream.Write(p^, VarArrayHighBound(vrnt, 1));
VarArrayUnlock(vrnt);
(MemberTbl.FieldByName('MemberFP') as  BlobField).LoadFromStream(tptStream);
MemberTbl.Post;
tptStream.Free();
end;
EN

回答 1

Stack Overflow用户

发布于 2016-03-06 00:30:22

我已经为Windows SDK版本1.6.1 (2010年8月)的DigitalPersona One Touch创建了一个组件包装器。

我已经在DigitalPersona U.are.U 4000B阅读器上测试过了,但是根据文档,它应该也可以与DigitalPersona U.are.U 4500阅读器一起使用

您可以查看并下载组件here

然后,您可以在OnCaptured事件处理程序上添加如下代码:

代码语言:javascript
运行
复制
procedure TForm1.DPFingerPrintReader1Captured(Reader: TDPFingerPrintReader; FingerComparer: IFingerComparer);
var
  LFingerPrintField: TField;
begin
    LFingerPrintField := YourDataSet.FieldByName('FingerPrintField');
    while not YourDataSet.Eof do
    begin
      if FingerComparer.CompareTo(LFingerPrintField.AsString) then
      begin
        ShowMessage('Found');
        Exit;
      end;
      YourDataSet.Next;
    end;    
    ShowMessage('NOT Found');
end;
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35793933

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档