Face Detection - Face Recognition Api Development- HUAWEI Developer

Capability Introduction

Landmark extraction, precise comparison

This API detects human faces in images and maps the faces according to a high-precision rectangular grid. It can be used as the key module for screen unlocking or locking apps, as well as a wide range of scenarios that require facial recognition, including face unlock, face clustering, and facial beautification. Specific locations on a human face can be beautified, based on their positioning relative to key facial features.
Scenarios

Similarity comparison, identity authentication

This API detects human faces based on a grid-based system, and can be applied in features such as face unlock, face clustering, and facial beautification.

Face unlock

This function can be used as the key module for implementing app and screen locking or unlocking functions.

Face Clustering and Retouching

Extracts the key features of human faces for portrait classification in the album and deep face beautification.

Description

Request
Copy

FaceDetector faceDetector = new FaceDetector(this);
Frame frame = new Frame();
frame.setBitmap(bitmap);
JSONObject jsonObject = faceDetector.detect(frame,null);

Response
Copy

"x": 716,
"y": 226
},
"type": 4
}],



"pitch": -25.060776,
"probability":



0.9999994,
"roll": 15.092653,
"yaw": 1.7165642
},



{
"faceRect": {
"height": 201,
"left":



79,
"top": 189,
"width": 168
},
"id": 1,
"landmarks":



[{
"position": {
"x": 142,
"y": 280
},
"type": 0
},



{
"position": {
"x": 203,
"y": 261
},
"type": 1
},



{
"position": {
"x": 188,
"y": 308
},
"type": 2
},



{
"position": {
"x": 152,
"y": 335
},
"type": 3
},



{
"position": {
"x": 207,
"y": 319
},
"type": 4
}
],



"pitch": -19.327066,
"probability"



: 0.99999964,
"roll": 16.324646,
"yaw": -21.680126
}
]
}

Start development here with Huawei

Service introduction

Service overview, application scenarios, and functions
Learn more

Access preparation

Preparation for access, such as registration, authentication, and agreement signing
Learn more

Sample code

Demonstration of sample code
Learn more

API description

Interface parameter definition, description, restrictions, and constraints
Learn more
FAQ
1Can I call the faceCompare() method without calling the prepare() method of the API?

Yes, you can. The engine is started by default in the faceCompare() method. If the engine has already been started, it will not restart.

2When should I call the release() method?

The release() method will uninstall a model that has been loaded to the NPU chip. If the app is no longer using face detection, uninstall the model in a timely manner to free up resources.