Face matching
The code snippet below demonstrates matching two images with printed faces.
1
request = new MatchFacesRequest()
2
3
firstImage = new FaceImage()
4
secondImage = new FaceImage()
5
6
request.images = [image1, image2]
7
8
Face.matchFaces(JSON.stringify(request), response => {
9
response = MatchFacesResponse.fromJson(JSON.parse(response))
10
console.log(JSON.stringify(response))
11
}, e => { })
Copied!
Declaring an image type is required for correct comparison. It influences matching results.

Response

1
MatchFacesResponse
2
└── error
3
└── matchedFaces
4
| └── first
5
| | └── tag
6
| | └── imageType
7
| | └── position
8
| └── second
9
| | └── tag
10
| | └── imageType
11
| | └── position
12
| └── similarity
13
| └── error
14
└── unmatchedFaces
15
| └── first
16
| | └── tag
17
| | └── imageType
18
| | └── position
19
| └── second
20
| | └── tag
21
| | └── imageType
22
| | └── position
23
| └── similarity
24
| └── error
Copied!
Parameter
Description
error
Error
matchedFaces
Matched faces
unmatchedFaces
Unmatched faces
first
First image
second
Second image
tag
Tag
imageType
Image type
position
Position an image in the array
Last modified 4mo ago
Copy link
Contents
Response