Face Recognition, Liveness Detection SDK Android Demo
This repository contains a demonstration of Recognito's face recognition SDK for Android. The SDK includes advanced features such as face recognition, liveness detection, and pose estimation. Recognito's face recognition algorithm has been ranked as the Top 1 in the NIST FRVT (Face Recognition Vendor Test).
For more details and documentation, visit https://docs.recognito.vision/.
Recognito Youtube Channel: youtube.com/@Recognito-Ltd
To use the Recognito SDK in your Android project, follow these steps:
libfacesdk
into the projectbuild.gradle
and settings.gradle
files:
https://github.com/Recognito-Vision/Face-SDK-Android-Demo/blob/601379c51970400b5c90972854b3468beef683ea/app/build.gradle#L50-L52
https://github.com/Recognito-Vision/Face-SDK-Android-Demo/blob/601379c51970400b5c90972854b3468beef683ea/settings.gradle#L17-L19
For trial license, share your application ID. https://github.com/Recognito-Vision/Face-SDK-Android-Demo/blob/601379c51970400b5c90972854b3468beef683ea/app/build.gradle#L6-L15
Add your license to assets/license
file:
https://github.com/Recognito-Vision/Face-SDK-Android-Demo/blob/601379c51970400b5c90972854b3468beef683ea/app/src/main/assets/license?plain=1#L1-L5
Initialize SDK with license. https://github.com/Recognito-Vision/Face-SDK-Android-Demo/blob/601379c51970400b5c90972854b3468beef683ea/app/src/main/java/com/bio/facerecognition/MainActivity.kt#L39-L47
Initialization status codes:
Code | Status |
---|---|
0 | Activate SDK successfully |
-1 | License Key Error |
-2 | License AppID Error |
-3 | License Expired |
-4 | Activate Error |
-5 | Init SDK Error |
public static native int setActivation(String var0);
Parameters
var0
: The license string.public static native int init(AssetManager var0);
Parameters
var0
: An instance of AssetManager used to access application assets.public static native Bitmap yuv2Bitmap(byte[] nv21, int width, int height, int orientation);
Parameters
nv21
: Byte array representing the YUV image data in NV21 format.
width
: Width of the image.
height
: Height of the image.
orientation
: Orientation of the image
Value | Orientation |
---|---|
1 | No processing |
2 | Flip horizontally |
3 | Flip horizontally first and then flip vertically |
4 | vertical flip |
5 | transpose |
6 | Rotate 90° clockwise |
7 | Horizontal and vertical flip --> transpose |
8 | Rotate 90° counterclockwise |
Return Value: A Bitmap object representing the converted image.
public static native List<FaceBox> faceDetection(Bitmap var0, FaceDetectionParam var1);
Parameters
var0
: The Bitmap image.var1
: Parameters for face detectionpublic class FaceDetectionParam {
public boolean check_liveness = false;
public int check_liveness_level = 0; // 0: more accurate model, 1: lighter model
}
public class FaceBox {
public int x1;
public int y1;
public int x2;
public int y2;
public float liveness;
public float yaw;
public float roll;
public float pitch;
}
public static native byte[] templateExtraction(Bitmap var0, FaceBox var1);
Parameters
var0
: The Bitmap imagevar1
: The bounding box (FaceBox
) of the detected face.public static native float similarityCalculation(byte[] var0, byte[] var1);
Parameters
var0
: The byte array representing the first face template.var1
: The byte array representing the second face template.For any questions, issues, or feature requests, please contact our support team.