Problemas biometria Sdk 2009 Griaule

Problemas biometria Sdk 2009 Griaule

Postby marca » Tue Sep 20, 2016 7:35 pm

#Include "FiveWin.ch"
#Include "grFinger.ch"
**************************************//***************************************
FUNCTION BuscaDigital( cQualDedo , oImagemDedo )
**************************************//***************************************
LOCAL oDlgActiveX
LOCAL oFoto
LOCAL cFoto := oPub:wPathBmp + "DigitalVazia.bmp"
LOCAL cMyContextID := "0"
PRIVATE lEmOperacao := .F.

DEFINE DIALOG oDlgActiveX RESOURCE "SV_DIGITAL" TITLE "Capturar Digital" // FONT oWnd:oFont ICON oPub:oIconeSv BRUSH oPub:oBrushS TRANSPARENT

REDEFINE BITMAP oFoto ID 900 OF oDlgActiveX FILENAME cFoto ADJUST
REDEFINE BUTTON oBt ID 950 OF oDlgActiveX ACTION ( oDlgActivex:End() )

ACTIVATE DIALOG oDlgActiveX CENTERED ON INIT ( oDlgActiveX:lHelpIcon := .F. , GrFingerInitialize( oDlgActiveX ,oFoto ,oImagemDedo ,cMyContextID , cQualDedo ) ) ;
VALID GrFingerDestroyContext( cMyContextID )


**************************************//***************************************
STATIC FUNCTION GrFingerInitialize( oDlgActiveX ,oFoto ,oImagemDedo ,cMyContextID , cQualDedo )
**************************************//***************************************
LOCAL nErr,oFinger

IF IsActiveX("GrFingerX.GrFingerXCtrl.1")

oFinger := TActiveX():New( oDlgActiveX, "GrFingerX.GrFingerXCtrl.1",0,0,.2,.2)
oDlgActiveX:oClient = oFinger
nErr = oFinger:Do("Initialize")
If nErr = 0

oFinger:Do("CapInitialize")
oFinger:Do("CreateContext", cMyContextID )
oFinger:bOnEvent = { | event, aParams, pParams | EventInfo( event, aParams , oFinger ,oFoto ,oImagemDedo ,oDlgActiveX ,cMyContextID , cQualDedo ) }

ELSE

MSGSTOP("Não foi encontrado o controle activex GrFingerX.GrFingerXCtrl.",;
"Inicialização abortada...")
RETURN .F.

ENDIF

ELSE

MSGStop("Para utilização do Leitor Biométrico é necessário" + CRLF +;
"a instalação de seu SDK Gfinger","ATENÇÃO","STOP")

ENDIF

RETURN .T.

**************************************//***************************************
STATIC FUNCTION GrFingerDestroyContext( cMyContextID )
**************************************//***************************************
LOCAL nErr

oFinger:Do( "CapFinalize" )
oFinger:Do( "Finalize" )
oFinger:Do( "DestroyContext", MyContextID )

RETURN .T.

**************************************//***************************************
FUNCTION EventInfo( event, aParams , oFinger ,oFoto ,oImagemDedo ,oDlgActiveX ,cMyContextID , cQualDedo )
**************************************//***************************************
LOCAL cEvent := cValToChar( event )
LOCAL cTemplate, nTemplateSize, nRet


IF .NOT. lEmOperacao

IF cEvent == "SensorPlug" .and. aParams[1] != "File"

oFinger:Do("CapStartCapture",AllTrim(aParams[1]))

ENDIF


IF cEvent == "SensorUnplug"

oFinger:Do("CapStopCapture",AllTrim(aParams[1]))

ENDIF


IF cEvent == "ImageAcquired"

lEmOperacao := .T.
FERASE( oPub:wPathBmp + "Dedo.BMP" )


nTemplateSize := 10000
cTemplate := SPACE(10000)


*** Usando somente a Sintax do ActiveX


Em qualquer das sintax da o problema de vir zerado
* Assim funciona
* nIni := oFinger:ExtractEx( cImagem, aParams[2], aParams[ 3], 500, cTemplate, @nTemplateSize, 0, GR_FORMAT_ISO )

* nIni := oFinger:DO("Extract", aParams[4], aParams[2], aParams[ 3], 500, cTemplate, @nTemplateSize, cMyContextID )
nIni := oFinger:Extract( aParams[4], aParams[2], aParams[ 3], 500, cTemplate, @nTemplateSize, cMyContextID )

