Highlighted
Absent Member.
Absent Member.
2913 views

[archive] Biometric Solution?

[Migrated content. Thread originally posted on 02 March 2010]

Hi all, I am trying to get a biometric solution up and running with Acucobol!

I am using the Griaule Fingerprint SDK 2009 active x control with a Futronic FS80 model.

I am afraid I have spun myself into a web of confusion, I can Initialize, Create Context, Capture Initialize, Start Capture and record all events but I can not get much further than that?

Has anyone got any suggestions or should I just pass the buck to the Java Programmer?

Griaule SDK Documentation Link
http://www.griaulebiometrics.com/page/en-us/manual/fingerprint-sdk/programming-reference-guide/activex
I have attached the generated def file...

I am not sure how to define the following...

* BiometricDisplay
* method BiometricDisplay
METHOD, 22, @BiometricDisplay,
"SAFEARRAY(unsigned char)*" @tptQuery, TYPE 16401,
"VARIANT*" @rawImage, TYPE 16396,

"long" @width, TYPE 3,
"long" @height, TYPE 3,
"long" @res, TYPE 3,
"long" @hdc, TYPE 3,
"IPictureDisp**" @handler, TYPE 16413,
"long" @matchContext, TYPE 3
RETURNING "long", TYPE 3

The documentation from Griaule is as follows:

Returns a picture display handle (IPictureDisp) to the supplied raw grayscale fingerprint image with its minutiae, segments and minutiae direction drawn.

PrerequisitesThe Fingerprint SDK library must have been previously initialized.


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

[in] tptTemplate corresponding to the raw grayscale fingerprint image supplied.
[in] rawImageA raw grayscale fingerprint image.
[in] widthFingerprint image width in pixels.
[in] heightFingerprint image height in pixels.
[in] resFingerprint image resolution in DPI.
[in] hdcThe device context handle (HDC) in which the picture will be created.
[out] handleThe fingerprint picture display handle (IPictureDisp).
[in] matchContextTo 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).

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 Long) As LongVB .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 matchContext As Integer) As LongDelphi
function BiometricDisplay(var tptQuery: PSafeArray; var rawImage: OleVariant; width: Integer; height: Integer; res: Integer; hdc: integer; var handler: IPictureDisp; matchContext: Integer): Integer;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.
int Res;
};
stdole::IPictureDisp *handle;
// screen HDC
Graphics *g = _btEnroll->CreateGraphics();
IntPtr hdc = g->GetHdc();
_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;
// Template size
size: Integer;
// Template ID (if retrieved from DB)
id: Integer;
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);



Any help or guidance will be appreciated?
0 Likes
6 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Biometric Solution?

Assuming this to be an ActiveX, I presume you will create an instance of it in
screen section, let us assume this is screen-01 and the handle of the activex
is BioX.
Thus,

In working storage, I would:
77  MyPic USAGE HANDLE OF IPictureDisp. | This is declared in Acuclass.def
77  hdc PIC X(4) COMP-N.
77  hwnd PIC X(4) COMP-N.
01  MySafeArray.
    05 MyItem     USAGE HANDLE OF VARIANT OCCURS 1.
in PROCEDURE DIVISON, I would:
DISPLAY screen-01
CALL "C$SETVARIANT" USING 0 MyItem(1)
MOVE x"00000000" TO hdc hwnd
CALL "USER32.DLL@WINAPI"
CALL "GetDC" Using BY VALUE hwnd GIVING hdc
MODIFY BioX   @Initialize()
MODIFY BioX   @CapInitialize()
MODIFY BioX   BioMetricDisplay(MySafeArray, 0, 0, 0, 0, hdc, MyPic, GR_NO_CONTEXT)
MODIFY BioX   @Finalize()
MODIFY BioX   @CapFinalize()
CALL "ReleaseDC" USING BY VALUE hwnd BY VALUE hdc.
Why do I do this?
Well, examples from the web site suggests the 5 first parameters are optional.
But you may want to verify this with the component vendor.

MyPic is what will provide you with the image as a IPictureDisp control.
We use the Windows API to get the HDC of the desktop because the example does
this.

Here is a more comprehensive vb example:
http://www.devx.com/security/Article/31576/1763?supportItem=10

However, as you can tell from the vb example above, you still have some way
to go, this of course depending on what you want to achieve.

Gets you started though.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Biometric Solution?

Many thanks, I will have a look at it within the next couple of days, it is an activex.

Essentially all I want to do, is save the image of the fingerprint from the scanner, and with that either enroll/register it (for future use) or validate it against registered fingerprints.

Will have a look at the above link and hopefully be in back in touch with good news
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Biometric Solution?

Sorry for the late reply, but I keep getting a "Bad variable type" error
when the following line executes
MODIFY BioX BioMetricDisplay(MySafeArray, 0, 0, 0, 0, hdc, MyPic, GR_NO_CONTEXT
,
am I doing something else wrong ???

I have even tried taking out all my other code and just running your code, same story.
This is soul crushing, LOL.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Biometric Solution?

Hi, my code is incomplete, just a quick draft so I would not anticipate it to work right away anyways.

Evidently one or more of the parameters are not accepted. With the limited documentation that is available, it is hard to tell which is the problem, but experimenting with each.

One thing I find really odd, is that the first parameter, has a textual claim to be a SAFEARRAY, but when you decode the TYPE #, this is VT-BYREF | VT-BOOL, e.g. address of a bool element.

I think it will be difficult to figure this out, without involving the vendors of the component and spending time on this.

You may have to contact technical support and inquire for professional services on this one.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Biometric Solution?

We decided to go the java route, which made things a lot easier on everyone... However I can honestly say that if you want to get a biometric solution up and running with Acu, instead of using any Griaule Fingerprint SDK's rather have a look at the DigitalPersona SDK.

That’s what we have got up and running and the manuals are much more helpful! Due to time constraints we went the java route but when we have more time, I would like to revisit it through the Acu ActiveX, I believe it can be achieved!
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Biometric Solution?

Thanks for sharing this 🙂
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.