FaceDetector

visual FaceDetector

This manager handles the detecting of faces in video streams. FaceDetector relies on the Face-API library developed by Vincent Muehler.

Constructor

new FaceDetector(options)

Source:
Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
name String

the name used when logging messages from the detector

win module:core.Window

the associated Window

input string | HTMLVideoElement | module:visual.Camera

the name of a movie resource or of a HTMLVideoElement or of a Camera component

faceApiUrl string <optional>
'face-api.js'

the Url of the face-api library

modelDir string <optional>
'models'

the directory where to find the face detection models

units string <optional>
"norm"

the units of the stimulus (e.g. for size, position, vertices)

pos Array.<number> <optional>
[0, 0]

the position of the center of the stimulus

units string <optional>
'norm'

the units of the stimulus vertices, size and position

ori number <optional>
0.0

the orientation (in degrees)

size number <optional>

the size of the rendered image (the size of the image will be used if size is not specified)

opacity number <optional>
1.0

the opacity

autoDraw boolean <optional>
false

whether or not the stimulus should be automatically drawn on every frame flip

autoLog boolean <optional>
false

whether or not to log

Extends

  • VisualStim

Methods

(protected) _estimateBoundingBox()

Source:

Estimate the bounding box.

(async, protected) _initFaceApi()

Source:

Init the Face-API library.

(protected) _updateIfNeeded()

Source:

Update the visual representation of the detected faces, if necessary.

isReady() → {boolean}

Source:

Query whether or not the face detector is ready to detect.

Returns:

whether or not the face detector is ready to detect

Type
boolean

setInput(input, logopt)

Source:

Setter for the video attribute.

Parameters:
Name Type Attributes Default Description
input string | HTMLVideoElement | module:visual.Camera

the name of a movie resource or a HTMLVideoElement or a Camera component

log boolean <optional>
false

whether of not to log

start(period, detectionCallback, logopt)

Source:

Start detecting faces.

Parameters:
Name Type Attributes Default Description
period number

the detection period, in ms (e.g. 100 ms for 10Hz)

detectionCallback

the callback triggered when detection results are available

log boolean <optional>
false

whether of not to log

stop(logopt)

Source:

Stop detecting faces.

Parameters:
Name Type Attributes Default Description
log boolean <optional>
false

whether of not to log