Skip to content

Commit 05b8c59

Browse files
committed
Create README.md
0 parents  commit 05b8c59

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# FaceLivenessDetection-Android
2+
3+
## Introduction
4+
This demo showcases a 3D passive liveness detection technique for detecting spoofed faces.
5+
6+
In real-time, a single image captured from the Android camera computes a liveness score.
7+
8+
## Try the APK
9+
10+
You can test the demo APK by following the link below:
11+
12+
https://drive.google.com/file/d/1U7-wHmRYb8VV32kOb6JdG_sdZA_3bSLe/view?usp=sharing
13+
14+
## SDK License
15+
16+
This project uses kby-ai's liveness detection SDK. The SDK requires a license per application ID.
17+
18+
- The code below shows how to use the license: https://github.com/kby-ai/FaceLivenessDetection-Android/blob/e5ca47f69de1159db81ca68908e039c45c022f8b/app/src/main/java/com/kbyai/facelivedemo/CameraActivity.java#L69-L77
19+
20+
- To request a license, please contact us:
21+
```
22+
Email: kbyai200914@gmail.com
23+
24+
Skype: live:.cid.66e2522354b1049b
25+
26+
Telegram: kbyai
27+
28+
WahtsApp: +19092802609
29+
```
30+
31+
## About SDK
32+
33+
### Set up
34+
1. Copy the SDK (libfacesdk folder) to the root folder of your project.
35+
36+
2. Add SDK to the project in settings.gradle
37+
```
38+
include ':libfacesdk'
39+
```
40+
41+
3. Add dependency to your build.gradle
42+
```
43+
implementation project(path: ':libfacesdk')
44+
```
45+
46+
### Initializing an SDK
47+
48+
- Step One
49+
50+
To begin, you need to activate the SDK using the license that you have received.
51+
```
52+
FaceSDK.setActivation("...")
53+
```
54+
55+
If activation is successful, the return value will be SDK_SUCCESS. Otherwise, an error value will be returned.
56+
57+
- Step Two
58+
59+
After activation, call the SDK's initialization function.
60+
```
61+
FaceSDK.init(getAssets());
62+
```
63+
If initialization is successful, the return value will be SDK_SUCCESS. Otherwise, an error value will be returned.
64+
65+
### Face Detection and Liveness Detection
66+
67+
The FaceSDK offers a single function for detecting face and liveness detection, which can be used as follows:
68+
```
69+
FaceSDK.faceDetection(bitmap)
70+
```
71+
72+
This function takes a single parameter, which is a bitmap object. The return value of the function is a list of FaceBox objects. Each FaceBox object contains the detected face rectangle, liveness score, and facial angles such as yaw, roll, and pitch.
73+
74+
### Yuv to Bitmap
75+
The SDK provides a function called yuv2Bitmap, which converts a yuv frame to a bitmap. Since camera frames are typically in yuv format, this function is necessary to convert them to bitmaps. The usage of this function is as follows:
76+
```
77+
Bitmap bitmap = FaceSDK.yuv2Bitmap(nv21, image.getWidth(), image.getHeight(), 7);
78+
```
79+
The first parameter is an nv21 byte array containing the yuv data.
80+
81+
The second parameter is the width of the yuv frame, and the third parameter is its height.
82+
83+
The fourth parameter is the conversion mode, which is determined by the camera orientation.
84+
85+
To determine the appropriate conversion mode, the following method can be used:
86+
```
87+
1 2 3 4 5 6 7 8
88+
89+
888888 888888 88 88 8888888888 88 88 8888888888
90+
88 88 88 88 88 88 88 88 88 88 88 88
91+
8888 8888 8888 8888 88 8888888888 8888888888 88
92+
88 88 88 88
93+
88 88 888888 888888
94+
```

0 commit comments

Comments
 (0)