Griaule Biometrics

Home » Fingerprint SDK 2009 Developer's Manual » Programming Reference Guide » Fingerprint SDK DLL Reference Guide » Matching functions » GrIdentifyPrepare

GrIdentifyPrepare

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++

int __stdcall GrIdentifyPrepare (char *templateQuery, int context);

Delphi

function GrIdentifyPrepare(templateQuery: PChar; context: Integer): Integer; stdcall;

Sample Code

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;
	}
}

TTemplate *tptRef;

// Checking if the template is valid.
if(!TemplateIsValid())
return ERR_INVALID_TEMPLATE;
// Starting the identification process and supplying the query //template.
result = GrIdentifyPrepare((char*)_tpt->_tpt, GR_DEFAULT_CONTEXT);
// Getting the current template from the recordset.
tptRef = _DB->getTemplate(rs);

// Comparing the current template.
result = GrIdentify((char*)tptRef->_tpt, &score, GR_DEFAULT_CONTEXT);

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

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;

Var
ret: Integer;
tptRef: TTemplate;
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 := GrIdentifyPrepare(template.tpt, GR_DEFAULT_CONTEXT);
// Comparing the current template.
ret := GrIdentify(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;
end;