【问题标题】:Wink detection on Google Glass with XE22使用 XE22 在 Google Glass 上进行眨眼检测
【发布时间】:2015-02-10 13:32:01
【问题描述】:

我正在尝试使用这个库:

https://github.com/thorikawa/EyeGestureLib

但它不起作用..

app启动时,在“onStart()”函数的这一行发生NullPointerException:

mEyeGestureManager.register(target1, mEyeGestureListener);
mEyeGestureManager.register(target2, mEyeGestureListener);

我在 github 存储库中公开了其他代码,例如 appDemo,以及“onCreate”函数中的这行代码:

mEyeGestureManager = EyeGestureManager.from(this);
mEyeGestureListener = new EyeGestureListener();

有什么建议吗?有更新库吗?

【问题讨论】:

    标签: android google-glass detection aero-glass


    【解决方案1】:

    您发布的库已经过时(最后一次更改是 11 个月前)。目前没有官方的方法来检测眨眼。我遇到了同样的问题,在检测到它时只检测到眨眼和停止玻璃拍照。有几种方法可以检测这种 EyeGestures。这对我有用(引自this awesome source):

    要收听 Intent,您必须扩展 BroadcastReceiver。

    public class EyeGesture extends BroadcastReceiver {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getStringExtra("gesture").equals("WINK")) {
                //Disable Camera Snapshot
                abortBroadcast();
                Log.e("WINKED ","");
            } else {
                Log.e("SOMETHING", "is detected " + intent.getStringExtra("gesture"));
            }
        }
    }
    

    您必须在 Manifest 中注册 Intent,如下所示:

    <receiver android:name="com.inno.inno.glassplugin.EyeGesture">
        <intent-filter>
            <action android:name="com.google.android.glass.action.EYE_GESTURE" />
        </intent-filter>
    </receiver>
    

    Manifest 中指定的名称必须与监听 Intent 的类的名称一致,即 EyeGesture。

    就这么简单。不需要库,但只能检测到 WINK。当检测到眨眼时,它还会阻止 Glass 拍照。你可以评论 abortBroadcast();如果您希望 Glass 在检测到事件时拍照。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-03-14
      • 2015-11-27
      • 2013-12-21
      • 2023-04-02
      • 1970-01-01
      • 2015-12-11
      • 2012-11-01
      相关资源
      最近更新 更多