0

I am at my wits end at the moment. I have looked everywhere for a way of verifying a captured fingerprint in my MySQL database using the Digital Persona SDK(One Touch) and Delphi 10. I am able to save the fingerprint as a longblob in my database but I am unable to verify from my database. Hopefully someone here would be able to assist me. Reader is a U.Are.U 4500.

Below is the code I use to save the fingerprint, but I have no idea how to query the database when I need to verify the fingerprint again.

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;
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Jan Burger
  • 11
  • 1
  • 4
  • 3
    What exactly is your issue, retrieving the blob back from your database, or performing a verification using that SDK. Show your code and where you are stuck, including error messages if applicable. What Delphi version? What *Digital Persona SDK*, add a link. Please [edit] your question. – Jan Doggen Mar 04 '16 at 11:21

1 Answers1

1

I've created a component wrapper for the DigitalPersona One Touch for Windows SDK Version 1.6.1 (August 2010)

I've tested it with the DigitalPersona U.are.U 4000B reader, but according to the documentation, it should work with the DigitalPersona U.are.U 4500 reader too

You can have a look and download the component here

Then you can add code like this on the OnCaptured event handler:

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;
Agustin Ortu
  • 230
  • 4
  • 8
  • Hi Agustin, I have already downloaded component but I am unable to install. As soon as package is opened is replaces requires with rrequires. I have tried everything to change rrequires to requires but no matter what it keeps changing it when package is opened. – Jan Burger Mar 06 '16 at 04:34
  • Ok I have managed to install the components, had to change file format from Unix to PC. When I drop a Fingerprint enroll component on my form and run my application, the mainform is invisible and doesn't even show on the taskbar. Any suggestions perhaps? – Jan Burger Mar 07 '16 at 07:06
  • The only way I could reproduce is having the reader disconnected The exception is generated in the constructor, `FReader := Reader.DefaultInterface;` – Agustin Ortu Mar 07 '16 at 15:16