ICAO

ICAO

Class for invoking ICAO checks on an image

Constructor

new ICAO(baseURLopt, plugin)

Description:
  • Instantiate an ICAO plugin

Source:
See:
  • IFace
Example
const icao = new ICAO()
Parameters:
Name Type Attributes Description
baseURL string <optional>

Protocol, domain, and port for the service.

plugin string | object

The ID of the desired plugin to use for this instance or an existing Plugin object. The plugin must support the icao method. Defaults to the capture_verify_iface plugin.

Extends

Members

baseUrl

Source:
Overrides:
Properties:
Name Type Description
id string

ID of the plugin, used when building REST endpoint paths.

name string

Human friendly name for the plugin.

description string

Human friendly description of plugin.

version string

Semantic version version of the plugin.

methods Array.<string>

A plugin's list of supported RPC methods.

ready boolean

True if plugin has been loaded into memory and is ready to receive requests.

defaultDevice object

Default device to use for the plugin.

configMethods Array.<string>

Methods required to implement configuration.

Methods

(async) check(image, cropopt, backgroundopt, cropEnlargementopt) → {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 icao = new ICAO()
const results = await icao.check(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 | ImageSource

A string containing base64 encoded image data or an ImageSource object.

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.

cropEnlargement number <optional>

If either full_frontal_extended or token_frontal_extended are supplied for the crop argument, this value defines the amount of background image area enlargement.

Returns:

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

Type
object

(async) device(id) → (nullable) {object}

Description:
  • Get a device by ID for this plugin

Source:
Overrides:
See:
Example
const plugin = await captureBridge.plugin('capture_camera_canon')
const device = await plugin.device('AWOOO56709')
Parameters:
Name Type Description
id string

Device ID

Returns:

Requested Device or null

Type
object

(async) devices() → {Array.<object>}

Description:
  • Get all devices for this plugin

Source:
Overrides:
See:
Example
const plugin = await captureBridge.plugin('capture_camera_canon')
const devices = await plugin.devices()
Returns:

Array of Device objects.

Type
Array.<object>

(async) hasMethod(method) → {boolean}

Description:
  • Check if a plugin has an RPC method

Source:
Overrides:
Example
const canCapture = await plugin.hasMethod('capture')
Parameters:
Name Type Description
method string

An RPC method

Returns:

Return true if plugin has the provided method.

Type
boolean

(async) shutdown(timeoutopt)

Description:
  • Shutdown a plugin

Source:
Overrides:
See:
Example
await plugin.shutdown()
Parameters:
Name Type Attributes Default Description
timeout number <optional>
10

Timeout in seconds. Forcefully terminate the plugin if it doesn't shutdown cleanly within the specified timeout. A value of 0 will result in immediately terminating the plugin and should be avoided unless the plugin is unresponsive.