Luxand FaceSDK – Using with .NET (C# and VB)
You need to have .NET Framework 4.0 on your system.
For Microsoft .NET applications, you need to add the .NET component into your project.
Follow these steps to add the component in Visual Studio 2010+:
- Select Project – Add Reference – Browse
- For 32-bit applications, choose the file bin\win32\FaceSDK.NET.dll
- For 64-bit native applications, choose the file bin\win64\FaceSDK.NET.dll
- Add the following statement to the beginning of your application:
After that you may use the methods of the Luxand.FSDK namespace for general FaceSDK functions, and Luxand.FSDKCam namespace for webcam-related functions. You may refer just to FSDK and FSDKCam namespaces if using Luxand is specified.
Once FaceSDK.NET.dll is added to the references, it will be redistributed automatically with your application, so no specific deployment actions are required. You do not need to redistribute facesdk.dll with your application. However, you need to redistribute Microsoft Visual C++ Redistributable for Visual Studio 2017.
By default, the documentation refers to C/C++ declarations of FaceSDK functions. For example, the function to detect a face is referred to as FSDK_DetectFace function. To refer to this function in .NET, replace the FSDK_ prefix with FSDK. namespace. Thus, the reference to this function becomes FSDK.DetectFace (note that webcam-specific functions are located in the FSDKCam. namespace; refer to Working with Cameras for details).
If you are using an older version of .NET (for example, 2.0, 3.0 or 3.5) or just need a component for a specific .NET version, you may use the source code available in the samples\advanced\.NET wrapper directory. Note that this component is actually a wrapper for facesdk.dll that is linked dynamically, so facesdk.dll must be redistributed with the application that uses this wrapper. The LiveRecognition sample includes projects for Microsoft C# 2005/2008 and Visual Basic .NET 2005/2008 that are using this wrapper.