Detection example#
What it does#
This example demonstrates how to use the detector to get a face bbox (bounding box) and landmarks.
Prerequisites#
This example assumes that you have already read the FaceEngine Handbook (or at least have it somewhere nearby for reference) and know some core concepts, like memory management, object ownership, and life-time control. This sample will not explain these aspects in detail.
Example walkthrough#
To get familiar with FSDK usage and common practices, please go through example_extraction first.
How to run#
Use the following command to run the example.
./example_detection <some_image.ppm>
Example output#
simpleDetect. bbox only result:
Rect:
x = 296.598
y = 77.0892
w = 145.655
h = 206.526
score = 0.999943
simpleDetect. bbox and Landmarks5 result:
Rect:
x = 296
y = 77
w = 145
h = 206
score = 0.999943
Landmarks5:
x = 338.899 y = 157.901
x = 407.017 y = 161.499
x = 374.56 y = 199.138
x = 341.442 y = 238.993
x = 396.452 y = 242.443
simpleDetect. bbox, Landmarks5 and Landmarks68 result:
Rect:
x = 296
y = 77
w = 145
h = 206
score = 0.999943
Landmarks5:
x = 341 y = 157
x = 408 y = 160
x = 377.1 y = 216.248
x = 342.972 y = 237.357
x = 396.948 y = 238.631
Landmarks68:
x = 296.226 y = 154.527
x = 296.786 y = 176.751
x = 298.726 y = 198.489
x = 301.404 y = 219.905
x = 308.43 y = 241.047
x = 319.536 y = 259.856
x = 334.036 y = 275.579
x = 351.577 y = 287.055
x = 371.124 y = 289.996
x = 388.04 y = 284.708
x = 400.513 y = 271.055
x = 411.994 y = 255.058
x = 421.157 y = 237.496
x = 427.666 y = 219.142
x = 433.504 y = 200.254
x = 437.435 y = 181.18
x = 439.423 y = 161.023
x = 306.067 y = 147.31
x = 318.217 y = 133.185
x = 336.968 y = 128.427
x = 356.102 y = 130.611
x = 372.956 y = 137.662
x = 386.046 y = 139.238
x = 400.82 y = 133.647
x = 416.646 y = 133.024
x = 430.68 y = 138.276
x = 436.744 y = 150.804
x = 378.511 y = 156.42
x = 379.145 y = 171.631
x = 379.889 y = 186.692
x = 380.242 y = 202.458
x = 360.399 y = 210.427
x = 368.582 y = 213.492
x = 377.1 y = 216.248
x = 384.595 y = 214.076
x = 391.243 y = 211.185
x = 327.115 y = 156.714
x = 336.181 y = 152.848
x = 345.985 y = 153.112
x = 354.717 y = 159.279
x = 345.537 y = 160.245
x = 335.503 y = 160.111
x = 395.182 y = 161.174
x = 404.413 y = 155.724
x = 413.722 y = 156.424
x = 420.032 y = 160.665
x = 413.331 y = 163.648
x = 403.925 y = 163.023
x = 342.972 y = 237.357
x = 356.428 y = 237.022
x = 367.702 y = 236.126
x = 374.406 y = 238.745
x = 381.428 y = 236.774
x = 389.371 y = 238.498
x = 396.948 y = 238.631
x = 388.453 y = 246.945
x = 379.715 y = 250.657
x = 372.491 y = 251.414
x = 364.784 y = 250.295
x = 354.543 y = 246.516
x = 347.606 y = 238.363
x = 366.75 y = 239.997
x = 373.865 y = 241.541
x = 380.56 y = 240.759
x = 392.985 y = 239.555
x = 379.898 y = 242.199
x = 372.858 y = 243.308
x = 365.794 y = 241.718
simpleRedetect. detect result:
Rect:
x = 296.598
y = 77.0892
w = 145.655
h = 206.526
score = 0.999943
simpleRedetect. redetect result:
Rect:
x = 293
y = 96
w = 150
h = 192
score = 0.99776
Landmarks5:
x = 340 y = 158
x = 407 y = 162
x = 373.659 y = 216.406
x = 341.528 y = 234.974
x = 395.089 y = 237.747
Landmarks68:
x = 298.137 y = 150.128
x = 298.055 y = 171.151
x = 299.717 y = 192.454
x = 302.577 y = 214.068
x = 308.745 y = 235.283
x = 317.092 y = 254.842
x = 328.641 y = 272.072
x = 343.394 y = 286.197
x = 363.29 y = 291.23
x = 382.517 y = 288.372
x = 397.777 y = 275.101
x = 410.911 y = 258.241
x = 421.019 y = 240.182
x = 429.028 y = 220.902
x = 434.677 y = 201.25
x = 438.724 y = 182.13
x = 440.777 y = 163.203
x = 314.434 y = 142.784
x = 323.061 y = 134.318
x = 336.166 y = 131.351
x = 350.011 y = 133.686
x = 362.363 y = 138.718
x = 390.543 y = 141.037
x = 403.225 y = 137.271
x = 416.249 y = 136.316
x = 427.145 y = 140.556
x = 432.458 y = 149.122
x = 376.602 y = 157.122
x = 376.577 y = 171.279
x = 376.754 y = 185.021
x = 376.752 y = 199.582
x = 357.403 y = 209.623
x = 364.947 y = 213.413
x = 373.659 y = 216.406
x = 381.697 y = 214.331
x = 388.521 y = 210.804
x = 326.251 y = 157.173
x = 335.71 y = 152.831
x = 345.414 y = 153.109
x = 353.374 y = 159.724
x = 344.507 y = 161.573
x = 334.942 y = 161.155
x = 394.179 y = 162.185
x = 402.952 y = 156.821
x = 412.325 y = 157.35
x = 419.771 y = 162.669
x = 411.891 y = 166.165
x = 402.491 y = 165.492
x = 341.528 y = 234.974
x = 353.652 y = 234.773
x = 364.368 y = 233.824
x = 370.725 y = 236.465
x = 377.429 y = 234.542
x = 386.134 y = 236.597
x = 395.089 y = 237.747
x = 386.147 y = 246.528
x = 376.973 y = 251.319
x = 369.676 y = 252.347
x = 361.574 y = 250.524
x = 351.74 y = 245.043
x = 343.893 y = 236.534
x = 362.526 y = 239.565
x = 370.169 y = 241.324
x = 377.229 y = 240.421
x = 392.548 y = 238.944
x = 377.549 y = 241.843
x = 369.759 y = 242.778
x = 361.78 y = 241.34
spanExample. Detect results for 0 image:
detected: 1 faces
next face:
Rect:
x = 296
y = 77
w = 145
h = 206
score = 0.999943
spanExample. Detect results for 1 image:
detected: 1 faces
next face:
Rect:
x = 296
y = 77
w = 145
h = 206
score = 0.999943
spanExample. Redetect results for image[0]:
next face:
Rect:
x = 293
y = 96
w = 150
h = 192
score = 0.99776
spanExample. Redetect results for image[1]:
next face:
Rect:
x = 293
y = 96
w = 150
h = 192
score = 0.99776
creationExample. Detector instance with type: 4 was created successfully!
creationExample. bbox only result:
Rect:
x = 289
y = 94
w = 147
h = 185
score = 0.999999
creationExample. Detector instance with type: 5 was created successfully!
creationExample. bbox only result:
Rect:
x = 297
y = 97
w = 152
h = 184
score = 0.999986
creationExample. Detector instance with type: 6 was created successfully!
creationExample. bbox only result:
Rect:
x = 296.598
y = 77.0892
w = 145.655
h = 206.526
score = 0.999943