Sample Application
1:N Face Identification and Liveness Detection SDK Android Demo
Last updated
1:N Face Identification and Liveness Detection SDK Android Demo
Last updated
Open the FaceRecognition
project in Android Studio.
Add license to assets/license
file:
BsTr9o4f4R/rM3TxbCWVb/hrOJuOIdz8ArQ/t2IgQFFUQzGHOLNNaMJiK/fUfr5zo005zoTA/cm6
VoZ6iGl+/hZGA3R5T/VWwhxekbw8JVz9sNesU6rMG5+1cNSN75trH2tpzdCPZ28ZDnZlttmiuUoC
9QazRe1xKi5tUXa+xgIxzL0vE6UW2dLKWaEXjn3fSJfLxXWw0q+UZP0hQAXb5Y9Yl/NVi7y3d0xT
Vq6/weuMQkgLcNdLqFRvQXup0M9W/pvuhaubySAxHCKVY8wToygN2iM78cOkyyAbGVwZeGQP0Jfd
46VZo+w+KCNw355j3osVVMghrOcVZnfbp1dNyg==
Build Project.
Import FaceSDK
import com.bio.facesdk.FaceBox
import com.bio.facesdk.FaceDetectionParam
import com.bio.facesdk.FaceSDK
Activate and Initialize FaceSDK
var ret = FaceSDK.setActivation(license_str)
if (ret == FaceSDK.SDK_SUCCESS) {
ret = FaceSDK.init(assets)
}
YUV to Bitmap for camera frame
override fun process(frame: Frame) {
val bitmap = FaceSDK.yuv2Bitmap(frame.image, frame.size.width, frame.size.height, cameraOrientation)
...
Set FaceDetectionParam
and Detect Face
val faceDetectionParam = FaceDetectionParam()
faceDetectionParam.check_liveness = true
faceDetectionParam.check_liveness_level = SettingsActivity.getLivenessModelType(this)
faceDetectionParam.check_eye_closeness = true // available for pro version
faceDetectionParam.check_face_occlusion = true // available for pro version
faceDetectionParam.check_mouth_opened = true // available for pro version
faceDetectionParam.estimate_age_gender = true // available for pro version
var faceBoxes: List<FaceBox>? = FaceSDK.faceDetection(bitmap, faceDetectionParam)
Extract Face Template
val faceBox = faceBoxes[0]
val templates = FaceSDK.templateExtraction(bitmap, faceBox)
Calculate Similarity
val similarity = FaceSDK.similarityCalculation(templates, person.templates)