Face matching

The code snippet below demonstrates matching two images with printed faces.

const Face = Regula.Face
const MatchFacesRequest = Face.MatchFacesRequest
const MatchFacesResponse = Face.MatchFacesResponse
request = new Face.MatchFacesRequest()
firstImage = new Face.Image()
secondImage = new Face.Image()
request.images = [image1, image2]
Face.matchFaces(JSON.stringify(request), response => {
response = MatchFacesResponse.fromJson(JSON.parse(response))
console.log(JSON.stringify(response))
}, e => { })

Declaring an image type is required for correct comparison. It influences matching results.

Response

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