Table of Contents

Class EyeAspectRatioBaseEyeBlinkDetector

Namespace
FaceRecognitionDotNet.Extensions
Assembly
VisioForge.Core.FaceAI.dll

An abstract base class that provides functionality to detect human eye's blink base on eye aspect ratio (EAR).

public abstract class EyeAspectRatioBaseEyeBlinkDetector : EyeBlinkDetector, IDisposable

Inheritance

Derived

Implements

Inherited Members

Constructors

EyeAspectRatioBaseEyeBlinkDetector(double, double, int[], int[])

Initializes a new instance of the FaceRecognitionDotNet.Extensions.EyeAspectRatioBaseEyeBlinkDetector class with the threshold and eye point indices for left and right eyes.

protected EyeAspectRatioBaseEyeBlinkDetector(double leftRatioThreshold, double rightRatioThreshold, int[] leftEyePointIndices, int[] rightEyePointIndices)

Parameters

leftRatioThreshold double

The threshold to decide that left eye blinks or not.

rightRatioThreshold double

The threshold to decide that right eye blinks or not.

leftEyePointIndices int[]

The indices of left eye location to calculate eye aspect ratio.

rightEyePointIndices int[]

The indices of right eye location to calculate eye aspect ratio.

Exceptions

ArgumentNullException

leftEyePointIndices or rightEyePointIndices is null.

ArgumentException

leftEyePointIndices or rightEyePointIndices does not contain 6 elements.

Properties

LeftEyePointIndices

Gets the array of the indices of left eye location to be used calculating eye aspect ratio.

protected int[] LeftEyePointIndices { get; }

Property Value

int[]

LeftRatioThreshold

Gets the threshold to decide that left eye blinks or not.

public double LeftRatioThreshold { get; }

Property Value

double

RightEyePointIndices

Gets the array of the indices of right eye location to be used calculating eye aspect ratio.

protected int[] RightEyePointIndices { get; }

Property Value

int[]

RightRatioThreshold

Gets the threshold to decide that right eye blinks or not.

public double RightRatioThreshold { get; }

Property Value

double

Methods

GetEar(IList<FacePoint>, IList<int>)

Return an eye aspect ratio.

protected double GetEar(IList<FacePoint> eye, IList<int> eyePointIndices)

Parameters

eye IList<FacePoint>

The collection of location corresponding to human eye.

eyePointIndices IList<int>

The collection of the indices of eye location to be used calculating eye aspect ratio.

Returns

double

Eye aspect ratio.

RawDetect(IDictionary<FacePart, IEnumerable<FacePoint>>, out bool, out bool)

Detects the values whether human eye's blink or not from face landmark.

protected override void RawDetect(IDictionary<FacePart, IEnumerable<FacePoint>> landmark, out bool leftBlink, out bool rightBlink)

Parameters

landmark IDictionary<FacePart, IEnumerable<FacePoint>>

The dictionary of face parts locations (eyes, nose, etc).

leftBlink bool

When this method returns, contains true, if the left eye blinks; otherwise, false.

rightBlink bool

When this method returns, contains true, if the right eye blinks; otherwise, false.

Exceptions

ArgumentNullException

landmark is null.

ArgumentException

landmark does not contain FaceRecognitionDotNet.FacePart.LeftEye or FaceRecognitionDotNet.FacePart.RightEye.