express-sweet 1.0.19 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +132 -1
- package/dist/build.common.js +4 -4
- package/dist/build.esm.js +5 -5
- package/docs/index.html +403 -115
- package/package.json +2 -2
- package/types/database/Model.d.ts +1 -1
- package/types/interfaces/AuthenticationOptions.d.ts +0 -1
- package/types/interfaces/BoundingBox.d.ts +1 -1
- package/types/interfaces/FaceDetailsEmotions.d.ts +40 -0
- package/types/interfaces/ViewOptions.d.ts +14 -0
- package/types/services/AWSRekognitionClient.d.ts +25 -254
package/docs/index.html
CHANGED
|
@@ -86,6 +86,9 @@
|
|
|
86
86
|
<nav class="nav nav-pills flex-column flex-nowrap fw-normal small">
|
|
87
87
|
<a class="nav-link" href="#rekognition-class">Class Rekognition</a>
|
|
88
88
|
<a class="nav-link" href="#rekognition-match-interface">Interface FaceMatch</a>
|
|
89
|
+
<a class="nav-link" href="#rekognition-face-details-interface">Interface FaceDetails</a>
|
|
90
|
+
<a class="nav-link" href="#rekognition-index-face-details-interface">Interface IndexFaceDetails</a>
|
|
91
|
+
<a class="nav-link" href="#rekognition-face-details-emotions-interface">Interface FaceDetailsEmotions</a>
|
|
89
92
|
<a class="nav-link" href="#rekognition-bbox-interface">Interface BoundingBox</a>
|
|
90
93
|
</nav>
|
|
91
94
|
<a class="nav-link" href="#changelog">Changelog</a>
|
|
@@ -112,7 +115,7 @@
|
|
|
112
115
|
</div>
|
|
113
116
|
<hr class="mx-auto mx-lg-0 my-5">
|
|
114
117
|
<p class="text-muted">
|
|
115
|
-
Currently <a href="https://github.com/takuya-motoshima/express-sweet/releases/tag/v1.0.
|
|
118
|
+
Currently <a href="https://github.com/takuya-motoshima/express-sweet/releases/tag/v1.0.22" target="_blank">v1.0.22</a>
|
|
116
119
|
<span class="px-1">•</span>
|
|
117
120
|
<a href="#quick-start">Quick Start</a>
|
|
118
121
|
<span class="px-1">•</span>
|
|
@@ -684,14 +687,14 @@ module.exports = router;</code></pre>
|
|
|
684
687
|
</div>
|
|
685
688
|
<ul class="list-group list-group-flush">
|
|
686
689
|
<li class="list-group-item">
|
|
687
|
-
<div class="fw-bold"><code
|
|
690
|
+
<div class="fw-bold"><code>string</code>views_dir</div>
|
|
688
691
|
<div class="ms-3">
|
|
689
692
|
The directory path where the view will be placed.<br>
|
|
690
693
|
The default is the <code>"views"</code> directory directly under the application root.
|
|
691
694
|
</div>
|
|
692
695
|
</li>
|
|
693
696
|
<li class="list-group-item">
|
|
694
|
-
<div class="fw-bold"><code
|
|
697
|
+
<div class="fw-bold"><code>string</code>partials_dir</div>
|
|
695
698
|
<div class="ms-3">
|
|
696
699
|
The directory path where the reusable templates are located.<br>
|
|
697
700
|
The default is the <code>"views/partials"</code> directory directly under the application root.<br>
|
|
@@ -699,14 +702,14 @@ module.exports = router;</code></pre>
|
|
|
699
702
|
</div>
|
|
700
703
|
</li>
|
|
701
704
|
<li class="list-group-item">
|
|
702
|
-
<div class="fw-bold"><code
|
|
705
|
+
<div class="fw-bold"><code>string</code>layouts_dir</div>
|
|
703
706
|
<div class="ms-3">
|
|
704
707
|
The directory path where the reusable base template is located.<br>
|
|
705
708
|
The default is the <code>"views/layout"</code> directory directly under the application root.
|
|
706
709
|
</div>
|
|
707
710
|
</li>
|
|
708
711
|
<li class="list-group-item">
|
|
709
|
-
<div class="fw-bold"><code
|
|
712
|
+
<div class="fw-bold"><code>string</code>default_layout</div>
|
|
710
713
|
<div class="ms-3">
|
|
711
714
|
The path to the layout file used by default.<br>
|
|
712
715
|
The default is the <code>"views/layout/default.*"</code> File directly under the application root.<br>
|
|
@@ -714,12 +717,36 @@ module.exports = router;</code></pre>
|
|
|
714
717
|
</div>
|
|
715
718
|
</li>
|
|
716
719
|
<li class="list-group-item">
|
|
717
|
-
<div class="fw-bold"><code
|
|
720
|
+
<div class="fw-bold"><code>string</code>extension</div>
|
|
718
721
|
<div class="ms-3">
|
|
719
722
|
Extension for templates and partials files.<br>
|
|
720
723
|
The default is <code>".hbs"</code>.
|
|
721
724
|
</div>
|
|
722
725
|
</li>
|
|
726
|
+
<li class="list-group-item">
|
|
727
|
+
<div class="fw-bold"><code>(res: express.Response) => void</code>beforeRender</div>
|
|
728
|
+
<div class="ms-3">
|
|
729
|
+
Hook function just before the view is rendered.<br>
|
|
730
|
+
For example, you can set your own local variables that can be used within the view.<br>
|
|
731
|
+
<div class="highlight">
|
|
732
|
+
<pre><code class="js">/**
|
|
733
|
+
* Hook function just before the view is rendered.
|
|
734
|
+
* For example, you can set your own local variables that can be used within the view.
|
|
735
|
+
*
|
|
736
|
+
* @example
|
|
737
|
+
* // The message set here can be referenced in the view as {{message}}.
|
|
738
|
+
* beforeRender: res => {
|
|
739
|
+
* res.loclas.message = 'Hello World';
|
|
740
|
+
* }
|
|
741
|
+
*
|
|
742
|
+
* @type {(res: express.Response) => void}
|
|
743
|
+
*/
|
|
744
|
+
beforeRender: res => {
|
|
745
|
+
res.locals.message = 'Hello World';
|
|
746
|
+
}</code></pre>
|
|
747
|
+
</div>
|
|
748
|
+
</div>
|
|
749
|
+
</li>
|
|
723
750
|
</ul>
|
|
724
751
|
<h2 id="views-syntax">Syntax</h2>
|
|
725
752
|
<p>To mark where layout should insert page.</p>
|
|
@@ -3276,18 +3303,18 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
3276
3303
|
</div>
|
|
3277
3304
|
<ul class="list-group list-group-flush">
|
|
3278
3305
|
<li class="list-group-item">
|
|
3279
|
-
<div class="fw-bold
|
|
3306
|
+
<div class="fw-bold"><code>boolean</code>enabled</div>
|
|
3280
3307
|
<div class="ms-3">
|
|
3281
3308
|
Set to true to enable user authentication using <a href="https://www.passportjs.org/docs/" target="_blank">Passport middleware</a>.<br>
|
|
3282
3309
|
User authentication is enabled (<code>true</code>) by default.
|
|
3283
3310
|
</div>
|
|
3284
3311
|
</li>
|
|
3285
3312
|
<li class="list-group-item">
|
|
3286
|
-
<div class="fw-bold
|
|
3313
|
+
<div class="fw-bold"><code>'memory'|'redis'</code>session_store</div>
|
|
3287
3314
|
<div class="ms-3">The session store instance, defaults to a new MemoryStore(<code>memory</code>) instance.</div>
|
|
3288
3315
|
</li>
|
|
3289
3316
|
<li class="list-group-item">
|
|
3290
|
-
<div class="fw-bold
|
|
3317
|
+
<div class="fw-bold"><code>string|undefined</code>redis_host?</div>
|
|
3291
3318
|
<div class="ms-3">
|
|
3292
3319
|
If the session is stored in <code>"redis"</code>, this field is required and should be set to the hostname of the Redis server.
|
|
3293
3320
|
For example, to connect to redis on localhost on port <code>6379</code>, set <code>"redis://localhost:6379"</code>.
|
|
@@ -3296,28 +3323,28 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
3296
3323
|
</div>
|
|
3297
3324
|
</li>
|
|
3298
3325
|
<li class="list-group-item">
|
|
3299
|
-
<div class="fw-bold
|
|
3326
|
+
<div class="fw-bold"><code>string</code>username</div>
|
|
3300
3327
|
<div class="ms-3">
|
|
3301
3328
|
The login username field name used for authentication.<br>
|
|
3302
3329
|
This should be set to the same value as the user field name in the POST body sent to the server and the user example name in the login user table.
|
|
3303
3330
|
</div>
|
|
3304
3331
|
</li>
|
|
3305
3332
|
<li class="list-group-item">
|
|
3306
|
-
<div class="fw-bold
|
|
3333
|
+
<div class="fw-bold"><code>string</code>password</div>
|
|
3307
3334
|
<div class="ms-3">
|
|
3308
3335
|
The login password field name used for authentication.<br>
|
|
3309
3336
|
This should be set to the same value as the password field name in the POST body sent to the server and the password column name in the login user table.
|
|
3310
3337
|
</div>
|
|
3311
3338
|
</li>
|
|
3312
3339
|
<li class="list-group-item">
|
|
3313
|
-
<div class="fw-bold
|
|
3340
|
+
<div class="fw-bold"><code>string</code>success_redirect</div>
|
|
3314
3341
|
<div class="ms-3">
|
|
3315
3342
|
The URL to redirect to after successful authentication.<br>
|
|
3316
3343
|
The default is the root URL (<code>/</code>).
|
|
3317
3344
|
</div>
|
|
3318
3345
|
</li>
|
|
3319
3346
|
<li class="list-group-item">
|
|
3320
|
-
<div class="fw-bold
|
|
3347
|
+
<div class="fw-bold"><code>string</code>failure_redirect</div>
|
|
3321
3348
|
<div class="ms-3">
|
|
3322
3349
|
Specify the URL to redirect after logging out, or the URL to redirect when the logoff user requests a URL that only the logged-in user can access.<br>
|
|
3323
3350
|
This usually specifies the URL of the login page.<br>
|
|
@@ -3325,7 +3352,7 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
3325
3352
|
</div>
|
|
3326
3353
|
</li>
|
|
3327
3354
|
<li class="list-group-item">
|
|
3328
|
-
<div class="fw-bold
|
|
3355
|
+
<div class="fw-bold"><code>(username: string, password: string): Promise<object|null></code>authenticate_user</div>
|
|
3329
3356
|
<div class="ms-3">
|
|
3330
3357
|
This hook is called when authenticating a user.<br>
|
|
3331
3358
|
Please find the user information that owns the credentials based on the user name and password you received and return it.<br>
|
|
@@ -3346,7 +3373,7 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
3346
3373
|
</div>
|
|
3347
3374
|
</li>
|
|
3348
3375
|
<li class="list-group-item">
|
|
3349
|
-
<div class="fw-bold
|
|
3376
|
+
<div class="fw-bold"><code>(id: number): Promise<object></code>subscribe_user</div>
|
|
3350
3377
|
<div class="ms-3">
|
|
3351
3378
|
This hook is called when user authentication is successful.<br>
|
|
3352
3379
|
Please search and return the authenticated user information to be set in the session based on the user ID of the parameter.<br>
|
|
@@ -3366,7 +3393,7 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
3366
3393
|
</div>
|
|
3367
3394
|
</li>
|
|
3368
3395
|
<li class="list-group-item">
|
|
3369
|
-
<div class="fw-bold
|
|
3396
|
+
<div class="fw-bold"><code>(string|RegExp)[]</code>allow_unauthenticated</div>
|
|
3370
3397
|
<div class="ms-3">
|
|
3371
3398
|
By default, it requires an authenticated user for all requests.<br>
|
|
3372
3399
|
You can use the <code>"allow_unauthenticated"</code> option to disable this behavior on certain requests.<br>
|
|
@@ -3381,7 +3408,7 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
3381
3408
|
</div>
|
|
3382
3409
|
</li>
|
|
3383
3410
|
<li class="list-group-item">
|
|
3384
|
-
<div class="fw-bold
|
|
3411
|
+
<div class="fw-bold"><code>number</code>expiration</div>
|
|
3385
3412
|
<div class="ms-3">
|
|
3386
3413
|
Specifies the time, in milliseconds, before the session expires.<br>
|
|
3387
3414
|
The default is 24 hours (<code>86400000</code> milliseconds).
|
|
@@ -3655,6 +3682,10 @@ module.exports = router;</code></pre>
|
|
|
3655
3682
|
<div class="highlight">
|
|
3656
3683
|
<pre><code class="js">import * as sweet from 'express-sweet';
|
|
3657
3684
|
|
|
3685
|
+
// Load environment variables.
|
|
3686
|
+
sweet.middlewares.Environment.mount();
|
|
3687
|
+
|
|
3688
|
+
// Rekognition Client.
|
|
3658
3689
|
const client = new sweet.services.AWSRekognitionClient({
|
|
3659
3690
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
3660
3691
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
@@ -3664,9 +3695,13 @@ const client = new sweet.services.AWSRekognitionClient({
|
|
|
3664
3695
|
</div>
|
|
3665
3696
|
<div class="tab-pane fade" id="rekognition-constructor-cjs">
|
|
3666
3697
|
<div class="highlight">
|
|
3667
|
-
<pre><code class="js">const
|
|
3668
|
-
|
|
3669
|
-
|
|
3698
|
+
<pre><code class="js">const sweet = require('express-sweet');
|
|
3699
|
+
|
|
3700
|
+
// Load environment variables.
|
|
3701
|
+
sweet.middlewares.Environment.mount();
|
|
3702
|
+
|
|
3703
|
+
// Rekognition Client.
|
|
3704
|
+
const client = new sweet.services.AWSRekognitionClient({
|
|
3670
3705
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
3671
3706
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
3672
3707
|
region: process.env.AWS_REKOGNITION_REGION
|
|
@@ -3677,7 +3712,11 @@ const client = new AWSRekognitionClient({
|
|
|
3677
3712
|
</div>
|
|
3678
3713
|
</li>
|
|
3679
3714
|
<li class="list-group-item">
|
|
3680
|
-
<div class="fw-bold"
|
|
3715
|
+
<div class="fw-bold">
|
|
3716
|
+
<code class="h5">
|
|
3717
|
+
public async detectFaces(img: string, minConfidence: number = 90, withDetails: boolean = false): Promise<<a href="#rekognition-bbox-interface">BoundingBox</a>[]|<a href="#rekognition-face-details-interface">FaceDetails</a>[]>
|
|
3718
|
+
</code>
|
|
3719
|
+
</div>
|
|
3681
3720
|
<div class="ms-3">
|
|
3682
3721
|
<p>
|
|
3683
3722
|
Detects faces within an image that is provided as input.<br>
|
|
@@ -3696,9 +3735,19 @@ const client = new AWSRekognitionClient({
|
|
|
3696
3735
|
Faces with a confidence lower than this value will not be returned as a result.
|
|
3697
3736
|
</div>
|
|
3698
3737
|
</li>
|
|
3738
|
+
<li class="list-group-item pt-0 border-0">
|
|
3739
|
+
<div class="fw-bold"><code>boolean</code>withDetails</div>
|
|
3740
|
+
<div class="ms-3">
|
|
3741
|
+
If false, returns only the face bounding box.<br>
|
|
3742
|
+
When true, returns the age group, gender, and emotion in addition to the face bounding box.
|
|
3743
|
+
</div>
|
|
3744
|
+
</li>
|
|
3699
3745
|
</ul>
|
|
3700
3746
|
<h6>Return value</h6>
|
|
3701
|
-
<p
|
|
3747
|
+
<p>
|
|
3748
|
+
<code>Promise<<a href="#rekognition-bbox-interface">BoundingBox</a>[]|<a href="#rekognition-face-details-interface">FaceDetails</a>[]></code>
|
|
3749
|
+
Returns the bounding box of the detected face.
|
|
3750
|
+
</p>
|
|
3702
3751
|
<h6>Example</h6>
|
|
3703
3752
|
<ul class="nav nav-tabs">
|
|
3704
3753
|
<li class="nav-item">
|
|
@@ -3714,22 +3763,55 @@ const client = new AWSRekognitionClient({
|
|
|
3714
3763
|
<pre><code class="js">import * as sweet from 'express-sweet';
|
|
3715
3764
|
import fs from 'fs';
|
|
3716
3765
|
|
|
3766
|
+
// Load environment variables.
|
|
3767
|
+
sweet.middlewares.Environment.mount();
|
|
3768
|
+
|
|
3769
|
+
// Rekognition Client.
|
|
3717
3770
|
const client = new sweet.services.AWSRekognitionClient({
|
|
3718
3771
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
3719
3772
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
3720
3773
|
region: process.env.AWS_REKOGNITION_REGION
|
|
3721
3774
|
});
|
|
3722
3775
|
|
|
3723
|
-
//
|
|
3724
|
-
// Output:
|
|
3725
|
-
//
|
|
3726
|
-
//
|
|
3727
|
-
//
|
|
3728
|
-
//
|
|
3729
|
-
//
|
|
3730
|
-
//
|
|
3731
|
-
//
|
|
3732
|
-
await client.detectFaces('img.jpg');
|
|
3776
|
+
// Detects bounding boxes on faces.
|
|
3777
|
+
// Output: [
|
|
3778
|
+
// {
|
|
3779
|
+
// width: 0.3099822998046875,
|
|
3780
|
+
// height: 0.661512017250061,
|
|
3781
|
+
// left: 0.5449195504188538,
|
|
3782
|
+
// top: 0.11531734466552734
|
|
3783
|
+
// }
|
|
3784
|
+
// ]
|
|
3785
|
+
let res = await client.detectFaces('img/face2.jpg');
|
|
3786
|
+
console.log(res);
|
|
3787
|
+
|
|
3788
|
+
// Detect facial details.
|
|
3789
|
+
// Output: [
|
|
3790
|
+
// {
|
|
3791
|
+
// boundingBox: {
|
|
3792
|
+
// width: 0.3099822998046875,
|
|
3793
|
+
// height: 0.661512017250061,
|
|
3794
|
+
// left: 0.5449195504188538,
|
|
3795
|
+
// top: 0.11531734466552734
|
|
3796
|
+
// },
|
|
3797
|
+
// ageRange: { high: 14, low: 6 },
|
|
3798
|
+
// gender: 'female',
|
|
3799
|
+
// emotions: {
|
|
3800
|
+
// happy: 99.78905487060547,
|
|
3801
|
+
// surprised: 6.306276321411133,
|
|
3802
|
+
// fear: 5.880091190338135,
|
|
3803
|
+
// sad: 2.152125835418701,
|
|
3804
|
+
// confused: 0.023256277665495872,
|
|
3805
|
+
// angry: 0.018351631239056587,
|
|
3806
|
+
// calm: 0.015775982290506363,
|
|
3807
|
+
// disgusted: 0.013914424926042557
|
|
3808
|
+
// }
|
|
3809
|
+
// }
|
|
3810
|
+
// ]
|
|
3811
|
+
const minConfidence = 90;
|
|
3812
|
+
const withDetails = true;
|
|
3813
|
+
res = await client.detectFaces('img/face2.jpg', minConfidence, withDetails);
|
|
3814
|
+
console.log(res);
|
|
3733
3815
|
|
|
3734
3816
|
// Detect faces from data URL.
|
|
3735
3817
|
await client.detectFaces('data:image/png;base64,/9j/4...');
|
|
@@ -3740,25 +3822,58 @@ await client.detectFaces(fs.readFileSync('img.jpg'));</code></pre>
|
|
|
3740
3822
|
</div>
|
|
3741
3823
|
<div class="tab-pane fade" id="rekognition-method-detect-faces-cjs">
|
|
3742
3824
|
<div class="highlight">
|
|
3743
|
-
<pre><code class="js">const
|
|
3825
|
+
<pre><code class="js">const sweet = require('express-sweet');
|
|
3744
3826
|
const fs = require('fs');
|
|
3745
3827
|
|
|
3746
|
-
|
|
3828
|
+
// Load environment variables.
|
|
3829
|
+
sweet.middlewares.Environment.mount();
|
|
3830
|
+
|
|
3831
|
+
// Rekognition Client.
|
|
3832
|
+
const client = new sweet.services.AWSRekognitionClient({
|
|
3747
3833
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
3748
3834
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
3749
3835
|
region: process.env.AWS_REKOGNITION_REGION
|
|
3750
3836
|
});
|
|
3751
3837
|
|
|
3752
|
-
//
|
|
3753
|
-
// Output:
|
|
3754
|
-
//
|
|
3755
|
-
//
|
|
3756
|
-
//
|
|
3757
|
-
//
|
|
3758
|
-
//
|
|
3759
|
-
//
|
|
3760
|
-
//
|
|
3761
|
-
await client.detectFaces('img.jpg');
|
|
3838
|
+
// Detects bounding boxes on faces.
|
|
3839
|
+
// Output: [
|
|
3840
|
+
// {
|
|
3841
|
+
// width: 0.3099822998046875,
|
|
3842
|
+
// height: 0.661512017250061,
|
|
3843
|
+
// left: 0.5449195504188538,
|
|
3844
|
+
// top: 0.11531734466552734
|
|
3845
|
+
// }
|
|
3846
|
+
// ]
|
|
3847
|
+
let res = await client.detectFaces('img/face2.jpg');
|
|
3848
|
+
console.log(res);
|
|
3849
|
+
|
|
3850
|
+
// Detect facial details.
|
|
3851
|
+
// Output: [
|
|
3852
|
+
// {
|
|
3853
|
+
// boundingBox: {
|
|
3854
|
+
// width: 0.3099822998046875,
|
|
3855
|
+
// height: 0.661512017250061,
|
|
3856
|
+
// left: 0.5449195504188538,
|
|
3857
|
+
// top: 0.11531734466552734
|
|
3858
|
+
// },
|
|
3859
|
+
// ageRange: { high: 14, low: 6 },
|
|
3860
|
+
// gender: 'female',
|
|
3861
|
+
// emotions: {
|
|
3862
|
+
// happy: 99.78905487060547,
|
|
3863
|
+
// surprised: 6.306276321411133,
|
|
3864
|
+
// fear: 5.880091190338135,
|
|
3865
|
+
// sad: 2.152125835418701,
|
|
3866
|
+
// confused: 0.023256277665495872,
|
|
3867
|
+
// angry: 0.018351631239056587,
|
|
3868
|
+
// calm: 0.015775982290506363,
|
|
3869
|
+
// disgusted: 0.013914424926042557
|
|
3870
|
+
// }
|
|
3871
|
+
// }
|
|
3872
|
+
// ]
|
|
3873
|
+
const minConfidence = 90;
|
|
3874
|
+
const withDetails = true;
|
|
3875
|
+
res = await client.detectFaces('img/face2.jpg', minConfidence, withDetails);
|
|
3876
|
+
console.log(res);
|
|
3762
3877
|
|
|
3763
3878
|
// Detect faces from data URL.
|
|
3764
3879
|
await client.detectFaces('data:image/png;base64,/9j/4...');
|
|
@@ -3802,6 +3917,10 @@ await client.detectFaces(fs.readFileSync('img.jpg'));</code></pre>
|
|
|
3802
3917
|
<pre><code class="js">import * as sweet from 'express-sweet';
|
|
3803
3918
|
import fs from 'fs';
|
|
3804
3919
|
|
|
3920
|
+
// Load environment variables.
|
|
3921
|
+
sweet.middlewares.Environment.mount();
|
|
3922
|
+
|
|
3923
|
+
// Rekognition Client.
|
|
3805
3924
|
const client = new sweet.services.AWSRekognitionClient({
|
|
3806
3925
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
3807
3926
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
@@ -3820,10 +3939,14 @@ await client.compareFaces(fs.readFileSync('img1.jpg'), fs.readFileSync
|
|
|
3820
3939
|
</div>
|
|
3821
3940
|
<div class="tab-pane fade" id="rekognition-method-compare-faces-cjs">
|
|
3822
3941
|
<div class="highlight">
|
|
3823
|
-
<pre><code class="js">const
|
|
3942
|
+
<pre><code class="js">const sweet = require('express-sweet');
|
|
3824
3943
|
const fs = require('fs');
|
|
3825
3944
|
|
|
3826
|
-
|
|
3945
|
+
// Load environment variables.
|
|
3946
|
+
sweet.middlewares.Environment.mount();
|
|
3947
|
+
|
|
3948
|
+
// Rekognition Client.
|
|
3949
|
+
const client = new sweet.services.AWSRekognitionClient({
|
|
3827
3950
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
3828
3951
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
3829
3952
|
region: process.env.AWS_REKOGNITION_REGION
|
|
@@ -3876,6 +3999,10 @@ await client.compareFaces(fs.readFileSync('img1.jpg'), fs.readFileSync
|
|
|
3876
3999
|
<div class="highlight">
|
|
3877
4000
|
<pre><code class="js">import * as sweet from 'express-sweet';
|
|
3878
4001
|
|
|
4002
|
+
// Load environment variables.
|
|
4003
|
+
sweet.middlewares.Environment.mount();
|
|
4004
|
+
|
|
4005
|
+
// Rekognition Client.
|
|
3879
4006
|
const client = new sweet.services.AWSRekognitionClient({
|
|
3880
4007
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
3881
4008
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
@@ -3888,9 +4015,13 @@ await client.createCollection('MyCollection');</code></pre>
|
|
|
3888
4015
|
</div>
|
|
3889
4016
|
<div class="tab-pane fade" id="rekognition-method-create-collection-cjs">
|
|
3890
4017
|
<div class="highlight">
|
|
3891
|
-
<pre><code class="js">const
|
|
4018
|
+
<pre><code class="js">const sweet = require('express-sweet');
|
|
3892
4019
|
|
|
3893
|
-
|
|
4020
|
+
// Load environment variables.
|
|
4021
|
+
sweet.middlewares.Environment.mount();
|
|
4022
|
+
|
|
4023
|
+
// Rekognition Client.
|
|
4024
|
+
const client = new sweet.services.AWSRekognitionClient({
|
|
3894
4025
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
3895
4026
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
3896
4027
|
region: process.env.AWS_REKOGNITION_REGION
|
|
@@ -3925,6 +4056,10 @@ await client.createCollection('MyCollection');</code></pre>
|
|
|
3925
4056
|
<div class="highlight">
|
|
3926
4057
|
<pre><code class="js">import * as sweet from 'express-sweet';
|
|
3927
4058
|
|
|
4059
|
+
// Load environment variables.
|
|
4060
|
+
sweet.middlewares.Environment.mount();
|
|
4061
|
+
|
|
4062
|
+
// Rekognition Client.
|
|
3928
4063
|
const client = new sweet.services.AWSRekognitionClient({
|
|
3929
4064
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
3930
4065
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
@@ -3941,9 +4076,13 @@ await client.listCollections();</code></pre>
|
|
|
3941
4076
|
</div>
|
|
3942
4077
|
<div class="tab-pane fade" id="rekognition-method-list-collections-cjs">
|
|
3943
4078
|
<div class="highlight">
|
|
3944
|
-
<pre><code class="js">const
|
|
3945
|
-
|
|
3946
|
-
|
|
4079
|
+
<pre><code class="js">const sweet = require('express-sweet');
|
|
4080
|
+
|
|
4081
|
+
// Load environment variables.
|
|
4082
|
+
sweet.middlewares.Environment.mount();
|
|
4083
|
+
|
|
4084
|
+
// Rekognition Client.
|
|
4085
|
+
const client = new sweet.services.AWSRekognitionClient({
|
|
3947
4086
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
3948
4087
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
3949
4088
|
region: process.env.AWS_REKOGNITION_REGION
|
|
@@ -3987,7 +4126,11 @@ await client.listCollections();</code></pre>
|
|
|
3987
4126
|
<div class="tab-pane fade show active" id="rekognition-method-delete-collection-esm">
|
|
3988
4127
|
<div class="highlight">
|
|
3989
4128
|
<pre><code class="js">import * as sweet from 'express-sweet';
|
|
3990
|
-
|
|
4129
|
+
|
|
4130
|
+
// Load environment variables.
|
|
4131
|
+
sweet.middlewares.Environment.mount();
|
|
4132
|
+
|
|
4133
|
+
// Rekognition Client.
|
|
3991
4134
|
const client = new sweet.services.AWSRekognitionClient({
|
|
3992
4135
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
3993
4136
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
@@ -4000,9 +4143,13 @@ await client.deleteCollection('MyCollection');</code></pre>
|
|
|
4000
4143
|
</div>
|
|
4001
4144
|
<div class="tab-pane fade" id="rekognition-method-delete-collection-cjs">
|
|
4002
4145
|
<div class="highlight">
|
|
4003
|
-
<pre><code class="js">const
|
|
4004
|
-
|
|
4005
|
-
|
|
4146
|
+
<pre><code class="js">const sweet = require('express-sweet');
|
|
4147
|
+
|
|
4148
|
+
// Load environment variables.
|
|
4149
|
+
sweet.middlewares.Environment.mount();
|
|
4150
|
+
|
|
4151
|
+
// Rekognition Client.
|
|
4152
|
+
const client = new sweet.services.AWSRekognitionClient({
|
|
4006
4153
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
4007
4154
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
4008
4155
|
region: process.env.AWS_REKOGNITION_REGION
|
|
@@ -4016,13 +4163,18 @@ await client.deleteCollection('MyCollection');</code></pre>
|
|
|
4016
4163
|
</div>
|
|
4017
4164
|
</li>
|
|
4018
4165
|
<li class="list-group-item">
|
|
4019
|
-
<div class="fw-bold"
|
|
4166
|
+
<div class="fw-bold">
|
|
4167
|
+
<code class="h5">
|
|
4168
|
+
public async indexFace(
|
|
4169
|
+
collectionId: string,
|
|
4170
|
+
img: string,
|
|
4171
|
+
options?: {externalImageId? : string, returnDetails?: boolean
|
|
4172
|
+
}): Promise<string|<a href="#rekognition-index-face-details-interface">IndexFaceDetails</a>>
|
|
4173
|
+
</code>
|
|
4174
|
+
</div>
|
|
4020
4175
|
<div class="ms-3">
|
|
4021
4176
|
<p>
|
|
4022
|
-
Detects one face in the input image and adds it to the specified collection
|
|
4023
|
-
This method doesn't save the actual faces that are detected.<br>
|
|
4024
|
-
Instead, the underlying detection algorithm first detects the faces in the input image.<br>
|
|
4025
|
-
The algorithm extracts facial features into a feature vector, and stores it in the backend database.
|
|
4177
|
+
Detects one face in the input image and adds it to the specified collection.
|
|
4026
4178
|
<div class="callout callout-warning">
|
|
4027
4179
|
Note that this method is used to index one face.<br>
|
|
4028
4180
|
Throws an exception if no face is found in the input image or multiple faces are found.
|
|
@@ -4039,7 +4191,7 @@ await client.deleteCollection('MyCollection');</code></pre>
|
|
|
4039
4191
|
<div class="ms-3">Image path or Data Url or image buffer.</div>
|
|
4040
4192
|
</li>
|
|
4041
4193
|
<li class="list-group-item pt-0 border-0">
|
|
4042
|
-
<div class="fw-bold"><code>string</code>externalImageId</div>
|
|
4194
|
+
<div class="fw-bold"><code>string|undefined</code>options.externalImageId</div>
|
|
4043
4195
|
<div class="ms-3">
|
|
4044
4196
|
The ID you want to assign to the faces detected in the image.<br>
|
|
4045
4197
|
When you call the <code>"listFaces"</code> operation, the response returns the external ID.<br>
|
|
@@ -4048,9 +4200,20 @@ await client.deleteCollection('MyCollection');</code></pre>
|
|
|
4048
4200
|
The maximum length is 255, and the characters that can be used are <code>"[a-zA-Z0-9_.\-:]+"</code>.
|
|
4049
4201
|
</div>
|
|
4050
4202
|
</li>
|
|
4203
|
+
<li class="list-group-item pt-0 border-0">
|
|
4204
|
+
<div class="fw-bold"><code>boolean</code>options.returnDetails</div>
|
|
4205
|
+
<div class="ms-3">
|
|
4206
|
+
If <code>false</code>, only the face ID of the created face is returned.<br>
|
|
4207
|
+
If <code>true</code>, returns the face ID of the created face, plus age range, gender, and emotion.
|
|
4208
|
+
</div>
|
|
4209
|
+
</li>
|
|
4051
4210
|
</ul>
|
|
4052
4211
|
<h6>Return value</h6>
|
|
4053
|
-
<p
|
|
4212
|
+
<p>
|
|
4213
|
+
<code>Promise<string|<a href="#rekognition-index-face-details-interface">IndexFaceDetails</a>></code><br>
|
|
4214
|
+
If <code>options.returnDetails</code> is <code>false</code>, the face identifier is returned.<br>
|
|
4215
|
+
If <code>options.returnDetails</code> is <code>true</code>, returns the gender, age group, and emotion in addition to the face identifier.
|
|
4216
|
+
</p>
|
|
4054
4217
|
<h6>Example</h6>
|
|
4055
4218
|
<ul class="nav nav-tabs">
|
|
4056
4219
|
<li class="nav-item">
|
|
@@ -4066,65 +4229,91 @@ await client.deleteCollection('MyCollection');</code></pre>
|
|
|
4066
4229
|
<pre><code class="js">import * as sweet from 'express-sweet';
|
|
4067
4230
|
import fs from 'fs';
|
|
4068
4231
|
|
|
4232
|
+
// Load environment variables.
|
|
4233
|
+
sweet.middlewares.Environment.mount();
|
|
4234
|
+
|
|
4235
|
+
// Rekognition Client.
|
|
4069
4236
|
const client = new sweet.services.AWSRekognitionClient({
|
|
4070
4237
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
4071
4238
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
4072
4239
|
region: process.env.AWS_REKOGNITION_REGION
|
|
4073
4240
|
});
|
|
4074
4241
|
|
|
4075
|
-
//
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
//
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
//
|
|
4085
|
-
//
|
|
4086
|
-
//
|
|
4087
|
-
//
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
//
|
|
4091
|
-
//
|
|
4092
|
-
//
|
|
4093
|
-
//
|
|
4094
|
-
|
|
4242
|
+
// Create a face and get the ID of the created face.
|
|
4243
|
+
// Output: e65d66cb-e7bc-4bbf-966c-b1b49ddf29f8
|
|
4244
|
+
const faceId = await client.indexFace(collectionId, 'img.jpg');
|
|
4245
|
+
console.log(faceId);
|
|
4246
|
+
|
|
4247
|
+
// Create a face and get the details of the created face.
|
|
4248
|
+
// Output: {
|
|
4249
|
+
// faceId: '7f2dd321-f047-44ff-8856-864637e1d286',
|
|
4250
|
+
// ageRange: { high: 29, low: 21 },
|
|
4251
|
+
// gender: 'female',
|
|
4252
|
+
// emotions: {
|
|
4253
|
+
// angry: 77.1907958984375,
|
|
4254
|
+
// surprised: 9.944050788879395,
|
|
4255
|
+
// fear: 7.514361381530762,
|
|
4256
|
+
// confused: 4.780297756195068,
|
|
4257
|
+
// sad: 2.91914963722229,
|
|
4258
|
+
// happy: 2.5718722343444824,
|
|
4259
|
+
// disgusted: 1.933768391609192,
|
|
4260
|
+
// calm: 1.5354809761047363
|
|
4261
|
+
// }
|
|
4262
|
+
// }
|
|
4263
|
+
const faceDetails = await client.indexFace(collectionId, 'img.jpg', {returnDetails: true});
|
|
4264
|
+
console.log(faceDetails);
|
|
4265
|
+
|
|
4266
|
+
// You can also index face images in DataURL format.
|
|
4267
|
+
await client.indexFace('MyCollection', 'data:image/png;base64,/9j/4...');
|
|
4268
|
+
|
|
4269
|
+
// Buffer face images can also be indexed.
|
|
4270
|
+
await client.indexFace('MyCollection', fs.readFileSync('img.jpg'));</code></pre>
|
|
4095
4271
|
</div>
|
|
4096
4272
|
</div>
|
|
4097
4273
|
<div class="tab-pane fade" id="rekognition-method-index-face-cjs">
|
|
4098
4274
|
<div class="highlight">
|
|
4099
|
-
<pre><code class="js">const
|
|
4275
|
+
<pre><code class="js">const sweet = require('express-sweet');
|
|
4100
4276
|
const fs = require('fs');
|
|
4101
4277
|
|
|
4102
|
-
|
|
4278
|
+
// Load environment variables.
|
|
4279
|
+
sweet.middlewares.Environment.mount();
|
|
4280
|
+
|
|
4281
|
+
// Rekognition Client.
|
|
4282
|
+
const client = new sweet.services.AWSRekognitionClient({
|
|
4103
4283
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
4104
4284
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
4105
4285
|
region: process.env.AWS_REKOGNITION_REGION
|
|
4106
4286
|
});
|
|
4107
4287
|
|
|
4108
|
-
//
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
//
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
//
|
|
4118
|
-
//
|
|
4119
|
-
//
|
|
4120
|
-
//
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
//
|
|
4124
|
-
//
|
|
4125
|
-
//
|
|
4126
|
-
//
|
|
4127
|
-
|
|
4288
|
+
// Create a face and get the ID of the created face.
|
|
4289
|
+
// Output: e65d66cb-e7bc-4bbf-966c-b1b49ddf29f8
|
|
4290
|
+
const faceId = await client.indexFace(collectionId, 'img.jpg');
|
|
4291
|
+
console.log(faceId);
|
|
4292
|
+
|
|
4293
|
+
// Create a face and get the details of the created face.
|
|
4294
|
+
// Output: {
|
|
4295
|
+
// faceId: '7f2dd321-f047-44ff-8856-864637e1d286',
|
|
4296
|
+
// ageRange: { high: 29, low: 21 },
|
|
4297
|
+
// gender: 'female',
|
|
4298
|
+
// emotions: {
|
|
4299
|
+
// angry: 77.1907958984375,
|
|
4300
|
+
// surprised: 9.944050788879395,
|
|
4301
|
+
// fear: 7.514361381530762,
|
|
4302
|
+
// confused: 4.780297756195068,
|
|
4303
|
+
// sad: 2.91914963722229,
|
|
4304
|
+
// happy: 2.5718722343444824,
|
|
4305
|
+
// disgusted: 1.933768391609192,
|
|
4306
|
+
// calm: 1.5354809761047363
|
|
4307
|
+
// }
|
|
4308
|
+
// }
|
|
4309
|
+
const faceDetails = await client.indexFace(collectionId, 'img.jpg', {returnDetails: true});
|
|
4310
|
+
console.log(faceDetails);
|
|
4311
|
+
|
|
4312
|
+
// You can also index face images in DataURL format.
|
|
4313
|
+
await client.indexFace('MyCollection', 'data:image/png;base64,/9j/4...');
|
|
4314
|
+
|
|
4315
|
+
// Buffer face images can also be indexed.
|
|
4316
|
+
await client.indexFace('MyCollection', fs.readFileSync('img.jpg'));</code></pre>
|
|
4128
4317
|
</div>
|
|
4129
4318
|
</div>
|
|
4130
4319
|
</div>
|
|
@@ -4186,6 +4375,10 @@ await client.indexFace('MyCollection', 'img.jpg');</code></p
|
|
|
4186
4375
|
<pre><code class="js">import * as sweet from 'express-sweet';
|
|
4187
4376
|
import fs from 'fs';
|
|
4188
4377
|
|
|
4378
|
+
// Load environment variables.
|
|
4379
|
+
sweet.middlewares.Environment.mount();
|
|
4380
|
+
|
|
4381
|
+
// Rekognition Client.
|
|
4189
4382
|
const client = new sweet.services.AWSRekognitionClient({
|
|
4190
4383
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
4191
4384
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
@@ -4233,10 +4426,14 @@ await client.searchFaces('MyCollection', fs.readFileSync('img.jpg
|
|
|
4233
4426
|
</div>
|
|
4234
4427
|
<div class="tab-pane fade" id="rekognition-method-search-faces-cjs">
|
|
4235
4428
|
<div class="highlight">
|
|
4236
|
-
<pre><code class="js">const
|
|
4429
|
+
<pre><code class="js">const sweet = require('express-sweet');
|
|
4237
4430
|
const fs = require('fs');
|
|
4238
4431
|
|
|
4239
|
-
|
|
4432
|
+
// Load environment variables.
|
|
4433
|
+
sweet.middlewares.Environment.mount();
|
|
4434
|
+
|
|
4435
|
+
// Rekognition Client.
|
|
4436
|
+
const client = new sweet.services.AWSRekognitionClient({
|
|
4240
4437
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
4241
4438
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
4242
4439
|
region: process.env.AWS_REKOGNITION_REGION
|
|
@@ -4317,7 +4514,11 @@ await client.searchFaces('MyCollection', fs.readFileSync('img.jpg
|
|
|
4317
4514
|
<div class="tab-pane fade show active" id="rekognition-method-list-faces-esm">
|
|
4318
4515
|
<div class="highlight">
|
|
4319
4516
|
<pre><code class="js">import * as sweet from 'express-sweet';
|
|
4320
|
-
|
|
4517
|
+
|
|
4518
|
+
// Load environment variables.
|
|
4519
|
+
sweet.middlewares.Environment.mount();
|
|
4520
|
+
|
|
4521
|
+
// Rekognition Client.
|
|
4321
4522
|
const client = new sweet.services.AWSRekognitionClient({
|
|
4322
4523
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
4323
4524
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
@@ -4343,9 +4544,13 @@ console.log(result);</code></pre>
|
|
|
4343
4544
|
</div>
|
|
4344
4545
|
<div class="tab-pane fade" id="rekognition-method-list-faces-cjs">
|
|
4345
4546
|
<div class="highlight">
|
|
4346
|
-
<pre><code class="js">const
|
|
4347
|
-
|
|
4348
|
-
|
|
4547
|
+
<pre><code class="js">const sweet = require('express-sweet');
|
|
4548
|
+
|
|
4549
|
+
// Load environment variables.
|
|
4550
|
+
sweet.middlewares.Environment.mount();
|
|
4551
|
+
|
|
4552
|
+
// Rekognition Client.
|
|
4553
|
+
const client = new sweet.services.AWSRekognitionClient({
|
|
4349
4554
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
4350
4555
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
4351
4556
|
region: process.env.AWS_REKOGNITION_REGION
|
|
@@ -4402,7 +4607,11 @@ console.log(result);</code></pre>
|
|
|
4402
4607
|
<div class="tab-pane fade show active" id="rekognition-method-delete-faces-esm">
|
|
4403
4608
|
<div class="highlight">
|
|
4404
4609
|
<pre><code class="js">import * as sweet from 'express-sweet';
|
|
4405
|
-
|
|
4610
|
+
|
|
4611
|
+
// Load environment variables.
|
|
4612
|
+
sweet.middlewares.Environment.mount();
|
|
4613
|
+
|
|
4614
|
+
// Rekognition Client.
|
|
4406
4615
|
const client = new sweet.services.AWSRekognitionClient({
|
|
4407
4616
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
4408
4617
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
@@ -4415,9 +4624,13 @@ await client.deleteFaces('MyCollection', ['f7befa24-3b83-43cc-b21
|
|
|
4415
4624
|
</div>
|
|
4416
4625
|
<div class="tab-pane fade" id="rekognition-method-delete-faces-cjs">
|
|
4417
4626
|
<div class="highlight">
|
|
4418
|
-
<pre><code class="js">const
|
|
4419
|
-
|
|
4420
|
-
|
|
4627
|
+
<pre><code class="js">const sweet = require('express-sweet');
|
|
4628
|
+
|
|
4629
|
+
// Load environment variables.
|
|
4630
|
+
sweet.middlewares.Environment.mount();
|
|
4631
|
+
|
|
4632
|
+
// Rekognition Client.
|
|
4633
|
+
const client = new sweet.services.AWSRekognitionClient({
|
|
4421
4634
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
4422
4635
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
4423
4636
|
region: process.env.AWS_REKOGNITION_REGION
|
|
@@ -4460,8 +4673,83 @@ await client.deleteFaces('MyCollection', ['f7befa24-3b83-43cc-b21
|
|
|
4460
4673
|
<div class="ms-3">Confidence in the match of this face with the input face.<br>Valid Range: Minimum value of 0. Maximum value of 100.</div>
|
|
4461
4674
|
</li>
|
|
4462
4675
|
</ul>
|
|
4676
|
+
<h2 id="rekognition-face-details-interface">Interface FaceDetails<span class="fs-5 ms-2">(express-sweet.interfaces.FaceDetails)</span></h2>
|
|
4677
|
+
<p>Details of each face found in the image. </p>
|
|
4678
|
+
<h3>Properties</h3>
|
|
4679
|
+
<ul class="list-group list-group-flush">
|
|
4680
|
+
<li class="list-group-item">
|
|
4681
|
+
<div class="fw-bold"><code class="h5">boundingBox: <a href="#rekognition-bbox-interface">BoundingBox</a></code></div>
|
|
4682
|
+
<div class="ms-3">Bounding box of the face.</div>
|
|
4683
|
+
</li>
|
|
4684
|
+
<li class="list-group-item">
|
|
4685
|
+
<div class="fw-bold"><code class="h5">ageRange?: {high: UInteger, low: UInteger}</code></div>
|
|
4686
|
+
<div class="ms-3">The estimated age range, in years, for the face. Low represents the lowest estimated age and High represents the highest estimated age.</div>
|
|
4687
|
+
</li>
|
|
4688
|
+
<li class="list-group-item">
|
|
4689
|
+
<div class="fw-bold"><code class="h5">gender?: 'male'|'female'</code></div>
|
|
4690
|
+
<div class="ms-3">The predicted gender of a detected face. </div>
|
|
4691
|
+
</li>
|
|
4692
|
+
<li class="list-group-item">
|
|
4693
|
+
<div class="fw-bold"><code class="h5">emotions?: <a href="#rekognition-face-details-emotions-interface">FaceDetailsEmotions</a></code></div>
|
|
4694
|
+
<div class="ms-3">The predicted gender of a detected face. </div>
|
|
4695
|
+
</li>
|
|
4696
|
+
</ul>
|
|
4697
|
+
<h2 id="rekognition-index-face-details-interface">Interface IndexFaceDetails<span class="fs-5 ms-2">(express-sweet.interfaces.IndexFaceDetails)</span></h2>
|
|
4698
|
+
<p>Detail of indexed face.</p>
|
|
4699
|
+
<h3>Properties</h3>
|
|
4700
|
+
<ul class="list-group list-group-flush">
|
|
4701
|
+
<li class="list-group-item">
|
|
4702
|
+
<div class="fw-bold"><code class="h5">faceId: string</code></div>
|
|
4703
|
+
<div class="ms-3">A unique identifier assigned to the face.</div>
|
|
4704
|
+
</li>
|
|
4705
|
+
<li class="list-group-item">
|
|
4706
|
+
<div class="fw-bold"><code class="h5">ageRange: {high: UInteger, low: UInteger}</code></div>
|
|
4707
|
+
<div class="ms-3">The estimated age range, in years, for the face. Low represents the lowest estimated age and High represents the highest estimated age.</div>
|
|
4708
|
+
</li>
|
|
4709
|
+
<li class="list-group-item">
|
|
4710
|
+
<div class="fw-bold"><code class="h5">gender: 'male'|'female'</code></div>
|
|
4711
|
+
<div class="ms-3">The predicted gender of a detected face. </div>
|
|
4712
|
+
</li>
|
|
4713
|
+
<li class="list-group-item">
|
|
4714
|
+
<div class="fw-bold"><code class="h5">emotions: <a href="#rekognition-face-details-emotions-interface">FaceDetailsEmotions</a></code></div>
|
|
4715
|
+
<div class="ms-3">The predicted gender of a detected face. </div>
|
|
4716
|
+
</li>
|
|
4717
|
+
</ul>
|
|
4718
|
+
<h2 id="rekognition-face-details-emotions-interface">Interface FaceDetailsEmotions<span class="fs-5 ms-2">(express-sweet.interfaces.FaceDetailsEmotions)</span></h2>
|
|
4719
|
+
<p>The emotions that appear to be expressed on the face, and the confidence level in the determination. </p>
|
|
4720
|
+
<h3>Properties</h3>
|
|
4721
|
+
<ul class="list-group list-group-flush">
|
|
4722
|
+
<li class="list-group-item">
|
|
4723
|
+
<div class="fw-bold"><code class="h5">disgusted: number</code></div>
|
|
4724
|
+
<div class="ms-3">Confidence level of "disgusted" predicted from the face.</div>
|
|
4725
|
+
</li>
|
|
4726
|
+
<li class="list-group-item">
|
|
4727
|
+
<div class="fw-bold"><code class="h5">happy: number</code></div>
|
|
4728
|
+
<div class="ms-3">Confidence level of "happy" predicted from the face.</div>
|
|
4729
|
+
</li>
|
|
4730
|
+
<li class="list-group-item">
|
|
4731
|
+
<div class="fw-bold"><code class="h5">surprised: number</code></div>
|
|
4732
|
+
<div class="ms-3">Confidence level of "surprised" predicted from the face.</div>
|
|
4733
|
+
</li>
|
|
4734
|
+
<li class="list-group-item">
|
|
4735
|
+
<div class="fw-bold"><code class="h5">angry: number</code></div>
|
|
4736
|
+
<div class="ms-3">Confidence level of "angry" predicted from the face.</div>
|
|
4737
|
+
</li>
|
|
4738
|
+
<li class="list-group-item">
|
|
4739
|
+
<div class="fw-bold"><code class="h5">confused: number</code></div>
|
|
4740
|
+
<div class="ms-3">Confidence level of "confused" predicted from the face.</div>
|
|
4741
|
+
</li>
|
|
4742
|
+
<li class="list-group-item">
|
|
4743
|
+
<div class="fw-bold"><code class="h5">calm: number</code></div>
|
|
4744
|
+
<div class="ms-3">Confidence level of "calm" predicted from the face.</div>
|
|
4745
|
+
</li>
|
|
4746
|
+
<li class="list-group-item">
|
|
4747
|
+
<div class="fw-bold"><code class="h5">sad: number</code></div>
|
|
4748
|
+
<div class="ms-3">Confidence level of "sad" predicted from the face.</div>
|
|
4749
|
+
</li>
|
|
4750
|
+
</ul>
|
|
4463
4751
|
<h2 id="rekognition-bbox-interface">Interface BoundingBox<span class="fs-5 ms-2">(express-sweet.interfaces.BoundingBox)</span></h2>
|
|
4464
|
-
<p>Bounding box
|
|
4752
|
+
<p>Bounding box of the face.</p>
|
|
4465
4753
|
<h3>Properties</h3>
|
|
4466
4754
|
<ul class="list-group list-group-flush">
|
|
4467
4755
|
<li class="list-group-item">
|