protected override void OnActionFacialCodingCommand(ActionFacialCodingEventArgs args) { // Gaurd against null objects if (args == null || args.Coding == null) return; // Look for specific actions that the eye will react to var actions = args.Coding.ActionUnits.Where(o => o.FacialActionCodingType == FacialActionCodingType.EntireFaceNotVisible || o.FacialActionCodingType == FacialActionCodingType.NeutralFace); bool visible = true; foreach (var action in actions) { switch (action.FacialActionCodingType) { case FacialActionCodingType.NeutralFace: SetToDefaults(); this.Visible = true; break; case FacialActionCodingType.EntireFaceNotVisible: visible = false; break; } } this.Visible = visible; }
protected override void OnActionFacialCodingCommand(ActionFacialCodingEventArgs args) { // Guard against null objects if (args == null || args.Coding == null) return; // Look for specific actions that the pupil will react to var actions = args.Coding.ActionUnits.Where(o => o.FacialActionCodingType == FacialActionCodingType.EntireFaceNotVisible || o.FacialActionCodingType == FacialActionCodingType.EyesClosed || o.FacialActionCodingType == FacialActionCodingType.Blink || o.FacialActionCodingType == FacialActionCodingType.BrowLowerer || o.FacialActionCodingType == FacialActionCodingType.BrowsAndForeheadNotVisible || o.FacialActionCodingType == FacialActionCodingType.EyebrowGatherer || o.FacialActionCodingType == FacialActionCodingType.InnerBrowRaiser || o.FacialActionCodingType == FacialActionCodingType.InnerEyebrowLowerer || o.FacialActionCodingType == FacialActionCodingType.OuterBrowRaiser || o.FacialActionCodingType == FacialActionCodingType.Wink || o.FacialActionCodingType == FacialActionCodingType.NeutralFace); bool visible = true; foreach (var action in actions) { switch (action.FacialActionCodingType) { case FacialActionCodingType.NeutralFace: SetToDefaults(); this.Visible = true; break; case FacialActionCodingType.InnerBrowRaiser: if (_right) this.Angle = _defaultAngle - 15; else this.Angle = _defaultAngle + 15; break; case FacialActionCodingType.OuterBrowRaiser: this.Y = _defaultY - 15; break; case FacialActionCodingType.BrowLowerer: this.Y = _defaultY + 15; break; case FacialActionCodingType.InnerEyebrowLowerer: if (_right) this.Angle = _defaultAngle + 15; else this.Angle = _defaultAngle - 15; break; case FacialActionCodingType.EyebrowGatherer: if (_right) this.X = _defaultX + 20; else this.X = _defaultX - 20; break; case FacialActionCodingType.EntireFaceNotVisible: visible = false; break; } } this.Visible = visible; }
protected override void OnActionFacialCodingCommand(ActionFacialCodingEventArgs args) { // Gaurd against null objects if (args == null || args.Coding == null) return; // Look for specific actions that the mouth will react to var actions = args.Coding.ActionUnits.Where(o => o.FacialActionCodingType == FacialActionCodingType.EntireFaceNotVisible || o.FacialActionCodingType == FacialActionCodingType.JawDrop || o.FacialActionCodingType == FacialActionCodingType.JawSideways || o.FacialActionCodingType == FacialActionCodingType.LipCornerPuller || o.FacialActionCodingType == FacialActionCodingType.UpperLipRaiser || o.FacialActionCodingType == FacialActionCodingType.LipCornerDepressor || o.FacialActionCodingType == FacialActionCodingType.LipFunneler || o.FacialActionCodingType == FacialActionCodingType.NeutralFace); bool visible = true; foreach(var action in actions) { switch(action.FacialActionCodingType) { case FacialActionCodingType.NeutralFace: SetToDefaults(); this.Visible = true; break; case FacialActionCodingType.EntireFaceNotVisible: visible = false; break; case FacialActionCodingType.JawDrop: this.ScaleX = .35; this.ScaleY = 1.5; break; case FacialActionCodingType.LipCornerPuller: //this.CenterX = 50; //this.CenterY = 50; //this.AngleY = 20; //this.CenterX2 = -50; //this.CenterY2 = -50; //this.AngleY2 = -20; break; } } this.Visible = visible; }
protected override void OnActionFacialCodingCommand(ActionFacialCodingEventArgs args) { // Guard against null objects if (args == null || args.Coding == null) return; // Look for specific actions that the pupil will react to var actions = args.Coding.ActionUnits.Where(o => o.FacialActionCodingType == FacialActionCodingType.EntireFaceNotVisible || o.FacialActionCodingType == FacialActionCodingType.EyesClosed || o.FacialActionCodingType == FacialActionCodingType.EyesDown || o.FacialActionCodingType == FacialActionCodingType.EyesNotVisible || o.FacialActionCodingType == FacialActionCodingType.EyesTurnLeft || o.FacialActionCodingType == FacialActionCodingType.EyesTurnRight || o.FacialActionCodingType == FacialActionCodingType.EyesUp || o.FacialActionCodingType == FacialActionCodingType.CrossEye || o.FacialActionCodingType == FacialActionCodingType.Walleye || o.FacialActionCodingType == FacialActionCodingType.NeutralFace); bool visible = true; int eyeLeftRight=0,eyeUpDown=0; foreach (var action in actions) { switch (action.FacialActionCodingType) { case FacialActionCodingType.NeutralFace: SetToDefaults(); break; case FacialActionCodingType.EntireFaceNotVisible: visible = false; break; case FacialActionCodingType.EyesTurnLeft: eyeLeftRight = 1; break; case FacialActionCodingType.EyesTurnRight: eyeLeftRight = -1; break; case FacialActionCodingType.EyesUp: eyeUpDown = 1; break; case FacialActionCodingType.EyesDown: eyeUpDown = -1; break; case FacialActionCodingType.CrossEye: eyeUpDown = 1; if (_right) eyeLeftRight = 1; else eyeLeftRight = -1; break; case FacialActionCodingType.Walleye: eyeUpDown = 1; if (_right) eyeLeftRight = -1; else eyeLeftRight = 1; break; } } if (eyeUpDown==0 && eyeLeftRight ==0) { X = this._defaultX; Y = this._defaultY; } else if (eyeUpDown > 0 && eyeLeftRight == 0) { X = this._defaultX; Y = this._defaultY + 30; } else if (eyeUpDown < 0 && eyeLeftRight == 0) { X = this._defaultX; Y = this._defaultY - 30; } else if (eyeUpDown== 0 && eyeLeftRight > 0) { X = this._defaultX + 30; Y = this._defaultY; } else if (eyeUpDown == 0 && eyeLeftRight < 0) { X = this._defaultX -30; Y = this._defaultY; } else if (eyeUpDown > 0 && eyeLeftRight > 0) { X = this._defaultX + 40; Y = this._defaultY + 30; } else if (eyeUpDown > 0 && eyeLeftRight < 0) { X = this._defaultX -40; Y = this._defaultY + 30; } else if (eyeUpDown < 0 && eyeLeftRight > 0) { X = this._defaultX + 20; Y = this._defaultY - 30; } else if (eyeUpDown < 0 && eyeLeftRight < 0) { X = this._defaultX -20; Y = this._defaultY - 30; } this.Visible = visible; }
protected virtual void OnActionFacialCodingCommand(ActionFacialCodingEventArgs args) { }