LeapMotion开发(四)-- Hand模块下的所有Methods用法和说明(上篇)(C++SDK)

官方C++ SDK介绍地址:

https://developer.leapmotion.com/documentation/cpp/api/Leap.Hand.html#cppclass_leap_1_1_hand_1aa2c9cca797fde17bf7371451a297e608

 

本文是就着英文版官方说明给出了翻译以及自己的理解,Hand模块总共分为了两块,上文完成一半,下午把另一半发上来。

 

目录概览:

 

·        Hand()

·        arm() const

·        basis() const

·        confidence() const

·        direction() const

·        finger(int32_t id) const

·        fingers() const

·        frame() const

·        grabAngle() const

·        grabStrength() const

·        id() const

·        invalid()

·        isLeft() const

·        isRight() const

·        isValid() const

·        operator!=(const Hand &) const

·        operator==(const Hand &) const

·        palmNormal() const

·        palmPosition() const

·        palmVelocity() const

·        palmWidth() const

 

 

详细解释:

class Leap::Hand

 

获取一个手的对象:

 

Leap::HandList hands = frame.hands();

Leap::Hand firstHand =hands[0];

备注:hand()出来的可能是无效对象,当检测不出手的时候会拟合出一个,故而可以用用手isvalid()功能来判定是否是有效的。

Since

1.0

 

Hand()

创造一个Hand object.//Frame对象里获取有效Hand对象

Leap::HandleftmostHand = frame.hands().leftmost();

Since

1.0

 

 

Arm arm() const

 

返回定义的Arm类型的参数,如果看不到胳膊就根据人体解剖学估计出一个(估计是吹逼的,效果并没有那么好,233,实测性能并不好,但勉强可以用)

 

Leap::Handhand = frame.hands().frontmost();

Leap::Armarm = hand.arm();

Since

2.0.3

 

 

Matrix basis() const

 

以矩阵的形式返回hand的方向信息//左右手呈镜面关系

xAxis 小拇指的正方向

yAxis 手面向上的正方向

zAxis 手腕朝向的正方向

 

Leap::Matrixbasis = hand.basis();

Leap::VectorxBasis = basis.xBasis;

Leap::VectoryBasis = basis.yBasis;

Leap::VectorzBasis = basis.zBasis;

Since

2.0

 

 

float confidence() const

 

对一个手部姿态的确信程度(看来并不是无脑自信,哈哈哈)

 

float confidence= hand.confidence();

Since

2.0

 

 

Vector direction() const

 

返回手掌朝向的Vector,分为pitch,yaw和row。

 

float pitch = hand.direction().pitch();

float yaw = hand.direction().yaw();

float roll = hand.palmNormal().roll();

Since

1.0

 

Finger finger(int32_t id) const

 

从前一Frame里返回Finger类型的指定编号的手指对象,如果没有会返回一个invalidFinger对象

 

Leap::Finger fingerOnHandByID = hand.finger(fingerID);

Since

1.0

 

 

FingerList fingers() const

 

返回这个hand里所有的Finger对象并储存在FingerList里。

 

备注:用 PointableList::extended() 可以去除列表里non-extendedfinger对象

// hand is a Leap::Hand object

Leap::PointableListpointables= hand.pointables();// Both fingers and tools

Leap::FingerListfingers = hand.fingers();

Since

1.0

 

Frame frame() const

 

返回和Hand相关的Frame。如果不可获得就返回invalid类型的Frame对象

 

Leap::FrameframeForHand = hand.frame();

Since

1.0

 

 

float grabAngle() const

 

返回手掌抓握的紧张程度,数值在0-π之间,紧握为0,松开为π

//本质上其实就是算的四根手指的平均张开角度

 

Since

3.0

 

 

float grabStrength() const

 

落伍了落伍了!!废弃不用了。。。

 grabAngle() 替代。

Since

2.0

 

 

int32_t id() const

Hand对象绑定的ID,就算手消失了还是存在的

