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, IDisposableInheritance
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
leftRatioThresholddouble-
The threshold to decide that left eye blinks or not.
rightRatioThresholddouble-
The threshold to decide that right eye blinks or not.
leftEyePointIndicesint[]-
The indices of left eye location to calculate eye aspect ratio.
rightEyePointIndicesint[]-
The indices of right eye location to calculate eye aspect ratio.
Exceptions
- ArgumentNullException
-
leftEyePointIndicesorrightEyePointIndicesis null. - ArgumentException
-
leftEyePointIndicesorrightEyePointIndicesdoes 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
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
Methods
GetEar(IList<FacePoint>, IList<int>)
Return an eye aspect ratio.
protected double GetEar(IList<FacePoint> eye, IList<int> eyePointIndices)Parameters
eyeIList<FacePoint>-
The collection of location corresponding to human eye.
eyePointIndicesIList<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
landmarkIDictionary<FacePart, IEnumerable<FacePoint>>-
The dictionary of face parts locations (eyes, nose, etc).
leftBlinkbool-
When this method returns, contains
true , if the left eye blinks; otherwise,false . rightBlinkbool-
When this method returns, contains
true , if the right eye blinks; otherwise,false .
Exceptions
- ArgumentNullException
-
landmarkis null. - ArgumentException
-
landmarkdoes not contain FaceRecognitionDotNet.FacePart.LeftEye or FaceRecognitionDotNet.FacePart.RightEye.