寄给你算了。
unit vfp;
interface
uses
Windows, SysUtils , Classes, Graphics, Dialogs ,StdCtrls ,ExtCtrls;
type
TDoublePChar=array [1..300] of PChar;
const
UsbPara=False; //if USB Interface then True else False
DLLPATH='';
VFPS_STANDARD=2;
VFPS_IMAGEPLUS=4;
VFPS_NOCALIBRATE=32;
VFPS_MASK_DFX_ERRORS=1024;
VFPS_AUTO_MAX=0;
VFPS_NO_DMA=16;
VFPS_NO_ECP=32;
VFPS_FORCE=64;
V_USB_TYPE=0;
V_PPORT_TYPE=1;
var
FingerPosition:integer;
BitMap : TBitMap;
fpreadimg,fpwriteimg:array[1..90000]of char;
fpsearchminu,fpenrollminu:array[1..256*20]of char;
fpCompressedMinu,fpReadCompressedMinu:array[1..256*4]of Char;
pstr,pstr2,cpstr2,ImageShow
Char;
pstr1,pstr3:TDoublePChar;
fpnumminus:longint;
fprows,fpcols,fpmode,fpflags:integer;
doopensensor,doclosesensor,doresetdevice:longint;
dosetdevicemode,dogetdevicemode:longint;
dovfpsinitialize:longint;
dovfpsgetimage,dovfpsclose:integer;
dofpfltrinit,dofpfltr:longint;
domatchprints,doinitmatcher:longint;
doreaduncompressedminufile,dowriteuncompressedminufile:Longint;
Stream : TStringStream;
ImageIn : string;
process : longint;
k : Char;
//ImageShow: PByteArray;
function VFPSinit(sensorid:integer; var numrows: integer;var numcolumns:integer;
var mode:integer;configure
Char;flags:integer):longint;
stdcall;external DLLPATH+'vfpsimg.dll';
function VFPSselectSensor(sensorType,overrides:Longint):Longint;
stdcall;external DLLPATH+'vfpsimg.dll';
function VFPSinitialize(sensorid:integer; var numrows: integer;var numcolumns:integer;
var mode:integer; configure
Char; flags: integer):longint;
stdcall;external DLLPATH+'vfpsimg.dll';
function VFPSgetImage(handle:longint;mode:integer;imagedata
Char;flags:integer):integer;
stdcall;external DLLPATH+'vfpsimg.dll';
function VFPSclose(fhandle:longint;flags:integer):integer;
stdcall;external DLLPATH+'vfpsimg.dll';
function fpfltrinit(configfile
Char):longint;
stdcall;external DLLPATH+'fpfltr5';
function fpfltr(imagein:TDoublePChar;height,width:longint;minutiae
Char;
var nminutiae:longint; imageout:TDoublePChar;dflag:integer):longint;
stdcall;external DLLPATH+'fpfltr5.dll';
function fpProcess(imagein
Char; height,width:longint; minutiae: PChar;
var nminutiae: longint; imageShow: PChar; dflag: longint; compressFlag : longint):longint;
stdcall;external DLLPATH+'fpfltr5.dll';
function initMatcher(configfile
Char):longint;
stdcall;external DLLPATH+'vmatcher.dll';
function matchprints(serachminu
char;nsearchminu:longint;fileminu
char;nfileminu:longint):longint;
stdcall;external DLLPATH+'vmatcher.dll';
function setMatcherSecurity(securityLevel:LongInt):LongInt;
stdcall;external 'vmatcher.dll';
function readUncompressedMinuFile(minufile
char;minudata
char):integer;
stdcall;external DLLPATH+'minulib.dll';
function writeUncompressedMinuFile(minufile
Char;minudata
char;numMinu:integer):integer;
stdcall;external DLLPATH+'minulib.dll';
function compressMinutiae(uncompressedMinutiae
Char;nMinutiae:LongInt;
CompressedMinutiae
Char):Integer;
stdcall;external 'minulib.dll';
function uncompressMinutiae(compressedMinutiae
Char;nMinutiae:LongInt;
uncompressedMinutiae
Char):Integer;
stdcall;external 'minulib.dll';
function initQuality(configFile
Char):longint;
stdcall;external DLLPATH+'kyqual.dll';
function Quality(inImage
Char;height:longint;width:longint):integer;
stdcall;external DLLPATH+'kyqual.dll';
function vfpinit:boolean;
procedure vfpclose;
procedure vfpgrasp (sImage1: TImage);
implementation
//uses finger;
procedure vfpclose;
begin
dovfpsclose:=VFPSclose(dovfpsinitialize,fpflags);
end;
function vfpinit:boolean;
begin
fpflags:=VFPS_IMAGEPLUS;
VFPSselectSensor(V_PPORT_TYPE,1);
dovfpsinitialize:= VFPSinitialize(0, fprows, fpcols, fpmode, 'fpsimg.cfg',fpflags);
dofpfltrinit:=fpfltrinit(DLLPATH+'fpfltr.cfg');
if (dovfpsinitialize >= 0) and ( dofpfltrinit = 0 ) then
vfpinit:=True
else
begin
vfpinit:=False;
Exit;
end;
//initQuality(DLLPATH+'quality.cfg');
end;
procedure vfpgrasp (sImage1: TImage);
var
x,y : integer;
P : PByteArray;
// pstr1,pstr3:TDoublePChar;
begin
// MainForm.ErrorBar.Caption:='';
pstr:=@fpreadimg;
// imageShow := @fpwriteimg;
fpflags:=VFPS_IMAGEPLUS;
fpmode:=0;
dovfpsgetimage:= VFPSgetImage(dovfpsinitialize,fpmode,pstr,fpflags );
// FingerPosition:=Quality(pstr,fprows,fpcols);
// process := fpProcess(pstr, 300,300, pstr2,fpnumMinus,ImageShow,0,0);
if dovfpsgetimage < 0 then
begin
Exit;
end;
try
for x:=1 to 300 do
begin
pstr1[x]:=@fpreadimg[(x-1)*300+1];
pstr3[x]:=@fpwriteimg[(x-1)*300+1];
end;
pstr2:=@fpsearchMinu;
dofpfltr:=fpfltr(pstr1, 300, 300, pstr2, fpnumMinus, pstr3, 0);
BitMap := TBitMap.create;
BitMap.LoadFromFile('xw.bmp');
for y := 50 to BitMap.height -1 + 50 do
begin
P := BitMap.ScanLine[y-50];
for x := 50 to BitMap.width -1 + 50 do
P[x-50] := 255 - Ord(fpreadimg[y*300+x+1]);
end;
sImage1.canvas.draw(0,0,BitMap);
{ for y := 0 to 300 -1 do
for x := 0 to 300 -1 do
begin k := ImageShow[y * 300 + x];
// SImage1.Canvas.Pixels[y,x] := TColor(RGB(k,k,k));
sImage1.Canvas.Pixels[x,y] := TColor(RGB(ord(k),ord(k),ord(k)));
end;
}
finally
end;
cpstr2:=@fpCompressedMinu;
compressMinutiae(pstr2,fpnumMinus,cpstr2);
end;
end.