Performs an identification by comparing the supplied reference template against the previously prepared query template.
| Prerequisites | The Fingerprint SDK library must have been previously initialized. The identification must be previously prepared by calling the IdentifyPrepare method. The Verify method must not be called beween the call to IdentifyPrepare method and a call to Identify method. |
| Return | On success, GR_MATCH is returned if the matching score is higher than the identification threshold, otherwise GR_NOT_MATCH is returned. On failure, the appropriate error code is returned. |
| [in] templateReference |
Reference template for identification. |
| [out] identifyScore |
Identification matching score. |
| [in] context |
Context in which the identification will be performed. |
C++ .NET
int Identify (ref byte[] templateReference, ref int identifyScore, int context)
C#
int Identify (ref Array templateReference, ref int identifyScore, int context)
VB6
Function Identify (ByRef templateReference() As Byte, ByRef identifyScore As Long, ByVal context As Long) As Long
VB .NET
Function Identify (ByRef templateReference As Array, ByRef identifyScore As integer, ByVal context As integer) As integer
Delphi
function Identify(var templateReference: PSafeArray; var identifyScore: integer; context: integer): integer;
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 TypeDim 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 ClassDim 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