Jump to content
Happy Holidays! Limited Staff Responses: 1/20 - 1/31 ×

Blink rate per min


Recommended Posts

  • 2 weeks later...

@Asish Here is Unity sample code to check for blinking. You can adjust the blinkLimit if desired (0 fully closed, 1 fully open).

    private static float blinkLimit = 0.1f;
    private static float leftOpen, rightOpen;

    public static bool IsBlinking()
    {
        // check both eyes open
        if (IsWinkingLeft() && IsWinkingRight())
            return true;
        else
            return false;
    }

    public static bool IsWinkingLeft()
    {
        SRanipal_Eye.GetEyeOpenness(EyeIndex.LEFT, out leftOpen);

        if (leftOpen < blinkLimit)
            return true;
        else
            return false;
    }

    public static bool IsWinkingRight()
    {
        SRanipal_Eye.GetEyeOpenness(EyeIndex.RIGHT, out rightOpen);

        if (rightOpen < blinkLimit)
            return true;
        else
            return false;
    }
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...