Skip to content

Commit 4de9186

Browse files
committed
add doc
1 parent 57d37f8 commit 4de9186

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

docs/using-with/c-cpp.md

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Whether it is C or C++, we recommend the use of a single CAPI header file + lib, because CAPI long-term maintenance is relatively stable, of course, there are C++ interfaces, specific reference to C++ header files.
44

5+
56
## Installation and Setup
67

78
You can download the precompiled inspireface library from the [release page](https://github.com/HyperInspire/InspireFace/releases), which includes the dynamic library +CAPI header by default. You need to link and include them in your project, using cmake as an example:
@@ -44,6 +45,8 @@ InspireFace's facial analysis algorithms are all concentrated in the session. Yo
4445

4546
Since the session contains some cache, **we recommend** using one session within a thread, and **we don't recommend** cross-using internal data from multiple sessions in tracking mode, as this can easily cause confusion. Sessions can be freely created and destroyed anywhere.
4647

48+
<img src="https://inspireface-1259028827.cos.ap-singapore.myqcloud.com/docs/pipeline.png">
49+
4750
### Create Session
4851

4952
When creating a session, there are some important parameters that need to be specified:
@@ -95,6 +98,8 @@ if (ret != HSUCCEED) {
9598

9699
Face detection is the first step in the analysis of faces, which requires the input of an image or frame:
97100

101+
![landmark](https://inspireface-1259028827.cos.ap-singapore.myqcloud.com/docs/feature/lmk.jpg)
102+
98103
```c
99104
// Load a image
100105
HFImageBitmap image;
@@ -172,11 +177,11 @@ if (ret != HSUCCEED) {
172177
}
173178
```
174179
180+
175181
### Face Landmark
176182
177183
Face landmark prediction can be used in any detection mode state, but it should be noted that if the detection mode is in **TRACK** state, you will get smoother facial landmark points. This is because the internal face tracking state landmark optimization filtering has been integrated. We provide two solutions: 5 basic key points and denser key points (more than 100 points).
178184
179-
![landmark](https://inspireface-1259028827.cos.ap-singapore.myqcloud.com/docs/feature/lmk.jpg)
180185
181186
```c
182187
// Set landmark smoothing ratio (only effective in TRACK mode!)
@@ -252,13 +257,34 @@ if (ret != HSUCCEED) {
252257
HFReleaseFaceFeature(&feature);
253258
```
254259
260+
### Face Pose Estimation
261+
262+
When you create a session with the **HF_ENABLE_FACE_POSE** option enabled, you can obtain face pose Euler angle values from the returned MultipleFaceData during face detection or tracking:
263+
264+
- **HFFaceEulerAngle**:
265+
- **roll**: Head rotation around the Z-axis (tilting left/right)
266+
- **yaw**: Head rotation around the Y-axis (turning left/right)
267+
- **pitch**: Head rotation around the X-axis (nodding up/down)
268+
269+
<img src="https://inspireface-1259028827.cos.ap-singapore.myqcloud.com/docs/feature/pose.jpg" alt="pose" style="max-width:250px;">
270+
271+
If you don't enable the **HF_ENABLE_FACE_POSE** option, you will get invalid values.
272+
273+
```c
274+
for (int index = 0; index < multipleFaceData.detectedNum; ++index) {
275+
HFloat roll = multipleFaceData.angles.roll[index];
276+
HFloat yaw = multipleFaceData.angles.yaw[index];
277+
HFloat pitch = multipleFaceData.angles.pitch[index];
278+
279+
HFLogPrint(HF_LOG_INFO, "face_index: %d, roll: %f, yaw: %f, pitch: %f", index, roll, yaw, pitch);
280+
}
281+
```
282+
255283
## Face Pipeline
256284

257285
If you want to access facial attribute functions such as Anti-Spoofing, mask detection, quality detection, and facial motion recognition, you need to call the Pipeline interface to execute these functions.
258286

259-
<img src="https://inspireface-1259028827.cos.ap-singapore.myqcloud.com/docs/feature/quality.jpg" alt="quality" style="max-width:200px;">
260-
<img src="https://inspireface-1259028827.cos.ap-singapore.myqcloud.com/docs/feature/attribute.jpg" alt="attribute" style="max-width:200px;">
261-
<img src="https://inspireface-1259028827.cos.ap-singapore.myqcloud.com/docs/feature/act.jpg" alt="action" style="max-width:200px;">
287+
<img src="https://inspireface-1259028827.cos.ap-singapore.myqcloud.com/docs/pip_bn.png" alt="quality" style="max-height:200px;">
262288

263289
### Execute the Face Pipeline
264290

@@ -287,9 +313,6 @@ if (ret != HSUCCEED) {
287313

288314
When you configure and execute a Pipeline with the Option containing **HF_ENABLE_LIVENESS**, you can obtain the RGB Anti-Spoofing detection confidence through the following method:
289315

290-
<img src="https://inspireface-1259028827.cos.ap-singapore.myqcloud.com/docs/feature/liveness.jpg" alt="liveness" style="max-width:512px;">
291-
292-
293316
```c
294317
HFRGBLivenessConfidence livenessConfidence;
295318
/* Get RGB liveness detection results from the pipeline cache */
@@ -300,6 +323,8 @@ if (ret != HSUCCEED) {
300323
}
301324
```
302325

326+
<img src="https://inspireface-1259028827.cos.ap-singapore.myqcloud.com/docs/feature/liveness.jpg" alt="liveness" style="max-width:220px;">
327+
303328
### Face Mask Detection
304329

305330
When you configure and execute a Pipeline with the Option containing **HF_ENABLE_MASK_DETECT**, you can obtain the face mask detection confidence through the following method:
@@ -613,6 +638,10 @@ cleanup:
613638

614639
We provide a lightweight face embedding vector database (**FeatureHub**) storage solution that includes basic functions such as adding, deleting, modifying, and searching, while supporting both **memory** and **persistent** storage modes.
615640

641+
::: tip
642+
Although we provide a lightweight vector storage and retrieval function, it is not necessary. If it cannot meet your performance requirements, we encourage you to manage the face embeddings yourself.
643+
:::
644+
616645
Before starting FeatureHub, you need to be familiar with the following parameters:
617646

618647
- **primaryKeyMode**: Primary key mode, with two modes available. It's recommended to use HF_PK_AUTO_INCREMENT by default

0 commit comments

Comments
 (0)