The code snippet below demonstrates matching two images with printed faces.
var request = new MatchFacesRequest()firstImage = new Image()secondImage = new Image()request.images = [image1, image2]Face.matchFaces(JSON.stringify(request)).then(response => {response = MatchFacesResponse.fromJson(JSON.parse(response))console.log(JSON.stringify(response))})
Declaring an image type is required for correct comparison. It influences matching results.
MatchFacesResponse└── error└── matchedFaces| └── first| | └── tag| | └── imageType| | └── position| └── second| | └── tag| | └── imageType| | └── position| └── similarity| └── error└── unmatchedFaces| └── first| | └── tag| | └── imageType| | └── position| └── second| | └── tag| | └── imageType| | └── position| └── similarity| └── error
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 |