Accessing rear facing camera on Glass

2019-02-15 06:44发布

问题:

I looked through the api, stackoverflow and google, and didn't find anything. Is there a way in the API to access the camera that faces the eye? I would like to be able to tell if the user's eye is open or closed...is this possible with this version of the GDK?

Is that what the built in wink-to-take-a-picture app is doing?

回答1:

AFAIK, you cannot currently determine open/closed, however there are some eye gestures that are supported, assuming that you have the latest version of Glass hardware.

From here, you can see the supported gestures:

  BLINK("BLINK", 3),
  DOFF("DOFF", 6),
  DON("DON", 5),
  DOUBLE_BLINK("DOUBLE_BLINK", 4),
  DOUBLE_WINK("DOUBLE_WINK", 2),
  NO_GESTURE("NO_GESTURE", 0),
  WINK("WINK", 1);

Also, on that page, they explain how you have to listen to the com.google.glass.action.EYE_GESTURE intent to receive the events:

If you are writing an app, the intent to listen for is com.google.glass.action.EYE_GESTURE . There is a public API to enable/disable them in the undocumented package android.glass.GlassGestureManager . Get it via Context.getSystemService("glass_gesture").

Check out winky's MainActivity.java for an example.

Here's another eye gesture example which interacts with eye gestures.