IFace

IFace. IFace

Class for Innovatrics IFace SDK

Constructor

new IFace(baseURLopt)

Description:
  • Instantiate an IFace plugin

Source:
Example
const iface = new IFace()
Parameters:
Name Type Attributes Description
baseURL string <optional>

Protocol, domain, and port for the service.

Methods

(async) icao(image, cropopt, backgroundopt) → {object}

Description:
  • Check the ICAO compliance of an image

Source:
Example
// Take a photo with a Canon Camera and perform ICAO checks on the
// returned image
const camera = new CanonCamera()
const photo = await camera.takePhoto('base64')
const iface = new IFace()
const results = await iface.icao(photo)
const img = document.createElement('img')
img.src = 'data:image/jpeg;base64,' + results.cropped
console.log(`found ${result.faces_found} faces in the image`)
document.body.appendChild(img)
Parameters:
Name Type Attributes Default Description
image string

A base64 encoded image.

crop string | bool <optional>

If falsy image will not be cropped, otherwise the value will be interpreted as the preferred crop method which will vary by plugin implementation.

background string <optional>
#ffffff

Hexadecimal color that will fill in any part of the cropped image that falls outside the original source image.

Returns:

Results of the ICAO check, this may vary by plugin implementation.

Type
object

(async) match(probe, candidates, modeopt)

Description:
  • Perform a facial match against one or more photos.

Source:
Example
// Create an iface object
const iface = new IFace()

// Obtain a photo for the probe photo
const probe = await camera.takePhoto('base64')

// Create a candidate set from the person's previous photos
const candidates = [
  new Candidate('/person/1/photo/2.jpg', '3', 'url'),
  new Candidate('/person/1/photo/1.jpg', '2', 'url')
]

// Match the probe to all the candidates using the 'balanced' mode
const results = await iface.match(probe, candidates, 'balanced')

// use the results
console.log(results)
Parameters:
Name Type Attributes Default Description
probe object | string

Either a Probe object or a base64 encoded image that is being compared or searched against one or more candidates

candidates Array.<object>

An array of candidate objects against which the probe photo is compared.

Properties
Name Type Attributes Description
id string

Id of the photo, when the results of the matched are returned, this id will be returned so results can be matched back to their original image. Must be less than 16 characters.

base64 string

Base64 encoded string containing the photo.

mode string <optional>

Matching mode to use for this photo. If left unspecified will use the mode provided in the mode parameter.

mode string <optional>
fast

Matching mode to use for all images, can be overriden on each candidate if desired. Valid values are: 'accurate', 'balanced', 'fast', and 'accurate_server'.

(async) matchModes() → {Array.<string>}

Description:
  • Return list of available face matching modes

Source:
Example
const iface = new IFace()
const modes = await iface.matchModes()
// do something with modes, such as build a <select> element
const select = document.createElement('select')
modes.forEach(mode => {
  const option = document.createElement('option')
  option.value = mode
  select.appendChild(mode)
})
document.body.appendChild(select)
Returns:

List of available face matching modes

Type
Array.<string>