Griaule Biometrics

Home » Fingerprint SDK 2009 Developer's Manual » Programming Reference Guide » Fingerprint SDK ActiveX Reference Guide » Matching methods » IdentifyPrepare

IdentifyPrepare

Prepares a query template to be identified against one or more reference templates.

Prerequisites The Fingerprint SDK library must have been previously initialized.

Return On success, GR_OK is returned.
On failure, the appropriate error code is returned.

Parameters

[in] templateQuery

Query template to be identified.

[in] context

Context in which the identification will be performed.

Declaration

C++ .NET

int IdentifyPrepare (ref byte[] templateQuery, int context)

C#

int IdentifyPrepare (ref Array templateQuery, int context)

VB6

Function IdentifyPrepare (ByRef templateQuery() As Byte, ByVal context As Long) As Long

VB .NET

Function IdentifyPrepare (ByRef templateQuery() As Array, ByVal context As integer) As integer

Delphi

function IdentifyPrepare(var templateQuery: PSafeArray; context: integer): integer;

Sample Code

C++ .NET

public class TTemplate
{
	// Template data.
	public Array _tpt;
	// Template size
	public int _size;

public TTemplate(){
// Create a byte buffer for the template
_tpt = new byte[(int)GRConstants.GR_MAX_SIZE_TEMPLATE];
_size = 0;
}
}

int result, id;
OleDbDataReader *rs;
TTemplate *tptRef;

// Checking if the template is valid.
if(!TemplateIsValid())
return ERR_INVALID_TEMPLATE;
// Starting the identification process and supplying the query template.
result = _grfingerx->IdentifyPrepare(&_tpt->_tpt, GR_DEFAULT_CONTEXT);
// error?
if(result < 0) return result;

// Getting the current template from the recordset.
tptRef = _DB->getTemplate(rs);

// Comparing the current template.
result = _grfingerx->Identify(&tptRef->_tpt, &score, GR_DEFAULT_CONTEXT);

// Checking if the query template and the reference template match.
if(result == GR_MATCH){
id = _DB->getId(rs);
rs->Close();
return id;
}
else if (result < 0){
rs->Close();
return result;
}

C#



public class TTemplate
{
// Template data.
public Array _tpt;
// Template size
public int _size;

public TTemplate(){
// Create a byte buffer for the template
_tpt = new byte[(int)GRConstants.GR_MAX_SIZE_TEMPLATE];
_size = 0;
}
}

GRConstants result;
int id;
OleDbDataReader rs;
TTemplate tptRef;

// Checking if the template is valid.
if(!TemplateIsValid()) return ERR_INVALID_TEMPLATE;
// Starting the identification process and supplying the query //template.
result = (GRConstants) _grfingerx.IdentifyPrepare(ref _tpt._tpt,
(int)GRConstants.GR_DEFAULT_CONTEXT);
// error?
if (result < 0) return (int)result;

// Getting the current template from the recordset.
tptRef = _DB->getTemplate(rs);

// Comparing the current template.
result = _grfingerx->Identify(&tptRef->_tpt, &score, GR_DEFAULT_CONTEXT);

// Checking if the query template and the reference template match.
if(result == GR_MATCH){
id = _DB->getId(rs);
rs->Close();
return id;
}
else if (result < 0){
rs->Close();
return result;
}


VB6



' Template data Type
Public Type TTemplate
' Template data
tpt() As Byte
' Template size
Size As Long
End Type

Dim ret As integer
Dim i As integer

' Starting the identification process and supplying the query 'template.
If Not TemplateIsValid() Then
Identify = ERR_INVALID_TEMPLATE
Exit Function
End If

' Starting the identification process and supplying the query 'template.
ret = GrFingerXCtrl1.IdentifyPrepare(template.tpt, GR_DEFAULT_CONTEXT)
' error?
If ret < 0 Then
Identify = ret
Exit Function
End If

' Getting the current template from the recordset.
tpt = rs("template")
' Comparing the current template.
ret = GrFingerXCtrl1.Identify(tpt, score, GR_DEFAULT_CONTEXT)
' Checking if the query template and the reference template match.
If ret = GR_MATCH Then
Identify = rs("ID")
rs.Close
Exit Function
ElseIf ret < 0 Then
Identify = ret
Exit Function
End If


VB .NET



' Template data
Public Class TTemplate
' Template itself
Public tpt(GrFingerXLib.GRConstants.GR_MAX_SIZE_TEMPLATE) As Byte
' Template size
Public Size As Long
End Class

Dim ret As integer
Dim i As integer

' Checking if the template is valid.
If Not TemplateIsValid() Then Return ERR_INVALID_TEMPLATE

' Starting the identification process and supplying the query template.
ret = _GrFingerX.IdentifyPrepare(template.tpt, GRConstants.GR_DEFAULT_CONTEXT)
' error?
If ret < 0 Then Return ret

' Comparing the current template.
ret = _GrFingerX.Identify(templates(i).template.tpt, score, GRConstants.GR_DEFAULT_CONTEXT)
' Checking if the query template and the reference template match.
If ret = GRConstants.GR_MATCH Then
Return templates(i).ID
End If
If ret < 0 Then Return ret


Delphi



type
// Class TTemplate
// Define a type to temporary storage of template
TTemplate = class
public
// Template data.
tpt: PSafeArray;
// Template size
size: Integer;
// Template ID (if retrieved from DB)
id: Integer;

// Allocates space to template
constructor Create;
// clean-up
destructor Destroy; override;
end;

Begin
// Checking if the template is valid.
if not(TemplateIsValid())then
begin
Identify := ERR_INVALID_TEMPLATE;
exit;
end;
// Starting the identification process and supplying the query //template.
ret := GrFingerXCtrl1.IdentifyPrepare(template.tpt, GR_DEFAULT_CONTEXT);
// error?
if (ret < 0) then begin
identify := ret;
exit;
end;

// Comparing the current template.
ret := GrFingerXCtrl1.Identify(tptRef.tpt, score, GR_DEFAULT_CONTEXT);
// Checking if the query template and the reference template match.
if (ret = GR_MATCH) then
begin
Identify := tptRef.id;
exit;
end
else if (ret < 0) then
begin
Identify := ret;
exit;
end;
end