Leap Motion

1、坐标系

这里写图片描述

2、手

这里写图片描述

3、Fingers

这里写图片描述

4、Gestures 四种: Circle、Swipe、Key Tap、Screen Tap

1)Circle
这里写图片描述

属性:center、duration、handIds、id、normal、pointableIds、progress、radius、state、type

2) Swipe 多两个属性:speed 、startPosition
这里写图片描述

判断滑动方向:
var controllerOptions = {enableGestures: true};
Leap.loop(controllerOptions, function(frame) {

  // Display Gesture object data
  if (frame.gestures.length > 0) {
    for (var i = 0; i < frame.gestures.length; i++) {
      var gesture = frame.gestures[i];
      if(gesture.type == "swipe") {
          //Classify swipe as either horizontal or vertical
          var isHorizontal = Math.abs(gesture.direction[0]) > Math.abs(gesture.direction[1]);
          //Classify as right-left or up-down
          if(isHorizontal){
              if(gesture.direction[0] > 0){
                  swipeDirection = "right";
              } else {
                  swipeDirection = "left";
              }
          } else { //vertical
              if(gesture.direction[1] > 0){
                  swipeDirection = "up";
              } else {
                  swipeDirection = "down";
              }                  
          }
          console.log(swipeDirection)
       }
     }
  }

});

3)Key Tap
这里写图片描述

4)Screen Tap
这里写图片描述

手势判断代码:

var controller = Leap.loop({enableGestures: true}, function(frame){
  if(frame.valid && frame.gestures.length > 0){
    frame.gestures.forEach(function(gesture){
        switch (gesture.type){
          case "circle":
              console.log("Circle Gesture");
              break;
          case "keyTap":
              console.log("Key Tap Gesture");
              break;
          case "screenTap":
              console.log("Screen Tap Gesture");
              break;
          case "swipe":
              console.log("Swipe Gesture");
              break;
        }
    });
  }
});
KeyTapGesture、ScreenTapGesture、SwipeGesture都拥有属性:
  • duration
  • handIds
  • id
  • pointableIds
  • state
  • type
  • direction
  • position
5、Motions:Scale、Rotation、Translation
Leap 可以根據每幀和前幀檢測到的數據,生成運動信息。例如,

若檢測到兩隻手,並且兩隻手都超一個方向移動,就認爲是平移;
若是像握着球一樣轉動,則記爲旋轉。
若兩隻手靠近或分開,則記爲縮放。

所生成的數據包含:
  • 旋轉的軸向向量;
  • 旋轉的角度(順時針爲正);
  • 描述旋轉的矩陣;
  • 縮放因子;
  • 平移向量;
對於每隻手,可以檢測到如下信息:
  • 手掌中心的位置(三維向量,相對於傳感器座標原點,毫米爲單位);
  • 手掌移動的速度(毫米每秒);
  • 手掌的法向量(垂直於手掌平面,從手心指向外);
  • 手掌朝向的方向;
  • 根據手掌彎曲的弧度確定的虛擬球體的中心;
  • 根據手掌彎曲的弧度確定的虛擬球體的半徑;
当设备检测到手、手指、工具或者是手势的话,设备会赋予它一个唯一的ID号码作为标记,只要这个实体不出设备的可视区域,这个ID号就会一直不变,如果设备丢失这个实体之后又出现了,Leap 就会赋予它一个新的ID号码,但是软件不会知道这个和以前的那个实体有什么关系。
建议在Leap Motion Controller的视野中至多保留两只手,以获得最佳的运动跟踪质量。
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值