Professional Documents
Culture Documents
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Griaule Biometrics Fingerprint SDK and GrFinger are trademarks of Griaule Biometrics LTDA. The names of actual companies and products mentioned herein may be the trademarks of their respective owners.
Manual Conventions
Icons Definitions and Acronyms
Icons
The icons below indicate that a section applies to a specific integration type: DLL, ActiveX or Java application/applet.
This icon indicates that the section applies to Fingerprint SDK DLL only.
This icon indicates that the section applies to Fingerprint SDK ActiveX component only.
This icon indicates that the section applies to Fingerprint SDK Java for Windows only.
The icons below are used to get reader's attention to any important information.
This icon usually gives hints to make something easier: learning, understanding, programming, deploying, etc.
This icon is used to indicate a very important section that should not be skipped.
This icon indicates a potential risk to system integrity, a risk of malfunctioning, etc. The section must not be skipped and you should read it carefully.
1 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
occurs, another program or library or even the operating system calls the handler, passing it arguments which describe the event. ActiveX - This is the Microsoft specification for reusable components. ActiveX is based on the Component Object Model (COM), an open standard that specifies how components interact and interoperate. Somewhat like a DLL, ActiveX allows packaging code to create highly reusable components. regsvr32 - This is a tool to register and unregister Object Linking and Embedding (OLE) controls, such as DLLs and ActiveX controls. For further info about this tool, check the Microsoft's regsvr32 page. JNI - The Java Native Interface (JNI) is a programming framework that allows Java code running in the Java Virtual Machine (JVM) to call and be called by native applications (programs specific to a hardware and operating system platform) and libraries written in other languages, such as C, C++ and assembly. Java applet - A Java applet is a Java program that can be included as part of a web page.
Getting Started
Fingerprint SDK is a fingerprint recognition library that comes packaged with a Software Development Kit (SDK), allowing you to integrate biometrics in a wide range of applications. Thanks to its support for several programming languages, richness of code samples, and its thorough documentation, you'll start developing your application in a matter of minutes. Quick Start Guide Features What's New on Fingerprint SDK About Fingerprint SDK Editions Upgrading from GrFinger 4.2 to Fingerprint SDK FingerCap USB Driver Licensing Support
Installing
To install Fingerprint SDK, run the installation program and follow the on-screen instructions.
Folders Overview
Check the SDK Folders Structure section in this manual.
Getting licenses
Check the Licensing section in this manual.
Features
Technical Characteristics Fingerprint Readers Support Programming Languages Support Sample Codes Quality One-to-many Identification Licensing
Technical Characteristics
Capture
Detects fingerprint readers plug/unplug; Automatic finger detection; Supports BMP files for fingerprint image saving/loading; Maximum image size of 1280 x 1280 pixels; Minimum image size of 50 x 50 pixels; Maximum resolution of 1000 DPI; Minimum resolution of 125 DPI;
Extraction
Average extraction time of 100ms*; Maximum image size of 500 x 500 pixels**; Minimum image size of 50 x 50 pixels; Average template size of 400 bytes*;
Matching
2 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Sample Codes
The Fingerprint SDK comes packaged with fifteen detailed and complete application samples, along with their source code, in several programming languages. The samples cover all Fingerprint SDK functions and provide an easy starting point for development.
Quality
Griaule's fingerprint recognition algorithm was successfully tested among the world's best fingerprint recognition systems, on a test held by the United States National Institute of Standards and Technology (NIST) in 2003. The Griaule fingerprint recognition algorithms (P066) get the first position of the average ERR in FVC 2006. The FVC (Fingerprint Verification Competition) is the worlds largest competition for fingerprint verification algorithms.
One-to-many Identification
Most solutions offer only one-to-one verification or one-to-little identification. Fingerprint SDK is capable of making unlimited one-to-many identification.
Licensing
Fingerprint SDK offers a number of licensing options to meet your needs. Please visit Griaule Web Site to know about it.
3 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
If Microsoft, DigitalPersona, Futronic FS80, M2SYS M2-S or Bio-I Cyte fingerprint readers are used, you must remove the manufacturer's device driver and install the FingerCap USB Driver. For further information check Fingerprint Readers compatible with Griaule FingerCap USB Driver installation section.
Each fingerprint reader is supported on specifics operating systems. Please check it at Griaule Web Site.
Licensing
Fingerprint SDK is distributed with a trial license valid for 90 days*. After this period you have to buy a license to keep using it. Check the Griaule Web Site for licensing options, pricing and instructions on how to request commercial licenses. To know how to apply and deploy licenses, check the Licensing Fingerprint SDK Based Deployed Applications section.
Support
Griaule Support Page
You also need to check the supported operating systems and the computer requirements for the fingerprint reader you're intending to use. In order to do so, check the manufacturer's website or the fingerprint reader's documentation.
Supported IDEs
Fingerprint SDK ActiveX component should be supported by any IDE that supports ActiveX components. It does works with the most used Windows IDEs: Visual Basic 6, Delphi 6, Delphi 7, Visual FoxPro 8, Visual Studio .NET 2003 and Visual Studio .NET 2005.
If you are intending to use Fingerprint SDK in an IDE other than those listed above, make sure it can import and use ActiveX components.
4 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Directory Description bin Contains all the files needed by Fingerprint SDK library. This folder contains (among others): GrFinger.dll (DLL), GrFingerX.dll (ActiveX) and GrFingerJava.dll (JNI for Windows). The Fingerprint SDK documentation files. Fingerprint SDK Developer's Manual ENUS.chm: This manual. Fingerprint SDK Java: Fingerprint SDK for Windows JavaDoc. Fingerprint SDK Applet Installer: Fingerprint SDK applet helper for Windows JavaDoc. images include lib Some fingerprint images for testing purposes (mainly playing with the samples without having to install a fingerprint reader). Import files for some of the supported languages (DLL only). GrFinger.lib, a library to access Fingerprint SDK in your C++ and C++.NET applications.
doc
The largest box shows the last fingerprint acquired from a fingerprint reader or loaded from a file. Each reader scans images in a specific size (width and height), but the samples resize all images to the same size before displaying them. The box on the bottom of the window shows status messages, e.g. when a reader is plugged or unplugged, a finger is placed over a reader, etc. By clicking the "Extract template" button, the last acquired fingerprint image is analyzed and its minutiae and segments are identified, extracted and displayed on screen. The "Enroll" button saves the last extracted template into the database, and the ID of the enrolled template is displayed in the log box. Placing a finger already enrolled in the database over the reader, waiting the image being acquired and clicking the "Identify" button will perform an identification; clicking the "Verify" button will perform a verification. In the latter case the sample will ask you the fingerprint ID you want to verify. In both cases the result will be displayed in the log box. By checking the "Auto identify" option, whenever a finger is placed over the reader, the sample will try to automatically identify the fingerprint; the result will be shown in the log box. To delete all the fingerprints enrolled in the database, click the "Clear database" button. To clear the log box, use the "Clear log" button. To save the currently displayed fingerprint image to a file, select the option "Save..." in the "Image" menu. To load a fingerprint image saved in BMP format, select the option "Load from file..." in the "Image" menu. Selecting the "Options..." menu causes a new window to be opened. In this window it's possible to change the identification and verification thresholds, the fingerprint rotation tolerance and also the colors used to display the fingerprint minutiae, their directions and segments.
5 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Import files for Delphi, C++ and C++.NET are available in the "include" folder in the SDK root folder.
This section contains detailed importing instructions for the following IDEs: Microsoft Visual Basic 6 Microsoft Visual Studio 2003/2005 Delphi 6/7 Microsoft Visual FoxPro 8
6 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Delphi 6/7
1. Go to Component -> Import ActiveX Control...;
7 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
2. Select the GrFingerX Control Library in the component list and click the Install... button;
3. Click the OK button. If a dialog box asks to install the package, click Yes;
4. A project with the Fingerprint SDK ActiveX library will be opened. Don't modify it, just close the project; 5. The Fingerprint SDK ActiveX component will be added to the Component Palette.
8 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Applet Prerequisites Fingerprint SDK is a native Windows library, thus Java programs using Fingerprint SDK only run on Windows.
Applet Prerequisites
In order to use Fingerprint SDK in Java applets for Windows, three more requisites must be met: 1. Sign the applet to grant permissions for copying files and loading libraries; 2. Copy all required Fingerprint SDK libraries to the client computer running the applet; 3. Copy the Fingerprint SDK license to the client computer running the applet; In order to make it easier to met the second and third requisites, the Fingerprint SDK also contains a helper, the GrFingerAppletInstaller class, that has methods to perform all the necessary operations: unpacking ZIP files, copying files to the filesystem, initializing GrFinger, removing the copied files.
The GrFingerAppletInstaller class handles two resources: a ZIP file (containing the libraries) and a license file. The ZIP package and license file must be located in the root folder of the JAR archive. Using the methods provided by the class, copying the files and creating a GrFinger object is straightforward:
// Create the installer GrFingerAppletInstaller installer = new GrFingerAppletInstaller("","libraries.zip"); // Install libraries installer.copyAndExtractZip(); // Install license installer.copyLicense("mylicense.txt"); // Create GrFinger object GrFinger grFinger = installer.getGrFinger();
Finalizing GrFinger and removing the copied files using the methods provided by the GrFingerAppletInstaller class is also straightforward:
// Finalize GrFinger library grFinger.finalize(); // Finalize installer, removing copied files installer.finalize();
Swing components should be created, queried and manipulated in the event-dispatching thread, but the web-browsers don't invoke any applet milestone method from this thread. Thus, the milestone methods - init, start, stop, and destroy - should use the SwingUtilities method invokeAndWait (or invokeLater if appropriate) so that code that refers to the Swing components is executed in the event-dispatching thread. Note in the example below the method invokeAndWait in the init method.
public void init() { //Execute a job on the event-dispatching thread: //creating this applet's GUI. try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { //Initialization code goes here } }); } catch (Exception e) { System.err.println("Initialization failed!"); } }
If the applet is Swing based, you must initialize and finalize Fingerprint SDK library in the invokeAndWait method.
An applet using Fingerprint SDK must copy all necessary files to the client computer in the init method. Only after this operation an applet may load and initialize Fingerprint SDK library. Finally, Fingerprint SDK library must be finalized in the destroy method.
Signing an Applet
The Java Virtual Machine security policy doesn't allow ordinary applets to write data to the filesystem or load libraries. Applets that must perform such operations must be signed. To sign an applet it's necessary to package it in a JAR file and then sign this file with a trusted certificate. Another way to grant permissions for writing data to filesystem and loading libraries in a development environment is editing the user's .java.policy file before loading the applet. This procedure isn't recommended for production environments.
9 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
In a development environment, creating self-signed certificates is an easy way to sign applets. To do so you must have the Java SDK installed. The keytool program is used for managing X.509 certificates. The command "keytool --help" shows the program usage. To create a self-signed key you may do:
keytool -genkey -alias signFiles -keystore keyFile -keypass keypassword -dname "cn=Distinguished Name" -storepass storepassword
The command above will generate a file named keyFile containing a certificate suitable to sign an applet. To do so, use the program jarsigner, using the generated file keyFile as the keystore:
jarsigner -keystore keyFile -storepass storepassword -keypass keypassword -signedjar SignedJarFile.jar JarFile.jar signFiles
The command above will generate the file SignedJarFile.jar, which is the same JarFile.jar, but signed. This must be done for every JAR package needing special permissions that is used by the applet. When a signed applet is loaded on a web-browser, a message box appears displaying the signature details and asking the user if the applet should be trusted. If the user doesn't trust the signed applet, the special permissions will not be granted. If the applet uses Fingerprint SDK, such permission denial will cause the library to fail during its initialization.
When the capture module is initialized, a special sensor is automatically plugged, firing the corresponding plugging event: the "File" sensor. Enabling image capture on this special sensor is required in order to load fingerprint images from picture files.
On GrFinger 4.1 FREE and LIGHT versions, the fingerprint images captured from the fingerprint readers couldn't be used for any other purpose because they were encrypted. Although Fingerprint SDK doesn't encrypt the fingerprint images, it accepts encrypted images as input for backward compatibility purposes.
Contexts
Contexts are an advanced feature used to: allow two or more biometric operations to be executed at the same time; create different ready-to-use identification or verification environments; Most biometric applications are interactive and don't execute more than one biometric operation at a time, using just the default context. But, for example, to perform two fingerprint identifications simultaneously on a multithreaded server, each identification must be executed on its own context. Two operations must not be called simultaneously in the same context because they are not guaranteed to be thread-safe. Creating a new context for each operation that will be executed simultaneously guarantees the thread safety.
10 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Furthermore, each context has its own matching parameters, making it possible to create different identification or verification environments. For example, in a two-level security biometric application, instead of tightening or lowering the matching parameters depending on the security level before performing a matching, two contexts, each one with the appropriate matching parameters, may be created; any fingerprint matching is then performed in a context corresponding to the right security level.
However, when Fingerprint SDK library is running with a trial license, a splash screen is shown when the library initializes, as shown in the picture below.
For backward compatibility purposes, Fingerprint SDK works with GrFinger 4.1 encrypted images.
Example
If an application uses Fingerprint SDK ActiveX component and supports the Nitgen Hamster I and Microsoft fingerprint readers, the following files must be packaged with it: GrFinger.dll pthreadVC2.dll GrFingerX.dll (must also be registered in the target computer with the regsvr32 tool) CapPluginFingercap.dll CapPluginHamster.dll NBioBSP.dll
Important notes
11 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
During application installation, any required DLL file must be copied to the application folder, to a system folder (for e.g., SYSTEM folder) or to a folder included in the PATH variable. For Java applications, any required JAR file must be added to the CLASSPATH variable.
Return codes
Success Codes GR_OK GR_BAD_QUALITY GR_MEDIUM_QUALITY GR_HIGH_QUALITY GR_MATCH GR_NOT_MATCH GR_DEFAULT_USED GR_ENROLL_NOT_READY GR_ENROLL_SUFFICIENT GR_ENROLL_GOOD GR_ENROLL_VERY_GOOD 0 Success 0 Extraction succeeded, template has bad quality 1 Extraction succeeded, template has medium quality 2 Extraction succeeded, template has high quality 1 Fingerprints match 0 Fingerprints don't match 3 A supplied parameter is invalid or out of range, default value will be used 0 Enrollment process not ready 1 Sufficient enrollment 2 Good enrollment 3 Very good enrollment
Initialization Error Codes GR_ERROR_INITIALIZE_FAIL GR_ERROR_NOT_INITIALIZED -1 Initialization failed -2 GrFinger isn't initialized
GR_ERROR_FAIL_LICENSE_READ -3 GrFinger couldn't read the license file GR_ERROR_NO_VALID_LICENSE GR_ERROR_NULL_ARGUMENT GR_ERROR_FAIL GR_ERROR_ALLOC GR_ERROR_PARAMETERS -4 No valid license found -5 A null parameter was supplied -6 Unexpected failure -7 Memory allocation failure -8 An incorrect parameter was supplied
Extraction and Matching Error Codes GR_ERROR_WRONG_USE GR_ERROR_EXTRACT GR_ERROR_SIZE_OFF_RANGE GR_ERROR_RES_OFF_RANGE -107 Function can't be called at this time -108 Error extracting template -109 Image size is too big -110 Image resolution is out of the valid range
GR_ERROR_CONTEXT_NOT_CREATED -111 Context couldn't be created GR_ERROR_INVALID_CONTEXT GR_ERROR_ERROR -112 Context isn't valid -113 General, unexpected or unknown error
12 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
GR_ERROR_NOT_ENOUGH_SPACE
Capture Error Codes GR_ERROR_CONNECT_SENSOR GR_ERROR_CAPTURING GR_ERROR_CANCEL_CAPTURING GR_ERROR_INVALID_ID_SENSOR -201 Error connecting to the fingerprint reader -202 Error while acquiring image -203 Capture has been canceled -204 Invalid fingerprint reader ID
GR_ERROR_SENSOR_NOT_CAPTURING -205 Capture wasn't started on the fingerprint reader GR_ERROR_INVALID_EXT GR_ERROR_INVALID_FILENAME GR_ERROR_INVALID_FILETYPE GR_ERROR_SENSOR -206 Invalid file extension -207 Invalid filename -208 Invalid file type -209 Fingerprint reader error
License Error Codes GR_ERROR_GET_HARDWARE_KEY -301 Unable to get your hardware key
GR_ERROR_NO_HARDWARE_BOUND -306 No hardware-bound license GR_ERROR_HTTP_AUTHORIZATION GR_ERROR_WRONG_PRODUCT_KEY GR_ERROR_INTERNAL_SERVER GR_ERROR_WRITING_LICENSE_FILE GR_ERROR_PK_NOT_LINKED GR_ERROR_PK_NOT_APPROVED -307 HTTP authentication failed -308 Wrong product key -309 Internal server error -310 Unable to write the license file -311 Product key not linked with a Griaule Account -312 Product key not approved yet
100 Legacy template format 200 ISO 19794-2 Compliant template Format 201 ANSI 378-2004 Compliant template Format
Event constants
Event Codes GR_PLUG GR_UNPLUG 21 A fingerprint reader was plugged on the machine 20 A fingerprint reader was unplugged from the machine
GR_FINGER_DOWN 11 A finger was placed over the fingerprint reader GR_FINGER_UP 10 A finger was removed from the fingerprint reader
Image constants
Picture File Formats GRCAP_IMAGE_FORMAT_BMP 501 Windows Bitmap (BMP) image format
Image Values GR_DEFAULT_RES GR_DEFAULT_DIM GR_MAX_SIZE_TEMPLATE GR_MAX_IMAGE_WIDTH GR_MAX_IMAGE_HEIGHT GR_MAX_RESOLUTION GR_MIN_IMAGE_WIDTH 500 500 10000 1280 1280 1000 50 Default resolution value for an image in DPI Maximum width and height of an image in pixels that is processed on template extraction Maximum template size in bytes Maximum acceptable image width in pixels Maximum acceptable image height in pixels Maximum acceptable image resolution in DPI Minimum acceptable image width in pixels
13 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
50 125
Minimum acceptable image height in pixels Minimum acceptable image resolution in DPI
Matching constants
Matching Values GR_MAX_THRESHOLD 200 Maximum threshold value GR_MIN_THRESHOLD GR_VERYLOW_FRR GR_LOW_FRR GR_LOW_FAR GR_VERYLOW_FAR GR_ROT_MIN GR_ROT_MAX 10 30 45 60 80 0 Minimum threshold value Threshold value for a very low FRR (1 false rejection in 1000) Threshold value for a low FRR (1 false rejection in 100) Threshold value for a low FAR (1 false acceptance in 300000) Threshold value for a very low FAR (1 false acceptance in 3000000) Minimum rotation tolerance
Context constants
Context Values GR_DEFAULT_CONTEXT 0 Default context GR_NO_CONTEXT -1 No context
Licensing constants
License Types GRFINGER_FULL 1 Fingerprint IDENTIFICATION SDK license agreement
Parameters Descriptions
Each function, method or event parameter is presented along with its description and type. The parameter type is inside square brackets and may be: [in] The parameter is used only to pass values in to the function; [out] The parameter is used only to pass values back from the function; [in, out] The parameter is used both to pass values in and to pass results back out of the function;
Initialization and finalization functions Matching functions Enrollment Functions Extraction functions Capture functions Biometric display functions Other functions Callback handlers
Enrollment Functions
GrEnroll GrStartEnroll
GrEnroll
Enrolls a fingerprint image. Prerequisites Prerequisites The Fingerprint SDK library must have been previously initialized.The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes. Return On success, the enroll quality code is returned. On failure, the appropriate error code is returned.
Parameters
[in] rawImage A raw grayscale fingerprint image.
[in] width
[in] height
[in] res
14 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
[out] tpt
[in,out] tptSize
[in] The maximum size in bytes of the byte array supplied. [out] The size in bytes of the extracted template.
[out] quality
[in] tptFormat
[in] context
Declaration
C++
int result; // set current buffer size for the consolidated template _tpt->_size = GR_MAX_SIZE_TEMPLATE; result = GrEnroll(_raw.img, _raw.width, _raw.height, _raw.Res, (char*)_tpt->_tpt, &_tpt->_size, &_tpt->_quality, GR_FORMAT_DEFAULT, GR_DEFAULT_CONTEXT); // if error, set template size to 0 if (result < 0){ // Result < 0 => enrollment problem _tpt->_size = 0; }
Delphi
Var ret: Integer; Begin // set current buffer size for the consolidated template template.size := GR_MAX_SIZE_TEMPLATE; ret := GrEnroll(raw.img, raw.width, raw.height, raw.res, template.tpt, template.size, template.quality, GR_FORMAT_DEFAULT, GR_DEFAULT_CONTEXT); // if error, set template size to 0 // Result < 0 => enrollment problem if (ret < 0 ) then template.size := 0; End;
GrStartEnroll
Starts the enrollment process. The fingerprint templates are consolidated to create a trustable one. Prerequisites The Fingerprint SDK library must have been previously initialized. On success, GR_OK is returned. On failure, the appropriate error code is returned.
Return
Parameters
[in] context Context in which the enrollment will be started.
Declaration
C++
int __stdcall GrStartEnroll(int context);
Delphi
function GrStartEnroll(context: Integer): Integer; stdcall;
Sample Code
C++
int result; result = GrStartEnroll(GR_DEFAULT_CONTEXT);
Delphi
Var ret: Integer; Begin ret := GrStartEnroll(GR_DEFAULT_CONTEXT); End;
GrInitialize
Initializes the Fingerprint SDK library, creates the default context and checks for a valid license on system. Prerequisites A valid license must exist on system. Return On success, GR_OK is returned. On failure, the appropriate error code is returned.
Declaration
C++
int __stdcall GrInitialize();
15 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Sample Code
C++
int result; //Initialize the library result = GrInitialize();
Delphi
// Initializing the library. err := GrInitialize();
GrFinalize
Finalizes the Fingerprint SDK library, freeing any resource used. 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.
Declaration
C++
int __stdcall GrFinalize();
Delphi
function GrFinalize: Integer; stdcall;
Sample Code
C++
retVal=GrFinalize();
Delphi
retVal:=GrFinalize();
GrCreateContext
Creates a context in which extraction, verification and identification may be performed. 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
[out] contextId The identifier of the newly created context.
Declaration
C++
int __stdcall GrCreateContext (int *contextId);
Delphi
function GrCreateContext( var contextId: Integer): Integer; stdcall;
Sample Code
C++
int contextId=0; retVal=GrCreateContext(&contextId);
Delphi
Var contextId : integer; begin retVal:=GrCreateContext(var contextId);
GrDestroyContext
Destroys a context. 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] contextId The identifier of the context to be destroyed.
Declaration
C++
int __stdcall GrDestroyContext (int contextId);
Delphi
function GrDestroyContext(contextId: Integer): Integer; stdcall;
16 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Delphi
retVal:=GrDestroyContext(contextId);
Matching functions
GrVerify GrIdentifyPrepare GrIdentify GrSetIdentifyParameters GrSetVerifyParameters GrGetIdentifyParameters GrGetVerifyParameters
GrVerify
Performs a verification by comparing the two templates supplied. Prerequisites The Fingerprint SDK library must have been previously initialized. Return On success, GR_MATCH is returned if the matching score is higher than the verification threshold, otherwise GR_NOT_MATCH is returned. On failure, the appropriate error code is returned.
Parameters
[in] queryTemplate Query template to be verified.
[out] verifyScore
[in] context
See also
Return codes
Declaration
C++
int __stdcall GrVerify(char *queryTemplate, char *referenceTemplate, int *verifyScore, int context);
Delphi
function GrVerify(queryTemplate: PChar; referenceTemplate: PChar; var verifyScore: Integer; 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; int result; // Checking if the template is valid. if(!TemplateIsValid()) return ERR_INVALID_TEMPLATE; // Getting the template with the supplied ID from the database. tptRef = _DB->getTemplate(id); // Checking if the ID was found. if ((tptRef->_tpt == NULL) || (tptRef->_size == 0)){ return ERR_INVALID_ID; } // Comparing the templates. result = GrVerify((char*)_tpt->_tpt, (char*)tptRef->_tpt, score, GR_DEFAULT_CONTEXT);
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 Verify := ERR_INVALID_TEMPLATE; exit; end;
17 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
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
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 TTemplate = class public // Template tpt: // Template size: // Template id:
temporary storage of template data. PSafeArray; size Integer; ID (if retrieved from DB) 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;
GrIdentify
Performs an identification by comparing the supplied reference template against the previously prepared query template. The Fingerprint SDK library must have been previously initialized. Prerequisites The identification must be previously prepared by calling the GrIdentifyPrepare function. The GrVerify function must not be called beween the call to GrIdentifyPrepare function and a call to GrIdentify function.
18 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
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.
Parameters
[in] templateReference Reference template for identification.
[out] identifyScore
[in] context
See also
Return codes
Declaration
C++
GrIdentify (char *templateReference, int *identifyScore, int context);
Delphi
function GrIdentify(templateReference: PChar; var identifyScore: Integer; 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 TTemplate = class public // Template tpt: // Template size: // Template id:
temporary storage of template data. PSafeArray; size Integer; ID (if retrieved from DB) 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;
GrSetIdentifyParameters
Sets the identification parameters in the supplied context. Prerequisites The Fingerprint SDK library must have been previously initialized. On success, GR_OK is returned. Return If any supplied parameter is invalid or out of range, its default value will be used and GR_DEFAULT_USED is returned. On failure, the appropriate error code is returned.
Parameters
[in] identifyThreshold The identification score threshold.
19 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
[in] context
See also
Matching constants Context constants
Declaration
C++
int __stdcall GrSetIdentifyParameters (int identifyThreshold, int identifyRotationTolerance, int context);
Delphi
function GrSetIdentifyParameters(identifyThreshold: Integer; identifyRotationTolerance: Integer; context: Integer): Integer; stdcall;
Sample Code
C++
ret = GrSetIdentifyParameters(thresholdId, rotationMaxId, GR_DEFAULT_CONTEXT); // error? if (ret == GR_DEFAULT_USED) { MessageBox::Show("Invalid identify parameters values. Default values will be used."); }
Delphi
ret := GrSetIdentifyParameters(thresholdId, rotationMaxId, GR_DEFAULT_CONTEXT); // error? if ret = GR_DEFAULT_USED then begin showmessage('Invalid identify parameters values. Default values will be used.'); end;
GrSetVerifyParameters
Sets the verification parameters in the supplied context. Prerequisites The Fingerprint SDK library must have been previously initialized. On success, GR_OK is returned. Return If any supplied parameter is invalid or out of range, its default value will be used and GR_DEFAULT_USED is returned. On failure, the appropriate error code is returned. Parameters
[in] verifyThreshold
[in] context
Delphi
function GrSetVerifyParameters(VerifyThreshold: Integer; VerifyRotationTolerance: Integer; context: Integer): Integer; stdcall;
Delphi
// set the new verification parameters ret := GrSetVerifyParameters(thresholdVr, rotationMaxVr, GR_DEFAULT_CONTEXT); // error? if ret = GR_DEFAULT_USED then begin showmessage('Invalid verify parameters values. Default values will be used.'); end;
GrGetIdentifyParameters
Retrieves the identification parameters for the supplied context. 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
20 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
[out] identifyThreshold
[out] identifyRotationTolerance The current rotation tolerance for the identification process.
[in] context
Delphi
function GrGetIdentifyParameters(var identifyThreshold: Integer; var identifyRotationTolerance: Integer; context: Integer): Integer; stdcall;
Delphi
Var thresholdId : Integer; rotationMaxId: Integer; begin GrGetIdentifyParameters(thresholdId, rotationMaxId, GR_DEFAULT_CONTEXT); end
GrGetVerifyParameters
Retrieves the verification parameters for the supplied context. Prerequisites The Fingerprint SDK library must have been previously initialized. On success, GR_OK is returned. On failure, the appropriate error code is returned.
Return
Parameters
[out] verifyThreshold The current verification score threshold.
[out] verifyRotationTolerance The current rotation tolerance for the verification process.
[in] context
See also
Matching constants Context constants
Declaration
C++
int __stdcall GrGetVerifyParameters (int &verifyThreshold, int &verifyRotationTolerance, int context);
Delphi
function GrGetVerifyParameters(var verifyThreshold: Integer; var verifyRotationTolerance: Integer; context: Integer): Integer; stdcall;
Sample Code
C++
int thresholdVr, rotationMaxVr; GrGetVerifyParameters(&thresholdVr, &rotationMaxVr, GR_DEFAULT_CONTEXT);
Delphi
var thresholdVr : Integer; rotationMaxVr: Integer; begin GrGetVerifyParameters(thresholdVr, rotationMaxVr, GR_DEFAULT_CONTEXT); End
Extraction functions
GrCovertTemplate GrExtractEx GrExtract
GrCovertTemplate
The Fingerprint SDK library must have been previously initialized. The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes. Prerequisites The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes.
21 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Return
Parameters
[in] oldTpt The template to convert.
[out] newTpt
[in,out] newTptSize
[in]The maximum size in bytes of the byte array supplied. [out] The size in bytes of the converted template.
[in] context
[in] format
Declaration
C++
int __stdcall GrConvertTemplate(char* oldTpt, char* newTpt, int* newTptSize, int context, int format);
Delphi
function GrConvertTemplate(oldTpt: Pchar; newTpt: PChar; var newTptSize: Integer; context: Integer; format: Integer): Integer; stdcall;
Sample Code
C++
int result; // set current buffer size for the extract template _newTpt->_size = GR_MAX_SIZE_TEMPLATE; result = GrConvertTemplate((char*)_oldTpt, (char*)_newTpt->_tpt, &_newTpt->_size, GR_DEFAULT_CONTEXT, GR_FORMAT_DEFAULT); // if error, set template size to 0 if (result < 0){ // Result < 0 => conversion problem _newTpt->_size = 0; }
Delphi
Var ret: Integer; Begin // set current buffer size for the extract template newTemplate.size := GR_MAX_SIZE_TEMPLATE; ret := GrConvertTemplate(oldTemplate.tpt, newTemplate.tpt, newTemplate.size, GR_DEFAULT_CONTEXT, GR_FORMAT_DEFAULT); // if error, set template size to 0 // Result < 0 => conversion problem if (ret < 0 ) then newTemplate.size := 0; End;
GrExtract
Extracts a fingerprint template from the supplied fingerprint raw image. The Fingerprint SDK library must have been previously initialized. Prerequisites The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes.
Return On success, the template quality code is returned. On failure, the appropriate error code is returned.
Parameters
[in] rawImage A raw grayscale fingerprint image.
[in] width
[in] height
[in] res
[out] tpt
[in,out] tptSize
[in] The maximum size in bytes of the byte array supplied. [out] The size in bytes of the extracted template.
[in] context
Declaration
C++
int __stdcall GrExtract(unsigned char *rawimage, int width, int height, int res, char *tpt, int *tptSize, int context);
Delphi
function GrExtract(rawimage: Pchar; width: Integer; height: Integer; res: Integer; tpt: PChar; var tptSize: Integer; context: Integer): Integer; stdcall;
22 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
int result; // set current buffer size for the extract template _tpt->_size = GR_MAX_SIZE_TEMPLATE; result = GrExtract(_raw.img, _raw.width, _raw.height, _raw.Res, (char*)_tpt->_tpt, &_tpt->_size, GR_DEFAULT_CONTEXT); // if error, set template size to 0 if (result < 0){ // Result < 0 => extraction problem _tpt->_size = 0; }
Delphi
Var ret: Integer; Begin // set current buffer size for the extract template template.size := GR_MAX_SIZE_TEMPLATE; ret := GrExtract(raw.img, raw.width, raw.height, raw.res, template.tpt, template.size, GR_DEFAULT_CONTEXT); // if error, set template size to 0 // Result < 0 => extraction problem if (ret < 0 ) then template.size := 0; End;
GrExtractEx
Extracts a fingerprint template, in a specified format, from the supplied fingerprint raw image. Prerequisites The Fingerprint SDK library must have been previously initialized. The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes.
Return On success, the template quality code is returned. On failure, the appropriate error code is returned.
Parameters
[in] rawImage A raw grayscale fingerprint image.
[in] width
[in] height
[in] res
[out] tpt
[in,out] tptSize
[in] The maximum size in bytes of the byte array supplied. [out] The size in bytes of the extracted template.
[in] context
[in] tptFormat
Declaration
C++
int __stdcall GrExtractEx(unsigned char *rawimage, int width, int height, int res, char *tpt, int *tptSize, int context, int tptFormat);
Delphi
function GrExtractEx(rawimage: Pchar; width: Integer; height: Integer; res: Integer; tpt: PChar; var tptSize: Integer; context: Integer; tptFormat: Integer): Integer; stdcall;
Sample Code
C++
int result; // set current buffer size for the extract template _tpt->_size = GR_MAX_SIZE_TEMPLATE; result = GrExtractEx(_raw.img, _raw.width, _raw.height, _raw.Res, (char*)_tpt->_tpt, &_tpt->_size, GR_DEFAULT_CONTEXT, GR_FORMAT_DEFAULT); // if error, set template size to 0 if (result < 0){ // Result < 0 => extraction problem _tpt->_size = 0; }
Delphi
Var ret: Integer; Begin // set current buffer size for the extract template template.size := GR_MAX_SIZE_TEMPLATE; ret := GrExtractEx(raw.img, raw.width, raw.height, raw.res, template.tpt, template.size, GR_DEFAULT_CONTEXT, GR_FORMAT_DEFAULT); // if error, set template size to 0 // Result < 0 => extraction problem if (ret < 0 ) then template.size := 0; End;
Capture functions
GrCapInitialize GrCapFinalize GrCapStartCapture
23 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
GrCapInitialize
Initializes the fingerprint capture module. Prerequisites A valid license must exist on system. Return On success, GR_OK is returned. On failure, the appropriate error code is returned.
Parameters
[in] StatusEventHandler Callback function responsible for handling the status events.
See also
Callback handlers
Declaration
C++
int __stdcall GrCapInitialize(StatusCallBack* StatusEventHandler);
Delphi
Function GrCapInitialize(StatusEventHandler: GRCAP_STATUS_EVENT_PROC): Integer; stdcall;
Sample Code
C++
retVal= GrCapInitialize (StatusEventHandler);
Delphi
retVal:= GrCapInitialize (@StatusEventHandler);
GrCapFinalize
Stops the capture module, freeing any resource used. Prerequisites The capture module must have been previously initialized. Return On success, GR_OK is returned. On failure, the appropriate error code is returned.
Declaration
C++
int __stdcall GrCapFinalize();
Delphi
function GrCapFinalize(): Integer; stdcall;
Sample Code
C++
retVal= GrCapFinalize();
Delphi
retVal:= GrCapFinalize();
GrCapStartCapture
Starts capturing fingerprint images from the supplied fingerprint reader. Prerequisites The capture module must have been previously initialized. The supplied fingerprint reader must be connected, working and recognized as plugged by the capture module.
Return
Parameters
[in] idSensor The ID of the fingerprint reader to start capturing images from.
[in] FingerEventHandler Callback function responsible for handling the finger events.
[in] ImageEventHandler Callback function responsible for handling the image event.
See also
Callback handlers
Declaration
C++
int __stdcall GrCapStartCapture(char* idSensor, FingerCallBack* FingerEventHandler, ImageCallBack* ImageEventHandler);
24 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Sample Code
C++
if (event == GR_PLUG) { // Start capturing from the plugged reader. GrCapStartCapture(idSensor, myFingerCallBack, myImageCallBack); }
Delphi
if (event = GR_PLUG) then // Start capturing from the plugged reader. GrCapStartCapture(idSensor, @FingerCallback, @ImageCallback)
GrCapStopCapture
Stops capturing fingerprint images from the supplied fingerprint reader. Prerequisites The capture module must have been previously initialized. Image capture must have been previously started on the supplied fingerprint reader.
Return
Parameters
[in] idSensor The ID of the fingerprint reader to stop capturing images from.
Declaration
C++
int GrCapStopCapture (string idSensor)
Delphi
Function GrCapStopCapture(const idSensor: WideString): integer;
Sample Code
C++
if (event == GR_UNPLUG) { // Stop capturing from the unplugged reader GrCapStopCapture(idSensor); }
Delphi
if (event = GR_UNPLUG) then // Stop capturing from the unplugged reader. GrCapStopCapture(idSensor);
GrCapSaveRawImageToFile
Saves a raw grayscale fingerprint image as a picture file. Prerequisites A valid license must exist on system. Return On success, GR_OK is returned. On failure, the appropriate error code is returned.
Parameters
[in] rawImage A raw grayscale fingerprint image.
[in] width
[in] height
[in] filename
See also
Image constants Fingerprint Image Format
Declaration
C++
int __stdcall GrCapSaveRawImageToFile(unsigned char* rawImage, unsigned int width, unsigned int height, char* fileName, GRCAP_IMAGE_FORMAT imageFormat);
Delphi
function GrCapSaveRawImageToFile(rawImage: PChar; width, height: Integer; filename: String; imageFormat: GRCAP_IMAGE_FORMAT): Integer; stdcall;
Sample Code
C++
char *temp = (char*)Marshal::StringToHGlobalAnsi(sfdImage-> FileName).ToPointer(); if (GrCapSaveRawImageToFile(_raw.img, _raw.width, _raw.height, temp, GRCAP_IMAGE_FORMAT_BMP) != GR_OK) { WriteLog("Failed to save the file."); } Marshal::FreeHGlobal((int)temp);
25 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
if GrCapSaveRawImageToFile(raw.img, raw.width, raw.Height, fname, GRCAP_IMAGE_FORMAT_BMP) <> GR_OK then WriteLog('Failed to save the file.');
GrCapLoadImageFromFile
Loads a grayscale fingerprint image from a picture file. The capture module must have been previously initialized. Prerequisites Picture file must be in one of the supported formats, as defined in the Image constants section. Image capture must have been previously started on the "File" sensor. On success, GR_OK is returned. On failure, the appropriate error code is returned.
Return
Parameters
[in] fileName The complete path and filename of the picture file to load.
[in] res
Remarks
On success, an image event is fired for the "File" sensor.
See also
Callback handlers
Declaration
C++
int __stdcall GrCapLoadImageFromFile(char* fileName, int res);
Delphi
function GrCapLoadImageFromFile(filename: String; res: Integer): Integer; stdcall;
Sample Code
C++
// Getting the resolution. int resolution = Convert::ToInt32(InputBox::ShowModal("What is the image resolution?", "Resolution", "")); // Checking if the action was canceled, no value or an invalid value was entered. if (resolution != 0) GrCapLoadImageFromFile(FileName,resolution);
Delphi
// Getting image resolution. resolution := StrToInt(InputBox('What is the image resolution?', 'Resolution', '')); // Checking if the action was canceled, no value or an invalid value was entered. if (resolution <> 0) then begin GrCapLoadImageFromFile(FileName, resolution); end;
GrCapRawImageToHandle
Returns a displayable Windows bitmap handle (HBITMAP) to the supplied raw grayscale fingerprint image. Prerequisites A valid license must exist on system. Return On success, GR_OK is returned. On failure, the appropriate error code is returned.
Parameters
[in] rawImage A raw grayscale fingerprint image.
[in] width
[in] height
[in] hdc
The device context handle (HDC) in which the bitmap will be created.
[out] handle
See also
Fingerprint Image Format
Declaration
C++
int __stdcall GrCapRawImageToHandle(unsigned char* rawImage, unsigned int width, unsigned int height, HDC hdc, HBITMAP &handle);
Delphi
function GrCapRawImageToHandle(rawImage: PChar; width, height: Integer; hdc: HDC; var handle: HBITMAP): Integer; stdcall;
Sample Code
C++
// handle to finger image
26 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Delphi
// get screen HDC hdc := GetDC(formMain.image.Canvas.Handle); // get raw image GrCapRawImageToHandle(raw.img, raw.width, raw.height, hdc, handle); // draw image on picture box if handle <> 0 then begin formMain.image.Picture.Bitmap.Handle := handle; formMain.image.Repaint(); end; // release screen HDC ReleaseDC(formMain.image.Canvas.Handle, hdc);
GrBiometricDisplay
Returns a displayable Windows bitmap handle (HBITMAP) to the supplied raw grayscale fingerprint image with its minutiae, segments and minutiae direction drawn. Prerequisites The Fingerprint SDK library must have been previously initialized. On success, GR_OK is returned. On failure, the appropriate error code is returned.
Return
Parameters
[in] tpt Template corresponding to the raw grayscale fingerprint image supplied.
[in] rawImage
[in] width
[in] height
[in] res
[in] hdc
The device context handle (HDC) in which the bitmap will be created.
[out] handle
[in] matchContext
To have only the minutiae, segments and minutiae direction of the supplied fingerprint drawn, this parameter must be GR_NO_CONTEXT. To have also the macthing minutiae, segments and minutiae direction drawn, this parameter must be the context identifier corresponding to the matching (identification or verification).
See also
Fingerprint Image Format
Declaration
C++
int __stdcall GrBiometricDisplay(char* tptQuery, unsigned char* rawImage, int width, int height, int res, HDC hdc, HBITMAP &handle, int matchContext);
Delphi
function GrBiometricDisplay (templateReference: Pchar, rawImage: PChar; width, height: Integer; hdc: HDC; var handle: HBITMAP, context: Integer): Integer; stdcall;
Sample Code
C++
// the template class __gc class TTemplate { public: // Template data. System::Byte _tpt[]; // Template size int _size; TTemplate(void); ~TTemplate(void); }; // Raw image data type. __gc struct TRawImage { // Image data. System::Object *img; // Image width. unsigned int width; // Image height. unsigned int height; // Image resolution. int Res; }; // handle to finger image HBITMAP handle; // screen HDC
27 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
// get image with biometric info GrBiometricDisplay((char *)_tpt->_tpt, _raw.img, _raw.width, _raw.height, _raw.Res, hdc, handle, context); // draw image on picture box if (handle != NULL) { Image *curImage = System::Drawing::Image::FromHbitmap(handle); _pbPic->Image = curImage; } // release HDC ReleaseDC(HWND(NULL), hdc);
Delphi
type // Raw image data type. TRawImage = record // Image data. img: OleVariant; // Image width. width: Integer; // Image height. Height: Integer; // Image resolution. Res: Integer; end; // Define a type to TTemplate = class public // Template tpt: // Template size: // Template id: begin // get screen HDC hdc := GetDC(formMain.image.Canvas.Handle); // get image with biometric info GrBiometricDisplay(template.tpt,raw.img, raw.width, raw.height,raw.Res, hdc,handle, context) // draw image on picture box if handle <> 0 then begin formMain.image.Picture.Bitmap.Handle := handle; formMain.image.Repaint(); end; // release screen HDC ReleaseDC(formMain.image.Canvas.Handle, hdc); End temporary storage of template data. PSafeArray; size Integer; ID (if retrieved from DB) Integer;
GrSetBiometricDisplayColors
Sets the colors used to draw the minutiae, matching minutiae, segments, matching segments, minutiae directions and matching minutiae directions in the bitmap returned by the GrBiometricDisplay function. Prerequisites The Fingerprint SDK library must have been previously initialized. On success, GR_OK is returned. On failure, the appropriate error code is returned.
Return
Parameters
[in] minutiaeColor Minutiae color in BGR 24-bits format.
[in] minutiaeMatchedColor
[in] segmentsColor
[in] segmentsMatchedColor
[in] directionsColor
Remarks
Passing GR_IMAGE_NO_COLOR as any color causes the corresponding feature (minutia, matching minutia, segment, matching segment, minutia direction or matching minutia direction) not being drawn. Passing all colors as GR_IMAGE_NO_COLOR causes the default colors to be used: red for minutiae, green for segments, blue for minutiae direction and magenta for matching minutiae, segments and minutiae direction.
See also
Color Coding Format
Declaration
C++
int __stdcall GrSetBiometricDisplayColors(int minutiaeColors, int minutiaeMatchedColors, int segmentColors, int segmentMatchedColors, int directionColors, int directionMatchedColors);
Delphi
function GrSetBiometricDisplayColors (minutiaeColors, minutiaeMatchedColors, segmentColors, segmentMatchedColors, directionColors, directionMatchedColors: Integer): Integer; stdcall;
Sample Code
C++
// set minutiae colors to red int minutiaeColor=Color::Red; int minutiaeMatchColor=Color::Red; // don't display any other biometric info int segmentsColor = GR_IMAGE_NO_COLOR; int segmentsMatchColor = GR_IMAGE_NO_COLOR; int directionsColor = GR_IMAGE_NO_COLOR; int directionsMatchColor = GR_IMAGE_NO_COLOR; GrSetBiometricDisplayColors(minutiaeColor, minutiaeMatchColor, segmentsColor, segmentsMatchColor, directionsColor, directionsMatchColor);
Delphi
28 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Other functions
GrGetGrFingerVersion GrDecodeBase64 GrEncodeBase64 GrInstallLicense GrIsBase64Encoding GrSetLicenseFolder
GrGetGrFingerVersion
Returns the Fingerprint SDK version and edition. Prerequisites A valid license must exist on system. Return On success, the Fingerprint SDK type code is returned. On failure, the appropriate error code is returned.
Parameters
[out] majorVersion The Fingerprint SDK major version.
See also
Licensing constants
Declaration
C++
Int __stdcall GrGetGrFingerVersion(unsigned char* majorVersion, unsigned char* minorVersion);
Delphi
Function GrGetGrFingerVersion(majorVersion, minorVersion: PChar): Integer; stdcall;
Sample Code
C++
unsigned char majorVersion=0, minorVersion=0; String *vStr = new String(""); int result = GrGetGrFingerVersion(&majorVersion, &minorVersion); if (result == GRFINGER_FULL) vStr = new String("IDENTIFICATION"); else if(result == GRFINGER_LIGHT) vStr = new String("VERIFICATION"); else if(result == GRFINGER_FREE) vStr = new String("FREE");
MessageBox::Show(System::String::Concat(System::String::Concat("The Fingerprint SDK DLL version is ", Convert::ToString(majorVersion) , "." , Convert::ToString(minorVersion)), System::String::C
Delphi
var majorVersion: byte; minorVersion: byte; result: integer; vStr: String; begin result := GrGetGrFingerVersion(majorVersion, minorVersion); If result = GRFINGER_FULL Then vStr := 'IDENTIFICATION'; If result = GRFINGER_LIGHT Then vStr := 'VERIFICATION'; If result = GRFINGER_FREE Then vStr := 'FREE'; Application.MessageBox(PChar('The Fingerprint SDK DLL version is ' + intToStr(majorVersion) + '.' + intToStr(minorVersion) + '.' + #13#10 + 'The license type is ''' + vStr + '''.'), PCh End;
GrDecodeBase64
Decodes a Base64 template. Prerequisites The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes. Return On success, GR_OK is returned. On failure, the appropriate error code is returned.
Parameters
[in] encodedBuffer The template to be decoded.
[in] encodedSize
29 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
[out] decodedBuffer
[in,out] decodedSize
[in] The maximum size in bytes of the byte array supplied. [out] The size in bytes of the decoded template.
Declaration
C++
int __stdcall GrDecodeBase64(const char* encodedBuffer, int encodedSize, char * decodedBuffer, int * decodedSize);
Delphi
function GrDecodeBase64(encodedBuffer: Pchar; encodedSize:Integer; decodedBuffer: Pchar; var decodedSize: Integer): Integer; stdcall;
GrEncodeBase64
Encodes a template in Base64 format. Prerequisites The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes. On success, GR_OK is returned. On failure, the appropriate error code is returned.
Return
Parameters
[in] buffer The template to be encoded.
[in] bufferSize
[out] encodedBuffer
[in,out] encodedSize
[in] The maximum size in bytes of the byte array supplied. [out] The size in bytes of the encoded template.
Declaration
C++
int __stdcall GrEncodeBase64(const char* buffer, int bufferSize, char * encodedBuffer, int * encodedSize);
Delphi
function GrEncodeBase64(buffer: Pchar; bufferSize:Integer; encodedBuffer: Pchar; var encodedSize: Integer): Integer; stdcall;
GrInstallLicense
Installs a license based on the product key. Prerequisites This method must be called before the initialization of the library. Return On success, GR_OK is returned. On failure, the appropriate error code is returned.
Parameters
[in] productKey the Product Key. See also Return codes
Declaration
C++
int __stdcall GrInstallLicense(char *productKey);
Delphi
function GrInstallLicense(productKey: String): Integer; stdcall;
Sample Code
C++
int result; result = GrInstallLicense("XXXX-XXXX-XXXX-XXXX");
Delphi
ret := GrInstallLicense('XXXX-XXXX-XXXX-XXXX');
GrIsBased64Encoding
Verifies if a buffer is in Base64 format. Return True if the supplied buffer is in Base64 format. Otherwise, False is returned.
Parameters
30 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
[in] buffer
Declaration
C++
bool __stdcall GrIsBase64Encoding(const char* buffer, int bufferSize);
Delphi
function GrIsBase64Encoding(buffer: Pchar; bufferSize:Integer): Boolean; stdcall;
GrSetLicenseFolder
Sets the directory in which Fingerprint SDK must search for its runtime license file. This is an optional function. Please, read "Licensing Fingerprint SDK Based Deployed Applications" section to know how Fingerprint SDK searchs for the license file. Prerequisites This method must be called before the initialization of the library. On success, GR_OK is returned. On failure, the appropriate error code is returned.
Return
Parameters
[in] licenseFolder the directory where the Fingerprint SDK runtime license file is located. See also Return codes
Declaration
C++
int __stdcall GrSetLicenseFolder(char *licenseFolder);
Delphi
function GrSetLicenseFolder(licenseFolder: String): Integer; stdcall;
Sample Code
C++
int result; result = GrSetLicenseFolder("C:\\FingerprintSDKLicenseFolder");
Delphi
ret := GrSetLicenseFolder('C:\\FingerprintSDKLicenseFolder');
Callback handlers
GRCAP_STATUS_EVENT_PROC GRCAP_FINGER_EVENT_PROC GRCAP_IMAGE_EVENT_PROC
GRCAP_STATUS_EVENT_PROC
Callback function responsible for handling the status events. This callback function is called whenever a fingerprint reader is plugged in or unplugged from the computer. Prerequisites The capture module must have been previously initialized. At least one fingerprint reader must be connected and working.
Parameters
[in] idSensor The ID of the fingerprint reader that raised the event.
The event raised by the fingerprint reader: [in] event GR_PLUG: the fingerprint reader was plugged into the computer; GR_UNPLUG: the fingerprint reader was unplugged from the computer;
Declaration
C++
typedef void CALLBACK GRCAP_STATUS_EVENT_PROC(char* idSensor, GRCAP_STATUS_EVENTS event);
Delphi
GRCAP_STATUS_EVENT_PROC = Procedure(idSensor: Pchar; event: GRCAP_STATUS_EVENTS); stdcall;
Sample Code
C++
void StatusEventHandler(char* idSensor, GRCAP_STATUS_EVENTS event) { // Signaling that a Status Event occurred. WriteEvent(idSensor, event); if (event == GR_PLUG) { // Start capturing from the plugged reader. GrCapStartCapture(idSensor, myFingerCallBack, myImageCallBack); } else if (event == GR_UNPLUG) { // Stop capturing from the unplugged reader GrCapStopCapture(idSensor); } }
31 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
GRCAP_FINGER_EVENT_PROC
Callback function responsible for handling the finger events. This callback function is called whenever a finger is placed over or removed from a plugged fingerprint reader. Prerequisites The capture module must have been previously initialized. At least one fingerprint reader started capturing fingerprint images.
Parameters
[in] idSensor The ID of the fingerprint reader that raised the event.
The event raised by the fingerprint reader: [in] event GR_FINGER_DOWN: a finger was placed over the fingerprint reader; GR_FINGER_UP: a finger was removed from the fingerprint reader;
Declaration
C++
typedef void CALLBACK GRCAP_FINGER_EVENT_PROC(char* idSensor, GRCAP_FINGER_EVENTS event);
Delphi
GRCAP_FINGER_EVENT_PROC = Procedure(idSensor: Pchar; event: GRCAP_FINGER_EVENTS); stdcall;
Sample Code
C++
void FingerEventHandler(char* idSensor, GRCAP_FINGER_EVENTS event) { // Just signals that a finger event occurred. WriteEvent(idSensor, event); }
Delphi
// This Function is called every time a finger is placed or removed //from reader. Procedure FingerCallback(idSensor: Pchar; event: GRCAP_FINGER_EVENTS); stdcall; Begin // Just signals that a finger event occurred. WriteEvent(idSensor, event); End;
GRCAP_IMAGE_EVENT_PROC
Callback function responsible for handling the image event. This callback function is called whenever a fingerprint image is acquired from a plugged fingerprint reader. Prerequisites The capture module must have been previously initialized. At least one fingerprint reader started capturing fingerprint images.
Parameters
[in] idSensor The ID of the fingerprint reader that raised the event.
[in] width
[in] height
[in] res
See also
Fingerprint Image Format
Declaration
C++
typedef void CALLBACK GRCAP_IMAGE_EVENT_PROC(char* idSensor, unsigned int width, unsigned int height, unsigned char* rawImage, int res);
Delphi
GRCAP_IMAGE_EVENT_PROC = Procedure(idSensor: PChar; width: Integer; height: Integer; rawImage: PChar; res: Integer); stdcall;
Sample Code
C++
void ImageEventHandler(char* idSensor, unsigned int width, unsigned int height, unsigned char* rawImage, int res) { // Copying acquired image memcpy(_raw.img, rawImage, width*height); _raw.height = height; _raw.width = width; _raw.Res = res; // Signaling that an Image Event occurred. WriteEvent(idSensor, GR_IMAGE);
32 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Delphi
Procedure ImageCallback(idSensor: PChar; imageWidth: Integer; imageHeight: Integer; rawImage: PChar; res: Integer); stdcall; Begin // Copying acquired image raw.height := imageHeight; raw.width := imageWidth; raw.res := res; Move(rawImage^, raw.img^, imageWidth*imageHeight); // Signaling that an Image Event occurred. WriteEvent(idSensor, GR_IMAGE); // Display the fingerprint image PrintBiometricDisplay(false, GR_DEFAULT_CONTEXT); end;
All return codes and constants presented in the Return Codes and Constants section are contained in the GRConstants Type. All methods and events are contained in the GrFingerXCtrl Class. Initialization and finalization methods Matching methods Extraction methods Capture methods Enrollment Methods Biometric display methods Other methods Events
Enrollment Methods
Enroll StartEnroll
Enroll
Enrolls a fingerprint image. Prerequisites The Fingerprint SDK library must have been previously initialized. The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes.
Return
On success, the enroll quality code is returned. On failure, the appropriate error code is returned.
Parameters
[in] rawImage A raw grayscale fingerprint image.
[in] width
[in] height
[in] res
[out] tpt
[in,out] tptSize
[in] The maximum size in bytes of the byte array supplied. [out] The size in bytes of the extracted template.
[out] quality
[in] tptFormat
[in] context
Declaration
C++ .NET
int Enroll (ref object RawImage, int width, int height, int res, ref byte[] tpt, ref int tptSize, int tptFormat, out int quality, int context);
C#
int Enroll (ref object RawImage, int width, int height, int res, ref Array tpt, ref int tptSize, int tptFormat, out int quality, int context);
VB6
Function Enroll (ByRef RawImage As Variant, ByVal width As Long, ByVal height As Long, ByVal res As Long, ByRef tpt() As Byte, ByRef tptSize As Long, ByVal tptFormat As Long, ByRef quality As L
VB .NET
33 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Function Enroll (ByRef RawImage As Object, ByVal width As Integer, ByVal height As Integer, ByVal res As Integer, ByRef tpt As Array, ByRef tptSize As Integer, ByVal tptFormat As Long, ByRef qu
Delphi
function Enroll(var rawimage: OleVariant; width: integer; height: integer; res: integer; var tpt: PSafeArray; var tptSize: integer; tptFormat: integer; var quality: integer; context: integer):
StartEnroll
Starts the enrollment process. The fingerprint templates are consolidated to create a trustable one. 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] context Context in which the enrollment will be started.
Declaration
C++ .NET
int StartEnroll (int context);
C#
int StartEnroll (int context);
VB6
Function StartEnroll (ByVal context As Long) As Long
VB .NET
Function StartEnroll (ByVal context As Integer) As Integer
Delphi
function StartEnroll(context: integer): integer;
Initialize
Initializes the Fingerprint SDK library, creates the default context and checks for a valid license on system. Prerequisites A valid license must exist on system. Return On success, GR_OK is returned. On failure, the appropriate error code is returned.
Declaration
C++ .NET
int Initialize();
C#
int Initialize();
VB6
Function Initialize () As Long
VB .NET
Function Initialize () As integer
Delphi
function Initialize: integer;
Sample Code
C++ .NET
// Initialize the GrFingerX Library int err = _grfingerx->Initialize();
C#
GRConstants result; //Initialize the library result = (GRConstants)_grfingerx.Initialize();
VB6
' Initializing the library Dim err As Long err = GrFingerXCtrl1.Initialize
VB .NET
' Initializing the library Dim err As integer err = _GrFingerX.Initialize()
Delphi
var err: integer; begin // Initializing the library. err := GrFingerXCtrl1.Initialize(); end;
34 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Finalize
Finalizes the Fingerprint SDK library, freeing any resource used. 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.
Declaration
C++ .NET
int Finalize();
C#
int Finalize();
VB6
Function Finalize() As Long
VB .NET
Function Finalize() As integer
Delphi
function Finalize: integer;
Sample Code
C++ .NET
_grfingerx->Finalize();
C#
_grfingerx.Finalize();
VB6
GrFingerXCtrl1.Finalize
VB .NET
_GrFingerX.Finalize()
Delphi
GrFingerXCtrl1.Finalize();
CreateContext
Creates a context in which extraction, verification and identification may be performed. 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
[out] contextId The identifier of the newly created context.
Declaration
C++ .NET
int CreateContext(ref int contextId);
C#
int CreateContext(ref int contextId);
VB6
Function CreateContext(ByRef contextId As Long) As Long
VB .NET
Function CreateContext(ByRef contextId As integer) As integer
Delphi
function CreateContext(var contextId: integer): integer;
Sample Code
C++ .NET
int myContextId=0; int retVal=_grfingerx->CreateContext(myContextId);
C#
int myContextId=0; int retVal=_grfingerx.CreateContext(myContextId);
VB6
Dim myContextId As Long retVal=GrFingerXCtrl1.CreateContext(myContextId)
VB .NET
Dim myContextId As integer retVal=_GrFingerX.CreateContext(myContextId)
Delphi
35 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
DestroyContext
Destroys a context. Prerequisites The Fingerprint SDK library must have been previously initialized. On success, GR_OK is returned. On failure, the appropriate error code is returned.
Return
Parameters
[in] contextId The identifier of the context to be destroyed.
Declaration
C++ .NET
int DestroyContext(int contextId);
C#
int DestroyContext(int contextId);
VB6
Function DestroyContext (ByVal contextId As Long) As Long
VB .NET
Function DestroyContext(ByVal contextId As integer) As integer
Delphi
Function DestroyContext(contextId: integer): integer;
Sample Code
C++ .NET
int retVal=_grfingerx->DestroyContext(myContextId);
C#
int retVal=_grfingerx.DestroyContext(myContextId);
VB6
retVal=GrFingerXCtrl1.DestroyContext(myContextId)
VB .NET
retVal=_GrFingerX.DestroyContext(myContextId)
Delphi
retVal:=GrFingerXCtrl1.DestroyContext(myContextId);
Matching methods
Verify IdentifyPrepare Identify SetIdentifyParameters SetVerifyParameters GetIdentifyParameters GetVerifyParameters
Verify
Performs a verification by comparing the two templates supplied. Prerequisites The Fingerprint SDK library must have been previously initialized. Return On success, GR_MATCH is returned if the matching score is higher than the verification threshold, otherwise GR_NOT_MATCH is returned. On failure, the appropriate error code is returned.
Parameters
[in] queryTemplate Query template to be verified.
[out] verifyScore
[in] context
See also
Return codes
Declaration
C++ .NET
int Verify(ref byte[] queryTemplate, ref byte[] referenceTemplate, ref int verifyScore, int context)
C#
int Verify(ref Array queryTemplate, ref Array referenceTemplate, ref int verifyScore, int context)
36 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Function Verify (ByRef queryTemplate() As Byte, ByRef referenceTemplate() As Byte, ByRef verifyScore As Long, ByVal context As Long) As Long
VB .NET
Function Verify (ByRef queryTemplate As Array, ByRef referenceTemplate As Array, ByRef verifyScore As integer, ByVal context As integer) As integer
Delphi
function Verify(var queryTemplate: PSafeArray; var referenceTemplate: PSafeArray; var verifyScore: integer; context: integer): integer;
Sample Code
C++ .NET
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; } } TTemplate *tptRef; int result; // Checking if the template is valid. if(!TemplateIsValid()) return ERR_INVALID_TEMPLATE; // Getting the template with the supplied ID from the database. tptRef = _DB->getTemplate(id); // Checking if the ID was found. if ((tptRef->_tpt == NULL) || (tptRef->_size == 0)){ return ERR_INVALID_ID; } // Comparing the templates. result = _grfingerx->Verify(&_tpt->_tpt, &tptRef->_tpt, score, GR_DEFAULT_CONTEXT); 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; } } TTemplate tptRef; // Checking if the template is valid. if(!TemplateIsValid()) return ERR_INVALID_TEMPLATE; // Getting the template with the supplied ID from the database. tptRef = _DB.getTemplate(id); // Checking if the ID was found. if ((tptRef._tpt==null) || (tptRef._size == 0)) { return ERR_INVALID_ID; } // Comparing the templates. return (int) _grfingerx.Verify(ref _tpt._tpt,ref tptRef._tpt, ref score, (int)GRConstants.GR_DEFAULT_CONTEXT);
VB6
' Template data Type Public Type TTemplate ' Template data tpt() As Byte ' Template size Size As Long End Type Dim tpt() As Byte ' Checking if the template is valid. If Not TemplateIsValid() Then Verify = ERR_INVALID_TEMPLATE Exit Function End If ' Getting the template with the supplied ID from the database. tpt = DB.getTemplate(id) ' Checking if the ID was found. If UBound(tpt) = 0 Then Verify = ERR_INVALID_ID Exit Function End If ' Comparing the templates. Verify = GrFingerXCtrl1.Verify(template.tpt, tpt, score, GR_DEFAULT_CONTEXT)
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 tptref As Byte() ' Checking if the template is valid. If Not (TemplateIsValid()) Then Return ERR_INVALID_TEMPLATE ' Getting the template with the supplied ID from the database. tptref = DB.getTemplate(id) ' Checking if the ID was found. If tptref.Length = 0 Then Return ERR_INVALID_ID ' Comparing the templates. Return _GrFingerX.Verify(template.tpt, tptref, score, GRConstants.GR_DEFAULT_CONTEXT)
Delphi
type // Class TTemplate // Define a type to temporary storage of template TTemplate = class public // Template data. tpt: PSafeArray;
37 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
// 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 Verify := ERR_INVALID_TEMPLATE; exit; end; // Getting the template with the supplied ID from the database. tptRef := DB.getTemplate(id); if ((tptRef.tpt = nil) or (tptRef.size <= 0)) then begin Verify := ERR_INVALID_ID; exit; end; // Comparing the templates. Verify := GrFingerXCtrl1.Verify(template.tpt, tptRef.tpt, score, GR_DEFAULT_CONTEXT); end;
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
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];
38 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
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 If Not TemplateIsValid() Then Identify = ERR_INVALID_TEMPLATE Exit Function End If 'template.
' 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
39 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Identify
Performs an identification by comparing the supplied reference template against the previously prepared query template. The Fingerprint SDK library must have been previously initialized. Prerequisites 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.
Parameters
[in] templateReference Reference template for identification.
[out] identifyScore
[in] context
See also
Return codes
Declaration
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;
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.
40 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
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 If Not TemplateIsValid() Then Identify = ERR_INVALID_TEMPLATE Exit Function End If 'template.
' 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
SetIdentifyParameters
41 of 63 3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
On success, GR_OK is returned. Return If any supplied parameter is invalid or out of range, its default value will be used and GR_DEFAULT_USED is returned. On failure, the appropriate error code is returned.
Parameters
[in] identifyThreshold The identification score threshold.
[in] context
See also
Matching constants Context constants
Declaration
C++ .NET
int SetIdentifyParameters (int identifyThreshold, int identifyRotationTolerance, int context)
C#
int SetIdentifyParameters (int identifyThreshold, int identifyRotationTolerance, int context)
VB6
Function SetIdentifyParameters (ByVal identifyThreshold As Long, ByVal identifyRotationTolerance As Long, ByVal context As Long) As Long
VB .NET
Function SetIdentifyParameters (ByVal identifyThreshold As integer, ByVal identifyRotationTolerance As integer, ByVal context As integer) As integer
Delphi
function SetIdentifyParameters(identifyThreshold: integer; identifyRotationTolerance: integer; context: integer): integer;
Sample Code
C++ .NET
ret = axGrFingerXCtrl2->SetIdentifyParameters(thresholdId, rotationMaxId, GR_DEFAULT_CONTEXT); // error? if (ret == GR_DEFAULT_USED) { MessageBox::Show("Invalid identify parameters values. Default values will be used."); }
C#
ret = axGrFingerXCtrl1.SetIdentifyParameters(thresholdId, rotationMaxId, (int)GRConstants.GR_DEFAULT_CONTEXT); // error? if ((GRConstants)ret == GRConstants.GR_DEFAULT_USED) { MessageBox.Show("Invalid identify parameters values. Default values will be used."); }
VB6
ret = GrFingerXCtrl1.SetIdentifyParameters(thresholdId, rotationMaxId, GR_DEFAULT_CONTEXT) ' error? If ret = GR_DEFAULT_USED Then MsgBox ("Invalid identify parameters values. Default values will be used.") End If
VB .NET
ret = AxGrFingerXCtrl1.SetIdentifyParameters(thresholdId, rotationMaxId, GRConstants.GR_DEFAULT_CONTEXT) ' error? If ret = GRConstants.GR_DEFAULT_USED Then MsgBox("Invalid identify parameters values. Default values will be used.") End If
Delphi
ret := GrFingerXCtrl1.SetIdentifyParameters(thresholdId, rotationMaxId, GR_DEFAULT_CONTEXT); // error? if ret = GR_DEFAULT_USED then begin showmessage('Invalid identify parameters values. Default values will be used.'); end;
SetVerifyParameters
Sets the verification parameters in the supplied context. Prerequisites The Fingerprint SDK library must have been previously initialized. On success, GR_OK is returned. Return If any supplied parameter is invalid or out of range, its default value will be used and GR_DEFAULT_USED is returned. On failure, the appropriate error code is returned.
Parameters
[in] verifyThreshold The verification score threshold.
[in] context
42 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Declaration
C++ .NET
int SetVerifyParameters (int verifyThreshold, int verifyRotationTolerance, int context)
C#
int SetVerifyParameters (int verifyThreshold, int verifyRotationTolerance, int context)
VB6
Function SetVerifyParameters (ByVal verifyThreshold As Long, ByVal verifyRotationTolerance As Long, ByVal context As Long) As Long
VB .NET
Function SetVerifyParameters (ByVal verifyThreshold As Integer, ByVal verifyRotationTolerance As Integer, ByVal context As Integer) As Integer
Delphi
function SetVerifyParameters(verifyThreshold: integer; verifyRotationTolerance: integer; context: integer): integer;
Sample Code
C++ .NET
// set the new verification parameters ret = axGrFingerXCtrl2->SetVerifyParameters(thresholdVr, rotationMaxVr, GR_DEFAULT_CONTEXT); // error? if (ret == GR_DEFAULT_USED) { MessageBox::Show("Invalid verify parameters values. Default values will be used."); }
C#
// set the new verification parameters ret = axGrFingerXCtrl1.SetVerifyParameters(thresholdVr, rotationMaxVr, (int)GRConstants.GR_DEFAULT_CONTEXT); // error? if ((GRConstants)ret == GRConstants.GR_DEFAULT_USED) { MessageBox.Show("Invalid verify parameters values. Default values will be used."); }
VB6
' set the new verification parameters ret = GrFingerXCtrl1.SetVerifyParameters(thresholdVr, rotationMaxVr, GR_DEFAULT_CONTEXT) ' error? If ret = GR_DEFAULT_USED Then MsgBox ("Invalid verify parameters values. Default values will be used.") End If
VB .NET
' set the new verification parameters ret = AxGrFingerXCtrl1.SetVerifyParameters(thresholdVr, rotationMaxVr, GRConstants.GR_DEFAULT_CONTEXT) ' error? If ret = GRConstants.GR_DEFAULT_USED Then MsgBox("Invalid verify parameters values. Default values will be used.") End If
Delphi
// set the new verification parameters ret := GrFingerXCtrl1.SetVerifyParameters(thresholdVr, rotationMaxVr, GR_DEFAULT_CONTEXT); // error? if ret = GR_DEFAULT_USED then begin showmessage('Invalid verify parameters values. Default values will be used.'); end;
GetIdentifyParameters
Retrieves the identification parameters for the supplied context. 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
[out] identifyThreshold The current identification score threshold.
[out] identifyRotationTolerance The current rotation tolerance for the identification process.
[in] context
See also
Matching constants Context constants
Declaration
C++ .NET
int GetIdentifyParameters (ref int identifyThreshold, ref int identifyRotationTolerance, int context)
C#
int GetIdentifyParameters (ref int identifyThreshold, ref int identifyRotationTolerance, int context)
VB6
Function GetIdentifyParameters (ByRef identifyThreshold As Long, ByRef identifyRotationTolerance As Long, ByVal context As Long) As Long
VB .NET
43 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Function GetIdentifyParameters (ByRef identifyThreshold As Integer, ByRef identifyRotationTolerance As Integer, ByVal context As Integer) As Integer
Delphi
function GetIdentifyParameters(var identifyThreshold: integer; var identifyRotationTolerance: integer; context: integer): integer;
Sample Code
C++ .NET
int thresholdId, rotationMaxId; axGrFingerXCtrl2->GetIdentifyParameters(&thresholdId, &rotationMaxId, GR_DEFAULT_CONTEXT);
C#
int ret, thresholdId = 0, rotationMaxId = 0; axGrFingerXCtrl1.GetIdentifyParameters(ref thresholdId, ref rotationMaxId, (int)GRConstants.GR_DEFAULT_CONTEXT);
VB6
Dim thresholdId As Long Dim rotationMaxId As Long GrFingerXCtrl1.GetIdentifyParameters thresholdId, rotationMaxId, GR_DEFAULT_CONTEXT
VB .NET
Dim thresholdId As Integer Dim rotationMaxId As Integer GrFingerXCtrl1.GetIdentifyParameters thresholdId, rotationMaxId, GR_DEFAULT_CONTEXT
Delphi
Var thresholdId : Integer; rotationMaxId: Integer; begin GrFingerXCtrl1.GetIdentifyParameters(thresholdId, rotationMaxId, GR_DEFAULT_CONTEXT);
GetVerifyParameters
Retrieves the verification parameters for the supplied context. 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
[out] verifyThreshold The current verification score threshold.
[out] verifyRotationTolerance The current rotation tolerance for the verification process.
[in] context
See also
Matching constants Context constants
Declaration
C++ .NET
int GetVerifyParameters (int verifyThreshold, int verifyRotationTolerance, int context)
C#
int GetVerifyParameters (int verifyThreshold, int verifyRotationTolerance, int context)
VB6
Function GetVerifyParameters (ByRef verifyThreshold As Long, ByRef verifyRotationTolerance As Long, ByVal context As Long) As Long
VB .NET
Function GetVerifyParameters (ByRef verifyThreshold As Integer, ByRef verifyRotationTolerance As Integer, ByVal context As Integer) As Integer
Delphi
function GetVerifyParameters(var verifyThreshold: integer; var verifyRotationTolerance: integer; context: integer): integer;
Sample Code
C++ .NET
int thresholdVr, rotationMaxVr; axGrFingerXCtrl2->GetVerifyParameters(&thresholdVr, &rotationMaxVr, GR_DEFAULT_CONTEXT);
C#
int thresholdVr = 0, rotationMaxVr = 0; axGrFingerXCtrl1.GetVerifyParameters(ref thresholdVr, ref rotationMaxVr, (int)GRConstants.GR_DEFAULT_CONTEXT);
VB6
Dim thresholdVr As Long Dim rotationMaxVr As Long GrFingerXCtrl1.GetVerifyParameters thresholdVr, rotationMaxVr, GR_DEFAULT_CONTEXT
VB .NET
Dim thresholdVr As Integer Dim rotationMaxVr As Integer GrFingerXCtrl1.GetVerifyParameters thresholdVr, rotationMaxVr, GR_DEFAULT_CONTEXT
Delphi
Var
44 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Extraction methods
ConvertTemplate ExtractEx Extract
Extract
Extracts a fingerprint template from the supplied fingerprint raw image. The Fingerprint SDK library must have been previously initialized. Prerequisites The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes.
Return On success, the template quality code is returned. On failure, the appropriate error code is returned.
Parameters
[in] rawImage A raw grayscale fingerprint image.
[in] width
[in] height
[in] res
[out] tpt
[in,out] tptSize
[in] The maximum size in bytes of the byte array supplied. [out] The size in bytes of the extracted template.
[in] context
Declaration
C++.NET
int Extract (ref object RawImage, int width, int height, int res, ref byte[] tpt, ref int tptSize, int context)
C#
int Extract (ref object RawImage, int width, int height, int res, ref Array tpt, ref int tptSize, int context)
VB6
Function Extract (ByRef RawImage As Variant, ByVal width As Long, ByVal height As Long, ByVal res As Long, ByRef tpt() As Byte, ByRef tptSize As Long, ByVal context As Long) As Long
VB.NET
Function Extract (ByRef RawImage As Object, ByVal width As Integer, ByVal height As Integer, ByVal res As Integer, ByRef tpt As Array, ByRef tptSize As Integer, ByVal context As Integer) As Int
DELPHI
function Extract(var rawimage: OleVariant; width: integer; height: integer; res: integer; var tpt: PSafeArray; var tptSize: integer; context: integer): integer;
Sample Code
C++ .NET
int result; // set current buffer size for the extract template _tpt->_size = GR_MAX_SIZE_TEMPLATE; result = _grfingerx->Extract(&_raw->img, _raw->width, _raw->height, _raw->Res, &_tpt->_tpt, &_tpt->_size, GR_DEFAULT_CONTEXT); // if error, set template size to 0 if (result < 0){ // Result < 0 => extraction problem _tpt->_size = 0; }
C#
int result; // set current buffer size for the extract template _tpt._size = (int)GRConstants.GR_MAX_SIZE_TEMPLATE; result = (int)_grfingerx.Extract( ref _raw.img, _raw.width, _raw.height, _raw.Res, ref _tpt._tpt,ref _tpt._size, (int)GRConstants.GR_DEFAULT_CONTEXT); // if error, set template size to 0 if (result < 0) { // Result < 0 => extraction problem _tpt._size = 0; }
VB6
Dim ret As Integer ' Set initial buffer size and allocate it
45 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
template.Size = GR_MAX_SIZE_TEMPLATE ' reallocate template buffer ReDim Preserve template.tpt(template.Size) ret = GrFingerXCtrl1.Extract(raw.img, raw.width, raw.height, raw.res, template.tpt, template.Size, GR_DEFAULT_CONTEXT) ' if error, set template size to 0 ' Result < 0 => extraction problem If ret < 0 Then template.Size = 0 ' Set real buffer size and free unnecessary data ReDim Preserve template.tpt(template.Size)
VB .NET
Dim ret As Integer ' set current buffer size for the extract template template.Size = template.tpt.Length ret = _GrFingerX.Extract(raw.img, raw.width, raw.height, raw.res, template.tpt, template.Size, GRConstants.GR_DEFAULT_CONTEXT) ' if error, set template size to 0 ' Result < 0 => extraction problem If ret < 0 Then template.Size = 0
DELPHI
Var ret: Integer; Begin // set current buffer size for the extract template template.size := GR_MAX_SIZE_TEMPLATE; ret := GrFingerXCtrl1.Extract(raw.img, raw.width, raw.height, raw.res, template.tpt, template.size, GR_DEFAULT_CONTEXT); // if error, set template size to 0 // Result < 0 => extraction problem if (ret < 0 ) then template.size := 0; end;
ExtractEx
Extracts a fingerprint template, in a specified format, from the supplied fingerprint raw image. Prerequisites The Fingerprint SDK library must have been previously initialized. The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes.
Return On success, the template quality code is returned. On failure, the appropriate error code is returned.
Parameters
[in] rawImage A raw grayscale fingerprint image.
[in] width
[in] height
[in] res
[out] tpt
[in,out] tptSize
[in] The maximum size in bytes of the byte array supplied. [out] The size in bytes of the extracted template.
[in] context
[in] tptFormat
See also
Image constants Return codes Fingerprint Image Format
Declaration
C++ .NET
int ExtractEx (ref object RawImage, int width, int height, int res, ref byte[] tpt, ref int tptSize, int context, int tptFormat);
C#
int ExtractEx (ref object RawImage, int width, int height, int res, ref Array tpt, ref int tptSize, int context, int tptFormat);
VB6
Function ExtractEx (ByRef RawImage As Variant, ByVal width As Long, ByVal height As Long, ByVal res As Long, ByRef tpt() As Byte, ByRef tptSize As Long, ByVal context As Long, ByVal tptFormat A
VB .NET
Function ExtractEx (ByRef RawImage As Object, ByVal width As Integer, ByVal height As Integer, ByVal res As Integer, ByRef tpt As Array, ByRef tptSize As Integer, ByVal context As Integer, ByVa
Delphi
function ExtractEx(var rawimage: OleVariant; width: integer; height: integer; res: integer; var tpt: PSafeArray; var tptSize: integer; context: integer; tptFormat: integer): integer;
CovertTemplate
Creates a copy of the specified template, serialized in the specified format. Prerequisites The Fingerprint SDK library must have been previously initialized. The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes.
Return On success, GR_OK is returned.On failure, the appropriate error code is returned.
46 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
[out] newTpt
[in,out] newTptSize
[in] The maximum size in bytes of the byte array supplied. [out] The size in bytes of the converted template.
[in] context
[in] format
Declaration
C++ .NET
int ConvertTemplate (ref byte[] tpt, ref byte[] newTpt, ref int newTptSize, int context, int format);
C#
int ConvertTemplate (ref Array tpt, ref Array newTpt, ref int newTptSize, int context, int format);
VB6
Function ConvertTemplate (ByRef tpt() As Byte, ByRef newTpt() As Byte, ByRef newTptSize As Long, ByVal context As Long, ByVal format As Long) As Long
VB .NET
Function ConvertTemplate (ByRef tpt As Array, ByRef newTpt As Array, ByRef newTptSize As Integer, ByVal context As Integer, ByVal format As Integer) As Integer
Delphi
function ConvertTemplate(var tpt: PSafeArray; var newTpt: PSafeArray; var newTptSize: integer; context: integer; format: integer): integer;
Capture methods
CapInitialize CapFinalize CapStartCapture CapStopCapture CapSaveRawImageToFile CapLoadImageFromFile CapRawImageToHandle
CapInitialize
Initializes the capture module. Prerequisites A valid license must exist on system. Return On success, GR_OK is returned. On failure, the appropriate error code is returned.
See also
Events
Declaration
C++ .NET
int CapInitialize()
C#
int CapInitialize()
VB6
Function CapInitialize() As Long
VB .NET
Function CapInitialize() As Integer
Delphi
Function CapInitialize(): integer;
Sample Code
C++ .NET
retVal= _grfingerx->CapInitialize();
C#
retVal= _grfingerx.CapInitialize();
VB6
retVal= GrFingerXCtrl1.CapInitialize
VB .NET
retVal= GrFingerXCtrl1.CapInitialize
Delphi
retVal:= GrFingerXCtrl1.CapInitialize();
CapFinalize
47 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Return
Declaration
C++ .NET
int CapFinalize()
C#
int CapFinalize ()
VB6
Function CapFinalize () As Long
VB .NET
Function CapFinalize () As Integer
Delphi
Function CapFinalize (): integer;
Sample Code
C++ .NET
retVal= _grfingerx->CapFinalize();
C#
retVal= _grfingerx.CapFinalize();
VB6
retVal= GrFingerXCtrl1.CapFinalize
VB .NET
retVal= GrFingerXCtrl1.CapFinalize
Delphi
retVal:= GrFingerXCtrl1.CapFinalize();
CapStartCapture
Starts capturing fingerprint images from the supplied fingerprint reader. Prerequisites The capture module must have been previously initialized. The supplied fingerprint reader must be connected, working and recognized as plugged by the capture module.
Return
Parameters
[in] idSensor The ID of the fingerprint reader to start capturing images from.
See also
Events
Declaration
C++ .NET
int CapStartCapture (string idSensor)
C#
int CapStartCapture (string idSensor)
VB6
Function CapStartCapture (ByVal idSensor As String)
VB .NET
Function CapStartCapture (ByVal idSensor As String)
Delphi
function CapStartCapture(const idSensor: WideString): integer;
Sample Code
C++ .NET
axGrFingerXCtrl2->CapStartCapture(e->idSensor);
C#
axGrFingerXCtrl1.CapStartCapture(e.idSensor);
VB6
GrFingerXCtrl1.CapStartCapture (idSensor)
VB .NET
AxGrFingerXCtrl1.CapStartCapture(e.idSensor)
Delphi
GrFingerXCtrl1.CapStartCapture (idSensor);
48 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
CapStopCapture
Stops capturing fingerprint images from the supplied fingerprint reader. Prerequisites The capture module must have been previously initialized. Image capture must have been previously started on the supplied fingerprint reader.
Return
Parameters
[in] idSensor The ID of the fingerprint reader to stop capturing images from.
Declaration
C++ .NET
int CapStopCapture (string idSensor)
C#
int CapStopCapture (string idSensor)
VB6
Function CapStopCapture (ByVal idSensor As String) As Long
VB .NET
Function CapStopCapture (ByVal idSensor As String) As Integer
Delphi
function CapStopCapture(const idSensor: WideString): integer;
Sample Code
C++ .NET
axGrFingerXCtrl2->CapStopCapture(e->idSensor);
C#
axGrFingerXCtrl1.CapStopCapture(e.idSensor);
VB6
GrFingerXCtrl1.CapStopCapture (idSensor)
VB .NET
AxGrFingerXCtrl1.CapStopCapture(e.idSensor)
Delphi
GrFingerXCtrl1.CapStopCapture (idSensor);
CapSaveRawImageToFile
Saves a raw grayscale fingerprint image as a picture file. Prerequisites A valid license must exist on system. Return On success, GR_OK is returned. On failure, the appropriate error code is returned.
Parameters
[in] rawImage A raw grayscale fingerprint image.
[in] width
[in] height
[in] filename
See also
Fingerprint Image Format
Declaration
C++ .NET
int CapSaveRawImageToFile (ref object RawImage, int width, int height, string filename, int imageFormat)
C#
int CapSaveRawImageToFile (ref Object RawImage, int width, int height, string filename, int imageFormat)
VB6
Function CapSaveRawImageToFile (ByRef RawImage As Variant, ByVal width As Long, ByVal height As Long, ByVal filename As String, ByVal imageFormat As Long) As Long
VB .NET
Function CapSaveRawImageToFile (ByRef RawImage As Object, ByVal width As Integer, ByVal height As Integer, ByVal filename As String, ByVal imageFormat As Integer) As Integer
Delphi
49 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
function CapSaveRawImageToFile(vat rawImage: OleVariant; width, height: integer; filename: WideString; imageFormat: GRCAP_IMAGE_FORMAT): integer;;
Sample Code
C++ .NET
if (axGrFingerXCtrl2->CapSaveRawImageToFile(&_raw->img, WriteLog("Failed to save the file."); } _raw->width, _raw->height, FileName, GRCAP_IMAGE_FORMAT_BMP) != GR_OK) {
C#
if (axGrFingerXCtrl1.CapSaveRawImageToFile(ref _raw.img, _raw.width, _raw.height, FileName, (int)GRConstants.GRCAP_IMAGE_FORMAT_BMP) != (int)GRConstants.GR_OK) { WriteLog("Failed to save the file."); }
VB6
If GrFingerXCtrl1.CapSaveRawImageToFile(raw.img, raw.width, raw.height, FileName, GRCAP_IMAGE_FORMAT_BMP) <> GR_OK Then writeLog ("Failed to save the file.") End If
VB .NET
If AxGrFingerXCtrl1.CapSaveRawImageToFile(raw.img, raw.width, raw.height, FileName, GRConstants.GRCAP_IMAGE_FORMAT_BMP) <> GRConstants.GR_OK Then WriteLog("Fail to save the file.") End If
Delphi
if GrFingerXCtrl1.CapSaveRawImageToFile(raw.img, raw.width, raw.Height, fname, GRCAP_IMAGE_FORMAT_BMP) <> GR_OK then WriteLog('Fail to save the file.');
CapLoadImageFromFile
Loads a grayscale fingerprint image from a picture file. The capture module must have been previously initialized. Prerequisites Picture file must be in one of the supported formats, as defined in the section. Image capture must have been previously started on the "File" sensor. On success, GR_OK is returned. On failure, the appropriate error code is returned.
Return
Parameters
[in] fileName The complete path and filename of the picture file to load.
[in] res
Remarks
On success, an image event is fired for the "File" sensor.
See also
Events
Declaration
C++ .NET
int CapLoadImageFromFile (string filename, int res)
C#
int CapLoadImageFromFile (string filename, int res)
VB6
Function CapLoadImageFromFile (ByVal filename As String, ByVal res As Long) As Long
VB .NET
Function CapLoadImageFromFile (ByVal filename As String, ByVal res As Integer) As Integer
Delphi
function CapLoadImageFromFile(const filename: WideString; res: integer): integer;
Sample Code
C++ .NET
// Getting the resolution. int resolution = Convert::ToInt32(InputBox::ShowModal("What is the image resolution?", "Resolution", "")); // Checking if the action was canceled, no value or an invalid value //was entered. if (resolution != 0) { axGrFingerXCtrl2->CapLoadImageFromFile(ofdImage->FileName, resolution); }
C#
// Getting the resolution. String res = InputBox.Show("What is the image resolution?", "Resolution", "").Text; if (!res.Equals("")) { int resolution = Convert.ToInt32(res); // Checking if the action was canceled, no value or an invalid value //was entered. if (resolution != 0) { axGrFingerXCtrl1.CapLoadImageFromFile(ofdImage.FileName, resolution); } }
VB6
' Getting the resolution. res = Val(InputBox("Enter the resolution of the selected image", "Resolution")) ' Checking if the action was canceled, no value or an invalid value was entered. If res <> 0 Then GrFingerXCtrl1.CapLoadImageFromFile CommonDialog.FileName, res End If
50 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Delphi
// Getting image resolution. resolution := StrToInt(InputBox('What is the image resolution?', 'Resolution', '')); // Checking if the action was canceled, no value or an invalid value was entered. if (resolution <> 0) then begin GrFingerXCtrl1.CapLoadImageFromFile(OpenPictureDialog.FileName, resolution); end;
CapRawImageToHandle
Returns a picture display handle (IPictureDisp) to the supplied raw grayscale fingerprint image. Prerequisites A valid license must exist on system. On success, GR_OK is returned. On failure, the appropriate error code is returned.
Return
Parameters
[in] rawImage A raw grayscale fingerprint image.
[in] width
[in] height
[in] hdc
The device context handle (HDC) in which the picture will be created.
[out] handle
See also
Fingerprint Image Format
Declaration
C++ .NET
int CapRawImageToHandle (ref object RawImage, int width, int height, int hdc, ref stdole.IPictureDisp handler)
C#
int CapRawImageToHandle (ref Object RawImage, int width, int height, int hdc, ref stdole.IPictureDisp handler)
VB6
Function CapRawImageToHandle (ByRef RawImage As Variant, ByVal width As Long, ByVal height As Long, ByVal hdc As Long, ByRef handler As IPictureDisp) As Long
VB .NET
Function CapRawImageToHandle (ByRef RawImage As Object, ByVal width As Integer, ByVal height As Integer, ByVal hdc As Integer, ByRef handler As stdole.IPictureDisp) As Integer
Delphi
function CapRawImageToHandle(var rawImage: OleVariant; width, height: integer; hdc: HDC; var handler: IPictureDisp): integer;
Sample Code
C++ .NET
stdole::IPictureDisp *handle; // screen HDC Graphics *g = _btEnroll->CreateGraphics(); IntPtr hdc = g->GetHdc(); _grfingerx->CapRawImageToHandle(&_raw->img, _raw->width, _raw->height, hdc.ToInt32(), &handle); if (handle != NULL) { Image *curImage = System::Drawing::Image::FromHbitmap(handle->Handle); _pbPic->Image = curImage; _pbPic->Update(); } g->ReleaseHdc(hdc);
C#
IPictureDisp handle = null; // screen HDC IntPtr hdc = GetDC(System.IntPtr.Zero); _grfingerx.CapRawImageToHandle(ref _raw.img,_raw.width,_raw.height, hdc.ToInt32(), ref handle); // draw image on picture box if (handle != null) { _pbPic.Image = GrFingerXSampleCS. ImageConverter.IpictureToImage(handle); _pbPic.Update(); } ReleaseDC(System.IntPtr.Zero,hdc);
VB6
Dim handle As IPictureDisp GrFingerXCtrl1.CapRawImageToHandle raw.img, raw.width, raw.height, formMain.hDC, handle If Not (handle Is Nothing) Then img.Picture = handle End If
VB .NET
' handle to finger image Dim handle As stdole.IPictureDisp = Nothing ' screen HDC Dim hdc = GetDC(0) _GrFingerX.CapRawImageToHandle(raw.img, raw.width, raw.height, hdc, handle) If Not (handle Is Nothing) Then _pbPic.Image = Image.FromHbitmap(New IntPtr(handle.Handle), New IntPtr(handle.hPal))
51 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Delphi
var // handle to finger image handle: IPictureDisp; // screen HDC hdc: LongInt; begin GrFingerXCtrl1.CapRawImageToHandle(raw.img, raw.width, raw.height, hdc, handle); if handle <> nil then begin SetOlePicture(image.Picture, handle); image.Repaint(); end; // release screen HDC ReleaseDC(HWND(nil), hdc);
BiometricDisplay
Returns a picture display handle (IPictureDisp) to the supplied raw grayscale fingerprint image with its minutiae, segments and minutiae direction drawn. 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] tpt Template corresponding to the raw grayscale fingerprint image supplied.
[in] rawImage
[in] width
[in] height
[in] res
[in] hdc
The device context handle (HDC) in which the picture will be created.
[out] handle
[in] matchContext
To have only the minutiae, segments and minutiae direction of the supplied fingerprint drawn, this parameter must be GR_NO_CONTEXT. To have also the macthing minutiae, segments and minutiae direction drawn, this parameter must be the context identifier corresponding to the matching (identification or verification).
See also
Fingerprint Image Format
Declaration
C++ .NET
int BiometricDisplay (ref byte[] tptQuery,ref object rawImage, int width, int height, int hdc, ref stdole.IPictureDisp handle, int matchContext)
C#
int BiometricDisplay (ref Array tptQuery,ref Object rawImage, int width, int height, int hdc, ref stdole.IPictureDisp handle, int matchContext)
VB6
Function BiometricDisplay (ByRef tptQuery() As Byte, ByRef rawImage As Variant, ByVal width As Long, ByVal height As Long, ByVal hdc As Long, ByRef handle As IPictureDisp, ByVal matchContext As
VB .NET
Function BiometricDisplay (ByRef tptQuery As Array, ByRef rawImage As Object, ByVal width As Integer, ByVal height As Integer, ByVal hdc As Integer, ByRef handle As stdole.IPictureDisp, ByVal m
Delphi
function
BiometricDisplay(var tptQuery: PSafeArray; var rawImage: OleVariant; width: Integer; height: Integer; res: Integer; hdc: integer; var handler: IPictureDisp; matchContext: Integer): In
Sample Code
C++ .NET
// the template class __gc class TTemplate { public: // Template data. System::Byte _tpt[]; // Template size int _size; TTemplate(void); ~TTemplate(void); }; // Raw image data type. __gc struct TRawImage { // Image data. System::Object *img; // Image width. unsigned int width; // Image height. unsigned int height; // Image resolution.
52 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
_grfingerx->BiometricDisplay(&_tpt->_tpt, &_raw->img, _raw->width, _raw->height, _raw->Res, hdc.ToInt32(), &handle, context); if (handle != NULL) { Image *curImage = System::Drawing::Image::FromHbitmap(handle->Handle); _pbPic->Image = curImage; _pbPic->Update(); } g->ReleaseHdc(hdc);
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; } } // Raw image data type. public struct TRawImage { // Image data. public object img; // Image width. public int width; // Image height. public int height; // Image resolution. public int Res; }; IPictureDisp handle = null; // screen HDC IntPtr hdc = GetDC(System.IntPtr.Zero); _grfingerx.BiometricDisplay(ref _tpt._tpt, ref raw.img, _raw.width, _raw.height, _raw.Res,hdc.ToInt32(), ref handle,(int)contextId); // draw image on picture box if (handle != null) { _pbPic.Image = GrFingerXSampleCS. ImageConverter.IpictureToImage(handle); _pbPic.Update(); } ReleaseDC(System.IntPtr.Zero,hdc);
VB6
' Raw image data type. Public Type rawImage ' Image data. img As Variant ' Image width. width As Long ' Image height. height As Long ' Image resolution. res As Long End Type ' Template data Type Public Type TTemplate ' Template data tpt() As Byte ' Template size Size As Long End Type Dim handle As IPictureDisp GrFingerXCtrl1.biometricDisplay template.tpt, raw.img, raw.width, raw.height, raw.res, formMain.hDC, handle, context If Not (handle Is Nothing) Then img.Picture = handle 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 ' Raw image data type. Public Structure RawImage ' Image data. Public img As Object ' Image width. Public width As Long ' Image height. Public height As Long ' Image resolution. Public res As Long End Structure ' handle to finger image Dim handle As stdole.IPictureDisp = Nothing ' screen HDC Dim hdc = GetDC(0) _GrFingerX.BiometricDisplay(template.tpt, raw.img, raw.width, raw.height, raw.res, hdc, handle, context) If Not (handle Is Nothing) Then _pbPic.Image = Image.FromHbitmap(New IntPtr(handle.Handle), New IntPtr(handle.hPal)) _pbPic.Update() End If ' release screen HDC ReleaseDC(0, hdc)
Delphi
type // Raw image data type. TRawImage = record // Image data. img: OleVariant; // Image width. width: Integer; // Image height. Height: Integer; // Image resolution. Res: Integer; end; // Define a type to temporary storage of template TTemplate = class public // Template data. tpt: PSafeArray;
53 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
var // handle to finger image handle: IPictureDisp; // screen HDC hdc: LongInt; begin GrFingerXCtrl1.BiometricDisplay(template.tpt,raw.img, raw.width, raw.height,raw.Res, hdc, handle, context) if handle <> nil then begin SetOlePicture(image.Picture, handle); image.Repaint(); end; // release screen HDC ReleaseDC(HWND(nil), hdc);
SetBiometricDisplayColors
Sets the colors used to draw the minutiae, matching minutiae, segments, matching segments, minutiae directions and matching minutiae directions in the picture returned by the BiometricDisplay method. 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] minutiaeColor Minutiae color in BGR 24-bits format.
[in] minutiaeMatchedColor
[in] segmentsColor
[in] segmentsMatchedColor
[in] directionsColor
Remarks
Passing GR_IMAGE_NO_COLOR as any color causes the corresponding feature (minutia, matching minutia, segment, matching segment, minutia direction or matching minutia direction) not being drawn. Passing all colors as GR_IMAGE_NO_COLOR causes the default colors to be used: red for minutiae, green for segments, blue for minutiae direction and magenta for matching minutiae, segments and minutiae direction.
See also
Color Coding Format
Declaration
C++ .NET
int SetBiometricDisplayColors(int minutiaeColors, int minutiaeMatchedColors, int segmentColors, int segmentMatchedColors, int directionColors, int directionMatchedColors)
C#
int SetBiometricDisplayColors(int minutiaeColors, int minutiaeMatchedColors, int segmentColors, int segmentMatchedColors, int directionColors, int directionMatchedColors)
VB6
Function GrSetBiometricDisplayColors(ByVal minutiaeColors As Long, ByVal minutiaeMatchedColors As Long, ByVal segmentColors As Long, ByVal segmentMatchedColors As Long, ByVal directionColors As
VB .NET
Function GrSetBiometricDisplayColors(ByVal minutiaeColors As Integer, ByVal minutiaeMatchedColors As Integer, ByVal segmentColors As Integer, ByVal segmentMatchedColors As Integer, ByVal direct
Delphi
function GrSetBiometricDisplayColors (minutiaeColors, minutiaeMatchedColors, segmentColors, segmentMatchedColors, directionColors, directionMatchedColors: integer): integer;
Sample Code
C++ .NET
// set minutiae colors to red int minutiaeColor=Color::Red; int minutiaeMatchColor=Color::Red; // don't display any other biometric info int segmentsColor = GR_IMAGE_NO_COLOR; int segmentsMatchColor = GR_IMAGE_NO_COLOR; int directionsColor = GR_IMAGE_NO_COLOR; int directionsMatchColor = GR_IMAGE_NO_COLOR; axGrFingerXCtrl2->SetBiometricDisplayColors(minutiaeColor, minutiaeMatchColor, segmentsColor, segmentsMatchColor, directionsColor, directionsMatchColor);
C#
// set minutiae colors to red int minutiaeColor=Color.Red; int minutiaeMatchColor=Color.Red; // don't display any other biometric info int segmentsColor = (int)GRConstants.GR_IMAGE_NO_COLOR; int segmentsMatchColor = (int)GRConstants.GR_IMAGE_NO_COLOR; int directionsColor = (int)GRConstants.GR_IMAGE_NO_COLOR; int directionsMatchColor = (int)GRConstants.GR_IMAGE_NO_COLOR; axGrFingerXCtrl1.SetBiometricDisplayColors(minutiaeColor, minutiaeMatchColor, segmentsColor, segmentsMatchColor, directionsColor, directionsMatchColor);
VB6
' set minutiae colors to red minutiaeColors = vbRed ' don't display any other biometric colors minutiaeMatchedColors = GR_IMAGE_NO_COLOR segmentColors = GR_IMAGE_NO_COLOR
54 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
VB .NET
' set minutiae colors to red minutiaeColors = Color.Red ' don't display any other biometric info minutiaeMatchedColors = GR_IMAGE_NO_COLOR segmentColors = GR_IMAGE_NO_COLOR segmentMatchedColors = GR_IMAGE_NO_COLOR directionColors = GR_IMAGE_NO_COLOR directionMatchedColors = GR_IMAGE_NO_COLOR retVal= GrFingerXCtrl1.SetBiometricDisplayColors (minutiaeColors, minutiaeMatchedColors, segmentColors, segmentMatchedColors, directionColors, directionMatchedColors)
Delphi
var minutiaeColor: Integer; minutiaeMatchColor: Integer; segmentsColor: Integer; segmentsMatchColor: Integer; directionsColor: Integer; directionsMatchColor: Integer; begin // set minutiae colors to red minutiaeColor := clRed; minutiaeMatchColor := clRed; // don't display any other biometric info segmentsColor := GR_IMAGE_NO_COLOR; segmentsMatchColor := GR_IMAGE_NO_COLOR; directionsColor := GR_IMAGE_NO_COLOR; directionsMatchColor := GR_IMAGE_NO_COLOR; GrFingerXCtrl1.SetBiometricDisplayColors(minutiaeColor, minutiaeMatchColor, segmentsColor, segmentsMatchColor, directionsColor, directionsMatchColor); end;
Other methods
GetGrFingerVersion DecodeBase64 EncodeBase64 InstallLicense IsBase64Encoding SetLicenseFolder
DecodeBase64
Decodes a Base64 template. Prerequisites The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes. Return On success, GR_OK is returned.On failure, the appropriate error code is returned.
Parameters
[in] encodedBuffer The template to be decoded.
[in] encodedSize
[out] decodedBuffer
[in,out] decodedSize
[in] The maximum size in bytes of the byte array supplied. [out] The size in bytes of the decoded template.
See also
Return codes
Declaration
C++ .NET
int DecodeBase64 (ref byte[] encodedBuffer, int encodedSize, ref byte[] decodedBuffer, ref int decodedSize);
C#
int DecodeBase64 (ref Array encodedBuffer, int encodedSize, ref Array decodedBuffer, ref int decodedSize);
VB6
Function DecodeBase64 (ByRef encodedBuffer() As Byte, ByVal encodedSize As Long, ByRef decodedBuffer() As Byte, ByRef decodedSize As Long) As Long
VB .NET
Function DecodeBase64 (ByRef encodedBuffer As Array, ByVal encodedSize As Integer, ByRef decodedBuffer As Array, ByRef decodedSize As Integer) As Integer
Delphi
function DecodeBase64(var encodedBuffer: PSafeArray; encodedSize: integer; var decodedBuffer: PSafeArray; var decodedSize: integer): integer;
GetGrFingerVersion
Returns the Fingerprint SDK version and edition. Prerequisites A valid license must exist on system. Return On success, the Fingerprint SDK type code is returned. On failure, the appropriate error code is returned.
Parameters
55 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
See also
Licensing constants
Declaration
C++ .NET
int GetGrFingerVersion(ref byte majorVersion, ref byte minorVersion)
C#
int GetGrFingerVersion(ref Byte majorVersion, ref Byte minorVersion)
VB6
Function GetGrFingerVersion(ByRef majorVersion As Byte, ByRef minorVersion As Byte) As Long
VB .NET
Function GetGrFingerVersion(ByRef majorVersion As Byte, ByRef minorVersion As Byte) As Long
Delphi
Function GetGrFingerVersion(majorVersion, minorVersion: Byte): integer;
Sample Code
C++ .NET
unsigned char majorVersion=0, minorVersion=0; String *vStr = new String(""); int result = _grfingerx->GetGrFingerVersion(&majorVersion, &minorVersion); if (result == GRFINGER_FULL) vStr = new String("IDENTIFICATION"); else if(result == GRFINGER_LIGHT) vStr = new String("VERIFICATION"); else if(result == GRFINGER_FREE) vStr = new String("FREE");
MessageBox::Show(System::String::Concat(System::String::Concat("The Fingerprint SDK DLL version is ", Convert::ToString(majorVersion) , "." , Convert::ToString(minorVersion)), System::String::C
C#
byte majorVersion=0,minorVersion=0; GRConstants result; string vStr = ""; result = (GRConstants)_grfingerx.GetGrFingerVersion(ref majorVersion, ref minorVersion); if(result == GRConstants.GRFINGER_FULL) vStr = "IDENTIFICATION"; else if(result == GRConstants.GRFINGER_LIGHT) vStr = "VERIFICATION"; else if(result == GRConstants.GRFINGER_FREE) vStr = "FREE"; MessageBox.Show("The Fingerprint SDK DLL version is " + majorVersion + "." + minorVersion + ". \n" + "The license type is '" + vStr + "'.","Fingerprint SDK Version");
VB6
Dim Dim Dim Dim majorVersion As Byte minorVersion As Byte ret As Long vStr As String
majorVersion = 0 minorVersion = 0 vStr = "" ret = GrFingerX.GetGrFingerVersion(majorVersion, minorVersion) If ret = GRFINGER_FULL Then vStr = "IDENTIFICATION" If ret = GRFINGER_LIGHT Then vStr = "VERIFICATION" If ret = GRFINGER_FREE Then vStr = "FREE" Call MsgBox("The Fingerprint SDK DLL version is " & majorVersion & _ "." & minorVersion & "." & vbCrLf & _ "The license type is '" & vStr & "'.", , "Fingerprint SDK Version")
VB .NET
Dim Dim Dim Dim majorVersion As Integer = 0 minorVersion As Integer = 0 result As GRConstants vStr As String = ""
result = _GrFingerX.GetGrFingerVersion(majorVersion, minorVersion) If result = GRConstants.GRFINGER_FULL Then vStr = "IDENTIFICATION" If result = GRConstants.GRFINGER_LIGHT Then vStr = "VERIFICATION" If result = GRConstants.GRFINGER_FREE Then vStr = "FREE" MessageBox.Show("The Fingerprint SDK DLL version is " & majorVersion & _ "." & minorVersion & "." & vbCrLf & _ "The license type is '" & vStr & "'.", "Fingerprint SDK Version") End Sub
Delphi
var majorVersion: byte; minorVersion: byte; result: integer; vStr: String; begin result := GrFingerXCtrl1.GetGrFingerVersion(majorVersion, minorVersion); If result = GRFINGER_FULL Then vStr := 'IDENTIFICATION'; If result = GRFINGER_LIGHT Then vStr := 'VERIFICATION'; If result = GRFINGER_FREE Then vStr := 'FREE'; Application.MessageBox(PChar('The Fingerprint SDK DLL version is ' + intToStr(majorVersion) + '.' + intToStr(minorVersion) + '.' + #13#10 + 'The license type is ''' + vStr + '''.'), PChar(' End;
IsBase64Encoding
Verifies if a buffer is in Base64 format. Return True if the supplied buffer is in Base64 format. Otherwise, False is returned.
Parameters
56 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
[in] buffer
Declaration
C++ .NET
bool IsBase64Encoding (ref byte[] buffer, int bufferSize);
C#
bool IsBase64Encoding (ref Array buffer, int bufferSize);
VB6
Function IsBase64Encoding (ByRef buffer() As Byte, ByVal bufferSize As Long) As Boolean
VB .NET
Function IsBase64Encoding (ByRef buffer As Array, ByVal bufferSize As Integer) As Boolean
Delphi
function IsBase64Encoding(var buffer: PSafeArray; bufferSize: integer): boolean;
EncodeBase64
Encodes a template in Base64 format. Prerequisites The template array must be already allocated. The recommended size is GR_MAX_SIZE_TEMPLATE bytes. Return On success, the template quality code is returned. On failure, the appropriate error code is returned.
Parameters
[in] buffer The template to be encoded.
[in] bufferSize
[out] encodedBuffer
[in,out] encodedSize
[in] The maximum size in bytes of the byte array supplied. [out] The size in bytes of the encoded template.
See also
Return codes
Declaration
C++ .NET
int EncodeBase64 (ref byte[] buffer, int bufferSize, ref byte[] encodedBuffer, ref int encodedSize);
C#
int EncodeBase64 (ref Array buffer, int bufferSize, ref Array encodedBuffer, ref int encodedSize);
VB6
Function EncodeBase64 (ByRef buffer() As Byte, ByVal bufferSize As Long, ByRef encodedBuffer() As Byte, ByRef encodedSize As Long) As Long
VB .NET
Function EncodeBase64 (ByRef buffer As Array, ByVal bufferSize As Integer, ByRef encodedBuffer As Array, ByRef encodedSize As Integer) As Integer
Delphi
function EncodeBase64(var buffer: PSafeArray; bufferSize: integer; var encodedBuffer: PSafeArray; var encodedSize: integer): integer;
InstallLicense
Installs a license based on the product key. Prerequisites This method must be called before the initialization of the library. Return On success, GR_OK is returned.On failure, the appropriate error code is returned.
Parameters
[in] productKey the Product Key.
See also
Return codes
Declaration
C++ .NET
int InstallLicense (string productKey)
C#
int InstallLicense (string productKey)
57 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
VB .NET
Function InstallLicense (ByVal productKey As String)
Delphi
function InstallLicense(const productKey: WideString): integer;
SetLicenseFolder
Sets the directory in which Fingerprint SDK must search for its runtime license file. This is an optional function. Please, read "Licensing Fingerprint SDK Based Deployed Applications" section to know how Fingerprint SDK searchs for the license file. Prerequisites This method must be called before the initialization of the library. Return On success, GR_OK is returned.On failure, the appropriate error code is returned.
Parameters
[in] licenseFolder the directory where the Fingerprint SDK runtime license file is located.
See also
Return codes
Declaration
C++ .NET
int SetLicenseFolder (string licenseFolder)
C#
int SetLicenseFolder (string licenseFolder)
VB6
Function SetLicenseFolder (ByVal licenseFolder As String)
VB .NET
Function SetLicenseFolder (ByVal licenseFolder As String)
Delphi
function SetLicenseFolder(const licenseFolder: WideString): integer;
Events
All events fired by ActiveX components are synchronized. This means that an event is fired only after any other event already fired finishes. Code events carefully to avoid race and deadlock conditions in your application. SensorPlug SensorUnplug FingerDown FingerUp ImageAcquired
SensorPlug
This event is fired whenever a fingerprint reader is plugged into the computer. Prerequisites The capture module must have been previously initialized. At least one fingerprint reader must be connected and working.
Parameters
[in] idSensor The ID of the fingerprint reader that raised the event.
Declaration
C++ .NET
void [Control Name]_SensorPlug(System::Object * sender, _IGrFingerXCtrlEvents_SensorPlugEvent * e)
C#
void [Control Name]_SensorPlug(object sender, [Library Name]._IGrFingerXCtrlEvents_SensorPlugEvent e)
VB6
Sub [Control Name]_SensorPlug(ByVal idSensor As String)
VB .NET
Sub [Control Name]_SensorPlug(ByVal sender As System.Object, ByVal e As [Library Name]._IGrFingerXCtrlEvents_SensorPlugEvent) Handles [Control Name].SensorPlug
Delphi
procedure [Control Name]SensorPlug(Sender: TObject; const idSensor: WideString);
Sample Code
C++ .NET
58 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
// A fingerprint reader was plugged on system private: System::Void axGrFingerXCtrl2_SensorPlug(System::Object * sender, _IGrFingerXCtrlEvents_SensorPlugEvent * WriteLog(String::Concat("Sensor: " , e->idSensor , ". Event: Plugged.")); axGrFingerXCtrl2->CapStartCapture(e->idSensor); }
e) {
C#
// A fingerprint reader was plugged on system private void axGrFingerXCtrl1_SensorPlug(object sender, AxGrFingerXLib._IGrFingerXCtrlEvents_SensorPlugEvent e) { WriteLog("Sensor: " + e.idSensor + ". Event: Plugged."); axGrFingerXCtrl1.CapStartCapture(e.idSensor); }
VB6
' A fingerprint reader was plugged on system Private Sub GrFingerXCtrl1_SensorPlug(ByVal idSensor As String) writeLog ("Sensor: " & idSensor & ". Event: Plugged.") GrFingerXCtrl1.CapStartCapture (idSensor) End Sub
VB .NET
' A fingerprint reader was plugged on system Private Sub AxGrFingerXCtrl1_SensorPlug(ByVal sender As System.Object, ByVal e As AxGrFingerXLib._IGrFingerXCtrlEvents_SensorPlugEvent) Handles AxGrFingerXCtrl1.SensorPlug WriteLog("Sensor: " & e.idSensor & ". Event: Plugged.") AxGrFingerXCtrl1.CapStartCapture(e.idSensor) End Sub
Delphi
// A fingerprint reader was plugged on system procedure TGrFingerXCtrl1SensorPlug(Sender: TObject; const idSensor: WideString); begin writeLog ('Sensor: ' + idSensor + '. Event: Plugged.'); GrFingerXCtrl1.CapStartCapture (idSensor); end;
SensorUnplug
This event is fired whenever a fingerprint reader is unplugged from the computer. Prerequisites The capture module must have been previously initialized. At least one fingerprint reader must be connected, working and recognized as plugged by the capture module.
Parameters
[in] idSensor The ID of the fingerprint reader that raised the event.
Declaration
C++ .NET
void [Control Name]_SensorUnplug(System::Object * sender, _IGrFingerXCtrlEvents_SensorUnplugEvent * e)
C#
void [Control Name]_SensorUnplug(object sender, [Library Name]._IGrFingerXCtrlEvents_SensorUnplugEvent e)
VB6
Sub [Control Name]_SensorUnplug(ByVal idSensor As String)
VB .NET
Sub [Control Name]_SensorUnplug(ByVal sender As System.Object, ByVal e As [Library Name]._IGrFingerXCtrlEvents_SensorUnplugEvent) Handles [Control Name].SensorUnplug
Delphi
procedure [Control Name]SensorUnplug(Sender: TObject; const idSensor: WideString);
Sample Code
C++ .NET
// A fingerprint reader was unplugged on system private: System::Void axGrFingerXCtrl2_SensorUnplug(System::Object * sender, _IGrFingerXCtrlEvents_SensorUnplugEvent * WriteLog(String::Concat(S"Sensor: " , e->idSensor , ". Event: Unplugged.")); axGrFingerXCtrl2->CapStopCapture(e->idSensor); } e) {
C#
// A fingerprint reader was unplugged on system private void axGrFingerXCtrl1_SensorUnplug(object sender, AxGrFingerXLib._IGrFingerXCtrlEvents_SensorUnplugEvent e) { WriteLog("Sensor: " + e.idSensor + ". Event: Unplugged."); axGrFingerXCtrl1.CapStopCapture(e.idSensor); }
VB6
' A fingerprint reader was unplugged on system Private Sub GrFingerXCtrl1_SensorUnplug(ByVal idSensor As String) writeLog ("Sensor: " & idSensor & ". Event: Unplugged.") GrFingerXCtrl1.CapStopCapture (idSensor) End Sub
VB .NET
' A fingerprint reader was unplugged on system Private Sub AxGrFingerXCtrl1_SensorUnplug(ByVal sender As System.Object, ByVal e As AxGrFingerXLib._IGrFingerXCtrlEvents_SensorUnplugEvent) Handles AxGrFingerXCtrl1.SensorUnplug WriteLog("Sensor: " & e.idSensor & ". Event: Unplugged.") AxGrFingerXCtrl1.CapStopCapture(e.idSensor) End Sub
Delphi
// A fingerprint reader was unplugged on system procedure TGrFingerXCtrl1SensorUnplug(Sender: TObject; const idSensor: WideString); begin writeLog ('Sensor: ' + idSensor + '. Event: Unplugged.'); GrFingerXCtrl1.CapStopCapture (idSensor); end;
59 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
FingerDown
This event is fired whenever a finger is placed over a plugged fingerprint reader. Prerequisites The capture module must have been previously initialized. At least one fingerprint reader started capturing fingerprint images.
Parameters
[in] idSensor The ID of the fingerprint reader that raised the event.
Declaration
C++ .NET
void [Control Name]_FingerDown(System::Object * sender, _IGrFingerXCtrlEvents_FingerDownEvent * e)
C#
void [Control Name]_FingerDown(object sender, [Library Name]._IGrFingerXCtrlEvents_FingerDownEvent e)
VB6
Sub [Control Name]_FingerDown(ByVal idSensor As String)
VB .NET
Sub [Control Name]_FingerDown(ByVal sender As System.Object, ByVal e As [Library Name]._IGrFingerXCtrlEvents_FingerDownEvent) Handles [Control Name].FingerDown
Delphi
procedure [Control Name]FingerDown(Sender: TObject; const idSensor: WideString);
Sample Code
C++ .NET
// A finger was placed over the reader private: System::Void axGrFingerXCtrl2_FingerDown(System::Object * sender, _IGrFingerXCtrlEvents_FingerDownEvent * WriteLog(String::Concat(S"Sensor: " , e->idSensor , ". Event: Finger Placed.")); } e) {
C#
// A finger was placed over the reader private void axGrFingerXCtrl1_FingerDown(object sender, AxGrFingerXLib._IGrFingerXCtrlEvents_FingerDownEvent e) { WriteLog("Sensor: " + e.idSensor + ". Event: Finger Placed."); }
VB6
' A finger was placed over the reader Private Sub GrFingerXCtrl1_FingerDown(ByVal idSensor As String) writeLog ("Sensor: " & idSensor & ". Event: Finger Placed.") End Sub
VB .NET
' A finger was placed over the reader Private Sub AxGrFingerXCtrl1_FingerDown(ByVal sender As System.Object, ByVal e As AxGrFingerXLib._IGrFingerXCtrlEvents_FingerDownEvent) Handles AxGrFingerXCtrl1.FingerDown WriteLog("Sensor: " & e.idSensor & ". Event: Finger Placed.") End Sub
Delphi
// A finger was placed over the reader procedure TGrFingerXCtrl1FingerDown(Sender: TObject; const idSensor: WideString); begin writeLog ('Sensor: ' + idSensor + '. Event: Finger Placed.'); end;
FingerUp
This event is fired whenever a finger is removed from a plugged fingerprint reader. Prerequisites The capture module must have been previously initialized. At least one fingerprint reader started capturing fingerprint images.
Parameters
[in] idSensor The ID of the fingerprint reader that raised the event.
Declaration
C++ .NET
void [Control Name]_FingerUp(System::Object * sender, _IGrFingerXCtrlEvents_FingerUpEvent * e)
C#
void [Control Name]_FingerUp(object sender, [Library Name]._IGrFingerXCtrlEvents_FingerUpEvent e)
VB6
Sub [Control Name]_FingerUp(ByVal idSensor As String)
VB .NET
Sub [Control Name]_FingerUp(ByVal sender As System.Object, ByVal e As [Library Name]._IGrFingerXCtrlEvents_FingerUpEvent) Handles [Control Name].FingerUp
Delphi
procedure [Control Name]FingerUp(Sender: TObject; const idSensor: WideString);
Sample Code
C++ .NET
// A finger was removed over the reader
60 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
e) {
private: System::Void axGrFingerXCtrl2_FingerUp(System::Object * sender, _IGrFingerXCtrlEvents_FingerUpEvent * WriteLog(String::Concat(S"Sensor: " , e->idSensor , ". Event: Finger removed.")); }
C#
// A finger was removed over the reader private void axGrFingerXCtrl1_FingerUp(object sender, AxGrFingerXLib._IGrFingerXCtrlEvents_FingerUpEvent e) { WriteLog("Sensor: " + e.idSensor + ". Event: Finger removed."); }
VB6
' A finger was removed over the reader Private Sub GrFingerXCtrl1_FingerUp(ByVal idSensor As String) writeLog ("Sensor: " & idSensor & ". Event: Finger removed.") End Sub
VB .NET
' A finger was removed over the reader Private Sub AxGrFingerXCtrl1_FingerUp(ByVal sender As System.Object, ByVal e As AxGrFingerXLib._IGrFingerXCtrlEvents_FingerUpEvent) Handles AxGrFingerXCtrl1.FingerUp WriteLog("Sensor: " & e.idSensor & ". Event: Finger removed.") End Sub
Delphi
// A finger was removed over the reader procedure TGrFingerXCtrl1FingerUp(Sender: TObject; const idSensor: WideString); begin writeLog ('Sensor: ' + idSensor + '. Event: Finger removed.'); end;
ImageAcquired
This event is fired whenever a fingerprint image is acquired from a plugged fingerprint reader. Prerequisites The capture module must have been previously initialized. At least one fingerprint reader started capturing fingerprint images.
Parameters
[in] idSensor The ID of the fingerprint reader that raised the event.
[in] width
[in] height
[in] res
See also
Fingerprint Image Format
Declaration
C++ .NET
void [Control Name]_ImageAcquired(System::Object * sender, _IGrFingerXCtrlEvents_ImageAcquiredEvent * e)
C#
void [Control Name]_ImageAcquired(object sender, [Library Name]._IGrFingerXCtrlEvents_ImageAcquireEvent e)
VB6
Sub [Control Name]_ImageAcquired(ByVal idSensor As String, ByVal width As Long, ByVal height As Long, rawImage As Variant, ByVal res As Long)
VB .NET
Sub [Control Name]_ImageAcquired(ByVal sender As System.Object, ByVal e As [Library Name]._IGrFingerXCtrlEvents_ImageAcquiredEvent) Handles [Control Name].ImageAcquired
Delphi
procedure [Control Name]ImageAcquired(Sender: TObject; const dSensor: WideString; width, height: Integer; var rawImage: OleVariant; res: Integer);
Sample Code
C++ .NET
private: System::Void axGrFingerXCtrl2_ImageAcquired(System::Object * // Copying acquired image _raw->img = e->rawImage; _raw->height = e->height; _raw->width = e->width; _raw->Res = e->res; sender, _IGrFingerXCtrlEvents_ImageAcquiredEvent * e) {
// Signaling that an Image Event occurred. WriteLog(String::Concat(S"Sensor: ", Convert::ToString(e->idSensor), S". Event: Image captured.")); // display the fingerprint image PrintBiometricDisplay(false, GR_DEFAULT_CONTEXT); }
C#
private void axGrFingerXCtrl1_ImageAcquired(object sender, AxGrFingerXLib._IGrFingerXCtrlEvents_ImageAcquiredEvent e) { // Copying acquired image _raw.img = e.rawImage; _raw.height = (int) e.height; _raw.width = (int) e.width; _raw.Res = e.res; // Signaling that an Image Event occurred. WriteLog("Sensor: " + e.idSensor + ". Event: Image captured."); // display the fingerprint image PrintBiometricDisplay(false, GRConstants.GR_DEFAULT_CONTEXT);
61 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
VB6
Private Sub GrFingerXCtrl1_ImageAcquired(ByVal idSensor As String, ByVal width As Long, ByVal height As Long, rawImage As Variant, ByVal res As Long) ' Copying acquired image With raw .img = rawImage .height = height .width = width .res = res End With ' Signaling that an Image Event occurred. writeLog ("Sensor: " & idSensor & ". Event: Image captured.") ' display the fingerprint image Call PrintBiometricDisplay(False, GR_DEFAULT_CONTEXT) End Sub
VB .NET
Private Sub AxGrFingerXCtrl1_ImageAcquired(ByVal sender As System.Object, ByVal e As AxGrFingerXLib._IGrFingerXCtrlEvents_ImageAcquiredEvent) Handles AxGrFingerXCtrl1.ImageAcquired ' Copying acquired image raw.height = e.height raw.width = e.width raw.res = e.res raw.img = e.rawImage ' Signaling that an Image Event occurred. WriteLog("Sensor: " & e.idSensor & ". Event: Image captured.") ' display the fingerprint image PrintBiometricDisplay(False, GRConstants.GR_DEFAULT_CONTEXT) End Sub
Delphi
procedure TGrFingerXCtrl1ImageAcquired(Sender: TObject; const idSensor: WideString; width, height: Integer; var rawImage: OleVariant; res: Integer); begin // Copying acquired image raw.height := height; raw.width := width; raw.res := res; raw.img := rawImage; // Signaling that an Image Event occurred. writeLog ('Sensor: ' + idSensor + '. Event: Image captured.'); // display the fingerprint image PrintBiometricDisplay(false, GR_DEFAULT_CONTEXT); end;
FingerprintSdk.Net
Troubleshooting
Extraction returns GR_NOT_ENOUGH_SPACE Reader doesn't work Identification problems
62 of 63
3/4/2009 14:33
http://www.griaulebiometrics.com/page/pt-br/book/export/html/361
Problem: The extraction funcion always returns GR_NOT_ENOUGH_SPACE. What does that mean? Solution: You must pass an already allocated byte array to the extraction function. If the array size is smaller than the resulting template size, the GR_NOT_ENOUGH_SPACE error code is returned. To avoid such situation, create such array with the size of GR_MAX_SIZE_TEMPLATE bytes.
Problem: My fingerprint reader doesn't work. Solution: Make sure that your fingerprint reader is plugged into the computer, that it is compatible with your operating system and that its driver is installed. For further information, check the Fingerprint Readers Installation section.
Identification problems
Problem: Identification process fails most of (or all) the time. Solution: Most identification errors are caused by bad fingerprint enrollments. Some tips for a good fingerprint enrollment: 1. 2. 3. 4. 5. Use the index finger whenever possible; Check if the finger has any scars or is wounded in some way. Choose another finger if necessary (preferably the middle one, otherwise the ring finger); Ask the person to place the center of his/her finger in the center of the fingerprint reader and apply some pressure; Depending on the fingerprint reader, the person may have to keep the finger upon the reader from 1 to 3 seconds; Make sure that the enrollment was good by asking the person to put his/her finger again in the fingerprint reader, and then try to identify him/her.
63 of 63
3/4/2009 14:33