Copyright © 2005–2011 Luxand, Inc. http://www.luxand.com
1
Luxand, Inc.
http://www.luxand.com
Luxand FaceSDK
4.0
Face Detection and Recognition Library
Developer’s Guide
Copyright © 2005–2011 Luxand, Inc. http://www.luxand.com
2
Table of Contents
Overview ................................................................................................................................... 5
Requirements ............................................................................................................................ 5
Technical Specifications ........................................................................................................... 5
Face Detection ................................................................................................................................................... 5
Face Matching ................................................................................................................................................... 6
Facial Feature Detection .................................................................................................................................. 6
Eye Centers Detection ...................................................................................................................................... 6
Multi-Core Support ........................................................................................................................................... 6
Library Size ....................................................................................................................................................... 6
Installation ................................................................................................................................ 6
Windows ............................................................................................................................................................ 6
Linux/Mac OS X ................................................................................................................................................ 7
Directory Structure ............................................................................................................................................. 7
Sample Applications ................................................................................................................. 7
Using FaceSDK with Programming Languages .................................................................... 8
Using with .NET (C# and VB) ........................................................................................................................... 9
Using CImage class in .NET ............................................................................................................................ 10
CImage(); .................................................................................................................................................... 10
CImage(Int); ................................................................................................................................................ 10
CImage.ReloadFromHandle(); .................................................................................................................... 10
Using with C/C++ ............................................................................................................................................ 10
Using with Delphi ............................................................................................................................................ 11
Using with Java ................................................................................................................................................ 11
Using with Cocoa ............................................................................................................................................. 12
Using with Visual Basic 6.0 ............................................................................................................................. 12
Unicode support ............................................................................................................................................... 12
Redistributables ...................................................................................................................... 12
Usage Scenarios ...................................................................................................................... 12
Library Activation .................................................................................................................. 13
FSDK_GetHardware_ID Function ................................................................................................................... 14
FSDK_ActivateLibrary Function ..................................................................................................................... 14
FSDK_GetLicenseInfo Function ...................................................................................................................... 15
Initialization ............................................................................................................................ 15
FSDK_Initialize Function ................................................................................................................................ 15
FSDK_Finalize Function .................................................................................................................................. 16
Working with Images ............................................................................................................. 16
FSDK_CreateEmptyImage Function................................................................................................................ 17
FSDK_LoadImageFromFile Function.............................................................................................................. 17
FSDK_LoadImageFromFileW Function .......................................................................................................... 18
FSDK_SaveImageToFile Function .................................................................................................................. 19
FSDK_SaveImageToFileW Function .............................................................................................................. 19
FSDK_LoadImageFromBuffer Function ......................................................................................................... 20
FSDK_LoadImageFromJpegBuffer Function .................................................................................................. 21
FSDK_LoadImageFromPngBuffer Function ................................................................................................... 22
FSDK_GetImageBufferSize Function .............................................................................................................. 22
FSDK_SaveImageToBuffer Function .............................................................................................................. 23
FSDK_LoadImageFromHBitmap Function ..................................................................................................... 23
FSDK_SaveImageToHBitmap Function .......................................................................................................... 24
Copyright © 2005–2011 Luxand, Inc. http://www.luxand.com
3
FSDK.LoadImageFromCLRImage Function ................................................................................................... 24
FSDK.SaveImageToCLRImage Function ........................................................................................................ 25
FSDK.LoadImageFromAWTImage Function .................................................................................................. 25
FSDK.SaveImageToAWTImage Function ...................................................................................................... 25
FSDK_SetJpegCompressionQuality ................................................................................................................ 26
FSDK_GetImageWidth Function ..................................................................................................................... 26
FSDK_GetImageHeight Function .................................................................................................................... 27
FSDK_CopyImage Function ............................................................................................................................ 28
FSDK_ResizeImage Function .......................................................................................................................... 28
FSDK_RotateImage Function .......................................................................................................................... 29
FSDK_RotateImageCenter Function................................................................................................................ 30
FSDK_RotateImage90 Function ...................................................................................................................... 31
FSDK_CopyRect Function............................................................................................................................... 31
FSDK_CopyRectReplicateBorder Function..................................................................................................... 32
FSDK_MirrorImage Function .......................................................................................................................... 33
FSDK_FreeImage Function ............................................................................................................................. 34
Face Detection ......................................................................................................................... 34
Data types ......................................................................................................................................................... 35
FSDK_DetectFace Function............................................................................................................................. 36
FSDK_DetectMultipleFaces Function ............................................................................................................. 37
FSDK_SetFaceDetectionParameters Function ................................................................................................. 38
FSDK_SetFaceDetectionThreshold Function .................................................................................................. 39
Facial Feature Detection ........................................................................................................ 40
FSDK_DetectFacialFeatures Function ............................................................................................................. 41
FSDK_DetectFacialFeaturesInRegion Function .............................................................................................. 42
FSDK_DetectEyes Function ............................................................................................................................ 43
FSDK_DetectEyesInRegion Function.............................................................................................................. 44
Detected Facial Features .................................................................................................................................. 46
Face Matching ........................................................................................................................ 50
FSDK_GetFaceTemplate ................................................................................................................................. 51
FSDK_GetFaceTemplateInRegion................................................................................................................... 51
FSDK_GetFaceTemplateUsingEyes ................................................................................................................ 52
FSDK_MatchFaces .......................................................................................................................................... 53
FSDK_GetMatchingThresholdAtFAR ............................................................................................................. 54
FSDK_GetMatchingThresholdAtFRR ............................................................................................................. 55
Working with Cameras .......................................................................................................... 56
Data Types ....................................................................................................................................................... 56
FSDK_InitializeCapturing Function ................................................................................................................ 57
FSDK_FinalizeCapturing Function .................................................................................................................. 58
FSDK_SetCameraNaming Function ................................................................................................................ 58
FSDK_GetCameraList Function ...................................................................................................................... 59
FSDK_GetCameraListEx Function .................................................................................................................. 60
FSDK_FreeCameraList Function ..................................................................................................................... 61
FSDK_GetVideoFormatList Function ............................................................................................................. 61
FSDK_FreeVideoFormatList Function ............................................................................................................ 62
FSDK_SetVideoFormat Function .................................................................................................................... 62
FSDK_OpenVideoCamera Function ................................................................................................................ 63
FSDK_OpenIPVideoCamera Function ............................................................................................................ 64
FSDK_SetHTTPProxy Function ...................................................................................................................... 65
FSDK_GrabFrame Function ............................................................................................................................ 65
FSDK_CloseVideoCamera Function ............................................................................................................... 66
Multi-Core Support ................................................................................................................ 67
FSDK_GetNumThreads Function .................................................................................................................... 67
FSDK_SetNumThreads Function ..................................................................................................................... 68
Copyright © 2005–2011 Luxand, Inc. http://www.luxand.com
4
Thread Safety .......................................................................................................................... 68
Migration from FaceSDK 3.0 ................................................................................................ 69
Deprecated Functions ............................................................................................................ 70
Error Codes ............................................................................................................................ 70
Library Information .............................................................................................................. 71
Copyright © 2005–2011 Luxand, Inc. http://www.luxand.com
5
Overview
Luxand FaceSDK is a cross-platform face detection and recognition library that can be easily
integrated into the customer’s application. FaceSDK offers the API (Application
Programming Interface) to detect a face and facial features and to match faces. The SDK
provides the coordinates of 66 facial feature points (including eyes, eyebrows, mouth, nose
and face contours). Luxand FaceSDK use multiple processor cores to speed up recognition.
The library supports DirectShow-compatible web cameras and IP cameras with an MJPEG
interface.
Luxand FaceSDK is a dynamic link library available for 32-bit and 64-bit versions of
Windows and Linux, and 64-bit MacOS X. The SDK contains interface header files and
sample applications for C++, Microsoft Visual C++ 6.0/2005/2008, Visual Basic .NET
2005/2008, Microsoft C# .NET 2005/2008, Borland Delphi 6.0/7.0, Java, Visual Basic 6.0
and C++Builder 6.0.
Requirements
The FaceSDK library supports the following platforms:
Windows 2000/XP/2003/Vista/2008, Windows 7, Windows 8
Linux (RHEL 5+, CentOS 5+ and other)
Mac OS X 10.5+ x86_64
An Intel processor is recommended for better performance.
Minimum system requirements:
1 GHz processor
256 MB RAM
Recommended system requirements:
Intel Core i7 or Xeon processor
2 GB RAM
DirectShow-compatible webcam
IP camera with MJPEG interface (like AXIS IP cameras)
Note that the web camera functions are available only for the Windows platform. IP cameras
are accessible within all supported platforms.
Technical Specifications
The FaceSDK library has the following technical specifications:
Face Detection
Robust frontal face detection
Detection of multiple faces in a photo
Head rotation support: –30..30 degrees of in-plane rotation and –30..30 degrees out-
of-plane rotation
Determines in-plane face rotation angle
Detection speed: as fast as 241 frames per second
*
, depending on resolution