**** Aqui da erro o Len(AllTrim(cTemplate)) da Zero
? "Extract",nIni,Len(AllTrim(cTemplate))
* Ou desta maneira
* nIni := oFinger:DO("ExtractEx", aParams[4], aParams[2], aParams[ 3], 500, cTemplate, @nTemplateSize, 0 , GR_FORMAT_DEFAULT ) // GR_FORMAT_ANSI
nIni := oFinger:ExtractEx( aParams[4], aParams[2], aParams[ 3], 500, cTemplate, @nTemplateSize, cMyContextID , GR_FORMAT_DEFAULT ) // GR_FORMAT_ANSI
? "ExtractEx",nIni,Len(AllTrim(cTemplate))

nIni := oFinger:Do("CapSaveRawImageToFile",aParams[ 4],aParams[ 2], aParams[ 3], oPub:wPathBmp + "Dedo.BMP",GRCAP_IMAGE_FORMAT_BMP)
*? "CapSaveRaw",nIni

oFoto:LoadBmp( oPub:wPathBmp + "Dedo.BMP" ) // cargo la imagen guardada en la anterior línea
oFoto:Refresh()

ret := oFinger:DO("IdentifyPrepare", cTemplate, cMyContextID )
*** Devido a isso da erro -5
? "IdentifyPrepare",ret

*ret := oFinger:Identify( cTemplate, @nIdScore , 0 )
ret := oFinger:DO("Identify", cTemplate, @nIdScore , cMyContextID )
? "Identify",ret


*** Ou usando a sintax das Dlls abaixo.

cLibFinger := LoadLibrary("GrFinger.dll")
GrInitialize()

TemplateSize := 10000
cTemplate := SPACE(10000)
* Assim com o @cTemplate
ret:= GrExtract( aParams[ 4], aParams[ 2], aParams[ 3], aParams[ 5], @cTemplate, @nTemplateSize, 0 )
Assim sem cTemplate
ret:= GrExtract( aParams[ 4], aParams[ 2], aParams[ 3], aParams[ 5], @cTemplate, @nTemplateSize, 0 )

select("Personal")
APPEND BLANK
IF Personal->(rlock())
REPLACE Huella WITH cTemplate
Personal->(dbcommit())
Personal->(dbunlock())
ENDIF
GO TOP

nIdScore := 0
WHILE !eof()

GrIdentifyPrepare( cTemplate, 0 )
nId:= GrIdentify( Personal->Huella, @nIdScore , 0 )
? nId é sempre 0 Zero
IF nId = 1
// Ok
msgwait("Digltal encontrada!","Atenção",1)
ELSE
msgwait("Digital não encontrado!","Atenção",1)
ENDIF

** oU
nId:= GrVerify( cTemplate , Personal->Huella, @nIdScore , 0 )
? "nId",nId
Skip
ENDDO


GrFinalize()
FreeLibrary(xLib)
ENDIF

ENDIF
RETURN NIL


DLL32 FUNCTION GrInitialize() AS LONG PASCAL FROM "_GrInitialize@0" LIB xLib
DLL32 FUNCTION GrFinalize() AS LONG PASCAL FROM "_GrFinalize@0" LIB xLib
DLL32 FUNCTION GrExtract( @rawImage AS LONG, width AS LONG, height AS LONG, res AS LONG, ttpt AS LPSTR, @ttptSize AS LONG , context AS LONG ) AS LONG PASCAL FROM "_GrExtract@28" LIB xLib
DLL32 FUNCTION GrIdentifyPrepare( ttpt AS LPSTR, context AS LONG ) AS LONG PASCAL FROM "_GrIdentifyPrepare@8" LIB xLib
DLL32 FUNCTION GrIdentify( @ttpt AS LPSTR, @Idscore AS LONG, context AS LONG ) AS LONG PASCAL FROM "_GrIdentify@12" LIB xLib
DLL32 FUNCTION GrVerify( ttpt AS LPSTR, qtpt AS LPSTR, @Idscore AS LONG, context AS LONG ) AS LONG PASCAL FROM "_GrVerify@16" LIB xLib



De maneira nenhuma vai.
Alguem poderia me orientar onde estou errando ?
Marcelo Ferro da Silveira
Fwh14.04/xHarbour 1.2.3 Simplex / Bcc582 / Pelles 8
SqlLib /xMate/WS
marca
 
Posts: 117
Joined: Mon Aug 13, 2007 5:22 pm
Location: Brazil

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 13 guests