Gesture手势-------LeapMotion API

来源:互联网 发布:excel多张表格数据汇总 编辑:程序博客网 时间:2024/04/20 05:06

class Leap::Gesture

Gesture 类代表了用户已识别的运动。

控制器监视着可见范围内的表示用户手势或命令的一些运动情况,例如,手从一边到一边的运动,表示滑动手势,一根手指向前点动表示屏幕敲动手势。

软件识别一个手势后,他将分配一个ID,并为这一帧的手势集(gesture list)添加一个手势对象。对于持续的手势,他出现在在很多帧,软件增加一个有相同ID的手势对象,在每一个子序列帧中更新属性。

提示:识别每一种手势必须使用controller.enableGesture(),来开启。否则无法识别。

controller.enableGesture(Leap::Gesture::TYPE_CIRCLE);controller.enableGesture(Leap::Gesture::TYPE_KEY_TAP);controller.enableGesture(Leap::Gesture::TYPE_SCREEN_TAP);controller.enableGesture(Leap::Gesture::TYPE_SWIPE);
Gesture子类定义了属性,来判断可以被LM软件识别的特殊运动。包括:

CircleGesture A circular movement by a finger.

SwipeGesture A straight line movement by the hand with fingers extended.

ScreenTapGesture A forward tapping movement by a finger.

KeyTapGesture A downward tapping movement by a finger.

画圆和滑动手势是连续的,并且这些对象有开始、更新和停止状态。敲击屏幕手势是一个离散的手势。软件只能够为每一次敲击创建单个对象,并且总是有停止状态。

从Frame对象中,获得一个有用的手势instance。你能从Frame::gesture()方法中得到手势队列。这个方法还可以使用ID值来寻找。在特定的帧里寻找使用的是Frame::gesture(const Frame&)方法。

下面的案件可以使用config类来创建手势识别器。


public 函数

duration()

float durationSeconds()

Frame frame()

Leap::Frame frameOfGesture = gesture.frame();
Gesture()

构建一个新的手势对象


**********************待续**********************

0 0