new VisageLivenessBlink()
VisageLivenessBlink is a class that detects whether the person on the live video stream has blinked.
In order for action to be detected accurately, it is required that the face is frontal for 30 frames before performing blink. During blink verification, face data from latest 30 frames ("face data sequence"), i.e. last 30 calls of update() is used to verify head stability (STATE_WAIT_FOR_STABLE). Each time the action is reset, face data sequence will be cleared and the action will need to go through initializing state (STATE_ACTION_INITIALIZING) to store initial face data sequence.
Action should be updated for each frame in order to update its internal state. The action can be in one of the following states (states are sequentially verified in each call of update()):
In order for action to be detected accurately, it is required that the face is frontal for 30 frames before performing blink. During blink verification, face data from latest 30 frames ("face data sequence"), i.e. last 30 calls of update() is used to verify head stability (STATE_WAIT_FOR_STABLE). Each time the action is reset, face data sequence will be cleared and the action will need to go through initializing state (STATE_ACTION_INITIALIZING) to store initial face data sequence.
Action should be updated for each frame in order to update its internal state. The action can be in one of the following states (states are sequentially verified in each call of update()):
- STATE_WAIT_FOR_FRONTAL Face is not frontal. Action is reset.
- STATE_ACTION_INITIALIZING Action is storing first set of face data sequence. After each reset, action needs to reinitialize.
- STATE_WAIT_FOR_STABLE Head is not stable. In order for action to be verified successfully, the user should keep his head still.
- STATE_WAIT_FOR_ACTION Data is processed in order to verify blink.
- STATE_ACTION_VERIFIED Action is verified.
Members
-
STATE_ACTION_VERIFIED :number
-
Describes action's state where the action was performed and verified.
Type:
- number
- Default Value:
- 0
-
STATE_WAIT_FOR_FRONTAL :number
-
Describes action's state where face in the frame is not frontal (head rotations larger than 0.3 rad, ~17 degrees).
If this state is detected, the action will be reset.Type:
- number
- Default Value:
- 1
-
STATE_ACTION_INITIALIZING :number
-
Describes action's state while the action is initializing, i.e. storing initial face data sequence. After each reset, action needs to reinitialize.
Type:
- number
- Default Value:
- 2
-
STATE_WAIT_FOR_STABLE :number
-
Describes action's state when user is not keeping his head still.
Type:
- number
- Default Value:
- 3
-
STATE_WAIT_FOR_ACTION :number
-
Describes action's state when blink is trying to be verified.
Type:
- number
- Default Value:
- 4
Methods
-
update(frameWidth, frameHeight, p_imageData, faceData) → {number}
-
Method that should be called for each frame until the action is verified. It should only be called when tracking status is TRACK_STAT_OK. Returns action's current state so appropriate message and/or image can be displayed if user interaction is required (e.g. warning for user or instruction on how to perform blink).
Parameters:
Name Type Description frameWidth
number Width of the frame frameHeight
number Height of the frame p_imageData
number Pointer to image pixel data, size of the array must correspond to frameWidth and frameHeight. faceData
FaceData FaceData object filled with tracking results from a previous call of the VisageTracker.track() or VisageDetector.detectFeatures() function. Returns:
state - action's current state.
State can be one of the following: or -1 if frame is not valid (frameWidth and frameHeight less than 1 or p_imageData is null).- Type
- number
-
reset()
-
Resets action.
Clears face data sequence.