2016-03-04 51 views
0

我在我的智慧結束目前。我到處尋找一種方法,使用Digital Persona SDK(One Touch)和Delphi 10驗證我的MySQL數據庫中的捕獲指紋。我能夠將指紋保存爲數據庫中的longblob,但我無法從我的數據庫中進行驗證數據庫。希望這裏有人能夠幫助我。讀者是U.Are.U 4500.德爾福10,數字角色和MySQL

下面是我用來保存指紋的代碼,但我不知道如何查詢數據庫,當我需要再次驗證指紋。

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; 
+3

問題是什麼,從數據庫中檢索blob或使用該SDK進行驗證。顯示您的代碼和您卡住的位置,包括錯誤消息(如果適用)。什麼德爾福版本?什麼* Digital Persona SDK *,添加一個鏈接。請[編輯]你的問題。 –

回答

1

我已經創建了用於Windows SDK版本1.6.1的一個的DigitalPersona接觸組件封裝(2010年8月)

我用的DigitalPersona的U.are.U 4000B閱讀器進行了測試,但根據該文件,就應該用的DigitalPersona的U.are.U 4500讀者工作太

你可以去看看,並下載該組件here

然後,你可以這樣對OnCaptured事件添加代碼處理程序:

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; 
+0

嗨Agustin,我已經下載組件,但我無法安裝。一旦包裝被打開,將取代要求與rrequires。我已經嘗試了一切,以改變需求,但無論它在打開包裝時如何改變它。 –

+0

好吧,我設法安裝組件,不得不將文件格式從Unix更改爲PC。當我在表單上放置指紋登記組件並運行我的應用程序時,mainform不可見,甚至不會顯示在任務欄上。也許有任何建議? –

+0

我可以重現的唯一方法是讓讀者斷開連接 在構造函數FReader:= Reader.DefaultInterface;中生成異常, –