long Verify( SensorHandle_t hSensor, long Mode, long Row, long Col, PENROLLINFO pEnrolledData ) { unsigned char *pImageData; ENROLLINFO VerifyData; long dFlag, compressFlag; BOOL Done = FALSE; long lReturnValue = -1; char Message[128];#ifdef EMBEDDED_SYSTEM pImageData = ImageDataBuffer; #else pImageData = (unsigned char *) calloc( Row*Col, sizeof( unsigned char) ); if ( pImageData == NULL ) { sprintf( Message, "\nERROR in Verify(): Fail to allocate system memory.\n" ); //OutputMessage( Message ); return lReturnValue; } #endif /* Suggested security level for verification is V_MATCH_MEDIUM_SEC. Depending on application, refer to SDK manual for all the available security levels. */ setMatcherSecurity( V_MATCH_MEDIUM_SEC ); dFlag = 0; compressFlag = FP_COMPRESS_FLAG; /* This loop is continuous until a matched fingerprint is input, or timeout happened. If timeout happens, it means user don't want to verify. Note that timeout period is adjustable in CaptureFingerprint(). */ while ( !Done ) { if ( CaptureFingerprint( hSensor, Mode, Row, Col, VERIFICATION, pImageData ) ) { /* Extract minutiae (information) from the fingerprint */ VerifyData.lMinuQuality = fpProcess( pImageData, Row, Col, (void *)VerifyData.Minutiae, &VerifyData.nMinutiae, NULL, dFlag, compressFlag ); /* Cannot get minutiae from the fingerprint, try again. */ if ( VerifyData.lMinuQuality < MIN_VERIFY_MINU_QUALITY || VerifyData.nMinutiae < MIN_VERIFY_MINU_NUMBER ) { sprintf( Message, "\nFail to extract reasonable minutiae. Do capture again." ); //OutputMessage( Message ); continue; } if ( matchprints( VerifyData.Minutiae, VerifyData.nMinutiae, pEnrolledData->Minutiae, pEnrolledData->nMinutiae ) >= MIN_VERIFY_MATCHES ) { /* Need to have at least 1 match. Programmer can adjust this value for according to the level of security. */ sprintf( Message, "\n\n!!! A matched finger is detected !!!" ); //OutputMessage( Message ); lReturnValue = VFPS_STATUS_SUCCESS; break; } else { sprintf( Message, "\n*** Not a matched finger ***" ); //OutputMessage( Message ); continue; } } else { sprintf( Message, "\nTimeout: Verification abort." ); //utputMessage( Message ); break; } } /* End while ( !Done ) */ /* free resources */ #ifndef EMBEDDED_SYSTEM free( pImageData ); #endif return lReturnValue;} /* End of Verify */
SensorHandle_t hSensor,
long Mode, long Row, long Col,
PENROLLINFO pEnrolledData )
{
unsigned char *pImageData;
ENROLLINFO VerifyData;
long dFlag, compressFlag;
BOOL Done = FALSE;
long lReturnValue = -1; char Message[128];#ifdef EMBEDDED_SYSTEM
pImageData = ImageDataBuffer;
#else
pImageData = (unsigned char *) calloc( Row*Col, sizeof( unsigned char) );
if ( pImageData == NULL )
{
sprintf( Message, "\nERROR in Verify(): Fail to allocate system memory.\n" );
//OutputMessage( Message );
return lReturnValue;
}
#endif /* Suggested security level for verification is V_MATCH_MEDIUM_SEC.
Depending on application, refer to SDK manual for all the
available security levels.
*/
setMatcherSecurity( V_MATCH_MEDIUM_SEC ); dFlag = 0;
compressFlag = FP_COMPRESS_FLAG; /* This loop is continuous until a matched fingerprint is input,
or timeout happened.
If timeout happens, it means user don't want to verify.
Note that timeout period is adjustable in CaptureFingerprint().
*/
while ( !Done )
{
if ( CaptureFingerprint( hSensor, Mode, Row, Col, VERIFICATION, pImageData ) )
{
/* Extract minutiae (information) from the fingerprint */
VerifyData.lMinuQuality =
fpProcess( pImageData, Row, Col,
(void *)VerifyData.Minutiae,
&VerifyData.nMinutiae,
NULL, dFlag, compressFlag ); /* Cannot get minutiae from the fingerprint, try again. */
if ( VerifyData.lMinuQuality < MIN_VERIFY_MINU_QUALITY ||
VerifyData.nMinutiae < MIN_VERIFY_MINU_NUMBER )
{
sprintf( Message, "\nFail to extract reasonable minutiae. Do capture again." );
//OutputMessage( Message );
continue;
} if ( matchprints( VerifyData.Minutiae, VerifyData.nMinutiae,
pEnrolledData->Minutiae,
pEnrolledData->nMinutiae ) >= MIN_VERIFY_MATCHES )
{
/* Need to have at least 1 match.
Programmer can adjust this value for according to
the level of security.
*/
sprintf( Message, "\n\n!!! A matched finger is detected !!!" );
//OutputMessage( Message );
lReturnValue = VFPS_STATUS_SUCCESS;
break;
}
else
{
sprintf( Message, "\n*** Not a matched finger ***" );
//OutputMessage( Message );
continue;
} }
else
{
sprintf( Message, "\nTimeout: Verification abort." );
//utputMessage( Message );
break;
} } /* End while ( !Done ) */ /* free resources */
#ifndef EMBEDDED_SYSTEM
free( pImageData );
#endif return lReturnValue;} /* End of Verify */
SensorHandle_t hSensor,
long Mode, long Row, long Col,
CAPTURE_PURPOSE Purpose,
unsigned char *pImageData )
{
unsigned long SleepTime;
long TotalAttempts, QualityAttempts, Flags;
long lResult, Quality;
BOOL Done, bResult;
SleepTime = 300; /* 500 mSec */
TotalAttempts = 60;
QualityAttempts = 3;
Flags = VFPS_IMAGEPLUS | VFPS_AS_CONTINUOUS;
bResult = FALSE;
Done = FALSE;
while ( !Done )
{
lResult = VFPSautosnap( hSensor, pImageData, SleepTime, TotalAttempts,
QualityAttempts, &Quality, Flags );
switch ( lResult )
{
case VFPS_AS_TIMEOUT:
Done = TRUE;
break; case VFPS_IMG_LATENT:
break; case VFPS_IMG_SUPPRESSED:
//OutputMessage( "\nPlease lift finger from sensor and put back again." );
break; case VFPS_AS_ACCEPTABLE_QUAL:
Done = TRUE;
bResult = TRUE;
break;
case VFPS_AS_POOR_QUAL:
if ( Purpose == VERIFICATION )
{
Done = TRUE;
bResult = TRUE;
break;
}
case VFPS_AS_UNACCEPTABLE_QUAL:
default:
PromptIfBadQuality( Quality );
break; } }
return bResult;}