(然而它并没有Kinect那种消失再回来还能一定程度上匹配的功能,至少我测试的没有,甚至同一只手没超出范围还会跳变,摔墙!)

//下面代码用于发现未来一些frame里已知ID的手的甄别

Leap::HandknownHand = frame.hand(handID);

Since

1.0

 

 

bool isLeft() const

判断手是不是左手。。。

 

std::string handName = hand.isLeft()? "Left hand" : "Right hand";

Since

2.0

 

bool isRight() const

判断是不是右手

if(hand.isRight()){

    // .. Do righthanded stuff

}

Since

2.0

 

 

bool isValid() const

判断手对象里的数据是不是有效的鲁棒的。

if (hand.isValid()){

    //Process handdata...

}

Since

1.0

 

 

 

bool operator!=(const Hand &) const

比较两个Hand对象是不是同一Frame同一个手(估计是比较手的长短啊大小啊位置啊之类的)//黑人问号脸:我要这个何用???

thisHand != thatHand;

Since

1.0

 

 

bool operator==(const Hand &) const

和上面的类似

thisHand == thatHand;

Since

1.0

 

 

Vector palmNormal() const

指向手掌的Vector,搭配direction食用风味更佳

float pitch = hand.direction().pitch();

float yaw = hand.direction().yaw();

float roll = hand.palmNormal().roll();

Since

1.0

 

Vector palmPosition() const

返回手腕重心点在LeapMotion坐标系里毫米单位的坐标

Leap::VectorhandCenter = hand.palmPosition();

Since

1.0

 

Vector palmVelocity() const

返回手掌的移动速度,单位:millimeters/second.

Leap::VectorhandSpeed = hand.palmVelocity();

Since

1.0

 

float palmWidth() const

当手面平整时估计手掌的宽度。单位是毫米

float handWidth = hand.palmWidth();

Since

2.0

 



第一部分先到这里了,剩下的下午翻译完再发。


最后祝大家开发LeapMotion愉快~


  • 5
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要解决Leap Motion连接不上的问题,可以按照以下步骤进行操作: 1. 首先,请确保Leap Motion设备已正确连接到计算机。检查USB连接是否牢固,尝试更换USB端口或使用另一根USB线缆进行连接。 2. 确保您的计算机已安装了Leap Motion驱动程序。您可以从Leap Motion官方网站下载并安装最新的驱动程序。 3. 如果您已经安装了驱动程序但仍无法连接,请尝试重新启动计算机。有时候重新启动可以解决设备连接的问题。 4. 如果您使用的是DERIVATIVE TouchDesigner软件,请确保该软件已正确配置Leap Motion设备。您可以参考软件的官方文档或使用手册,了解如何正确设置骨骼层次和反向运动学设置来重建手部运动。 5. 如果您在编程中使用Leap Motion设备,请确保您的代码正确地引用了Leap Motion设备的相关参数和变量。例如,将右手映射到right_hand变量,将左手映射到left_hand变量。 6. 如果问题仍未解决,您可以尝试更换另一个Leap Motion设备或与Leap Motion官方支持团队联系,寻求他们的帮助和支持。 请注意,以上是一些建议和可能的解决方法,具体解决方法可能因您的具体情况而异。如果问题仍然存在,建议您联系Leap Motion官方支持团队,以获取更详细的帮助和指导。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Control-Mouse-through-Gesture-using-Leap-Motion:您可以使用 Leap Motion 设备通过指定手势控制系统鼠标](https://download.csdn.net/download/weixin_42116650/19571414)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [Leap-Motion-hand-skeleton:Leap Motion的Touch Designer的3D手骨骼重建设置](https://download.csdn.net/download/weixin_42137028/18219159)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [leap-arduino-cylon:使用 Leap Motion 通过 CylonJS 处理 Arduino 上的输出(在本例中为旋转伺服系统)](https://download.csdn.net/download/weixin_42116585/19310100)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值